commit
9af6d311ec
4
.gitignore
vendored
4
.gitignore
vendored
@ -14,10 +14,14 @@ tv.txt
|
||||
*_tv.txt
|
||||
|
||||
# *nix/windows test executables
|
||||
constants
|
||||
constants.exe
|
||||
encrypt
|
||||
encrypt.exe
|
||||
hashsum
|
||||
hashsum.exe
|
||||
sizes
|
||||
sizes.exe
|
||||
small
|
||||
small.exe
|
||||
test
|
||||
|
54
demos/demo_crypt_constants.c
Normal file
54
demos/demo_crypt_constants.c
Normal file
@ -0,0 +1,54 @@
|
||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file demo_crypt_constants.c
|
||||
|
||||
Demo how to get various constants to dynamic languages
|
||||
like Python
|
||||
|
||||
Larry Bugbee, February 2013
|
||||
*/
|
||||
|
||||
|
||||
int main(void) {
|
||||
// given a specific constant name, get and print its value
|
||||
char name[] = "CTR_COUNTER_BIG_ENDIAN";
|
||||
int value;
|
||||
|
||||
if (crypt_get_constant(name, &value) != 0)
|
||||
exit(EXIT_FAILURE);
|
||||
printf("\n %s is %d \n\n", name, value);
|
||||
|
||||
// get and print the length of the names (and values) list
|
||||
char *names_list;
|
||||
unsigned long names_list_len;
|
||||
|
||||
if (crypt_list_all_constants(NULL, &names_list_len) != 0)
|
||||
exit(EXIT_FAILURE);
|
||||
printf(" need to allocate %lu bytes \n\n", names_list_len);
|
||||
|
||||
// get and print the names (and values) list
|
||||
if ((names_list = malloc(names_list_len)) == NULL)
|
||||
exit(EXIT_FAILURE);
|
||||
if (crypt_list_all_constants(names_list, &names_list_len) != 0)
|
||||
exit(EXIT_FAILURE);
|
||||
printf(" supported constants:\n\n%s\n\n", names_list);
|
||||
free(names_list);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
45
demos/demo_crypt_sizes.c
Normal file
45
demos/demo_crypt_sizes.c
Normal file
@ -0,0 +1,45 @@
|
||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file demo_crypt_sizes.c
|
||||
|
||||
Demo how to get various sizes to dynamic languages
|
||||
like Python - Larry Bugbee, February 2013
|
||||
*/
|
||||
|
||||
|
||||
int main(void) {
|
||||
int rc;
|
||||
|
||||
// given a specific size name, get and print its size
|
||||
char name[] = "ecc_key";
|
||||
int size;
|
||||
rc = crypt_get_size(name, &size);
|
||||
printf("\n size of '%s' is %d \n\n", name, size);
|
||||
|
||||
// get and print the length of the names (and sizes) list
|
||||
char *sizes_list;
|
||||
unsigned long sizes_list_len;
|
||||
rc = crypt_list_all_sizes(NULL, &sizes_list_len);
|
||||
printf(" need to allocate %lu bytes \n\n", sizes_list_len);
|
||||
|
||||
// get and print the names (and sizes) list
|
||||
sizes_list = malloc(sizes_list_len);
|
||||
rc = crypt_list_all_sizes(sizes_list, &sizes_list_len);
|
||||
printf(" supported sizes:\n\n%s\n\n", sizes_list);
|
||||
}
|
||||
|
||||
|
||||
/* $Source: $ */
|
||||
/* $Revision: $ */
|
||||
/* $Date: $ */
|
206
demos/demo_dynamic.py
Executable file
206
demos/demo_dynamic.py
Executable file
@ -0,0 +1,206 @@
|
||||
|
||||
|
||||
"""
|
||||
demo_dynamic.py v1
|
||||
|
||||
This program demonstrates Python's use of the dynamic
|
||||
language support additions to LTC, namely access to LTC
|
||||
constants, struct and union sizes, and the binding of a
|
||||
math package to LTC. Also provided are simple code
|
||||
fragments to illustrate how one might write a Python
|
||||
wrapper for LTC and how an app might call the wrapper.
|
||||
This or a similar model should work for Ruby and other
|
||||
dynamic languages.
|
||||
|
||||
This instance uses Python's ctypes and requires a single
|
||||
.dylib linking together LTC and a math library. Building
|
||||
a single .dylib is needed because LTC wants a fairly tight
|
||||
relationship between itself and the mathlib. (ctypes can
|
||||
load multiple .dylibs, but it does not support this level
|
||||
of tight coupling between otherwise independent libraries.)
|
||||
|
||||
My .dylib was created on OSX with the following steps:
|
||||
|
||||
1- compile LTC to a .a static lib:
|
||||
CFLAGS="-DLTM_DESC -DUSE_LTM" make
|
||||
|
||||
2- link LTC and LTM into a single .dylib:
|
||||
ar2dylib_with tomcrypt tommath
|
||||
where ar2dylib_with is a shell script that combines
|
||||
the LTC .a with the LTM .dylib
|
||||
|
||||
Reminder: you don't need to bind in a math library unless
|
||||
you are going to use LTC functions that depend
|
||||
on a mathlib. For example, public key crypto
|
||||
needs a mathlib; hashing and symmetric encryption
|
||||
do not.
|
||||
|
||||
This code was written for Python 2.7.
|
||||
|
||||
Larry Bugbee
|
||||
March 2014
|
||||
|
||||
"""
|
||||
|
||||
|
||||
from ctypes import *
|
||||
from ctypes.util import find_library
|
||||
|
||||
|
||||
#---------------------------------------------------------------
|
||||
# load the .dylib
|
||||
|
||||
libname = 'tomcrypt'
|
||||
libpath = find_library(libname)
|
||||
|
||||
print
|
||||
print(' demo_dynamic.py')
|
||||
print
|
||||
print(' path to library %s: %s' % (libname, libpath))
|
||||
|
||||
LTC = cdll.LoadLibrary(libpath)
|
||||
print(' loaded: %s' % LTC)
|
||||
print
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------
|
||||
# get list of all supported constants followed by a list of all
|
||||
# supported sizes. One alternative: these lists may be parsed
|
||||
# and used as needed.
|
||||
|
||||
if 1:
|
||||
print ' all supported constants and their values:'
|
||||
|
||||
# get size to allocate for constants output list
|
||||
str_len = c_int(0)
|
||||
ret = LTC.crypt_list_all_constants(None, byref(str_len))
|
||||
print ' need to allocate %d bytes \n' % str_len.value
|
||||
|
||||
# allocate that size and get (name, size) pairs, each pair
|
||||
# separated by a newline char.
|
||||
names_sizes = c_buffer(str_len.value)
|
||||
ret = LTC.crypt_list_all_constants(names_sizes, byref(str_len))
|
||||
print names_sizes.value
|
||||
print
|
||||
|
||||
|
||||
if 1:
|
||||
print ' all supported sizes:'
|
||||
|
||||
# get size to allocate for sizes output list
|
||||
str_len = c_int(0)
|
||||
ret = LTC.crypt_list_all_sizes(None, byref(str_len))
|
||||
print ' need to allocate %d bytes \n' % str_len.value
|
||||
|
||||
# allocate that size and get (name, size) pairs, each pair
|
||||
# separated by a newline char.
|
||||
names_sizes = c_buffer(str_len.value)
|
||||
ret = LTC.crypt_list_all_sizes(names_sizes, byref(str_len))
|
||||
print names_sizes.value
|
||||
print
|
||||
|
||||
|
||||
#---------------------------------------------------------------
|
||||
# get individually named constants and sizes
|
||||
|
||||
# print selected constants
|
||||
if 1:
|
||||
print '\n selected constants:'
|
||||
|
||||
names = [
|
||||
'ENDIAN_LITTLE',
|
||||
'ENDIAN_64BITWORD',
|
||||
'PK_PUBLIC',
|
||||
'MAX_RSA_SIZE',
|
||||
'CTR_COUNTER_BIG_ENDIAN',
|
||||
]
|
||||
for name in names:
|
||||
const_value = c_int(0)
|
||||
rc = LTC.crypt_get_constant(name, byref(const_value))
|
||||
value = const_value.value
|
||||
print ' %-25s %d' % (name, value)
|
||||
|
||||
# print selected sizes
|
||||
if 1:
|
||||
print '\n selected sizes:'
|
||||
|
||||
names = [
|
||||
'rijndael_key',
|
||||
'rsa_key',
|
||||
'symmetric_CTR',
|
||||
'twofish_key',
|
||||
'ecc_point',
|
||||
'gcm_state',
|
||||
'sha512_state',
|
||||
]
|
||||
for name in names:
|
||||
size_value = c_int(0)
|
||||
rc = LTC.crypt_get_size(name, byref(size_value))
|
||||
value = size_value.value
|
||||
print ' %-25s %d' % (name, value)
|
||||
|
||||
|
||||
#---------------------------------------------------------------
|
||||
#---------------------------------------------------------------
|
||||
# ctypes getting a list of this build's supported algorithms
|
||||
# and compiler switches
|
||||
|
||||
def get_named_string(lib, name):
|
||||
return c_char_p.in_dll(lib, name).value
|
||||
|
||||
if 0:
|
||||
print '\n%s' % ('-'*60)
|
||||
print 'This is a string compiled into LTC showing compile '
|
||||
print 'options and algorithms supported by this build \n'
|
||||
print get_named_string(LTC, 'crypt_build_settings')
|
||||
print
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------
|
||||
#---------------------------------------------------------------
|
||||
# here is an example of how a wrapper can make Python access
|
||||
# more Pythonic
|
||||
|
||||
# - - - - - - - - - - - - -
|
||||
# a wrapper fragment...
|
||||
|
||||
def _get_size(name):
|
||||
size = c_int(0)
|
||||
rc = LTC.crypt_get_size(name, byref(size))
|
||||
return size.value
|
||||
|
||||
sha256_state_struct_size = _get_size('sha256_state')
|
||||
sha512_state_struct_size = _get_size('sha512_state')
|
||||
|
||||
class SHA256(object):
|
||||
def __init__(self):
|
||||
self.state = c_buffer(sha256_state_struct_size)
|
||||
LTC.sha256_init(byref(self.state))
|
||||
def update(self, data):
|
||||
LTC.sha256_process(byref(self.state), data, len(data))
|
||||
def digest(self):
|
||||
md = c_buffer(32)
|
||||
LTC.sha256_done(byref(self.state), byref(md))
|
||||
return md.raw
|
||||
|
||||
# - - - - - - - - - - - - -
|
||||
# an app fragment...
|
||||
|
||||
# from wrapper import * # uncomment in real life
|
||||
|
||||
data = 'hello world'
|
||||
|
||||
sha256 = SHA256()
|
||||
sha256.update(data)
|
||||
md = sha256.digest()
|
||||
|
||||
template = '\n\n the SHA256 digest for "%s" is %s \n'
|
||||
print template % (data, md.encode('hex'))
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------
|
||||
#---------------------------------------------------------------
|
||||
#---------------------------------------------------------------
|
45
makefile
45
makefile
@ -81,6 +81,8 @@ TV=tv_gen
|
||||
MULTI=multi
|
||||
TIMING=timing
|
||||
TEST=test
|
||||
SIZES=sizes
|
||||
CONSTANTS=constants
|
||||
|
||||
#LIBPATH-The directory for libtomcrypt to be installed to.
|
||||
#INCPATH-The directory to install the header files for libtomcrypt.
|
||||
@ -157,24 +159,26 @@ src/mac/xcbc/xcbc_test.o src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src
|
||||
src/math/multi.o src/math/rand_bn.o src/math/rand_prime.o src/math/tfm_desc.o \
|
||||
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/burn_stack.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher_any.o \
|
||||
src/misc/crypt/crypt_find_cipher.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash_any.o src/misc/crypt/crypt_find_hash.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_constants.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_inits.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/hkdf/hkdf.o src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_sizes.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/hkdf/hkdf.o \
|
||||
src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o \
|
||||
src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \
|
||||
src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \
|
||||
src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \
|
||||
src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \
|
||||
src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \
|
||||
src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \
|
||||
src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
@ -255,6 +259,8 @@ TVS=demos/tv_gen.o
|
||||
MULTIS=demos/multi.o
|
||||
TIMINGS=demos/timing.o
|
||||
TESTS=demos/test.o
|
||||
CRYPTSIZES=demos/demo_crypt_sizes.o
|
||||
CRYPTCONSTANTS=demos/demo_crypt_constants.o
|
||||
|
||||
#Files left over from making the crypt.pdf.
|
||||
LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind *.out *.lof
|
||||
@ -312,6 +318,12 @@ timing: library testprof/$(LIBTEST) $(TIMINGS)
|
||||
test: library testprof/$(LIBTEST) $(TESTS)
|
||||
$(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
|
||||
|
||||
sizes: library $(CRYPTSIZES)
|
||||
$(CC) $(LDFLAGS) $(CRYPTSIZES) $(LIBNAME) $(EXTRALIBS) -o $(SIZES)
|
||||
|
||||
constants: library $(CRYPTCONSTANTS)
|
||||
$(CC) $(LDFLAGS) $(CRYPTCONSTANTS) $(LIBNAME) $(EXTRALIBS) -o $(CONSTANTS)
|
||||
|
||||
#This rule installs the library and the header files. This must be run
|
||||
#as root in order to have a high enough permission to write to the correct
|
||||
#directories and to set the owner and group to root.
|
||||
@ -360,6 +372,7 @@ clean:
|
||||
rm -rf `find . -type d -name "*.libs" | xargs`
|
||||
rm -f crypt.aux crypt.dvi crypt.idx crypt.ilg crypt.ind crypt.log crypt.toc
|
||||
rm -f $(TV) $(SMALL) $(CRYPT) $(HASH) $(MULTI) $(TIMING) $(TEST)
|
||||
rm -f $(SIZES) $(CONSTANTS)
|
||||
rm -rf doc/doxygen
|
||||
rm -f `find . -type f -name "*.pdf" | grep -FL crypt.pdf | xargs`
|
||||
rm -f *.txt
|
||||
|
34
makefile.icc
34
makefile.icc
@ -142,24 +142,26 @@ src/mac/xcbc/xcbc_test.o src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src
|
||||
src/math/multi.o src/math/rand_bn.o src/math/rand_prime.o src/math/tfm_desc.o \
|
||||
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/burn_stack.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher_any.o \
|
||||
src/misc/crypt/crypt_find_cipher.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash_any.o src/misc/crypt/crypt_find_hash.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_constants.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_inits.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/hkdf/hkdf.o src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_sizes.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/hkdf/hkdf.o \
|
||||
src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o \
|
||||
src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \
|
||||
src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \
|
||||
src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \
|
||||
src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \
|
||||
src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \
|
||||
src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \
|
||||
src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
|
@ -89,24 +89,26 @@ src/mac/xcbc/xcbc_test.o src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src
|
||||
src/math/multi.o src/math/rand_bn.o src/math/rand_prime.o src/math/tfm_desc.o \
|
||||
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/burn_stack.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher_any.o \
|
||||
src/misc/crypt/crypt_find_cipher.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash_any.o src/misc/crypt/crypt_find_hash.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_constants.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_inits.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/hkdf/hkdf.o src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_sizes.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/hkdf/hkdf.o \
|
||||
src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o \
|
||||
src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \
|
||||
src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \
|
||||
src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \
|
||||
src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \
|
||||
src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \
|
||||
src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \
|
||||
src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
|
@ -47,24 +47,26 @@ src/mac/xcbc/xcbc_test.obj src/math/fp/ltc_ecc_fp_mulmod.obj src/math/gmp_desc.o
|
||||
src/math/multi.obj src/math/rand_bn.obj src/math/rand_prime.obj src/math/tfm_desc.obj \
|
||||
src/misc/base64/base64_decode.obj src/misc/base64/base64_encode.obj src/misc/burn_stack.obj \
|
||||
src/misc/crypt/crypt_argchk.obj src/misc/crypt/crypt.obj src/misc/crypt/crypt_cipher_descriptor.obj \
|
||||
src/misc/crypt/crypt_cipher_is_valid.obj src/misc/crypt/crypt_find_cipher_any.obj \
|
||||
src/misc/crypt/crypt_find_cipher.obj src/misc/crypt/crypt_find_cipher_id.obj \
|
||||
src/misc/crypt/crypt_find_hash_any.obj src/misc/crypt/crypt_find_hash.obj \
|
||||
src/misc/crypt/crypt_find_hash_id.obj src/misc/crypt/crypt_find_hash_oid.obj \
|
||||
src/misc/crypt/crypt_find_prng.obj src/misc/crypt/crypt_fsa.obj src/misc/crypt/crypt_hash_descriptor.obj \
|
||||
src/misc/crypt/crypt_hash_is_valid.obj src/misc/crypt/crypt_ltc_mp_descriptor.obj \
|
||||
src/misc/crypt/crypt_cipher_is_valid.obj src/misc/crypt/crypt_constants.obj \
|
||||
src/misc/crypt/crypt_find_cipher_any.obj src/misc/crypt/crypt_find_cipher.obj \
|
||||
src/misc/crypt/crypt_find_cipher_id.obj src/misc/crypt/crypt_find_hash_any.obj \
|
||||
src/misc/crypt/crypt_find_hash.obj src/misc/crypt/crypt_find_hash_id.obj \
|
||||
src/misc/crypt/crypt_find_hash_oid.obj src/misc/crypt/crypt_find_prng.obj src/misc/crypt/crypt_fsa.obj \
|
||||
src/misc/crypt/crypt_hash_descriptor.obj src/misc/crypt/crypt_hash_is_valid.obj \
|
||||
src/misc/crypt/crypt_inits.obj src/misc/crypt/crypt_ltc_mp_descriptor.obj \
|
||||
src/misc/crypt/crypt_prng_descriptor.obj src/misc/crypt/crypt_prng_is_valid.obj \
|
||||
src/misc/crypt/crypt_register_cipher.obj src/misc/crypt/crypt_register_hash.obj \
|
||||
src/misc/crypt/crypt_register_prng.obj src/misc/crypt/crypt_unregister_cipher.obj \
|
||||
src/misc/crypt/crypt_unregister_hash.obj src/misc/crypt/crypt_unregister_prng.obj \
|
||||
src/misc/error_to_string.obj src/misc/hkdf/hkdf.obj src/misc/hkdf/hkdf_test.obj src/misc/pkcs5/pkcs_5_1.obj \
|
||||
src/misc/pkcs5/pkcs_5_2.obj src/misc/pkcs5/pkcs_5_test.obj src/misc/pk_get_oid.obj src/misc/zeromem.obj \
|
||||
src/modes/cbc/cbc_decrypt.obj src/modes/cbc/cbc_done.obj src/modes/cbc/cbc_encrypt.obj \
|
||||
src/modes/cbc/cbc_getiv.obj src/modes/cbc/cbc_setiv.obj src/modes/cbc/cbc_start.obj \
|
||||
src/modes/cfb/cfb_decrypt.obj src/modes/cfb/cfb_done.obj src/modes/cfb/cfb_encrypt.obj \
|
||||
src/modes/cfb/cfb_getiv.obj src/modes/cfb/cfb_setiv.obj src/modes/cfb/cfb_start.obj \
|
||||
src/modes/ctr/ctr_decrypt.obj src/modes/ctr/ctr_done.obj src/modes/ctr/ctr_encrypt.obj \
|
||||
src/modes/ctr/ctr_getiv.obj src/modes/ctr/ctr_setiv.obj src/modes/ctr/ctr_start.obj src/modes/ctr/ctr_test.obj \
|
||||
src/misc/crypt/crypt_register_prng.obj src/misc/crypt/crypt_sizes.obj \
|
||||
src/misc/crypt/crypt_unregister_cipher.obj src/misc/crypt/crypt_unregister_hash.obj \
|
||||
src/misc/crypt/crypt_unregister_prng.obj src/misc/error_to_string.obj src/misc/hkdf/hkdf.obj \
|
||||
src/misc/hkdf/hkdf_test.obj src/misc/pkcs5/pkcs_5_1.obj src/misc/pkcs5/pkcs_5_2.obj \
|
||||
src/misc/pkcs5/pkcs_5_test.obj src/misc/pk_get_oid.obj src/misc/zeromem.obj src/modes/cbc/cbc_decrypt.obj \
|
||||
src/modes/cbc/cbc_done.obj src/modes/cbc/cbc_encrypt.obj src/modes/cbc/cbc_getiv.obj \
|
||||
src/modes/cbc/cbc_setiv.obj src/modes/cbc/cbc_start.obj src/modes/cfb/cfb_decrypt.obj \
|
||||
src/modes/cfb/cfb_done.obj src/modes/cfb/cfb_encrypt.obj src/modes/cfb/cfb_getiv.obj \
|
||||
src/modes/cfb/cfb_setiv.obj src/modes/cfb/cfb_start.obj src/modes/ctr/ctr_decrypt.obj \
|
||||
src/modes/ctr/ctr_done.obj src/modes/ctr/ctr_encrypt.obj src/modes/ctr/ctr_getiv.obj \
|
||||
src/modes/ctr/ctr_setiv.obj src/modes/ctr/ctr_start.obj src/modes/ctr/ctr_test.obj \
|
||||
src/modes/ecb/ecb_decrypt.obj src/modes/ecb/ecb_done.obj src/modes/ecb/ecb_encrypt.obj \
|
||||
src/modes/ecb/ecb_start.obj src/modes/f8/f8_decrypt.obj src/modes/f8/f8_done.obj src/modes/f8/f8_encrypt.obj \
|
||||
src/modes/f8/f8_getiv.obj src/modes/f8/f8_setiv.obj src/modes/f8/f8_start.obj src/modes/f8/f8_test_mode.obj \
|
||||
|
@ -141,24 +141,26 @@ src/mac/xcbc/xcbc_test.o src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src
|
||||
src/math/multi.o src/math/rand_bn.o src/math/rand_prime.o src/math/tfm_desc.o \
|
||||
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/burn_stack.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher_any.o \
|
||||
src/misc/crypt/crypt_find_cipher.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash_any.o src/misc/crypt/crypt_find_hash.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_constants.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_inits.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/hkdf/hkdf.o src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_sizes.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/hkdf/hkdf.o \
|
||||
src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o \
|
||||
src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \
|
||||
src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \
|
||||
src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \
|
||||
src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \
|
||||
src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \
|
||||
src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \
|
||||
src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
|
@ -83,24 +83,26 @@ src/mac/xcbc/xcbc_test.o src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src
|
||||
src/math/multi.o src/math/rand_bn.o src/math/rand_prime.o src/math/tfm_desc.o \
|
||||
src/misc/base64/base64_decode.o src/misc/base64/base64_encode.o src/misc/burn_stack.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher_any.o \
|
||||
src/misc/crypt/crypt_find_cipher.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash_any.o src/misc/crypt/crypt_find_hash.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_constants.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_inits.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/hkdf/hkdf.o src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_sizes.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/hkdf/hkdf.o \
|
||||
src/misc/hkdf/hkdf_test.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o \
|
||||
src/misc/pkcs5/pkcs_5_test.o src/misc/pk_get_oid.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o \
|
||||
src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o \
|
||||
src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o \
|
||||
src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o \
|
||||
src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o \
|
||||
src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o \
|
||||
src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
|
@ -49,6 +49,26 @@ extern const char *crypt_build_settings;
|
||||
/* ---- HMM ---- */
|
||||
int crypt_fsa(void *mp, ...);
|
||||
|
||||
/* ---- Dynamic language support ---- */
|
||||
int crypt_get_constant(const char* namein, int *valueout);
|
||||
int crypt_list_all_constants(char *names_list, unsigned long *names_list_size);
|
||||
|
||||
int crypt_get_size(const char* namein, int *sizeout);
|
||||
int crypt_list_all_sizes(char *names_list, unsigned long *names_list_size);
|
||||
|
||||
#ifdef LTM_DESC
|
||||
void init_LTM(void);
|
||||
#endif
|
||||
#ifdef TFM_DESC
|
||||
void init_TFM(void);
|
||||
#endif
|
||||
/* *** use of GMP is untested ***
|
||||
#ifdef GMP_DESC
|
||||
void init_GMP(void);
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
231
src/misc/crypt/crypt_constants.c
Executable file
231
src/misc/crypt/crypt_constants.c
Executable file
@ -0,0 +1,231 @@
|
||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file crypt_constants.c
|
||||
|
||||
Make various constants available to dynamic languages
|
||||
like Python - Larry Bugbee, February 2013
|
||||
|
||||
LB - Dec 2013 - revised to include compiler define options
|
||||
LB - Mar 2014 - added endianness and word size
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const long value;
|
||||
} crypt_constant;
|
||||
|
||||
#define _C_STRINGIFY(s) { #s, s }
|
||||
|
||||
static const crypt_constant _crypt_constants[] = {
|
||||
_C_STRINGIFY(PK_PUBLIC),
|
||||
_C_STRINGIFY(PK_PRIVATE),
|
||||
|
||||
_C_STRINGIFY(PKA_RSA),
|
||||
_C_STRINGIFY(PKA_DSA),
|
||||
|
||||
#ifdef LTC_PKCS_1
|
||||
{"LTC_PKCS_1", 1},
|
||||
/* Block types */
|
||||
_C_STRINGIFY(LTC_PKCS_1_EMSA),
|
||||
_C_STRINGIFY(LTC_PKCS_1_EME),
|
||||
|
||||
/* Padding types */
|
||||
_C_STRINGIFY(LTC_PKCS_1_V1_5),
|
||||
_C_STRINGIFY(LTC_PKCS_1_OAEP),
|
||||
_C_STRINGIFY(LTC_PKCS_1_PSS),
|
||||
#else
|
||||
{"LTC_PKCS_1", 0},
|
||||
#endif
|
||||
|
||||
#ifdef LTC_MRSA
|
||||
{"LTC_MRSA", 1},
|
||||
_C_STRINGIFY(MIN_RSA_SIZE),
|
||||
_C_STRINGIFY(MAX_RSA_SIZE),
|
||||
#else
|
||||
{"LTC_MRSA", 0},
|
||||
#endif
|
||||
|
||||
#ifdef MKAT
|
||||
{"MKAT", 1},
|
||||
_C_STRINGIFY(MIN_KAT_SIZE),
|
||||
_C_STRINGIFY(MAX_KAT_SIZE),
|
||||
#else
|
||||
{"MKAT", 0},
|
||||
#endif
|
||||
|
||||
#ifdef LTC_MECC
|
||||
{"LTC_MECC", 1},
|
||||
_C_STRINGIFY(ECC_BUF_SIZE),
|
||||
_C_STRINGIFY(ECC_MAXSIZE),
|
||||
#else
|
||||
{"LTC_MECC", 0},
|
||||
#endif
|
||||
|
||||
#ifdef LTC_MDSA
|
||||
{"LTC_MDSA", 1},
|
||||
_C_STRINGIFY(LTC_MDSA_DELTA),
|
||||
_C_STRINGIFY(LTC_MDSA_MAX_GROUP),
|
||||
#else
|
||||
{"LTC_MDSA", 0},
|
||||
#endif
|
||||
|
||||
#ifdef LTC_CTR_MODE
|
||||
{"LTC_CTR_MODE", 1},
|
||||
_C_STRINGIFY(CTR_COUNTER_LITTLE_ENDIAN),
|
||||
_C_STRINGIFY(CTR_COUNTER_BIG_ENDIAN),
|
||||
_C_STRINGIFY(LTC_CTR_RFC3686),
|
||||
#else
|
||||
{"LTC_CTR_MODE", 0},
|
||||
#endif
|
||||
|
||||
_C_STRINGIFY(MAXBLOCKSIZE),
|
||||
_C_STRINGIFY(TAB_SIZE),
|
||||
_C_STRINGIFY(ARGTYPE),
|
||||
|
||||
#ifdef LTM_DESC
|
||||
{"LTM_DESC", 1},
|
||||
#else
|
||||
{"LTM_DESC", 0},
|
||||
#endif
|
||||
#ifdef TFM_DESC
|
||||
{"TFM_DESC", 1},
|
||||
#else
|
||||
{"TFM_DESC", 0},
|
||||
#endif
|
||||
#ifdef GMP_DESC
|
||||
{"GMP_DESC", 1},
|
||||
#else
|
||||
{"GMP_DESC", 0},
|
||||
#endif
|
||||
|
||||
#ifdef LTC_FAST
|
||||
{"LTC_FAST", 1},
|
||||
#else
|
||||
{"LTC_FAST", 0},
|
||||
#endif
|
||||
|
||||
#ifdef LTC_NO_FILE
|
||||
{"LTC_NO_FILE", 1},
|
||||
#else
|
||||
{"LTC_NO_FILE", 0},
|
||||
#endif
|
||||
|
||||
#ifdef ENDIAN_LITTLE
|
||||
{"ENDIAN_LITTLE", 1},
|
||||
#else
|
||||
{"ENDIAN_LITTLE", 0},
|
||||
#endif
|
||||
|
||||
#ifdef ENDIAN_BIG
|
||||
{"ENDIAN_BIG", 1},
|
||||
#else
|
||||
{"ENDIAN_BIG", 0},
|
||||
#endif
|
||||
|
||||
#ifdef ENDIAN_32BITWORD
|
||||
{"ENDIAN_32BITWORD", 1},
|
||||
#else
|
||||
{"ENDIAN_32BITWORD", 0},
|
||||
#endif
|
||||
|
||||
#ifdef ENDIAN_64BITWORD
|
||||
{"ENDIAN_64BITWORD", 1},
|
||||
#else
|
||||
{"ENDIAN_64BITWORD", 0},
|
||||
#endif
|
||||
|
||||
#ifdef ENDIAN_NEUTRAL
|
||||
{"ENDIAN_NEUTRAL", 1},
|
||||
#else
|
||||
{"ENDIAN_NEUTRAL", 0},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* crypt_get_constant()
|
||||
* valueout will be the value of the named constant
|
||||
* return -1 if named item not found
|
||||
*/
|
||||
int crypt_get_constant(const char* namein, int *valueout) {
|
||||
int i;
|
||||
int _crypt_constants_len = sizeof(_crypt_constants) / sizeof(_crypt_constants[0]);
|
||||
for (i=0; i<_crypt_constants_len; i++) {
|
||||
if (strcmp(_crypt_constants[i].name, namein) == 0) {
|
||||
*valueout = _crypt_constants[i].value;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* crypt_list_all_constants()
|
||||
* if names_list is NULL, names_list_size will be the minimum
|
||||
* number of bytes needed to receive the complete names_list
|
||||
* if names_list is NOT NULL, names_list must be the addr of
|
||||
* sufficient memory allocated into which the names_list
|
||||
* is to be written. Also, the value in names_list_size
|
||||
* sets the upper bound of the number of characters to be
|
||||
* written.
|
||||
* a -1 return value signifies insufficient space made available
|
||||
*/
|
||||
int crypt_list_all_constants(char *names_list, unsigned long *names_list_size) {
|
||||
int i;
|
||||
unsigned long total_len = 0;
|
||||
char number[32];
|
||||
int number_len;
|
||||
int count = sizeof(_crypt_constants) / sizeof(_crypt_constants[0]);
|
||||
|
||||
/* calculate amount of memory required for the list */
|
||||
for (i=0; i<count; i++) {
|
||||
total_len += strlen(_crypt_constants[i].name) + 1;
|
||||
/* the above +1 is for the commas */
|
||||
number_len = snprintf(number, sizeof(number), "%ld", _crypt_constants[i].value);
|
||||
if ((number_len < 0) ||
|
||||
((unsigned int)number_len >= sizeof(number)))
|
||||
return -1;
|
||||
total_len += number_len + 1;
|
||||
/* this last +1 is for newlines (and ending NULL) */
|
||||
}
|
||||
|
||||
if (names_list == NULL) {
|
||||
*names_list_size = total_len;
|
||||
} else {
|
||||
if (total_len > *names_list_size) {
|
||||
return -1;
|
||||
}
|
||||
/* build the names list */
|
||||
char *ptr = names_list;
|
||||
for (i=0; i<count; i++) {
|
||||
strcpy(ptr, _crypt_constants[i].name);
|
||||
ptr += strlen(_crypt_constants[i].name);
|
||||
strcpy(ptr, ",");
|
||||
ptr += 1;
|
||||
|
||||
number_len = snprintf(number, sizeof(number), "%ld", _crypt_constants[i].value);
|
||||
strcpy(ptr, number);
|
||||
ptr += number_len;
|
||||
strcpy(ptr, "\n");
|
||||
ptr += 1;
|
||||
}
|
||||
/* to remove the trailing new-line */
|
||||
ptr -= 1;
|
||||
*ptr = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
44
src/misc/crypt/crypt_inits.c
Executable file
44
src/misc/crypt/crypt_inits.c
Executable file
@ -0,0 +1,44 @@
|
||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file crypt_inits.c
|
||||
|
||||
Provide math library functions for dynamic languages
|
||||
like Python - Larry Bugbee, February 2013
|
||||
*/
|
||||
|
||||
|
||||
#ifdef LTM_DESC
|
||||
void init_LTM(void) {
|
||||
ltc_mp = ltm_desc;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TFM_DESC
|
||||
void init_TFM(void) {
|
||||
ltc_mp = tfm_desc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* *** use of GMP is untested ***
|
||||
#ifdef GMP_DESC
|
||||
void init_GMP(void) {
|
||||
ltc_mp = gmp_desc;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
311
src/misc/crypt/crypt_sizes.c
Executable file
311
src/misc/crypt/crypt_sizes.c
Executable file
@ -0,0 +1,311 @@
|
||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file crypt_sizes.c
|
||||
|
||||
Make various struct sizes available to dynamic languages
|
||||
like Python - Larry Bugbee, February 2013
|
||||
|
||||
LB - Dec 2013 - revised to include compiler define options
|
||||
*/
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const long size;
|
||||
} crypt_size;
|
||||
|
||||
#define _SZ_STRINGIFY_S(s) { #s, sizeof(struct s) }
|
||||
#define _SZ_STRINGIFY_T(s) { #s, sizeof(s) }
|
||||
|
||||
static const crypt_size _crypt_sizes[] = {
|
||||
// hash state sizes
|
||||
_SZ_STRINGIFY_S(ltc_hash_descriptor),
|
||||
_SZ_STRINGIFY_T(hash_state),
|
||||
#ifdef LTC_SHA256
|
||||
_SZ_STRINGIFY_S(sha256_state),
|
||||
#endif
|
||||
#ifdef LTC_SHA512
|
||||
_SZ_STRINGIFY_S(sha512_state),
|
||||
#endif
|
||||
#ifdef LTC_WHIRLPOOL
|
||||
_SZ_STRINGIFY_S(whirlpool_state),
|
||||
#endif
|
||||
#ifdef LTC_MD2
|
||||
_SZ_STRINGIFY_S(md2_state),
|
||||
#endif
|
||||
#ifdef LTC_MD4
|
||||
_SZ_STRINGIFY_S(md4_state),
|
||||
#endif
|
||||
#ifdef LTC_MD5
|
||||
_SZ_STRINGIFY_S(md5_state),
|
||||
#endif
|
||||
#ifdef LTC_RIPEMD128
|
||||
_SZ_STRINGIFY_S(rmd128_state),
|
||||
#endif
|
||||
#ifdef LTC_RIPEMD160
|
||||
_SZ_STRINGIFY_S(rmd160_state),
|
||||
#endif
|
||||
#ifdef LTC_RIPEMD256
|
||||
_SZ_STRINGIFY_S(rmd256_state),
|
||||
#endif
|
||||
#ifdef LTC_RIPEMD320
|
||||
_SZ_STRINGIFY_S(rmd320_state),
|
||||
#endif
|
||||
#ifdef LTC_SHA1
|
||||
_SZ_STRINGIFY_S(sha1_state),
|
||||
#endif
|
||||
#ifdef LTC_TIGER
|
||||
_SZ_STRINGIFY_S(tiger_state),
|
||||
#endif
|
||||
#ifdef LTC_CHC_HASH
|
||||
_SZ_STRINGIFY_S(chc_state),
|
||||
#endif
|
||||
|
||||
// block cipher key sizes
|
||||
_SZ_STRINGIFY_S(ltc_cipher_descriptor),
|
||||
_SZ_STRINGIFY_T(symmetric_key),
|
||||
#ifdef LTC_ANUBIS
|
||||
_SZ_STRINGIFY_S(anubis_key),
|
||||
#endif
|
||||
#ifdef LTC_CAMELLIA
|
||||
_SZ_STRINGIFY_S(camellia_key),
|
||||
#endif
|
||||
#ifdef LTC_BLOWFISH
|
||||
_SZ_STRINGIFY_S(blowfish_key),
|
||||
#endif
|
||||
#ifdef LTC_CAST5
|
||||
_SZ_STRINGIFY_S(cast5_key),
|
||||
#endif
|
||||
#ifdef LTC_DES
|
||||
_SZ_STRINGIFY_S(des_key),
|
||||
_SZ_STRINGIFY_S(des3_key),
|
||||
#endif
|
||||
#ifdef LTC_KASUMI
|
||||
_SZ_STRINGIFY_S(kasumi_key),
|
||||
#endif
|
||||
#ifdef LTC_KHAZAD
|
||||
_SZ_STRINGIFY_S(khazad_key),
|
||||
#endif
|
||||
#ifdef LTC_KSEED
|
||||
_SZ_STRINGIFY_S(kseed_key),
|
||||
#endif
|
||||
#ifdef LTC_MULTI2
|
||||
_SZ_STRINGIFY_S(multi2_key),
|
||||
#endif
|
||||
#ifdef LTC_NOEKEON
|
||||
_SZ_STRINGIFY_S(noekeon_key),
|
||||
#endif
|
||||
#ifdef LTC_RC2
|
||||
_SZ_STRINGIFY_S(rc2_key),
|
||||
#endif
|
||||
#ifdef LTC_RC5
|
||||
_SZ_STRINGIFY_S(rc5_key),
|
||||
#endif
|
||||
#ifdef LTC_RC6
|
||||
_SZ_STRINGIFY_S(rc6_key),
|
||||
#endif
|
||||
#ifdef LTC_SKIPJACK
|
||||
_SZ_STRINGIFY_S(skipjack_key),
|
||||
#endif
|
||||
#ifdef LTC_XTEA
|
||||
_SZ_STRINGIFY_S(xtea_key),
|
||||
#endif
|
||||
#ifdef LTC_RIJNDAEL
|
||||
_SZ_STRINGIFY_S(rijndael_key),
|
||||
#endif
|
||||
#ifdef LTC_SAFER
|
||||
_SZ_STRINGIFY_S(safer_key),
|
||||
#endif
|
||||
#ifdef LTC_SAFERP
|
||||
_SZ_STRINGIFY_S(saferp_key),
|
||||
#endif
|
||||
#ifdef LTC_TWOFISH
|
||||
_SZ_STRINGIFY_S(twofish_key),
|
||||
#endif
|
||||
|
||||
// mode sizes
|
||||
#ifdef LTC_CBC_MODE
|
||||
_SZ_STRINGIFY_T(symmetric_CBC),
|
||||
#endif
|
||||
#ifdef LTC_CFB_MODE
|
||||
_SZ_STRINGIFY_T(symmetric_CFB),
|
||||
#endif
|
||||
#ifdef LTC_CTR_MODE
|
||||
_SZ_STRINGIFY_T(symmetric_CTR),
|
||||
#endif
|
||||
#ifdef LTC_ECB_MODE
|
||||
_SZ_STRINGIFY_T(symmetric_ECB),
|
||||
#endif
|
||||
#ifdef LTC_F8_MODE
|
||||
_SZ_STRINGIFY_T(symmetric_F8),
|
||||
#endif
|
||||
#ifdef LTC_LRW_MODE
|
||||
_SZ_STRINGIFY_T(symmetric_LRW),
|
||||
#endif
|
||||
#ifdef LTC_OFB_MODE
|
||||
_SZ_STRINGIFY_T(symmetric_OFB),
|
||||
#endif
|
||||
|
||||
// MAC sizes -- no states for ccm, lrw
|
||||
#ifdef LTC_F9_MODE
|
||||
_SZ_STRINGIFY_T(f9_state),
|
||||
#endif
|
||||
#ifdef LTC_HMAC
|
||||
_SZ_STRINGIFY_T(hmac_state),
|
||||
#endif
|
||||
#ifdef LTC_OMAC
|
||||
_SZ_STRINGIFY_T(omac_state),
|
||||
#endif
|
||||
#ifdef LTC_PELICAN
|
||||
_SZ_STRINGIFY_T(pelican_state),
|
||||
#endif
|
||||
#ifdef LTC_PMAC
|
||||
_SZ_STRINGIFY_T(pmac_state),
|
||||
#endif
|
||||
#ifdef LTC_XCBC
|
||||
_SZ_STRINGIFY_T(xcbc_state),
|
||||
#endif
|
||||
#ifdef LTC_OCB_MODE
|
||||
_SZ_STRINGIFY_T(ocb_state),
|
||||
#endif
|
||||
#ifdef LTC_OCB3_MODE
|
||||
_SZ_STRINGIFY_T(ocb3_state),
|
||||
#endif
|
||||
#ifdef LTC_GCM_MODE
|
||||
_SZ_STRINGIFY_T(gcm_state),
|
||||
#endif
|
||||
#ifdef LTC_EAX_MODE
|
||||
_SZ_STRINGIFY_T(eax_state),
|
||||
#endif
|
||||
#ifdef LTC_CCM_MODE
|
||||
// not defined
|
||||
#endif
|
||||
#ifdef LRW_MODE
|
||||
// not defined
|
||||
#endif
|
||||
|
||||
// asymmetric keys
|
||||
#ifdef LTC_MRSA
|
||||
_SZ_STRINGIFY_T(rsa_key),
|
||||
#endif
|
||||
#ifdef LTC_MDSA
|
||||
_SZ_STRINGIFY_T(dsa_key),
|
||||
#endif
|
||||
#ifdef LTC_MDH
|
||||
_SZ_STRINGIFY_T(dh_key),
|
||||
#endif
|
||||
#ifdef LTC_MECC
|
||||
_SZ_STRINGIFY_T(ltc_ecc_set_type),
|
||||
_SZ_STRINGIFY_T(ecc_key),
|
||||
_SZ_STRINGIFY_T(ecc_point),
|
||||
#endif
|
||||
#ifdef MKAT
|
||||
_SZ_STRINGIFY_T(katja_key),
|
||||
#endif
|
||||
|
||||
// prng state sizes
|
||||
_SZ_STRINGIFY_S(ltc_prng_descriptor),
|
||||
_SZ_STRINGIFY_T(prng_state),
|
||||
#ifdef LTC_FORTUNA
|
||||
_SZ_STRINGIFY_S(fortuna_prng),
|
||||
#endif
|
||||
#ifdef LTC_RC4
|
||||
_SZ_STRINGIFY_S(rc4_prng),
|
||||
#endif
|
||||
#ifdef LTC_SOBER128
|
||||
_SZ_STRINGIFY_S(sober128_prng),
|
||||
#endif
|
||||
#ifdef LTC_YARROW
|
||||
_SZ_STRINGIFY_S(yarrow_prng),
|
||||
#endif
|
||||
// sprng has no state as it uses other potentially available sources
|
||||
// like /dev/random. See Developers Guide for more info.
|
||||
};
|
||||
|
||||
/* crypt_get_size()
|
||||
* sizeout will be the size (bytes) of the named struct or union
|
||||
* return -1 if named item not found
|
||||
*/
|
||||
int crypt_get_size(const char* namein, int *sizeout) {
|
||||
int i;
|
||||
int count = sizeof(_crypt_sizes) / sizeof(_crypt_sizes[0]);
|
||||
for (i=0; i<count; i++) {
|
||||
if (strcmp(_crypt_sizes[i].name, namein) == 0) {
|
||||
*sizeout = _crypt_sizes[i].size;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* crypt_list_all_sizes()
|
||||
* if names_list is NULL, names_list_size will be the minimum
|
||||
* size needed to receive the complete names_list
|
||||
* if names_list is NOT NULL, names_list must be the addr with
|
||||
* sufficient memory allocated into which the names_list
|
||||
* is to be written. Also, the value in names_list_size
|
||||
* sets the upper bound of the number of characters to be
|
||||
* written.
|
||||
* a -1 return value signifies insufficient space made available
|
||||
*/
|
||||
int crypt_list_all_sizes(char *names_list, unsigned long *names_list_size) {
|
||||
int i;
|
||||
unsigned long total_len = 0;
|
||||
char number[32];
|
||||
int number_len;
|
||||
int count = sizeof(_crypt_sizes) / sizeof(_crypt_sizes[0]);
|
||||
|
||||
/* calculate amount of memory required for the list */
|
||||
for (i=0; i<count; i++) {
|
||||
total_len += strlen(_crypt_sizes[i].name) + 1;
|
||||
/* the above +1 is for the commas */
|
||||
number_len = snprintf(number, sizeof(number), "%ld", _crypt_sizes[i].size);
|
||||
if ((number_len < 0) ||
|
||||
((unsigned int)number_len >= sizeof(number)))
|
||||
return -1;
|
||||
total_len += strlen(number) + 1;
|
||||
/* this last +1 is for newlines (and ending NULL) */
|
||||
}
|
||||
|
||||
if (names_list == NULL) {
|
||||
*names_list_size = total_len;
|
||||
} else {
|
||||
if (total_len > *names_list_size) {
|
||||
return -1;
|
||||
}
|
||||
/* build the names list */
|
||||
char *ptr = names_list;
|
||||
for (i=0; i<count; i++) {
|
||||
strcpy(ptr, _crypt_sizes[i].name);
|
||||
ptr += strlen(_crypt_sizes[i].name);
|
||||
strcpy(ptr, ",");
|
||||
ptr += 1;
|
||||
|
||||
number_len = snprintf(number, sizeof(number), "%ld", _crypt_sizes[i].size);
|
||||
strcpy(ptr, number);
|
||||
ptr += number_len;
|
||||
strcpy(ptr, "\n");
|
||||
ptr += 1;
|
||||
}
|
||||
/* to remove the trailing new-line */
|
||||
ptr -= 1;
|
||||
*ptr = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
Loading…
Reference in New Issue
Block a user