diff --git a/src/Makefile b/src/Makefile index 0c7ef49..05bed2b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -103,20 +103,20 @@ ltc/pk/dsa/dsa_verify_hash.o ltc/pk/dsa/dsa_verify_key.o ltc/pk/ecc/ecc.o ltc/pk/ecc/ecc_ansi_x963_export.o \ ltc/pk/ecc/ecc_ansi_x963_import.o ltc/pk/ecc/ecc_decrypt_key.o ltc/pk/ecc/ecc_encrypt_key.o \ ltc/pk/ecc/ecc_export.o ltc/pk/ecc/ecc_export_openssl.o ltc/pk/ecc/ecc_free.o ltc/pk/ecc/ecc_get_curve.o \ -ltc/pk/ecc/ecc_get_key.o ltc/pk/ecc/ecc_get_size.o ltc/pk/ecc/ecc_import.o ltc/pk/ecc/ecc_import_openssl.o \ -ltc/pk/ecc/ecc_import_pkcs8.o ltc/pk/ecc/ecc_import_x509.o ltc/pk/ecc/ecc_make_key.o \ -ltc/pk/ecc/ecc_set_dp.o ltc/pk/ecc/ecc_set_dp_internal.o ltc/pk/ecc/ecc_set_key.o \ -ltc/pk/ecc/ecc_shared_secret.o ltc/pk/ecc/ecc_sign_hash.o ltc/pk/ecc/ecc_sizes.o \ -ltc/pk/ecc/ecc_verify_hash.o ltc/pk/ecc/ltc_ecc_export_point.o ltc/pk/ecc/ltc_ecc_import_point.o \ -ltc/pk/ecc/ltc_ecc_is_point.o ltc/pk/ecc/ltc_ecc_is_point_at_infinity.o ltc/pk/ecc/ltc_ecc_map.o \ -ltc/pk/ecc/ltc_ecc_mul2add.o ltc/pk/ecc/ltc_ecc_mulmod.o ltc/pk/ecc/ltc_ecc_mulmod_timing.o \ -ltc/pk/ecc/ltc_ecc_points.o ltc/pk/ecc/ltc_ecc_projective_add_point.o ltc/pk/ecc/ltc_ecc_projective_dbl_point.o \ -ltc/pk/ecc/ltc_ecc_verify_key.o ltc/pk/pkcs1/pkcs_1_i2osp.o ltc/pk/pkcs1/pkcs_1_mgf1.o \ -ltc/pk/pkcs1/pkcs_1_oaep_decode.o ltc/pk/pkcs1/pkcs_1_oaep_encode.o ltc/pk/pkcs1/pkcs_1_os2ip.o \ -ltc/pk/pkcs1/pkcs_1_pss_decode.o ltc/pk/pkcs1/pkcs_1_pss_encode.o ltc/pk/pkcs1/pkcs_1_v1_5_decode.o \ -ltc/pk/pkcs1/pkcs_1_v1_5_encode.o ltc/pk/rsa/rsa_decrypt_key.o ltc/pk/rsa/rsa_encrypt_key.o \ -ltc/pk/rsa/rsa_export.o ltc/pk/rsa/rsa_exptmod.o ltc/pk/rsa/rsa_free.o ltc/pk/rsa/rsa_get_size.o \ -ltc/pk/rsa/rsa_import.o ltc/pk/rsa/rsa_import_pkcs8.o ltc/pk/rsa/rsa_import_x509.o \ +ltc/pk/ecc/ecc_get_key.o ltc/pk/ecc/ecc_get_oid_str.o ltc/pk/ecc/ecc_get_size.o ltc/pk/ecc/ecc_import.o \ +ltc/pk/ecc/ecc_import_openssl.o ltc/pk/ecc/ecc_import_pkcs8.o ltc/pk/ecc/ecc_import_x509.o \ +ltc/pk/ecc/ecc_make_key.o ltc/pk/ecc/ecc_set_dp.o ltc/pk/ecc/ecc_set_dp_internal.o \ +ltc/pk/ecc/ecc_set_key.o ltc/pk/ecc/ecc_shared_secret.o ltc/pk/ecc/ecc_sign_hash.o \ +ltc/pk/ecc/ecc_sizes.o ltc/pk/ecc/ecc_verify_hash.o ltc/pk/ecc/ltc_ecc_export_point.o \ +ltc/pk/ecc/ltc_ecc_import_point.o ltc/pk/ecc/ltc_ecc_is_point.o ltc/pk/ecc/ltc_ecc_is_point_at_infinity.o \ +ltc/pk/ecc/ltc_ecc_map.o ltc/pk/ecc/ltc_ecc_mul2add.o ltc/pk/ecc/ltc_ecc_mulmod.o \ +ltc/pk/ecc/ltc_ecc_mulmod_timing.o ltc/pk/ecc/ltc_ecc_points.o ltc/pk/ecc/ltc_ecc_projective_add_point.o \ +ltc/pk/ecc/ltc_ecc_projective_dbl_point.o ltc/pk/ecc/ltc_ecc_verify_key.o ltc/pk/pkcs1/pkcs_1_i2osp.o \ +ltc/pk/pkcs1/pkcs_1_mgf1.o ltc/pk/pkcs1/pkcs_1_oaep_decode.o ltc/pk/pkcs1/pkcs_1_oaep_encode.o \ +ltc/pk/pkcs1/pkcs_1_os2ip.o ltc/pk/pkcs1/pkcs_1_pss_decode.o ltc/pk/pkcs1/pkcs_1_pss_encode.o \ +ltc/pk/pkcs1/pkcs_1_v1_5_decode.o ltc/pk/pkcs1/pkcs_1_v1_5_encode.o ltc/pk/rsa/rsa_decrypt_key.o \ +ltc/pk/rsa/rsa_encrypt_key.o ltc/pk/rsa/rsa_export.o ltc/pk/rsa/rsa_exptmod.o ltc/pk/rsa/rsa_free.o \ +ltc/pk/rsa/rsa_get_size.o ltc/pk/rsa/rsa_import.o ltc/pk/rsa/rsa_import_pkcs8.o ltc/pk/rsa/rsa_import_x509.o \ ltc/pk/rsa/rsa_make_key.o ltc/pk/rsa/rsa_set.o ltc/pk/rsa/rsa_sign_hash.o ltc/pk/rsa/rsa_sign_saltlen_get.o \ ltc/pk/rsa/rsa_verify_hash.o ltc/prngs/chacha20.o ltc/prngs/fortuna.o ltc/prngs/rc4.o \ ltc/prngs/rng_get_bytes.o ltc/prngs/rng_make_prng.o ltc/prngs/sober128.o ltc/prngs/sprng.o \ @@ -124,18 +124,18 @@ ltc/stream/chacha/chacha_ivctr32.o ltc/stream/chacha/chacha_ivctr64.o ltc/stream/chacha/chacha_keystream.o \ ltc/stream/chacha/chacha_setup.o ltc/stream/rabbit/rabbit.o ltc/stream/rc4/rc4_stream.o \ ltc/stream/salsa20/salsa20_crypt.o ltc/stream/salsa20/salsa20_done.o ltc/stream/salsa20/salsa20_ivctr64.o \ -ltc/stream/salsa20/salsa20_keystream.o ltc/stream/salsa20/salsa20_setup.o ltc/stream/sober128/sober128_stream.o \ -ltc/stream/sosemanuk/sosemanuk.o ltm/bncore.o ltm/bn_error.o ltm/bn_fast_mp_invmod.o \ -ltm/bn_fast_mp_montgomery_reduce.o ltm/bn_fast_s_mp_mul_digs.o ltm/bn_fast_s_mp_mul_high_digs.o \ -ltm/bn_fast_s_mp_sqr.o ltm/bn_mp_2expt.o ltm/bn_mp_abs.o ltm/bn_mp_add.o ltm/bn_mp_addmod.o \ -ltm/bn_mp_add_d.o ltm/bn_mp_and.o ltm/bn_mp_clamp.o ltm/bn_mp_clear.o ltm/bn_mp_clear_multi.o \ -ltm/bn_mp_cmp.o ltm/bn_mp_cmp_d.o ltm/bn_mp_cmp_mag.o ltm/bn_mp_cnt_lsb.o ltm/bn_mp_copy.o \ -ltm/bn_mp_count_bits.o ltm/bn_mp_div.o ltm/bn_mp_div_2.o ltm/bn_mp_div_2d.o ltm/bn_mp_div_3.o \ -ltm/bn_mp_div_d.o ltm/bn_mp_dr_is_modulus.o ltm/bn_mp_dr_reduce.o ltm/bn_mp_dr_setup.o \ -ltm/bn_mp_exch.o ltm/bn_mp_export.o ltm/bn_mp_exptmod.o ltm/bn_mp_exptmod_fast.o \ -ltm/bn_mp_expt_d.o ltm/bn_mp_expt_d_ex.o ltm/bn_mp_exteuclid.o ltm/bn_mp_fread.o \ -ltm/bn_mp_fwrite.o ltm/bn_mp_gcd.o ltm/bn_mp_get_int.o ltm/bn_mp_get_long.o ltm/bn_mp_grow.o \ -ltm/bn_mp_import.o ltm/bn_mp_init.o ltm/bn_mp_init_copy.o ltm/bn_mp_init_multi.o \ +ltc/stream/salsa20/salsa20_keystream.o ltc/stream/salsa20/salsa20_setup.o ltc/stream/salsa20/xsalsa20_setup.o \ +ltc/stream/sober128/sober128_stream.o ltc/stream/sosemanuk/sosemanuk.o ltm/bncore.o \ +ltm/bn_error.o ltm/bn_fast_mp_invmod.o ltm/bn_fast_mp_montgomery_reduce.o ltm/bn_fast_s_mp_mul_digs.o \ +ltm/bn_fast_s_mp_mul_high_digs.o ltm/bn_fast_s_mp_sqr.o ltm/bn_mp_2expt.o ltm/bn_mp_abs.o \ +ltm/bn_mp_add.o ltm/bn_mp_addmod.o ltm/bn_mp_add_d.o ltm/bn_mp_and.o ltm/bn_mp_clamp.o \ +ltm/bn_mp_clear.o ltm/bn_mp_clear_multi.o ltm/bn_mp_cmp.o ltm/bn_mp_cmp_d.o ltm/bn_mp_cmp_mag.o \ +ltm/bn_mp_cnt_lsb.o ltm/bn_mp_copy.o ltm/bn_mp_count_bits.o ltm/bn_mp_div.o ltm/bn_mp_div_2.o \ +ltm/bn_mp_div_2d.o ltm/bn_mp_div_3.o ltm/bn_mp_div_d.o ltm/bn_mp_dr_is_modulus.o \ +ltm/bn_mp_dr_reduce.o ltm/bn_mp_dr_setup.o ltm/bn_mp_exch.o ltm/bn_mp_export.o ltm/bn_mp_exptmod.o \ +ltm/bn_mp_exptmod_fast.o ltm/bn_mp_expt_d.o ltm/bn_mp_expt_d_ex.o ltm/bn_mp_exteuclid.o \ +ltm/bn_mp_fread.o ltm/bn_mp_fwrite.o ltm/bn_mp_gcd.o ltm/bn_mp_get_int.o ltm/bn_mp_get_long.o \ +ltm/bn_mp_grow.o ltm/bn_mp_import.o ltm/bn_mp_init.o ltm/bn_mp_init_copy.o ltm/bn_mp_init_multi.o \ ltm/bn_mp_init_set.o ltm/bn_mp_init_set_int.o ltm/bn_mp_init_size.o ltm/bn_mp_invmod.o \ ltm/bn_mp_invmod_slow.o ltm/bn_mp_is_square.o ltm/bn_mp_jacobi.o ltm/bn_mp_karatsuba_mul.o \ ltm/bn_mp_karatsuba_sqr.o ltm/bn_mp_lcm.o ltm/bn_mp_lshd.o ltm/bn_mp_mod.o ltm/bn_mp_mod_2d.o \ diff --git a/src/Makefile.nmake b/src/Makefile.nmake index b6cd4ff..47703d5 100644 --- a/src/Makefile.nmake +++ b/src/Makefile.nmake @@ -110,15 +110,15 @@ ltc/pk/dsa/dsa_verify_key.obj ltc/pk/ecc/ecc.obj ltc/pk/ecc/ecc_ansi_x963_export.obj \ ltc/pk/ecc/ecc_ansi_x963_import.obj ltc/pk/ecc/ecc_decrypt_key.obj ltc/pk/ecc/ecc_encrypt_key.obj \ ltc/pk/ecc/ecc_export.obj ltc/pk/ecc/ecc_export_openssl.obj ltc/pk/ecc/ecc_free.obj \ -ltc/pk/ecc/ecc_get_curve.obj ltc/pk/ecc/ecc_get_key.obj ltc/pk/ecc/ecc_get_size.obj \ -ltc/pk/ecc/ecc_import.obj ltc/pk/ecc/ecc_import_openssl.obj ltc/pk/ecc/ecc_import_pkcs8.obj \ -ltc/pk/ecc/ecc_import_x509.obj ltc/pk/ecc/ecc_make_key.obj ltc/pk/ecc/ecc_set_dp.obj \ -ltc/pk/ecc/ecc_set_dp_internal.obj ltc/pk/ecc/ecc_set_key.obj ltc/pk/ecc/ecc_shared_secret.obj \ -ltc/pk/ecc/ecc_sign_hash.obj ltc/pk/ecc/ecc_sizes.obj ltc/pk/ecc/ecc_verify_hash.obj \ -ltc/pk/ecc/ltc_ecc_export_point.obj ltc/pk/ecc/ltc_ecc_import_point.obj ltc/pk/ecc/ltc_ecc_is_point.obj \ -ltc/pk/ecc/ltc_ecc_is_point_at_infinity.obj ltc/pk/ecc/ltc_ecc_map.obj ltc/pk/ecc/ltc_ecc_mul2add.obj \ -ltc/pk/ecc/ltc_ecc_mulmod.obj ltc/pk/ecc/ltc_ecc_mulmod_timing.obj ltc/pk/ecc/ltc_ecc_points.obj \ -ltc/pk/ecc/ltc_ecc_projective_add_point.obj ltc/pk/ecc/ltc_ecc_projective_dbl_point.obj \ +ltc/pk/ecc/ecc_get_curve.obj ltc/pk/ecc/ecc_get_key.obj ltc/pk/ecc/ecc_get_oid_str.obj \ +ltc/pk/ecc/ecc_get_size.obj ltc/pk/ecc/ecc_import.obj ltc/pk/ecc/ecc_import_openssl.obj \ +ltc/pk/ecc/ecc_import_pkcs8.obj ltc/pk/ecc/ecc_import_x509.obj ltc/pk/ecc/ecc_make_key.obj \ +ltc/pk/ecc/ecc_set_dp.obj ltc/pk/ecc/ecc_set_dp_internal.obj ltc/pk/ecc/ecc_set_key.obj \ +ltc/pk/ecc/ecc_shared_secret.obj ltc/pk/ecc/ecc_sign_hash.obj ltc/pk/ecc/ecc_sizes.obj \ +ltc/pk/ecc/ecc_verify_hash.obj ltc/pk/ecc/ltc_ecc_export_point.obj ltc/pk/ecc/ltc_ecc_import_point.obj \ +ltc/pk/ecc/ltc_ecc_is_point.obj ltc/pk/ecc/ltc_ecc_is_point_at_infinity.obj ltc/pk/ecc/ltc_ecc_map.obj \ +ltc/pk/ecc/ltc_ecc_mul2add.obj ltc/pk/ecc/ltc_ecc_mulmod.obj ltc/pk/ecc/ltc_ecc_mulmod_timing.obj \ +ltc/pk/ecc/ltc_ecc_points.obj ltc/pk/ecc/ltc_ecc_projective_add_point.obj ltc/pk/ecc/ltc_ecc_projective_dbl_point.obj \ ltc/pk/ecc/ltc_ecc_verify_key.obj ltc/pk/pkcs1/pkcs_1_i2osp.obj ltc/pk/pkcs1/pkcs_1_mgf1.obj \ ltc/pk/pkcs1/pkcs_1_oaep_decode.obj ltc/pk/pkcs1/pkcs_1_oaep_encode.obj ltc/pk/pkcs1/pkcs_1_os2ip.obj \ ltc/pk/pkcs1/pkcs_1_pss_decode.obj ltc/pk/pkcs1/pkcs_1_pss_encode.obj ltc/pk/pkcs1/pkcs_1_v1_5_decode.obj \ @@ -132,14 +132,14 @@ ltc/stream/chacha/chacha_ivctr32.obj ltc/stream/chacha/chacha_ivctr64.obj ltc/stream/chacha/chacha_keystream.obj \ ltc/stream/chacha/chacha_setup.obj ltc/stream/rabbit/rabbit.obj ltc/stream/rc4/rc4_stream.obj \ ltc/stream/salsa20/salsa20_crypt.obj ltc/stream/salsa20/salsa20_done.obj ltc/stream/salsa20/salsa20_ivctr64.obj \ -ltc/stream/salsa20/salsa20_keystream.obj ltc/stream/salsa20/salsa20_setup.obj ltc/stream/sober128/sober128_stream.obj \ -ltc/stream/sosemanuk/sosemanuk.obj ltm/bncore.obj ltm/bn_error.obj ltm/bn_fast_mp_invmod.obj \ -ltm/bn_fast_mp_montgomery_reduce.obj ltm/bn_fast_s_mp_mul_digs.obj ltm/bn_fast_s_mp_mul_high_digs.obj \ -ltm/bn_fast_s_mp_sqr.obj ltm/bn_mp_2expt.obj ltm/bn_mp_abs.obj ltm/bn_mp_add.obj \ -ltm/bn_mp_addmod.obj ltm/bn_mp_add_d.obj ltm/bn_mp_and.obj ltm/bn_mp_clamp.obj ltm/bn_mp_clear.obj \ -ltm/bn_mp_clear_multi.obj ltm/bn_mp_cmp.obj ltm/bn_mp_cmp_d.obj ltm/bn_mp_cmp_mag.obj \ -ltm/bn_mp_cnt_lsb.obj ltm/bn_mp_copy.obj ltm/bn_mp_count_bits.obj ltm/bn_mp_div.obj \ -ltm/bn_mp_div_2.obj ltm/bn_mp_div_2d.obj ltm/bn_mp_div_3.obj ltm/bn_mp_div_d.obj \ +ltc/stream/salsa20/salsa20_keystream.obj ltc/stream/salsa20/salsa20_setup.obj ltc/stream/salsa20/xsalsa20_setup.obj \ +ltc/stream/sober128/sober128_stream.obj ltc/stream/sosemanuk/sosemanuk.obj ltm/bncore.obj \ +ltm/bn_error.obj ltm/bn_fast_mp_invmod.obj ltm/bn_fast_mp_montgomery_reduce.obj ltm/bn_fast_s_mp_mul_digs.obj \ +ltm/bn_fast_s_mp_mul_high_digs.obj ltm/bn_fast_s_mp_sqr.obj ltm/bn_mp_2expt.obj ltm/bn_mp_abs.obj \ +ltm/bn_mp_add.obj ltm/bn_mp_addmod.obj ltm/bn_mp_add_d.obj ltm/bn_mp_and.obj ltm/bn_mp_clamp.obj \ +ltm/bn_mp_clear.obj ltm/bn_mp_clear_multi.obj ltm/bn_mp_cmp.obj ltm/bn_mp_cmp_d.obj \ +ltm/bn_mp_cmp_mag.obj ltm/bn_mp_cnt_lsb.obj ltm/bn_mp_copy.obj ltm/bn_mp_count_bits.obj \ +ltm/bn_mp_div.obj ltm/bn_mp_div_2.obj ltm/bn_mp_div_2d.obj ltm/bn_mp_div_3.obj ltm/bn_mp_div_d.obj \ ltm/bn_mp_dr_is_modulus.obj ltm/bn_mp_dr_reduce.obj ltm/bn_mp_dr_setup.obj ltm/bn_mp_exch.obj \ ltm/bn_mp_export.obj ltm/bn_mp_exptmod.obj ltm/bn_mp_exptmod_fast.obj ltm/bn_mp_expt_d.obj \ ltm/bn_mp_expt_d_ex.obj ltm/bn_mp_exteuclid.obj ltm/bn_mp_fread.obj ltm/bn_mp_fwrite.obj \ diff --git a/src/ltc/ciphers/aes/aes.c b/src/ltc/ciphers/aes/aes.c index 2abff12..537fece 100644 --- a/src/ltc/ciphers/aes/aes.c +++ b/src/ltc/ciphers/aes/aes.c @@ -28,7 +28,7 @@ Implementation of AES */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_RIJNDAEL diff --git a/src/ltc/ciphers/anubis.c b/src/ltc/ciphers/anubis.c index 07b22d4..7bc3590 100644 --- a/src/ltc/ciphers/anubis.c +++ b/src/ltc/ciphers/anubis.c @@ -13,7 +13,7 @@ Authors: Paulo S.L.M. Barreto and Vincent Rijmen. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_ANUBIS diff --git a/src/ltc/ciphers/blowfish.c b/src/ltc/ciphers/blowfish.c index e0cd1d1..caeb46e 100644 --- a/src/ltc/ciphers/blowfish.c +++ b/src/ltc/ciphers/blowfish.c @@ -10,7 +10,7 @@ @file blowfish.c Implementation of the Blowfish block cipher, Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLOWFISH @@ -394,7 +394,7 @@ ulong32 L, R; int r; #ifndef __GNUC__ - ulong32 *S1, *S2, *S3, *S4; + const ulong32 *S1, *S2, *S3, *S4; #endif LTC_ARGCHK(pt != NULL); @@ -456,7 +456,7 @@ ulong32 L, R; int r; #ifndef __GNUC__ - ulong32 *S1, *S2, *S3, *S4; + const ulong32 *S1, *S2, *S3, *S4; #endif LTC_ARGCHK(pt != NULL); diff --git a/src/ltc/ciphers/camellia.c b/src/ltc/ciphers/camellia.c index a99647a..4e5602e 100644 --- a/src/ltc/ciphers/camellia.c +++ b/src/ltc/ciphers/camellia.c @@ -12,7 +12,7 @@ Implementation by Tom St Denis of Elliptic Semiconductor */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CAMELLIA diff --git a/src/ltc/ciphers/cast5.c b/src/ltc/ciphers/cast5.c index 95693d5..1089ade 100644 --- a/src/ltc/ciphers/cast5.c +++ b/src/ltc/ciphers/cast5.c @@ -11,7 +11,7 @@ @file cast5.c Implementation of LTC_CAST5 (RFC 2144) by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CAST5 diff --git a/src/ltc/ciphers/des.c b/src/ltc/ciphers/des.c index 3b1cb3a..a72fdf5 100644 --- a/src/ltc/ciphers/des.c +++ b/src/ltc/ciphers/des.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file des.c @@ -36,7 +36,7 @@ { "3des", 14, - 24, 24, 8, 16, + 16, 24, 8, 16, &des3_setup, &des3_ecb_encrypt, &des3_ecb_decrypt, @@ -2068,8 +2068,11 @@ int des3_keysize(int *keysize) { LTC_ARGCHK(keysize != NULL); - if(*keysize < 24) { - return CRYPT_INVALID_KEYSIZE; + if (*keysize < 16) + return CRYPT_INVALID_KEYSIZE; + if (*keysize < 24) { + *keysize = 16; + return CRYPT_OK; } *keysize = 24; return CRYPT_OK; diff --git a/src/ltc/ciphers/idea.c b/src/ltc/ciphers/idea.c index ac3cac5..86ded4d 100644 --- a/src/ltc/ciphers/idea.c +++ b/src/ltc/ciphers/idea.c @@ -22,7 +22,7 @@ and Japan (JP 3225440) (expired May 16, 2011). */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_IDEA diff --git a/src/ltc/ciphers/kasumi.c b/src/ltc/ciphers/kasumi.c index aba6cb2..fba9b65 100644 --- a/src/ltc/ciphers/kasumi.c +++ b/src/ltc/ciphers/kasumi.c @@ -13,7 +13,7 @@ Derived from the 3GPP standard source code */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_KASUMI diff --git a/src/ltc/ciphers/khazad.c b/src/ltc/ciphers/khazad.c index 54637d8..c8d8d7a 100644 --- a/src/ltc/ciphers/khazad.c +++ b/src/ltc/ciphers/khazad.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file khazad.c diff --git a/src/ltc/ciphers/kseed.c b/src/ltc/ciphers/kseed.c index f4e1345..6d2b084 100644 --- a/src/ltc/ciphers/kseed.c +++ b/src/ltc/ciphers/kseed.c @@ -13,7 +13,7 @@ Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_KSEED diff --git a/src/ltc/ciphers/multi2.c b/src/ltc/ciphers/multi2.c index 5421cb2..39c83a1 100644 --- a/src/ltc/ciphers/multi2.c +++ b/src/ltc/ciphers/multi2.c @@ -11,7 +11,7 @@ @file multi2.c Multi-2 implementation (not public domain, hence the default disable) */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MULTI2 diff --git a/src/ltc/ciphers/noekeon.c b/src/ltc/ciphers/noekeon.c index 71f9430..c933d45 100644 --- a/src/ltc/ciphers/noekeon.c +++ b/src/ltc/ciphers/noekeon.c @@ -10,7 +10,7 @@ @file noekeon.c Implementation of the Noekeon block cipher by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_NOEKEON diff --git a/src/ltc/ciphers/rc2.c b/src/ltc/ciphers/rc2.c index fbb1690..61219fe 100644 --- a/src/ltc/ciphers/rc2.c +++ b/src/ltc/ciphers/rc2.c @@ -16,7 +16,7 @@ * Thanks to CodeView, SoftIce, and D86 for helping bring this code to * * the public. * \**********************************************************************/ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rc2.c diff --git a/src/ltc/ciphers/rc5.c b/src/ltc/ciphers/rc5.c index 5368fac..41305f0 100644 --- a/src/ltc/ciphers/rc5.c +++ b/src/ltc/ciphers/rc5.c @@ -12,7 +12,7 @@ LTC_RC5 code by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_RC5 diff --git a/src/ltc/ciphers/rc6.c b/src/ltc/ciphers/rc6.c index 5c8a8f9..1a71e50 100644 --- a/src/ltc/ciphers/rc6.c +++ b/src/ltc/ciphers/rc6.c @@ -11,7 +11,7 @@ @file rc6.c LTC_RC6 code by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_RC6 diff --git a/src/ltc/ciphers/safer/safer.c b/src/ltc/ciphers/safer/safer.c index 8e1368f..913e193 100644 --- a/src/ltc/ciphers/safer/safer.c +++ b/src/ltc/ciphers/safer/safer.c @@ -26,7 +26,7 @@ * *******************************************************************************/ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SAFER diff --git a/src/ltc/ciphers/safer/saferp.c b/src/ltc/ciphers/safer/saferp.c index 65dc921..e6e1c90 100644 --- a/src/ltc/ciphers/safer/saferp.c +++ b/src/ltc/ciphers/safer/saferp.c @@ -11,7 +11,7 @@ @file saferp.c LTC_SAFER+ Implementation by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SAFERP diff --git a/src/ltc/ciphers/serpent.c b/src/ltc/ciphers/serpent.c index 362ce26..340010e 100644 --- a/src/ltc/ciphers/serpent.c +++ b/src/ltc/ciphers/serpent.c @@ -15,7 +15,7 @@ https://en.wikipedia.org/wiki/Serpent_(cipher) */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SERPENT diff --git a/src/ltc/ciphers/skipjack.c b/src/ltc/ciphers/skipjack.c index 67be57f..8726af2 100644 --- a/src/ltc/ciphers/skipjack.c +++ b/src/ltc/ciphers/skipjack.c @@ -11,7 +11,7 @@ @file skipjack.c Skipjack Implementation by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SKIPJACK diff --git a/src/ltc/ciphers/twofish/twofish.c b/src/ltc/ciphers/twofish/twofish.c index d444bb2..cbc85fa 100644 --- a/src/ltc/ciphers/twofish/twofish.c +++ b/src/ltc/ciphers/twofish/twofish.c @@ -11,7 +11,7 @@ @file twofish.c Implementation of Twofish by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_TWOFISH @@ -473,7 +473,7 @@ const ulong32 *k; int r; #if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__) - ulong32 *S1, *S2, *S3, *S4; + const ulong32 *S1, *S2, *S3, *S4; #endif LTC_ARGCHK(pt != NULL); @@ -547,7 +547,7 @@ const ulong32 *k; int r; #if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__) - ulong32 *S1, *S2, *S3, *S4; + const ulong32 *S1, *S2, *S3, *S4; #endif LTC_ARGCHK(pt != NULL); diff --git a/src/ltc/ciphers/xtea.c b/src/ltc/ciphers/xtea.c index 3f91bf7..b159078 100644 --- a/src/ltc/ciphers/xtea.c +++ b/src/ltc/ciphers/xtea.c @@ -11,7 +11,7 @@ @file xtea.c Implementation of LTC_XTEA, Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_XTEA diff --git a/src/ltc/encauth/ccm/ccm_add_aad.c b/src/ltc/encauth/ccm/ccm_add_aad.c index 9744c57..53ff299 100644 --- a/src/ltc/encauth/ccm/ccm_add_aad.c +++ b/src/ltc/encauth/ccm/ccm_add_aad.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CCM_MODE diff --git a/src/ltc/encauth/ccm/ccm_add_nonce.c b/src/ltc/encauth/ccm/ccm_add_nonce.c index ceffb8e..e2b0faf 100644 --- a/src/ltc/encauth/ccm/ccm_add_nonce.c +++ b/src/ltc/encauth/ccm/ccm_add_nonce.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CCM_MODE diff --git a/src/ltc/encauth/ccm/ccm_done.c b/src/ltc/encauth/ccm/ccm_done.c index 797b7d9..b379bdf 100644 --- a/src/ltc/encauth/ccm/ccm_done.c +++ b/src/ltc/encauth/ccm/ccm_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CCM_MODE diff --git a/src/ltc/encauth/ccm/ccm_init.c b/src/ltc/encauth/ccm/ccm_init.c index b24e33e..20c2a17 100644 --- a/src/ltc/encauth/ccm/ccm_init.c +++ b/src/ltc/encauth/ccm/ccm_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CCM_MODE diff --git a/src/ltc/encauth/ccm/ccm_memory.c b/src/ltc/encauth/ccm/ccm_memory.c index 0ffdbce..40ecba6 100644 --- a/src/ltc/encauth/ccm/ccm_memory.c +++ b/src/ltc/encauth/ccm/ccm_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ccm_memory.c diff --git a/src/ltc/encauth/ccm/ccm_process.c b/src/ltc/encauth/ccm/ccm_process.c index 8346d22..6e843d1 100644 --- a/src/ltc/encauth/ccm/ccm_process.c +++ b/src/ltc/encauth/ccm/ccm_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CCM_MODE diff --git a/src/ltc/encauth/ccm/ccm_reset.c b/src/ltc/encauth/ccm/ccm_reset.c index c2d0cae..24dcc3f 100644 --- a/src/ltc/encauth/ccm/ccm_reset.c +++ b/src/ltc/encauth/ccm/ccm_reset.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CCM_MODE diff --git a/src/ltc/encauth/chachapoly/chacha20poly1305_add_aad.c b/src/ltc/encauth/chachapoly/chacha20poly1305_add_aad.c index 0c0cf9d..630c383 100644 --- a/src/ltc/encauth/chachapoly/chacha20poly1305_add_aad.c +++ b/src/ltc/encauth/chachapoly/chacha20poly1305_add_aad.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20POLY1305_MODE diff --git a/src/ltc/encauth/chachapoly/chacha20poly1305_decrypt.c b/src/ltc/encauth/chachapoly/chacha20poly1305_decrypt.c index 1797932..f19cf18 100644 --- a/src/ltc/encauth/chachapoly/chacha20poly1305_decrypt.c +++ b/src/ltc/encauth/chachapoly/chacha20poly1305_decrypt.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20POLY1305_MODE diff --git a/src/ltc/encauth/chachapoly/chacha20poly1305_done.c b/src/ltc/encauth/chachapoly/chacha20poly1305_done.c index 127a7f0..ff1adbd 100644 --- a/src/ltc/encauth/chachapoly/chacha20poly1305_done.c +++ b/src/ltc/encauth/chachapoly/chacha20poly1305_done.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20POLY1305_MODE diff --git a/src/ltc/encauth/chachapoly/chacha20poly1305_encrypt.c b/src/ltc/encauth/chachapoly/chacha20poly1305_encrypt.c index c53c4a6..aeecc18 100644 --- a/src/ltc/encauth/chachapoly/chacha20poly1305_encrypt.c +++ b/src/ltc/encauth/chachapoly/chacha20poly1305_encrypt.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20POLY1305_MODE diff --git a/src/ltc/encauth/chachapoly/chacha20poly1305_init.c b/src/ltc/encauth/chachapoly/chacha20poly1305_init.c index 2799e98..f75ab76 100644 --- a/src/ltc/encauth/chachapoly/chacha20poly1305_init.c +++ b/src/ltc/encauth/chachapoly/chacha20poly1305_init.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20POLY1305_MODE diff --git a/src/ltc/encauth/chachapoly/chacha20poly1305_memory.c b/src/ltc/encauth/chachapoly/chacha20poly1305_memory.c index 54e2011..34da912 100644 --- a/src/ltc/encauth/chachapoly/chacha20poly1305_memory.c +++ b/src/ltc/encauth/chachapoly/chacha20poly1305_memory.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20POLY1305_MODE diff --git a/src/ltc/encauth/chachapoly/chacha20poly1305_setiv.c b/src/ltc/encauth/chachapoly/chacha20poly1305_setiv.c index b87666e..4e770a0 100644 --- a/src/ltc/encauth/chachapoly/chacha20poly1305_setiv.c +++ b/src/ltc/encauth/chachapoly/chacha20poly1305_setiv.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20POLY1305_MODE diff --git a/src/ltc/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.c b/src/ltc/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.c index 7136a1e..f2c5cb6 100644 --- a/src/ltc/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.c +++ b/src/ltc/encauth/chachapoly/chacha20poly1305_setiv_rfc7905.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20POLY1305_MODE diff --git a/src/ltc/encauth/eax/eax_addheader.c b/src/ltc/encauth/eax/eax_addheader.c index 5545336..f70c638 100644 --- a/src/ltc/encauth/eax/eax_addheader.c +++ b/src/ltc/encauth/eax/eax_addheader.c @@ -10,7 +10,7 @@ @file eax_addheader.c EAX implementation, add meta-data, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_EAX_MODE diff --git a/src/ltc/encauth/eax/eax_decrypt.c b/src/ltc/encauth/eax/eax_decrypt.c index b140716..75001e7 100644 --- a/src/ltc/encauth/eax/eax_decrypt.c +++ b/src/ltc/encauth/eax/eax_decrypt.c @@ -11,7 +11,7 @@ @file eax_decrypt.c EAX implementation, decrypt block, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_EAX_MODE diff --git a/src/ltc/encauth/eax/eax_decrypt_verify_memory.c b/src/ltc/encauth/eax/eax_decrypt_verify_memory.c index 058a6a9..788ac36 100644 --- a/src/ltc/encauth/eax/eax_decrypt_verify_memory.c +++ b/src/ltc/encauth/eax/eax_decrypt_verify_memory.c @@ -11,7 +11,7 @@ @file eax_decrypt_verify_memory.c EAX implementation, decrypt block of memory, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_EAX_MODE diff --git a/src/ltc/encauth/eax/eax_done.c b/src/ltc/encauth/eax/eax_done.c index b00bfe0..ab0c6c5 100644 --- a/src/ltc/encauth/eax/eax_done.c +++ b/src/ltc/encauth/eax/eax_done.c @@ -11,7 +11,7 @@ @file eax_done.c EAX implementation, terminate session, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_EAX_MODE diff --git a/src/ltc/encauth/eax/eax_encrypt.c b/src/ltc/encauth/eax/eax_encrypt.c index 174f263..7b30d1d 100644 --- a/src/ltc/encauth/eax/eax_encrypt.c +++ b/src/ltc/encauth/eax/eax_encrypt.c @@ -11,7 +11,7 @@ @file eax_encrypt.c EAX implementation, encrypt block by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_EAX_MODE diff --git a/src/ltc/encauth/eax/eax_encrypt_authenticate_memory.c b/src/ltc/encauth/eax/eax_encrypt_authenticate_memory.c index 9980fc0..b98aef5 100644 --- a/src/ltc/encauth/eax/eax_encrypt_authenticate_memory.c +++ b/src/ltc/encauth/eax/eax_encrypt_authenticate_memory.c @@ -11,7 +11,7 @@ @file eax_encrypt_authenticate_memory.c EAX implementation, encrypt a block of memory, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_EAX_MODE diff --git a/src/ltc/encauth/eax/eax_init.c b/src/ltc/encauth/eax/eax_init.c index 154d7a9..2b2f1a6 100644 --- a/src/ltc/encauth/eax/eax_init.c +++ b/src/ltc/encauth/eax/eax_init.c @@ -11,7 +11,7 @@ @file eax_init.c EAX implementation, initialized EAX state, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_EAX_MODE diff --git a/src/ltc/encauth/gcm/gcm_add_aad.c b/src/ltc/encauth/gcm/gcm_add_aad.c index cacc15b..4f0293b 100644 --- a/src/ltc/encauth/gcm/gcm_add_aad.c +++ b/src/ltc/encauth/gcm/gcm_add_aad.c @@ -11,7 +11,7 @@ @file gcm_add_aad.c GCM implementation, Add AAD data to the stream, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_GCM_MODE diff --git a/src/ltc/encauth/gcm/gcm_add_iv.c b/src/ltc/encauth/gcm/gcm_add_iv.c index 3fd3861..2099f7b 100644 --- a/src/ltc/encauth/gcm/gcm_add_iv.c +++ b/src/ltc/encauth/gcm/gcm_add_iv.c @@ -11,7 +11,7 @@ @file gcm_add_iv.c GCM implementation, add IV data to the state, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_GCM_MODE diff --git a/src/ltc/encauth/gcm/gcm_done.c b/src/ltc/encauth/gcm/gcm_done.c index ffd551e..55a1324 100644 --- a/src/ltc/encauth/gcm/gcm_done.c +++ b/src/ltc/encauth/gcm/gcm_done.c @@ -11,7 +11,7 @@ @file gcm_done.c GCM implementation, Terminate the stream, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_GCM_MODE diff --git a/src/ltc/encauth/gcm/gcm_gf_mult.c b/src/ltc/encauth/gcm/gcm_gf_mult.c index 2e7a906..b1b8e08 100644 --- a/src/ltc/encauth/gcm/gcm_gf_mult.c +++ b/src/ltc/encauth/gcm/gcm_gf_mult.c @@ -11,7 +11,7 @@ @file gcm_gf_mult.c GCM implementation, do the GF mult, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #if defined(LTC_GCM_TABLES) || defined(LTC_LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST)) diff --git a/src/ltc/encauth/gcm/gcm_init.c b/src/ltc/encauth/gcm/gcm_init.c index 072870d..4b58247 100644 --- a/src/ltc/encauth/gcm/gcm_init.c +++ b/src/ltc/encauth/gcm/gcm_init.c @@ -11,7 +11,7 @@ @file gcm_init.c GCM implementation, initialize state, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_GCM_MODE diff --git a/src/ltc/encauth/gcm/gcm_memory.c b/src/ltc/encauth/gcm/gcm_memory.c index 7b59960..b318f7c 100644 --- a/src/ltc/encauth/gcm/gcm_memory.c +++ b/src/ltc/encauth/gcm/gcm_memory.c @@ -11,7 +11,7 @@ @file gcm_memory.c GCM implementation, process a packet, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_GCM_MODE diff --git a/src/ltc/encauth/gcm/gcm_mult_h.c b/src/ltc/encauth/gcm/gcm_mult_h.c index 4e374b4..add59c7 100644 --- a/src/ltc/encauth/gcm/gcm_mult_h.c +++ b/src/ltc/encauth/gcm/gcm_mult_h.c @@ -11,7 +11,7 @@ @file gcm_mult_h.c GCM implementation, do the GF mult, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #if defined(LTC_GCM_MODE) /** diff --git a/src/ltc/encauth/gcm/gcm_process.c b/src/ltc/encauth/gcm/gcm_process.c index b1ec20c..079cdfa 100644 --- a/src/ltc/encauth/gcm/gcm_process.c +++ b/src/ltc/encauth/gcm/gcm_process.c @@ -11,7 +11,7 @@ @file gcm_process.c GCM implementation, process message data, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_GCM_MODE diff --git a/src/ltc/encauth/gcm/gcm_reset.c b/src/ltc/encauth/gcm/gcm_reset.c index 3bd1088..bb6987f 100644 --- a/src/ltc/encauth/gcm/gcm_reset.c +++ b/src/ltc/encauth/gcm/gcm_reset.c @@ -11,7 +11,7 @@ @file gcm_reset.c GCM implementation, reset a used state so it can accept IV data, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_GCM_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_add_aad.c b/src/ltc/encauth/ocb3/ocb3_add_aad.c index 70e3211..625e4b9 100644 --- a/src/ltc/encauth/ocb3/ocb3_add_aad.c +++ b/src/ltc/encauth/ocb3/ocb3_add_aad.c @@ -11,7 +11,7 @@ @file ocb3_add_aad.c OCB implementation, add AAD data, by Karel Miko */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_decrypt.c b/src/ltc/encauth/ocb3/ocb3_decrypt.c index 4973bd2..3c57fda 100644 --- a/src/ltc/encauth/ocb3/ocb3_decrypt.c +++ b/src/ltc/encauth/ocb3/ocb3_decrypt.c @@ -11,7 +11,7 @@ @file ocb3_decrypt.c OCB implementation, decrypt data, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_decrypt_last.c b/src/ltc/encauth/ocb3/ocb3_decrypt_last.c index 70608dc..cb0b6ea 100644 --- a/src/ltc/encauth/ocb3/ocb3_decrypt_last.c +++ b/src/ltc/encauth/ocb3/ocb3_decrypt_last.c @@ -11,7 +11,7 @@ @file ocb3_decrypt_last.c OCB implementation, internal helper, by Karel Miko */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_decrypt_verify_memory.c b/src/ltc/encauth/ocb3/ocb3_decrypt_verify_memory.c index 066b62c..f6c1023 100644 --- a/src/ltc/encauth/ocb3/ocb3_decrypt_verify_memory.c +++ b/src/ltc/encauth/ocb3/ocb3_decrypt_verify_memory.c @@ -11,7 +11,7 @@ @file ocb3_decrypt_verify_memory.c OCB implementation, helper to decrypt block of memory, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_done.c b/src/ltc/encauth/ocb3/ocb3_done.c index b913d3a..0331cce 100644 --- a/src/ltc/encauth/ocb3/ocb3_done.c +++ b/src/ltc/encauth/ocb3/ocb3_done.c @@ -11,7 +11,7 @@ @file ocb3_done.c OCB implementation, INTERNAL ONLY helper, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_encrypt.c b/src/ltc/encauth/ocb3/ocb3_encrypt.c index 337b025..3fd9596 100644 --- a/src/ltc/encauth/ocb3/ocb3_encrypt.c +++ b/src/ltc/encauth/ocb3/ocb3_encrypt.c @@ -11,7 +11,7 @@ @file ocb3_encrypt.c OCB implementation, encrypt data, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_encrypt_authenticate_memory.c b/src/ltc/encauth/ocb3/ocb3_encrypt_authenticate_memory.c index efc1a8f..5261e94 100644 --- a/src/ltc/encauth/ocb3/ocb3_encrypt_authenticate_memory.c +++ b/src/ltc/encauth/ocb3/ocb3_encrypt_authenticate_memory.c @@ -11,7 +11,7 @@ @file ocb3_encrypt_authenticate_memory.c OCB implementation, encrypt block of memory, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_encrypt_last.c b/src/ltc/encauth/ocb3/ocb3_encrypt_last.c index 8110a3c..5834ef4 100644 --- a/src/ltc/encauth/ocb3/ocb3_encrypt_last.c +++ b/src/ltc/encauth/ocb3/ocb3_encrypt_last.c @@ -11,7 +11,7 @@ @file ocb3_encrypt_last.c OCB implementation, internal helper, by Karel Miko */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_init.c b/src/ltc/encauth/ocb3/ocb3_init.c index a3cabae..3ad4ab0 100644 --- a/src/ltc/encauth/ocb3/ocb3_init.c +++ b/src/ltc/encauth/ocb3/ocb3_init.c @@ -11,7 +11,7 @@ @file ocb3_init.c OCB implementation, initialize state, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_int_ntz.c b/src/ltc/encauth/ocb3/ocb3_int_ntz.c index 3c5b18d..d2dc4b4 100644 --- a/src/ltc/encauth/ocb3/ocb3_int_ntz.c +++ b/src/ltc/encauth/ocb3/ocb3_int_ntz.c @@ -11,7 +11,7 @@ @file ocb3_int_ntz.c OCB implementation, INTERNAL ONLY helper, by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/encauth/ocb3/ocb3_int_xor_blocks.c b/src/ltc/encauth/ocb3/ocb3_int_xor_blocks.c index 798bddc..bb7d6eb 100644 --- a/src/ltc/encauth/ocb3/ocb3_int_xor_blocks.c +++ b/src/ltc/encauth/ocb3/ocb3_int_xor_blocks.c @@ -11,7 +11,7 @@ @file ocb3_int_xor_blocks.c OCB implementation, INTERNAL ONLY helper, by Karel Miko */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_OCB3_MODE diff --git a/src/ltc/hashes/blake2b.c b/src/ltc/hashes/blake2b.c index cd5115c..6b91a85 100644 --- a/src/ltc/hashes/blake2b.c +++ b/src/ltc/hashes/blake2b.c @@ -23,7 +23,7 @@ */ /* see also https://www.ietf.org/rfc/rfc7693.txt */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLAKE2B @@ -199,6 +199,19 @@ return CRYPT_OK; } +/** + Initialize the hash/MAC state + + Use this function to init for arbitrary sizes. + + Give a key and keylen to init for MAC mode. + + @param md The hash state you wish to initialize + @param outlen The desired output-length + @param key The key of the MAC + @param keylen The length of the key + @return CRYPT_OK if successful +*/ int blake2b_init(hash_state *md, unsigned long outlen, const unsigned char *key, unsigned long keylen) { unsigned char P[BLAKE2B_PARAM_SIZE]; @@ -237,12 +250,32 @@ return CRYPT_OK; } +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ int blake2b_160_init(hash_state *md) { return blake2b_init(md, 20, NULL, 0); } +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ int blake2b_256_init(hash_state *md) { return blake2b_init(md, 32, NULL, 0); } +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ int blake2b_384_init(hash_state *md) { return blake2b_init(md, 48, NULL, 0); } +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ int blake2b_512_init(hash_state *md) { return blake2b_init(md, 64, NULL, 0); } #define G(r, i, a, b, c, d) \ @@ -328,6 +361,13 @@ } #endif +/** + Process a block of memory through the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen) { LTC_ARGCHK(md != NULL); @@ -360,6 +400,12 @@ return CRYPT_OK; } +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (size depending on the length used on init) + @return CRYPT_OK if successful +*/ int blake2b_done(hash_state *md, unsigned char *out) { unsigned char buffer[BLAKE2B_OUTBYTES] = { 0 }; diff --git a/src/ltc/hashes/blake2s.c b/src/ltc/hashes/blake2s.c index e3e90f8..96439eb 100644 --- a/src/ltc/hashes/blake2s.c +++ b/src/ltc/hashes/blake2s.c @@ -23,7 +23,7 @@ */ /* see also https://www.ietf.org/rfc/rfc7693.txt */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLAKE2S @@ -193,6 +193,19 @@ return CRYPT_OK; } +/** + Initialize the hash/MAC state + + Use this function to init for arbitrary sizes. + + Give a key and keylen to init for MAC mode. + + @param md The hash state you wish to initialize + @param outlen The desired output-length + @param key The key of the MAC + @param keylen The length of the key + @return CRYPT_OK if successful +*/ int blake2s_init(hash_state *md, unsigned long outlen, const unsigned char *key, unsigned long keylen) { unsigned char P[BLAKE2S_PARAM_SIZE]; @@ -230,12 +243,32 @@ return CRYPT_OK; } +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ int blake2s_128_init(hash_state *md) { return blake2s_init(md, 16, NULL, 0); } +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ int blake2s_160_init(hash_state *md) { return blake2s_init(md, 20, NULL, 0); } +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ int blake2s_224_init(hash_state *md) { return blake2s_init(md, 28, NULL, 0); } +/** + Initialize the hash state + @param md The hash state you wish to initialize + @return CRYPT_OK if successful +*/ int blake2s_256_init(hash_state *md) { return blake2s_init(md, 32, NULL, 0); } #define G(r, i, a, b, c, d) \ @@ -316,6 +349,13 @@ } #endif +/** + Process a block of memory through the hash + @param md The hash state + @param in The data to hash + @param inlen The length of the data (octets) + @return CRYPT_OK if successful +*/ int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen) { LTC_ARGCHK(md != NULL); @@ -348,6 +388,12 @@ return CRYPT_OK; } +/** + Terminate the hash to get the digest + @param md The hash state + @param out [out] The destination of the hash (size depending on the length used on init) + @return CRYPT_OK if successful +*/ int blake2s_done(hash_state *md, unsigned char *out) { unsigned char buffer[BLAKE2S_OUTBYTES] = { 0 }; diff --git a/src/ltc/hashes/chc/chc.c b/src/ltc/hashes/chc/chc.c index dc35052..bcb6947 100644 --- a/src/ltc/hashes/chc/chc.c +++ b/src/ltc/hashes/chc/chc.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file chc.c diff --git a/src/ltc/hashes/helper/hash_file.c b/src/ltc/hashes/helper/hash_file.c index 0b96eae..9c8493b 100644 --- a/src/ltc/hashes/helper/hash_file.c +++ b/src/ltc/hashes/helper/hash_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifndef LTC_NO_FILE /** diff --git a/src/ltc/hashes/helper/hash_filehandle.c b/src/ltc/hashes/helper/hash_filehandle.c index 0e4d7a6..521aa80 100644 --- a/src/ltc/hashes/helper/hash_filehandle.c +++ b/src/ltc/hashes/helper/hash_filehandle.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifndef LTC_NO_FILE /** diff --git a/src/ltc/hashes/helper/hash_memory.c b/src/ltc/hashes/helper/hash_memory.c index e8471ac..483552d 100644 --- a/src/ltc/hashes/helper/hash_memory.c +++ b/src/ltc/hashes/helper/hash_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_HASH_HELPERS /** diff --git a/src/ltc/hashes/helper/hash_memory_multi.c b/src/ltc/hashes/helper/hash_memory_multi.c index d10b458..5200d9a 100644 --- a/src/ltc/hashes/helper/hash_memory_multi.c +++ b/src/ltc/hashes/helper/hash_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include #ifdef LTC_HASH_HELPERS diff --git a/src/ltc/hashes/md2.c b/src/ltc/hashes/md2.c index 36cc8ae..b3fc88a 100644 --- a/src/ltc/hashes/md2.c +++ b/src/ltc/hashes/md2.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @param md2.c diff --git a/src/ltc/hashes/md4.c b/src/ltc/hashes/md4.c index e3bc0c5..0dd2074 100644 --- a/src/ltc/hashes/md4.c +++ b/src/ltc/hashes/md4.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @param md4.c diff --git a/src/ltc/hashes/md5.c b/src/ltc/hashes/md5.c index a417970..f37a472 100644 --- a/src/ltc/hashes/md5.c +++ b/src/ltc/hashes/md5.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** diff --git a/src/ltc/hashes/rmd128.c b/src/ltc/hashes/rmd128.c index b60cb0a..a9c26fc 100644 --- a/src/ltc/hashes/rmd128.c +++ b/src/ltc/hashes/rmd128.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @param rmd128.c diff --git a/src/ltc/hashes/rmd160.c b/src/ltc/hashes/rmd160.c index d38d2be..550e3ed 100644 --- a/src/ltc/hashes/rmd160.c +++ b/src/ltc/hashes/rmd160.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rmd160.c diff --git a/src/ltc/hashes/rmd256.c b/src/ltc/hashes/rmd256.c index da51a1d..f3ca106 100644 --- a/src/ltc/hashes/rmd256.c +++ b/src/ltc/hashes/rmd256.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @param rmd256.c diff --git a/src/ltc/hashes/rmd320.c b/src/ltc/hashes/rmd320.c index ba6ba9e..06f2764 100644 --- a/src/ltc/hashes/rmd320.c +++ b/src/ltc/hashes/rmd320.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rmd320.c diff --git a/src/ltc/hashes/sha1.c b/src/ltc/hashes/sha1.c index f78ef75..debf9b0 100644 --- a/src/ltc/hashes/sha1.c +++ b/src/ltc/hashes/sha1.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file sha1.c diff --git a/src/ltc/hashes/sha2/sha224.c b/src/ltc/hashes/sha2/sha224.c index 773a2c5..bb68abc 100644 --- a/src/ltc/hashes/sha2/sha224.c +++ b/src/ltc/hashes/sha2/sha224.c @@ -11,7 +11,7 @@ LTC_SHA-224 new NIST standard based off of LTC_SHA-256 truncated to 224 bits (Tom St Denis) */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #if defined(LTC_SHA224) && defined(LTC_SHA256) diff --git a/src/ltc/hashes/sha2/sha256.c b/src/ltc/hashes/sha2/sha256.c index 3b9c4e2..c553fd0 100644 --- a/src/ltc/hashes/sha2/sha256.c +++ b/src/ltc/hashes/sha2/sha256.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file sha256.c diff --git a/src/ltc/hashes/sha2/sha384.c b/src/ltc/hashes/sha2/sha384.c index 1623812..973625f 100644 --- a/src/ltc/hashes/sha2/sha384.c +++ b/src/ltc/hashes/sha2/sha384.c @@ -11,7 +11,7 @@ LTC_SHA384 hash included in sha512.c, Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #if defined(LTC_SHA384) && defined(LTC_SHA512) diff --git a/src/ltc/hashes/sha2/sha512.c b/src/ltc/hashes/sha2/sha512.c index c7bffd1..5e4ad15 100644 --- a/src/ltc/hashes/sha2/sha512.c +++ b/src/ltc/hashes/sha2/sha512.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @param sha512.c diff --git a/src/ltc/hashes/sha2/sha512_224.c b/src/ltc/hashes/sha2/sha512_224.c index 48bb938..ad0f95b 100644 --- a/src/ltc/hashes/sha2/sha512_224.c +++ b/src/ltc/hashes/sha2/sha512_224.c @@ -11,7 +11,7 @@ SHA512/224 hash included in sha512.c */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #if defined(LTC_SHA512_224) && defined(LTC_SHA512) diff --git a/src/ltc/hashes/sha2/sha512_256.c b/src/ltc/hashes/sha2/sha512_256.c index 943adaa..fda0339 100644 --- a/src/ltc/hashes/sha2/sha512_256.c +++ b/src/ltc/hashes/sha2/sha512_256.c @@ -11,7 +11,7 @@ SHA512/256 hash included in sha512.c */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #if defined(LTC_SHA512_256) && defined(LTC_SHA512) diff --git a/src/ltc/hashes/sha3.c b/src/ltc/hashes/sha3.c index 5e91538..d9bbc8a 100644 --- a/src/ltc/hashes/sha3.c +++ b/src/ltc/hashes/sha3.c @@ -9,7 +9,7 @@ /* based on https://github.com/brainhub/SHA3IUF (public domain) */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SHA3 diff --git a/src/ltc/hashes/sha3_test.c b/src/ltc/hashes/sha3_test.c index 2bf7482..3f119a6 100644 --- a/src/ltc/hashes/sha3_test.c +++ b/src/ltc/hashes/sha3_test.c @@ -9,7 +9,7 @@ /* based on https://github.com/brainhub/SHA3IUF (public domain) */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SHA3 diff --git a/src/ltc/hashes/tiger.c b/src/ltc/hashes/tiger.c index c6dce7c..0d3ba10 100644 --- a/src/ltc/hashes/tiger.c +++ b/src/ltc/hashes/tiger.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file tiger.c diff --git a/src/ltc/hashes/whirl/whirl.c b/src/ltc/hashes/whirl/whirl.c index 636f03a..1f374f8 100644 --- a/src/ltc/hashes/whirl/whirl.c +++ b/src/ltc/hashes/whirl/whirl.c @@ -12,7 +12,7 @@ LTC_WHIRLPOOL (using their new sbox) hash function by Tom St Denis */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_WHIRLPOOL diff --git a/src/ltc/headers/tomcrypt_cipher.h b/src/ltc/headers/tomcrypt_cipher.h index a94055e..4b98359 100644 --- a/src/ltc/headers/tomcrypt_cipher.h +++ b/src/ltc/headers/tomcrypt_cipher.h @@ -1031,6 +1031,15 @@ #endif /* LTC_SALSA20 */ +#ifdef LTC_XSALSA20 + +int xsalsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long keylen, + const unsigned char *nonce, unsigned long noncelen, + int rounds); +int xsalsa20_test(void); + +#endif /* LTC_XSALSA20 */ + #ifdef LTC_SOSEMANUK typedef struct { diff --git a/src/ltc/headers/tomcrypt_custom.h b/src/ltc/headers/tomcrypt_custom.h index ab45e76..2772718 100644 --- a/src/ltc/headers/tomcrypt_custom.h +++ b/src/ltc/headers/tomcrypt_custom.h @@ -208,6 +208,7 @@ /* stream ciphers */ #define LTC_CHACHA #define LTC_SALSA20 +#define LTC_XSALSA20 #define LTC_SOSEMANUK #define LTC_RABBIT #define LTC_RC4_STREAM @@ -364,6 +365,15 @@ /* time-based rate limit of the reseeding */ #define LTC_FORTUNA_RESEED_RATELIMIT_TIMED +/* with non-glibc or glibc 2.17+ prefer clock_gettime over gettimeofday */ +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 17) + #define LTC_CLOCK_GETTIME +#endif +#elif defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L + #define LTC_CLOCK_GETTIME +#endif + #else #ifndef LTC_FORTUNA_WD @@ -414,9 +424,6 @@ #define LTC_DH6144 #define LTC_DH8192 #endif - -/* Include Katja (a Rabin variant like RSA) */ -/* #define LTC_MKAT */ /* Digital Signature Algorithm */ #define LTC_MDSA @@ -538,7 +545,7 @@ #endif #endif -#if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_MKAT) +#if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) /* Include the MPI functionality? (required by the PK algorithms) */ #define LTC_MPI @@ -568,7 +575,7 @@ #error ASN.1 DER requires MPI functionality #endif -#if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC) || defined(LTC_MKAT)) && !defined(LTC_DER) +#if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC)) && !defined(LTC_DER) #error PK requires ASN.1 DER functionality, make sure LTC_DER is enabled #endif @@ -578,6 +585,10 @@ #if defined(LTC_CHACHA20_PRNG) && !defined(LTC_CHACHA) #error LTC_CHACHA20_PRNG requires LTC_CHACHA +#endif + +#if defined(LTC_XSALSA20) && !defined(LTC_SALSA20) + #error LTC_XSALSA20 requires LTC_SALSA20 #endif #if defined(LTC_RC4) && !defined(LTC_RC4_STREAM) diff --git a/src/ltc/headers/tomcrypt_hash.h b/src/ltc/headers/tomcrypt_hash.h index ea2077e..dbb6b9a 100644 --- a/src/ltc/headers/tomcrypt_hash.h +++ b/src/ltc/headers/tomcrypt_hash.h @@ -507,46 +507,6 @@ int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen); #endif -/* a simple macro for making hash "process" functions */ -#define HASH_PROCESS(func_name, compress_name, state_var, block_size) \ -int func_name (hash_state * md, const unsigned char *in, unsigned long inlen) \ -{ \ - unsigned long n; \ - int err; \ - LTC_ARGCHK(md != NULL); \ - LTC_ARGCHK(in != NULL); \ - if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \ - return CRYPT_INVALID_ARG; \ - } \ - if ((md-> state_var .length + inlen) < md-> state_var .length) { \ - return CRYPT_HASH_OVERFLOW; \ - } \ - while (inlen > 0) { \ - if (md-> state_var .curlen == 0 && inlen >= block_size) { \ - if ((err = compress_name (md, in)) != CRYPT_OK) { \ - return err; \ - } \ - md-> state_var .length += block_size * 8; \ - in += block_size; \ - inlen -= block_size; \ - } else { \ - n = MIN(inlen, (block_size - md-> state_var .curlen)); \ - XMEMCPY(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \ - md-> state_var .curlen += n; \ - in += n; \ - inlen -= n; \ - if (md-> state_var .curlen == block_size) { \ - if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) { \ - return err; \ - } \ - md-> state_var .length += 8*block_size; \ - md-> state_var .curlen = 0; \ - } \ - } \ - } \ - return CRYPT_OK; \ -} - /* ref: $Format:%D$ */ /* git commit: $Format:%H$ */ /* commit time: $Format:%ai$ */ diff --git a/src/ltc/headers/tomcrypt_mac.h b/src/ltc/headers/tomcrypt_mac.h index ebb8410..e4fdf14 100644 --- a/src/ltc/headers/tomcrypt_mac.h +++ b/src/ltc/headers/tomcrypt_mac.h @@ -146,6 +146,7 @@ int blake2bmac_test(void); #endif /* LTC_BLAKE2BMAC */ + #ifdef LTC_PELICAN typedef struct pelican_state @@ -391,12 +392,6 @@ int ocb3_test(void); -#ifdef LTC_SOURCE -/* internal helper functions */ -int ocb3_int_ntz(unsigned long x); -void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len); -#endif /* LTC_SOURCE */ - #endif /* LTC_OCB3_MODE */ #ifdef LTC_CCM_MODE diff --git a/src/ltc/headers/tomcrypt_math.h b/src/ltc/headers/tomcrypt_math.h index 79f6d21..0678339 100644 --- a/src/ltc/headers/tomcrypt_math.h +++ b/src/ltc/headers/tomcrypt_math.h @@ -524,77 +524,6 @@ extern const ltc_math_descriptor gmp_desc; #endif -#if !defined(DESC_DEF_ONLY) && defined(LTC_SOURCE) - -#define MP_DIGIT_BIT ltc_mp.bits_per_digit - -/* some handy macros */ -#define mp_init(a) ltc_mp.init(a) -#define mp_init_multi ltc_init_multi -#define mp_clear(a) ltc_mp.deinit(a) -#define mp_clear_multi ltc_deinit_multi -#define mp_cleanup_multi ltc_cleanup_multi -#define mp_init_copy(a, b) ltc_mp.init_copy(a, b) - -#define mp_neg(a, b) ltc_mp.neg(a, b) -#define mp_copy(a, b) ltc_mp.copy(a, b) - -#define mp_set(a, b) ltc_mp.set_int(a, b) -#define mp_set_int(a, b) ltc_mp.set_int(a, b) -#define mp_get_int(a) ltc_mp.get_int(a) -#define mp_get_digit(a, n) ltc_mp.get_digit(a, n) -#define mp_get_digit_count(a) ltc_mp.get_digit_count(a) -#define mp_cmp(a, b) ltc_mp.compare(a, b) -#define mp_cmp_d(a, b) ltc_mp.compare_d(a, b) -#define mp_count_bits(a) ltc_mp.count_bits(a) -#define mp_cnt_lsb(a) ltc_mp.count_lsb_bits(a) -#define mp_2expt(a, b) ltc_mp.twoexpt(a, b) - -#define mp_read_radix(a, b, c) ltc_mp.read_radix(a, b, c) -#define mp_toradix(a, b, c) ltc_mp.write_radix(a, b, c) -#define mp_unsigned_bin_size(a) ltc_mp.unsigned_size(a) -#define mp_to_unsigned_bin(a, b) ltc_mp.unsigned_write(a, b) -#define mp_read_unsigned_bin(a, b, c) ltc_mp.unsigned_read(a, b, c) - -#define mp_add(a, b, c) ltc_mp.add(a, b, c) -#define mp_add_d(a, b, c) ltc_mp.addi(a, b, c) -#define mp_sub(a, b, c) ltc_mp.sub(a, b, c) -#define mp_sub_d(a, b, c) ltc_mp.subi(a, b, c) -#define mp_mul(a, b, c) ltc_mp.mul(a, b, c) -#define mp_mul_d(a, b, c) ltc_mp.muli(a, b, c) -#define mp_sqr(a, b) ltc_mp.sqr(a, b) -#define mp_sqrtmod_prime(a, b, c) ltc_mp.sqrtmod_prime(a, b, c) -#define mp_div(a, b, c, d) ltc_mp.mpdiv(a, b, c, d) -#define mp_div_2(a, b) ltc_mp.div_2(a, b) -#define mp_mod(a, b, c) ltc_mp.mpdiv(a, b, NULL, c) -#define mp_mod_d(a, b, c) ltc_mp.modi(a, b, c) -#define mp_gcd(a, b, c) ltc_mp.gcd(a, b, c) -#define mp_lcm(a, b, c) ltc_mp.lcm(a, b, c) - -#define mp_addmod(a, b, c, d) ltc_mp.addmod(a, b, c, d) -#define mp_submod(a, b, c, d) ltc_mp.submod(a, b, c, d) -#define mp_mulmod(a, b, c, d) ltc_mp.mulmod(a, b, c, d) -#define mp_sqrmod(a, b, c) ltc_mp.sqrmod(a, b, c) -#define mp_invmod(a, b, c) ltc_mp.invmod(a, b, c) - -#define mp_montgomery_setup(a, b) ltc_mp.montgomery_setup(a, b) -#define mp_montgomery_normalization(a, b) ltc_mp.montgomery_normalization(a, b) -#define mp_montgomery_reduce(a, b, c) ltc_mp.montgomery_reduce(a, b, c) -#define mp_montgomery_free(a) ltc_mp.montgomery_deinit(a) - -#define mp_exptmod(a,b,c,d) ltc_mp.exptmod(a,b,c,d) -#define mp_prime_is_prime(a, b, c) ltc_mp.isprime(a, b, c) - -#define mp_iszero(a) (mp_cmp_d(a, 0) == LTC_MP_EQ ? LTC_MP_YES : LTC_MP_NO) -#define mp_isodd(a) (mp_get_digit_count(a) > 0 ? (mp_get_digit(a, 0) & 1 ? LTC_MP_YES : LTC_MP_NO) : LTC_MP_NO) -#define mp_exch(a, b) do { void *ABC__tmp = a; a = b; b = ABC__tmp; } while(0) - -#define mp_tohex(a, b) mp_toradix(a, b, 16) - -#define mp_rand(a, b) ltc_mp.rand(a, b) - -#endif - /* ref: $Format:%D$ */ /* git commit: $Format:%H$ */ /* commit time: $Format:%ai$ */ diff --git a/src/ltc/headers/tomcrypt_misc.h b/src/ltc/headers/tomcrypt_misc.h index a022b28..b30e087 100644 --- a/src/ltc/headers/tomcrypt_misc.h +++ b/src/ltc/headers/tomcrypt_misc.h @@ -54,7 +54,7 @@ #ifdef LTC_BASE16 int base16_encode(const unsigned char *in, unsigned long inlen, char *out, unsigned long *outlen, - int caps); + unsigned int options); int base16_decode(const char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen); #endif @@ -85,9 +85,6 @@ /* ---- MEM routines ---- */ int mem_neq(const void *a, const void *b, size_t len); void zeromem(volatile void *dst, size_t len); -#ifdef LTC_SOURCE -void copy_or_zeromem(const unsigned char* src, unsigned char* dest, unsigned long len, int coz); -#endif void burn_stack(unsigned long len); const char *error_to_string(int err); @@ -155,11 +152,6 @@ int padding_pad(unsigned char *data, unsigned long length, unsigned long* padded_length, unsigned long mode); int padding_depad(const unsigned char *data, unsigned long *length, unsigned long mode); - -#ifdef LTC_SOURCE -/* internal helper functions */ -#define LTC_PAD_MASK (0xF000U) -#endif #endif /* LTC_PADDING */ int compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which); diff --git a/src/ltc/headers/tomcrypt_pk.h b/src/ltc/headers/tomcrypt_pk.h index c3d05da..64e83bd 100644 --- a/src/ltc/headers/tomcrypt_pk.h +++ b/src/ltc/headers/tomcrypt_pk.h @@ -24,29 +24,6 @@ }; int rand_prime(void *N, long len, prng_state *prng, int wprng); - -#ifdef LTC_SOURCE -/* internal helper functions */ -int rand_bn_bits(void *N, int bits, prng_state *prng, int wprng); -int rand_bn_upto(void *N, void *limit, prng_state *prng, int wprng); - -enum public_key_algorithms { - PKA_RSA, - PKA_DSA, - PKA_EC, - PKA_EC_PRIMEF -}; - -typedef struct Oid { - unsigned long OID[16]; - /** Number of OID digits in use */ - unsigned long OIDlen; -} oid_st; - -int pk_get_oid(int pk, oid_st *st); -int pk_oid_str_to_num(const char *OID, unsigned long *oid, unsigned long *oidlen); -int pk_oid_num_to_str(const unsigned long *oid, unsigned long oidlen, char *OID, unsigned long *outlen); -#endif /* LTC_SOURCE */ /* ---- RSA ---- */ #ifdef LTC_MRSA @@ -149,61 +126,6 @@ rsa_key *key); #endif -/* ---- Katja ---- */ -#ifdef LTC_MKAT - -/* Min and Max KAT key sizes (in bits) */ -#define MIN_KAT_SIZE 1024 -#define MAX_KAT_SIZE 4096 - -/** Katja PKCS style key */ -typedef struct KAT_key { - /** Type of key, PK_PRIVATE or PK_PUBLIC */ - int type; - /** The private exponent */ - void *d; - /** The modulus */ - void *N; - /** The p factor of N */ - void *p; - /** The q factor of N */ - void *q; - /** The 1/q mod p CRT param */ - void *qP; - /** The d mod (p - 1) CRT param */ - void *dP; - /** The d mod (q - 1) CRT param */ - void *dQ; - /** The pq param */ - void *pq; -} katja_key; - -int katja_make_key(prng_state *prng, int wprng, int size, katja_key *key); - -int katja_exptmod(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, int which, - katja_key *key); - -void katja_free(katja_key *key); - -/* These use PKCS #1 v2.0 padding */ -int katja_encrypt_key(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - const unsigned char *lparam, unsigned long lparamlen, - prng_state *prng, int prng_idx, int hash_idx, katja_key *key); - -int katja_decrypt_key(const unsigned char *in, unsigned long inlen, - unsigned char *out, unsigned long *outlen, - const unsigned char *lparam, unsigned long lparamlen, - int hash_idx, int *stat, - katja_key *key); - -/* PKCS #1 import/export */ -int katja_export(unsigned char *out, unsigned long *outlen, int type, katja_key *key); -int katja_import(const unsigned char *in, unsigned long inlen, katja_key *key); - -#endif - /* ---- DH Routines ---- */ #ifdef LTC_MDH @@ -235,19 +157,6 @@ void dh_free(dh_key *key); int dh_export_key(void *out, unsigned long *outlen, int type, const dh_key *key); - -#ifdef LTC_SOURCE -typedef struct { - int size; - const char *name, *base, *prime; -} ltc_dh_set_type; - -extern const ltc_dh_set_type ltc_dh_sets[]; - -/* internal helper functions */ -int dh_check_pubkey(const dh_key *key); -#endif - #endif /* LTC_MDH */ @@ -347,6 +256,7 @@ int ecc_generate_key(prng_state *prng, int wprng, ecc_key *key); int ecc_set_key(const unsigned char *in, unsigned long inlen, int type, ecc_key *key); int ecc_get_key(unsigned char *out, unsigned long *outlen, int type, const ecc_key *key); +int ecc_get_oid_str(char *out, unsigned long *outlen, const ecc_key *key); int ecc_make_key(prng_state *prng, int wprng, int keysize, ecc_key *key); int ecc_make_key_ex(prng_state *prng, int wprng, ecc_key *key, const ltc_ecc_curve *cu); @@ -392,76 +302,6 @@ int ecc_verify_hash(const unsigned char *sig, unsigned long siglen, const unsigned char *hash, unsigned long hashlen, int *stat, const ecc_key *key); - - -#ifdef LTC_SOURCE -/* INTERNAL ONLY - it should be later moved to src/headers/tomcrypt_internal.h */ - -int ecc_set_dp_from_mpis(void *a, void *b, void *prime, void *order, void *gx, void *gy, unsigned long cofactor, ecc_key *key); -int ecc_copy_dp(const ecc_key *srckey, ecc_key *key); -int ecc_set_dp_by_size(int size, ecc_key *key); - -/* low level functions */ -ecc_point *ltc_ecc_new_point(void); -void ltc_ecc_del_point(ecc_point *p); -int ltc_ecc_set_point_xyz(ltc_mp_digit x, ltc_mp_digit y, ltc_mp_digit z, ecc_point *p); -int ltc_ecc_copy_point(const ecc_point *src, ecc_point *dst); -int ltc_ecc_is_point(const ltc_ecc_dp *dp, void *x, void *y); -int ltc_ecc_is_point_at_infinity(const ecc_point *P, void *modulus, int *retval); -int ltc_ecc_import_point(const unsigned char *in, unsigned long inlen, void *prime, void *a, void *b, void *x, void *y); -int ltc_ecc_export_point(unsigned char *out, unsigned long *outlen, void *x, void *y, unsigned long size, int compressed); -int ltc_ecc_verify_key(const ecc_key *key); - -/* point ops (mp == montgomery digit) */ -#if !defined(LTC_MECC_ACCEL) || defined(LTM_DESC) || defined(GMP_DESC) -/* R = 2P */ -int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, void *mp); - -/* R = P + Q */ -int ltc_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, void *modulus, void *mp); -#endif - -#if defined(LTC_MECC_FP) -/* optimized point multiplication using fixed point cache (HAC algorithm 14.117) */ -int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulus, int map); - -/* functions for saving/loading/freeing/adding to fixed point cache */ -int ltc_ecc_fp_save_state(unsigned char **out, unsigned long *outlen); -int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen); -void ltc_ecc_fp_free(void); -int ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock); - -/* lock/unlock all points currently in fixed point cache */ -void ltc_ecc_fp_tablelock(int lock); -#endif - -/* R = kG */ -int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map); - -#ifdef LTC_ECC_SHAMIR -/* kA*A + kB*B = C */ -int ltc_ecc_mul2add(const ecc_point *A, void *kA, - const ecc_point *B, void *kB, - ecc_point *C, - void *ma, - void *modulus); - -#ifdef LTC_MECC_FP -/* Shamir's trick with optimized point multiplication using fixed point cache */ -int ltc_ecc_fp_mul2add(const ecc_point *A, void *kA, - const ecc_point *B, void *kB, - ecc_point *C, - void *ma, - void *modulus); -#endif - -#endif - - -/* map P to affine from projective */ -int ltc_ecc_map(ecc_point *P, void *modulus, void *mp); - -#endif /* LTC_SOURCE */ #endif @@ -539,16 +379,10 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key); int dsa_export(unsigned char *out, unsigned long *outlen, int type, const dsa_key *key); int dsa_verify_key(const dsa_key *key, int *stat); -#ifdef LTC_SOURCE -/* internal helper functions */ -int dsa_int_validate_xy(const dsa_key *key, int *stat); -int dsa_int_validate_pqg(const dsa_key *key, int *stat); -int dsa_int_validate_primes(const dsa_key *key, int *stat); -#endif int dsa_shared_secret(void *private_key, void *base, const dsa_key *public_key, unsigned char *out, unsigned long *outlen); -#endif +#endif /* LTC_MDSA */ #ifdef LTC_DER /* DER handling */ @@ -711,30 +545,6 @@ unsigned long *outlen, unsigned long *payloadlen); -#ifdef LTC_SOURCE -/* internal helper functions */ -int der_decode_custom_type_ex(const unsigned char *in, unsigned long inlen, - ltc_asn1_list *root, - ltc_asn1_list *list, unsigned long outlen, unsigned int flags); - -int der_encode_asn1_identifier(const ltc_asn1_list *id, unsigned char *out, unsigned long *outlen); -int der_decode_asn1_identifier(const unsigned char *in, unsigned long *inlen, ltc_asn1_list *id); -int der_length_asn1_identifier(const ltc_asn1_list *id, unsigned long *idlen); - -int der_encode_asn1_length(unsigned long len, unsigned char* out, unsigned long* outlen); -int der_decode_asn1_length(const unsigned char* len, unsigned long* lenlen, unsigned long* outlen); -int der_length_asn1_length(unsigned long len, unsigned long *outlen); - -int der_length_sequence_ex(const ltc_asn1_list *list, unsigned long inlen, - unsigned long *outlen, unsigned long *payloadlen); - -extern const ltc_asn1_type der_asn1_tag_to_type_map[]; -extern const unsigned long der_asn1_tag_to_type_map_sz; - -extern const int der_asn1_type_to_identifier_map[]; -extern const unsigned long der_asn1_type_to_identifier_map_sz; -#endif /* LTC_SOURCE */ - /* SET */ #define der_decode_set(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, LTC_DER_SEQ_SET) #define der_length_set der_length_sequence @@ -747,10 +557,6 @@ /* VA list handy helpers with triplets of */ int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...); int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...); -#ifdef LTC_SOURCE -/* internal helper functions */ -int der_decode_sequence_multi_ex(const unsigned char *in, unsigned long inlen, unsigned int flags, ...); -#endif /* LTC_SOURCE */ /* FLEXI DECODER handle unknown list decoder */ int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out); @@ -815,13 +621,6 @@ unsigned char *out, unsigned long *outlen); int der_length_teletex_string(const unsigned char *octets, unsigned long noctets, unsigned long *outlen); -#ifdef LTC_SOURCE -/* internal helper functions */ -int der_teletex_char_encode(int c); -int der_teletex_value_decode(int v); -#endif /* LTC_SOURCE */ - - /* PRINTABLE STRING */ int der_encode_printable_string(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen); @@ -834,16 +633,16 @@ /* UTF-8 */ #if (defined(SIZE_MAX) || __STDC_VERSION__ >= 199901L || defined(WCHAR_MAX) || defined(__WCHAR_MAX__) || defined(_WCHAR_T) || defined(_WCHAR_T_DEFINED) || defined (__WCHAR_TYPE__)) && !defined(LTC_NO_WCHAR) -#include -#if defined(__WCHAR_MAX__) -#define LTC_WCHAR_MAX __WCHAR_MAX__ -#elif defined(WCHAR_MAX) -#define LTC_WCHAR_MAX WCHAR_MAX -#endif + #if defined(__WCHAR_MAX__) + #define LTC_WCHAR_MAX __WCHAR_MAX__ + #else + #include + #define LTC_WCHAR_MAX WCHAR_MAX + #endif /* please note that it might happen that LTC_WCHAR_MAX is undefined */ #else -typedef ulong32 wchar_t; -#define LTC_WCHAR_MAX 0xFFFFFFFF + typedef ulong32 wchar_t; + #define LTC_WCHAR_MAX 0xFFFFFFFF #endif int der_encode_utf8_string(const wchar_t *in, unsigned long inlen, @@ -852,10 +651,6 @@ int der_decode_utf8_string(const unsigned char *in, unsigned long inlen, wchar_t *out, unsigned long *outlen); unsigned long der_utf8_charsize(const wchar_t c); -#ifdef LTC_SOURCE -/* internal helper functions */ -int der_utf8_valid_char(const wchar_t c); -#endif /* LTC_SOURCE */ int der_length_utf8_string(const wchar_t *in, unsigned long noctets, unsigned long *outlen); @@ -906,18 +701,6 @@ int der_length_generalizedtime(const ltc_generalizedtime *gtime, unsigned long *outlen); -#ifdef LTC_SOURCE -/* internal helper functions */ -/* SUBJECT PUBLIC KEY INFO */ -int x509_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen, - unsigned int algorithm, const void* public_key, unsigned long public_key_len, - ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long parameters_len); - -int x509_decode_subject_public_key_info(const unsigned char *in, unsigned long inlen, - unsigned int algorithm, void* public_key, unsigned long* public_key_len, - ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long *parameters_len); -#endif /* LTC_SOURCE */ - #endif /* ref: $Format:%D$ */ diff --git a/src/ltc/headers/tomcrypt_private.h b/src/ltc/headers/tomcrypt_private.h new file mode 100644 index 0000000..865b7ad --- /dev/null +++ b/src/ltc/headers/tomcrypt_private.h @@ -0,0 +1,334 @@ +/* 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. + */ + +#include "tomcrypt.h" + +/* + * Internal Macros + */ + +#define LTC_PAD_MASK (0xF000U) + +/* + * Internal Enums + */ + +enum public_key_algorithms { + PKA_RSA, + PKA_DSA, + PKA_EC, + PKA_EC_PRIMEF +}; + +/* + * Internal Types + */ + +typedef struct Oid { + unsigned long OID[16]; + /** Number of OID digits in use */ + unsigned long OIDlen; +} oid_st; + +typedef struct { + int size; + const char *name, *base, *prime; +} ltc_dh_set_type; + + +/* + * Internal functions + */ + +/* tomcrypt_hash.h */ + +/* a simple macro for making hash "process" functions */ +#define HASH_PROCESS(func_name, compress_name, state_var, block_size) \ +int func_name (hash_state * md, const unsigned char *in, unsigned long inlen) \ +{ \ + unsigned long n; \ + int err; \ + LTC_ARGCHK(md != NULL); \ + LTC_ARGCHK(in != NULL); \ + if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \ + return CRYPT_INVALID_ARG; \ + } \ + if ((md-> state_var .length + inlen) < md-> state_var .length) { \ + return CRYPT_HASH_OVERFLOW; \ + } \ + while (inlen > 0) { \ + if (md-> state_var .curlen == 0 && inlen >= block_size) { \ + if ((err = compress_name (md, in)) != CRYPT_OK) { \ + return err; \ + } \ + md-> state_var .length += block_size * 8; \ + in += block_size; \ + inlen -= block_size; \ + } else { \ + n = MIN(inlen, (block_size - md-> state_var .curlen)); \ + XMEMCPY(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \ + md-> state_var .curlen += n; \ + in += n; \ + inlen -= n; \ + if (md-> state_var .curlen == block_size) { \ + if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) { \ + return err; \ + } \ + md-> state_var .length += 8*block_size; \ + md-> state_var .curlen = 0; \ + } \ + } \ + } \ + return CRYPT_OK; \ +} + + +/* tomcrypt_mac.h */ + +int ocb3_int_ntz(unsigned long x); +void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len); + + +/* tomcrypt_math.h */ + +#if !defined(DESC_DEF_ONLY) + +#define MP_DIGIT_BIT ltc_mp.bits_per_digit + +/* some handy macros */ +#define mp_init(a) ltc_mp.init(a) +#define mp_init_multi ltc_init_multi +#define mp_clear(a) ltc_mp.deinit(a) +#define mp_clear_multi ltc_deinit_multi +#define mp_cleanup_multi ltc_cleanup_multi +#define mp_init_copy(a, b) ltc_mp.init_copy(a, b) + +#define mp_neg(a, b) ltc_mp.neg(a, b) +#define mp_copy(a, b) ltc_mp.copy(a, b) + +#define mp_set(a, b) ltc_mp.set_int(a, b) +#define mp_set_int(a, b) ltc_mp.set_int(a, b) +#define mp_get_int(a) ltc_mp.get_int(a) +#define mp_get_digit(a, n) ltc_mp.get_digit(a, n) +#define mp_get_digit_count(a) ltc_mp.get_digit_count(a) +#define mp_cmp(a, b) ltc_mp.compare(a, b) +#define mp_cmp_d(a, b) ltc_mp.compare_d(a, b) +#define mp_count_bits(a) ltc_mp.count_bits(a) +#define mp_cnt_lsb(a) ltc_mp.count_lsb_bits(a) +#define mp_2expt(a, b) ltc_mp.twoexpt(a, b) + +#define mp_read_radix(a, b, c) ltc_mp.read_radix(a, b, c) +#define mp_toradix(a, b, c) ltc_mp.write_radix(a, b, c) +#define mp_unsigned_bin_size(a) ltc_mp.unsigned_size(a) +#define mp_to_unsigned_bin(a, b) ltc_mp.unsigned_write(a, b) +#define mp_read_unsigned_bin(a, b, c) ltc_mp.unsigned_read(a, b, c) + +#define mp_add(a, b, c) ltc_mp.add(a, b, c) +#define mp_add_d(a, b, c) ltc_mp.addi(a, b, c) +#define mp_sub(a, b, c) ltc_mp.sub(a, b, c) +#define mp_sub_d(a, b, c) ltc_mp.subi(a, b, c) +#define mp_mul(a, b, c) ltc_mp.mul(a, b, c) +#define mp_mul_d(a, b, c) ltc_mp.muli(a, b, c) +#define mp_sqr(a, b) ltc_mp.sqr(a, b) +#define mp_sqrtmod_prime(a, b, c) ltc_mp.sqrtmod_prime(a, b, c) +#define mp_div(a, b, c, d) ltc_mp.mpdiv(a, b, c, d) +#define mp_div_2(a, b) ltc_mp.div_2(a, b) +#define mp_mod(a, b, c) ltc_mp.mpdiv(a, b, NULL, c) +#define mp_mod_d(a, b, c) ltc_mp.modi(a, b, c) +#define mp_gcd(a, b, c) ltc_mp.gcd(a, b, c) +#define mp_lcm(a, b, c) ltc_mp.lcm(a, b, c) + +#define mp_addmod(a, b, c, d) ltc_mp.addmod(a, b, c, d) +#define mp_submod(a, b, c, d) ltc_mp.submod(a, b, c, d) +#define mp_mulmod(a, b, c, d) ltc_mp.mulmod(a, b, c, d) +#define mp_sqrmod(a, b, c) ltc_mp.sqrmod(a, b, c) +#define mp_invmod(a, b, c) ltc_mp.invmod(a, b, c) + +#define mp_montgomery_setup(a, b) ltc_mp.montgomery_setup(a, b) +#define mp_montgomery_normalization(a, b) ltc_mp.montgomery_normalization(a, b) +#define mp_montgomery_reduce(a, b, c) ltc_mp.montgomery_reduce(a, b, c) +#define mp_montgomery_free(a) ltc_mp.montgomery_deinit(a) + +#define mp_exptmod(a,b,c,d) ltc_mp.exptmod(a,b,c,d) +#define mp_prime_is_prime(a, b, c) ltc_mp.isprime(a, b, c) + +#define mp_iszero(a) (mp_cmp_d(a, 0) == LTC_MP_EQ ? LTC_MP_YES : LTC_MP_NO) +#define mp_isodd(a) (mp_get_digit_count(a) > 0 ? (mp_get_digit(a, 0) & 1 ? LTC_MP_YES : LTC_MP_NO) : LTC_MP_NO) +#define mp_exch(a, b) do { void *ABC__tmp = a; a = b; b = ABC__tmp; } while(0) + +#define mp_tohex(a, b) mp_toradix(a, b, 16) + +#define mp_rand(a, b) ltc_mp.rand(a, b) + +#endif + + +/* tomcrypt_misc.h */ + +void copy_or_zeromem(const unsigned char* src, unsigned char* dest, unsigned long len, int coz); + + +/* tomcrypt_pk.h */ + +int rand_bn_bits(void *N, int bits, prng_state *prng, int wprng); +int rand_bn_upto(void *N, void *limit, prng_state *prng, int wprng); + +int pk_get_oid(int pk, oid_st *st); +int pk_oid_str_to_num(const char *OID, unsigned long *oid, unsigned long *oidlen); +int pk_oid_num_to_str(const unsigned long *oid, unsigned long oidlen, char *OID, unsigned long *outlen); + +/* ---- DH Routines ---- */ +#ifdef LTC_MDH +extern const ltc_dh_set_type ltc_dh_sets[]; + +int dh_check_pubkey(const dh_key *key); +#endif /* LTC_MDH */ + +/* ---- ECC Routines ---- */ +#ifdef LTC_MECC +int ecc_set_dp_from_mpis(void *a, void *b, void *prime, void *order, void *gx, void *gy, unsigned long cofactor, ecc_key *key); +int ecc_copy_dp(const ecc_key *srckey, ecc_key *key); +int ecc_set_dp_by_size(int size, ecc_key *key); + +/* low level functions */ +ecc_point *ltc_ecc_new_point(void); +void ltc_ecc_del_point(ecc_point *p); +int ltc_ecc_set_point_xyz(ltc_mp_digit x, ltc_mp_digit y, ltc_mp_digit z, ecc_point *p); +int ltc_ecc_copy_point(const ecc_point *src, ecc_point *dst); +int ltc_ecc_is_point(const ltc_ecc_dp *dp, void *x, void *y); +int ltc_ecc_is_point_at_infinity(const ecc_point *P, void *modulus, int *retval); +int ltc_ecc_import_point(const unsigned char *in, unsigned long inlen, void *prime, void *a, void *b, void *x, void *y); +int ltc_ecc_export_point(unsigned char *out, unsigned long *outlen, void *x, void *y, unsigned long size, int compressed); +int ltc_ecc_verify_key(const ecc_key *key); + +/* point ops (mp == montgomery digit) */ +#if !defined(LTC_MECC_ACCEL) || defined(LTM_DESC) || defined(GMP_DESC) +/* R = 2P */ +int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, void *mp); + +/* R = P + Q */ +int ltc_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, void *modulus, void *mp); +#endif + +#if defined(LTC_MECC_FP) +/* optimized point multiplication using fixed point cache (HAC algorithm 14.117) */ +int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulus, int map); + +/* functions for saving/loading/freeing/adding to fixed point cache */ +int ltc_ecc_fp_save_state(unsigned char **out, unsigned long *outlen); +int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen); +void ltc_ecc_fp_free(void); +int ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock); + +/* lock/unlock all points currently in fixed point cache */ +void ltc_ecc_fp_tablelock(int lock); +#endif + +/* R = kG */ +int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map); + +#ifdef LTC_ECC_SHAMIR +/* kA*A + kB*B = C */ +int ltc_ecc_mul2add(const ecc_point *A, void *kA, + const ecc_point *B, void *kB, + ecc_point *C, + void *ma, + void *modulus); + +#ifdef LTC_MECC_FP +/* Shamir's trick with optimized point multiplication using fixed point cache */ +int ltc_ecc_fp_mul2add(const ecc_point *A, void *kA, + const ecc_point *B, void *kB, + ecc_point *C, + void *ma, + void *modulus); +#endif + +#endif + + +/* map P to affine from projective */ +int ltc_ecc_map(ecc_point *P, void *modulus, void *mp); +#endif /* LTC_MECC */ + +#ifdef LTC_MDSA +int dsa_int_validate_xy(const dsa_key *key, int *stat); +int dsa_int_validate_pqg(const dsa_key *key, int *stat); +int dsa_int_validate_primes(const dsa_key *key, int *stat); +#endif /* LTC_MDSA */ + +#ifdef LTC_DER +/* DER handling */ +int der_decode_custom_type_ex(const unsigned char *in, unsigned long inlen, + ltc_asn1_list *root, + ltc_asn1_list *list, unsigned long outlen, unsigned int flags); + +int der_encode_asn1_identifier(const ltc_asn1_list *id, unsigned char *out, unsigned long *outlen); +int der_decode_asn1_identifier(const unsigned char *in, unsigned long *inlen, ltc_asn1_list *id); +int der_length_asn1_identifier(const ltc_asn1_list *id, unsigned long *idlen); + +int der_encode_asn1_length(unsigned long len, unsigned char* out, unsigned long* outlen); +int der_decode_asn1_length(const unsigned char* len, unsigned long* lenlen, unsigned long* outlen); +int der_length_asn1_length(unsigned long len, unsigned long *outlen); + +int der_length_sequence_ex(const ltc_asn1_list *list, unsigned long inlen, + unsigned long *outlen, unsigned long *payloadlen); + +extern const ltc_asn1_type der_asn1_tag_to_type_map[]; +extern const unsigned long der_asn1_tag_to_type_map_sz; + +extern const int der_asn1_type_to_identifier_map[]; +extern const unsigned long der_asn1_type_to_identifier_map_sz; + +int der_decode_sequence_multi_ex(const unsigned char *in, unsigned long inlen, unsigned int flags, ...); + +int der_teletex_char_encode(int c); +int der_teletex_value_decode(int v); + +int der_utf8_valid_char(const wchar_t c); + +/* SUBJECT PUBLIC KEY INFO */ +int x509_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen, + unsigned int algorithm, const void* public_key, unsigned long public_key_len, + ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long parameters_len); + +int x509_decode_subject_public_key_info(const unsigned char *in, unsigned long inlen, + unsigned int algorithm, void* public_key, unsigned long* public_key_len, + ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long *parameters_len); + +#endif /* LTC_DER */ + +/* tomcrypt_prng.h */ + +#define _LTC_PRNG_EXPORT(which) \ +int which ## _export(unsigned char *out, unsigned long *outlen, prng_state *prng) \ +{ \ + unsigned long len = which ## _desc.export_size; \ + \ + LTC_ARGCHK(prng != NULL); \ + LTC_ARGCHK(out != NULL); \ + LTC_ARGCHK(outlen != NULL); \ + \ + if (*outlen < len) { \ + *outlen = len; \ + return CRYPT_BUFFER_OVERFLOW; \ + } \ + \ + if (which ## _read(out, len, prng) != len) { \ + return CRYPT_ERROR_READPRNG; \ + } \ + \ + *outlen = len; \ + return CRYPT_OK; \ +} + + +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/src/ltc/headers/tomcrypt_prng.h b/src/ltc/headers/tomcrypt_prng.h index 541f68e..8525313 100644 --- a/src/ltc/headers/tomcrypt_prng.h +++ b/src/ltc/headers/tomcrypt_prng.h @@ -13,16 +13,12 @@ int cipher, hash; unsigned char pool[MAXBLOCKSIZE]; symmetric_CTR ctr; - short ready; /* ready flag 0-1 */ - LTC_MUTEX_TYPE(lock) /* lock */ }; #endif #ifdef LTC_RC4 struct rc4_prng { rc4_state s; - short ready; /* ready flag 0-1 */ - LTC_MUTEX_TYPE(lock) /* lock */ }; #endif @@ -31,8 +27,6 @@ chacha_state s; /* chacha state */ unsigned char ent[40]; /* entropy buffer */ unsigned long idx; /* entropy counter */ - short ready; /* ready flag 0-1 */ - LTC_MUTEX_TYPE(lock) /* lock */ }; #endif @@ -46,12 +40,9 @@ IV[16]; /* IV for CTR mode */ unsigned long pool_idx, /* current pool we will add to */ - pool0_len, /* length of 0'th pool */ - wd; - + pool0_len; /* length of 0'th pool */ + ulong64 wd; ulong64 reset_cnt; /* number of times we have reseeded */ - short ready; /* ready flag 0-1 */ - LTC_MUTEX_TYPE(lock) /* lock */ }; #endif @@ -60,28 +51,30 @@ sober128_state s; /* sober128 state */ unsigned char ent[40]; /* entropy buffer */ unsigned long idx; /* entropy counter */ - short ready; /* ready flag 0-1 */ - LTC_MUTEX_TYPE(lock) /* lock */ -}; -#endif - -typedef union Prng_state { - char dummy[1]; +}; +#endif + +typedef struct { + union { + char dummy[1]; #ifdef LTC_YARROW - struct yarrow_prng yarrow; + struct yarrow_prng yarrow; #endif #ifdef LTC_RC4 - struct rc4_prng rc4; + struct rc4_prng rc4; #endif #ifdef LTC_CHACHA20_PRNG - struct chacha20_prng chacha; + struct chacha20_prng chacha; #endif #ifdef LTC_FORTUNA - struct fortuna_prng fortuna; + struct fortuna_prng fortuna; #endif #ifdef LTC_SOBER128 - struct sober128_prng sober128; -#endif + struct sober128_prng sober128; +#endif + } u; + short ready; /* ready flag 0-1 */ + LTC_MUTEX_TYPE(lock) /* lock */ } prng_state; /** PRNG descriptor */ @@ -220,31 +213,6 @@ int prng_is_valid(int idx); LTC_MUTEX_PROTO(ltc_prng_mutex) -#ifdef LTC_SOURCE -/* internal helper functions */ -#define _LTC_PRNG_EXPORT(which) \ -int which ## _export(unsigned char *out, unsigned long *outlen, prng_state *prng) \ -{ \ - unsigned long len = which ## _desc.export_size; \ - \ - LTC_ARGCHK(prng != NULL); \ - LTC_ARGCHK(out != NULL); \ - LTC_ARGCHK(outlen != NULL); \ - \ - if (*outlen < len) { \ - *outlen = len; \ - return CRYPT_BUFFER_OVERFLOW; \ - } \ - \ - if (which ## _read(out, len, prng) != len) { \ - return CRYPT_ERROR_READPRNG; \ - } \ - \ - *outlen = len; \ - return CRYPT_OK; \ -} -#endif - /* Slow RNG you **might** be able to use to seed a PRNG with. Be careful as this * might not work on all platforms as planned */ diff --git a/src/ltc/mac/blake2/blake2bmac.c b/src/ltc/mac/blake2/blake2bmac.c index 1c80b1c..fc20cd9 100644 --- a/src/ltc/mac/blake2/blake2bmac.c +++ b/src/ltc/mac/blake2/blake2bmac.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLAKE2BMAC diff --git a/src/ltc/mac/blake2/blake2bmac_file.c b/src/ltc/mac/blake2/blake2bmac_file.c index c1e9c6b..6d436a6 100644 --- a/src/ltc/mac/blake2/blake2bmac_file.c +++ b/src/ltc/mac/blake2/blake2bmac_file.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLAKE2BMAC diff --git a/src/ltc/mac/blake2/blake2bmac_memory.c b/src/ltc/mac/blake2/blake2bmac_memory.c index 45ddd6f..c0a09b7 100644 --- a/src/ltc/mac/blake2/blake2bmac_memory.c +++ b/src/ltc/mac/blake2/blake2bmac_memory.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLAKE2BMAC diff --git a/src/ltc/mac/blake2/blake2bmac_memory_multi.c b/src/ltc/mac/blake2/blake2bmac_memory_multi.c index 2b875d7..e135f6f 100644 --- a/src/ltc/mac/blake2/blake2bmac_memory_multi.c +++ b/src/ltc/mac/blake2/blake2bmac_memory_multi.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include #ifdef LTC_BLAKE2BMAC diff --git a/src/ltc/mac/blake2/blake2smac.c b/src/ltc/mac/blake2/blake2smac.c index 080241b..77ef17d 100644 --- a/src/ltc/mac/blake2/blake2smac.c +++ b/src/ltc/mac/blake2/blake2smac.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLAKE2SMAC diff --git a/src/ltc/mac/blake2/blake2smac_file.c b/src/ltc/mac/blake2/blake2smac_file.c index 1ac6679..9d31a18 100644 --- a/src/ltc/mac/blake2/blake2smac_file.c +++ b/src/ltc/mac/blake2/blake2smac_file.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLAKE2SMAC diff --git a/src/ltc/mac/blake2/blake2smac_memory.c b/src/ltc/mac/blake2/blake2smac_memory.c index 1661fb0..487a810 100644 --- a/src/ltc/mac/blake2/blake2smac_memory.c +++ b/src/ltc/mac/blake2/blake2smac_memory.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BLAKE2SMAC diff --git a/src/ltc/mac/blake2/blake2smac_memory_multi.c b/src/ltc/mac/blake2/blake2smac_memory_multi.c index 0985c42..2e96c75 100644 --- a/src/ltc/mac/blake2/blake2smac_memory_multi.c +++ b/src/ltc/mac/blake2/blake2smac_memory_multi.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include #ifdef LTC_BLAKE2SMAC diff --git a/src/ltc/mac/f9/f9_done.c b/src/ltc/mac/f9/f9_done.c index 8d2ccb0..b43daa8 100644 --- a/src/ltc/mac/f9/f9_done.c +++ b/src/ltc/mac/f9/f9_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file f9_done.c diff --git a/src/ltc/mac/f9/f9_file.c b/src/ltc/mac/f9/f9_file.c index 04d509b..f9969bb 100644 --- a/src/ltc/mac/f9/f9_file.c +++ b/src/ltc/mac/f9/f9_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file f9_file.c diff --git a/src/ltc/mac/f9/f9_init.c b/src/ltc/mac/f9/f9_init.c index ba59b20..cc41656 100644 --- a/src/ltc/mac/f9/f9_init.c +++ b/src/ltc/mac/f9/f9_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file f9_init.c diff --git a/src/ltc/mac/f9/f9_memory.c b/src/ltc/mac/f9/f9_memory.c index 70c694b..16d40ef 100644 --- a/src/ltc/mac/f9/f9_memory.c +++ b/src/ltc/mac/f9/f9_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file f9_process.c diff --git a/src/ltc/mac/f9/f9_memory_multi.c b/src/ltc/mac/f9/f9_memory_multi.c index 2c1d31a..580980c 100644 --- a/src/ltc/mac/f9/f9_memory_multi.c +++ b/src/ltc/mac/f9/f9_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include /** diff --git a/src/ltc/mac/f9/f9_process.c b/src/ltc/mac/f9/f9_process.c index ba4d39f..b945ef4 100644 --- a/src/ltc/mac/f9/f9_process.c +++ b/src/ltc/mac/f9/f9_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file f9_process.c diff --git a/src/ltc/mac/hmac/hmac_done.c b/src/ltc/mac/hmac/hmac_done.c index 3c09df1..58d3c49 100644 --- a/src/ltc/mac/hmac/hmac_done.c +++ b/src/ltc/mac/hmac/hmac_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file hmac_done.c diff --git a/src/ltc/mac/hmac/hmac_file.c b/src/ltc/mac/hmac/hmac_file.c index 0e1a163..0ea680b 100644 --- a/src/ltc/mac/hmac/hmac_file.c +++ b/src/ltc/mac/hmac/hmac_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file hmac_file.c diff --git a/src/ltc/mac/hmac/hmac_init.c b/src/ltc/mac/hmac/hmac_init.c index 16e58d5..fadc839 100644 --- a/src/ltc/mac/hmac/hmac_init.c +++ b/src/ltc/mac/hmac/hmac_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file hmac_init.c diff --git a/src/ltc/mac/hmac/hmac_memory.c b/src/ltc/mac/hmac/hmac_memory.c index 9a3a199..e4bfa87 100644 --- a/src/ltc/mac/hmac/hmac_memory.c +++ b/src/ltc/mac/hmac/hmac_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file hmac_memory.c diff --git a/src/ltc/mac/hmac/hmac_memory_multi.c b/src/ltc/mac/hmac/hmac_memory_multi.c index 6e3d0fe..8e3e401 100644 --- a/src/ltc/mac/hmac/hmac_memory_multi.c +++ b/src/ltc/mac/hmac/hmac_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include /** diff --git a/src/ltc/mac/hmac/hmac_process.c b/src/ltc/mac/hmac/hmac_process.c index 8da62c1..a8714de 100644 --- a/src/ltc/mac/hmac/hmac_process.c +++ b/src/ltc/mac/hmac/hmac_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file hmac_process.c diff --git a/src/ltc/mac/omac/omac_done.c b/src/ltc/mac/omac/omac_done.c index bf22523..338a4cc 100644 --- a/src/ltc/mac/omac/omac_done.c +++ b/src/ltc/mac/omac/omac_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file omac_done.c diff --git a/src/ltc/mac/omac/omac_file.c b/src/ltc/mac/omac/omac_file.c index 3f6a85d..11cc1b1 100644 --- a/src/ltc/mac/omac/omac_file.c +++ b/src/ltc/mac/omac/omac_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file omac_file.c diff --git a/src/ltc/mac/omac/omac_init.c b/src/ltc/mac/omac/omac_init.c index 55de2a6..70caee6 100644 --- a/src/ltc/mac/omac/omac_init.c +++ b/src/ltc/mac/omac/omac_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file omac_init.c diff --git a/src/ltc/mac/omac/omac_memory.c b/src/ltc/mac/omac/omac_memory.c index 1b57db8..5bbc95f 100644 --- a/src/ltc/mac/omac/omac_memory.c +++ b/src/ltc/mac/omac/omac_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file omac_memory.c diff --git a/src/ltc/mac/omac/omac_memory_multi.c b/src/ltc/mac/omac/omac_memory_multi.c index 50f26e6..c0922d6 100644 --- a/src/ltc/mac/omac/omac_memory_multi.c +++ b/src/ltc/mac/omac/omac_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include /** diff --git a/src/ltc/mac/omac/omac_process.c b/src/ltc/mac/omac/omac_process.c index 4ae2bd1..2024d3e 100644 --- a/src/ltc/mac/omac/omac_process.c +++ b/src/ltc/mac/omac/omac_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file omac_process.c diff --git a/src/ltc/mac/pelican/pelican.c b/src/ltc/mac/pelican/pelican.c index 6a4dde6..e8cea64 100644 --- a/src/ltc/mac/pelican/pelican.c +++ b/src/ltc/mac/pelican/pelican.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pelican.c diff --git a/src/ltc/mac/pelican/pelican_memory.c b/src/ltc/mac/pelican/pelican_memory.c index 08607a0..11ba07c 100644 --- a/src/ltc/mac/pelican/pelican_memory.c +++ b/src/ltc/mac/pelican/pelican_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pelican_memory.c diff --git a/src/ltc/mac/pmac/pmac_done.c b/src/ltc/mac/pmac/pmac_done.c index de7a5aa..18296e0 100644 --- a/src/ltc/mac/pmac/pmac_done.c +++ b/src/ltc/mac/pmac/pmac_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pmac_done.c diff --git a/src/ltc/mac/pmac/pmac_file.c b/src/ltc/mac/pmac/pmac_file.c index fe202a2..bdd7b82 100644 --- a/src/ltc/mac/pmac/pmac_file.c +++ b/src/ltc/mac/pmac/pmac_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pmac_file.c diff --git a/src/ltc/mac/pmac/pmac_init.c b/src/ltc/mac/pmac/pmac_init.c index b1bb400..15d433a 100644 --- a/src/ltc/mac/pmac/pmac_init.c +++ b/src/ltc/mac/pmac/pmac_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pmac_init.c diff --git a/src/ltc/mac/pmac/pmac_memory.c b/src/ltc/mac/pmac/pmac_memory.c index 7842781..77223d9 100644 --- a/src/ltc/mac/pmac/pmac_memory.c +++ b/src/ltc/mac/pmac/pmac_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pmac_memory.c diff --git a/src/ltc/mac/pmac/pmac_memory_multi.c b/src/ltc/mac/pmac/pmac_memory_multi.c index f3de4b5..19915a9 100644 --- a/src/ltc/mac/pmac/pmac_memory_multi.c +++ b/src/ltc/mac/pmac/pmac_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include /** diff --git a/src/ltc/mac/pmac/pmac_ntz.c b/src/ltc/mac/pmac/pmac_ntz.c index 2c7dec5..bb262f8 100644 --- a/src/ltc/mac/pmac/pmac_ntz.c +++ b/src/ltc/mac/pmac/pmac_ntz.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pmac_ntz.c diff --git a/src/ltc/mac/pmac/pmac_process.c b/src/ltc/mac/pmac/pmac_process.c index 018fa27..d12684b 100644 --- a/src/ltc/mac/pmac/pmac_process.c +++ b/src/ltc/mac/pmac/pmac_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pmac_process.c diff --git a/src/ltc/mac/pmac/pmac_shift_xor.c b/src/ltc/mac/pmac/pmac_shift_xor.c index 49d48f9..8895d97 100644 --- a/src/ltc/mac/pmac/pmac_shift_xor.c +++ b/src/ltc/mac/pmac/pmac_shift_xor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pmac_shift_xor.c diff --git a/src/ltc/mac/poly1305/poly1305.c b/src/ltc/mac/poly1305/poly1305.c index f709f72..1cd7a0a 100644 --- a/src/ltc/mac/poly1305/poly1305.c +++ b/src/ltc/mac/poly1305/poly1305.c @@ -12,7 +12,7 @@ * https://github.com/floodyberry/poly1305-donna */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_POLY1305 diff --git a/src/ltc/mac/poly1305/poly1305_file.c b/src/ltc/mac/poly1305/poly1305_file.c index e57437b..946d399 100644 --- a/src/ltc/mac/poly1305/poly1305_file.c +++ b/src/ltc/mac/poly1305/poly1305_file.c @@ -12,7 +12,7 @@ * https://github.com/floodyberry/poly1305-donna */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_POLY1305 diff --git a/src/ltc/mac/poly1305/poly1305_memory.c b/src/ltc/mac/poly1305/poly1305_memory.c index a827f8d..e9d2ff2 100644 --- a/src/ltc/mac/poly1305/poly1305_memory.c +++ b/src/ltc/mac/poly1305/poly1305_memory.c @@ -12,7 +12,7 @@ * https://github.com/floodyberry/poly1305-donna */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_POLY1305 diff --git a/src/ltc/mac/poly1305/poly1305_memory_multi.c b/src/ltc/mac/poly1305/poly1305_memory_multi.c index f22f255..952bd6c 100644 --- a/src/ltc/mac/poly1305/poly1305_memory_multi.c +++ b/src/ltc/mac/poly1305/poly1305_memory_multi.c @@ -12,7 +12,7 @@ * https://github.com/floodyberry/poly1305-donna */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include #ifdef LTC_POLY1305 diff --git a/src/ltc/mac/xcbc/xcbc_done.c b/src/ltc/mac/xcbc/xcbc_done.c index 133d16f..0ae96c1 100644 --- a/src/ltc/mac/xcbc/xcbc_done.c +++ b/src/ltc/mac/xcbc/xcbc_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file xcbc_done.c diff --git a/src/ltc/mac/xcbc/xcbc_file.c b/src/ltc/mac/xcbc/xcbc_file.c index 27eb0de..bfd5d3e 100644 --- a/src/ltc/mac/xcbc/xcbc_file.c +++ b/src/ltc/mac/xcbc/xcbc_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file xcbc_file.c diff --git a/src/ltc/mac/xcbc/xcbc_init.c b/src/ltc/mac/xcbc/xcbc_init.c index 4eccd5e..0d80c27 100644 --- a/src/ltc/mac/xcbc/xcbc_init.c +++ b/src/ltc/mac/xcbc/xcbc_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file xcbc_init.c diff --git a/src/ltc/mac/xcbc/xcbc_memory.c b/src/ltc/mac/xcbc/xcbc_memory.c index a1bc045..65f558f 100644 --- a/src/ltc/mac/xcbc/xcbc_memory.c +++ b/src/ltc/mac/xcbc/xcbc_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file xcbc_process.c diff --git a/src/ltc/mac/xcbc/xcbc_memory_multi.c b/src/ltc/mac/xcbc/xcbc_memory_multi.c index a5b9d91..db1b8c4 100644 --- a/src/ltc/mac/xcbc/xcbc_memory_multi.c +++ b/src/ltc/mac/xcbc/xcbc_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include /** diff --git a/src/ltc/mac/xcbc/xcbc_process.c b/src/ltc/mac/xcbc/xcbc_process.c index 12e25c5..1407a1c 100644 --- a/src/ltc/mac/xcbc/xcbc_process.c +++ b/src/ltc/mac/xcbc/xcbc_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file xcbc_process.c diff --git a/src/ltc/math/fp/ltc_ecc_fp_mulmod.c b/src/ltc/math/fp/ltc_ecc_fp_mulmod.c index eed4483..757488b 100644 --- a/src/ltc/math/fp/ltc_ecc_fp_mulmod.c +++ b/src/ltc/math/fp/ltc_ecc_fp_mulmod.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ltc_ecc_fp_mulmod.c diff --git a/src/ltc/math/ltm_desc.c b/src/ltc/math/ltm_desc.c index 4749657..0ee7958 100644 --- a/src/ltc/math/ltm_desc.c +++ b/src/ltc/math/ltm_desc.c @@ -8,7 +8,7 @@ */ #define DESC_DEF_ONLY -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTM_DESC diff --git a/src/ltc/math/multi.c b/src/ltc/math/multi.c index cfe1451..4b3178f 100644 --- a/src/ltc/math/multi.c +++ b/src/ltc/math/multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MPI #include diff --git a/src/ltc/math/radix_to_bin.c b/src/ltc/math/radix_to_bin.c index 409bd20..83eda81 100644 --- a/src/ltc/math/radix_to_bin.c +++ b/src/ltc/math/radix_to_bin.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file radix_to_bin.c diff --git a/src/ltc/math/rand_bn.c b/src/ltc/math/rand_bn.c index aa6539c..9c87336 100644 --- a/src/ltc/math/rand_bn.c +++ b/src/ltc/math/rand_bn.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #if defined(LTC_MDSA) || defined(LTC_MECC) /** diff --git a/src/ltc/math/rand_prime.c b/src/ltc/math/rand_prime.c index 4dd5764..97c82c7 100644 --- a/src/ltc/math/rand_prime.c +++ b/src/ltc/math/rand_prime.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #if defined(LTC_MRSA) || (!defined(LTC_NO_MATH) && !defined(LTC_NO_PRNGS)) diff --git a/src/ltc/math/tfm_desc.c b/src/ltc/math/tfm_desc.c index 81f14b8..e42d246 100644 --- a/src/ltc/math/tfm_desc.c +++ b/src/ltc/math/tfm_desc.c @@ -8,7 +8,7 @@ */ #define DESC_DEF_ONLY -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef TFM_DESC diff --git a/src/ltc/misc/adler32.c b/src/ltc/misc/adler32.c index 49ce7d7..c1d7c86 100644 --- a/src/ltc/misc/adler32.c +++ b/src/ltc/misc/adler32.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file adler32.c diff --git a/src/ltc/misc/base16/base16_decode.c b/src/ltc/misc/base16/base16_decode.c index 6738285..d02b9e2 100644 --- a/src/ltc/misc/base16/base16_decode.c +++ b/src/ltc/misc/base16/base16_decode.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file base16_decode.c @@ -21,6 +21,7 @@ /** Base16 decode a string @param in The Base16 string to decode + @param inlen The length of the Base16 data @param out [out] The destination of the binary decoded data @param outlen [in/out] The max size and resulting size of the decoded data @return CRYPT_OK if successful diff --git a/src/ltc/misc/base16/base16_encode.c b/src/ltc/misc/base16/base16_encode.c index 428002a..f052fd1 100644 --- a/src/ltc/misc/base16/base16_encode.c +++ b/src/ltc/misc/base16/base16_encode.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file base16_encode.c @@ -22,12 +22,12 @@ @param inlen The length of the input buffer @param out [out] The destination of the Base16 encoded data @param outlen [in/out] The max size and resulting size of the encoded data - @param caps Output 'a-f' on 0 and 'A-F' otherwise. + @param options Output 'a-f' on 0 and 'A-F' otherwise. @return CRYPT_OK if successful */ int base16_encode(const unsigned char *in, unsigned long inlen, char *out, unsigned long *outlen, - int caps) + unsigned int options) { unsigned long i, x; const char *alphabet; @@ -52,7 +52,7 @@ x--; *outlen = x; /* returning the length without terminating NUL */ - if (caps == 0) alphabet = alphabets[0]; + if (options == 0) alphabet = alphabets[0]; else alphabet = alphabets[1]; for (i = 0; i < x; i += 2) { diff --git a/src/ltc/misc/base32/base32_decode.c b/src/ltc/misc/base32/base32_decode.c index 5809553..91db6ee 100644 --- a/src/ltc/misc/base32/base32_decode.c +++ b/src/ltc/misc/base32/base32_decode.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BASE32 diff --git a/src/ltc/misc/base32/base32_encode.c b/src/ltc/misc/base32/base32_encode.c index 81fa97a..9e40745 100644 --- a/src/ltc/misc/base32/base32_encode.c +++ b/src/ltc/misc/base32/base32_encode.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_BASE32 diff --git a/src/ltc/misc/base64/base64_decode.c b/src/ltc/misc/base64/base64_decode.c index 6af4eb5..7506d50 100644 --- a/src/ltc/misc/base64/base64_decode.c +++ b/src/ltc/misc/base64/base64_decode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file base64_decode.c diff --git a/src/ltc/misc/base64/base64_encode.c b/src/ltc/misc/base64/base64_encode.c index 788c9d5..a6b7b9b 100644 --- a/src/ltc/misc/base64/base64_encode.c +++ b/src/ltc/misc/base64/base64_encode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file base64_encode.c diff --git a/src/ltc/misc/burn_stack.c b/src/ltc/misc/burn_stack.c index afbafee..b79f540 100644 --- a/src/ltc/misc/burn_stack.c +++ b/src/ltc/misc/burn_stack.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file burn_stack.c diff --git a/src/ltc/misc/compare_testvector.c b/src/ltc/misc/compare_testvector.c index 74cebcc..842678a 100644 --- a/src/ltc/misc/compare_testvector.c +++ b/src/ltc/misc/compare_testvector.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file compare_testvector.c diff --git a/src/ltc/misc/copy_or_zeromem.c b/src/ltc/misc/copy_or_zeromem.c index 237f712..1cfd2bd 100644 --- a/src/ltc/misc/copy_or_zeromem.c +++ b/src/ltc/misc/copy_or_zeromem.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file copy_or_zeromem.c diff --git a/src/ltc/misc/crc32.c b/src/ltc/misc/crc32.c index a1bdc8e..5c49f42 100644 --- a/src/ltc/misc/crc32.c +++ b/src/ltc/misc/crc32.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crc32.c diff --git a/src/ltc/misc/crypt/crypt.c b/src/ltc/misc/crypt/crypt.c index d8eaa73..1f76662 100644 --- a/src/ltc/misc/crypt/crypt.c +++ b/src/ltc/misc/crypt/crypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt.c @@ -135,6 +135,9 @@ #if defined(LTC_SALSA20) " Salsa20\n" #endif +#if defined(LTC_XSALSA20) + " XSalsa20\n" +#endif #if defined(LTC_SOSEMANUK) " Sosemanuk\n" #endif @@ -350,9 +353,6 @@ #if defined(LTC_MDSA) " DSA\n" #endif -#if defined(LTC_MKAT) - " Katja\n" -#endif #if defined(LTC_PK_MAX_RETRIES) " "NAME_VALUE(LTC_PK_MAX_RETRIES)"\n" #endif @@ -515,10 +515,13 @@ " LTC_MECC_ACCEL " #endif #if defined(LTC_MECC_FP) - " LTC_MECC_FP " + " LTC_MECC_FP " #endif #if defined(LTC_ECC_SHAMIR) - " LTC_ECC_SHAMIR " + " LTC_ECC_SHAMIR " +#endif +#if defined(LTC_CLOCK_GETTIME) + " LTC_CLOCK_GETTIME " #endif "\n" ; diff --git a/src/ltc/misc/crypt/crypt_argchk.c b/src/ltc/misc/crypt/crypt_argchk.c index da7306b..479c6a4 100644 --- a/src/ltc/misc/crypt/crypt_argchk.c +++ b/src/ltc/misc/crypt/crypt_argchk.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_argchk.c diff --git a/src/ltc/misc/crypt/crypt_cipher_descriptor.c b/src/ltc/misc/crypt/crypt_cipher_descriptor.c index ccc9890..77411e6 100644 --- a/src/ltc/misc/crypt/crypt_cipher_descriptor.c +++ b/src/ltc/misc/crypt/crypt_cipher_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_cipher_descriptor.c diff --git a/src/ltc/misc/crypt/crypt_cipher_is_valid.c b/src/ltc/misc/crypt/crypt_cipher_is_valid.c index aebc94c..4490243 100644 --- a/src/ltc/misc/crypt/crypt_cipher_is_valid.c +++ b/src/ltc/misc/crypt/crypt_cipher_is_valid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_cipher_is_valid.c diff --git a/src/ltc/misc/crypt/crypt_constants.c b/src/ltc/misc/crypt/crypt_constants.c index 902b774..df8ab2d 100644 --- a/src/ltc/misc/crypt/crypt_constants.c +++ b/src/ltc/misc/crypt/crypt_constants.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_constants.c @@ -96,14 +96,6 @@ {"LTC_MRSA", 0}, #endif -#ifdef LTC_MKAT - {"LTC_MKAT", 1}, - _C_STRINGIFY(MIN_KAT_SIZE), - _C_STRINGIFY(MAX_KAT_SIZE), -#else - {"LTC_MKAT", 0}, -#endif - #ifdef LTC_MECC {"LTC_MECC", 1}, _C_STRINGIFY(ECC_BUF_SIZE), diff --git a/src/ltc/misc/crypt/crypt_find_cipher.c b/src/ltc/misc/crypt/crypt_find_cipher.c index ba908f4..a6a9d45 100644 --- a/src/ltc/misc/crypt/crypt_find_cipher.c +++ b/src/ltc/misc/crypt/crypt_find_cipher.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_find_cipher.c diff --git a/src/ltc/misc/crypt/crypt_find_cipher_any.c b/src/ltc/misc/crypt/crypt_find_cipher_any.c index 5cdcdf8..93b5039 100644 --- a/src/ltc/misc/crypt/crypt_find_cipher_any.c +++ b/src/ltc/misc/crypt/crypt_find_cipher_any.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_find_cipher_any.c diff --git a/src/ltc/misc/crypt/crypt_find_cipher_id.c b/src/ltc/misc/crypt/crypt_find_cipher_id.c index 34d0049..62b3266 100644 --- a/src/ltc/misc/crypt/crypt_find_cipher_id.c +++ b/src/ltc/misc/crypt/crypt_find_cipher_id.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_find_cipher_id.c diff --git a/src/ltc/misc/crypt/crypt_find_hash.c b/src/ltc/misc/crypt/crypt_find_hash.c index 19ee55c..f418c27 100644 --- a/src/ltc/misc/crypt/crypt_find_hash.c +++ b/src/ltc/misc/crypt/crypt_find_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_find_hash.c diff --git a/src/ltc/misc/crypt/crypt_find_hash_any.c b/src/ltc/misc/crypt/crypt_find_hash_any.c index 413809f..a50f915 100644 --- a/src/ltc/misc/crypt/crypt_find_hash_any.c +++ b/src/ltc/misc/crypt/crypt_find_hash_any.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_find_hash_any.c diff --git a/src/ltc/misc/crypt/crypt_find_hash_id.c b/src/ltc/misc/crypt/crypt_find_hash_id.c index ea784e8..f8c2e79 100644 --- a/src/ltc/misc/crypt/crypt_find_hash_id.c +++ b/src/ltc/misc/crypt/crypt_find_hash_id.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_find_hash_id.c diff --git a/src/ltc/misc/crypt/crypt_find_hash_oid.c b/src/ltc/misc/crypt/crypt_find_hash_oid.c index 026cc73..797e9ca 100644 --- a/src/ltc/misc/crypt/crypt_find_hash_oid.c +++ b/src/ltc/misc/crypt/crypt_find_hash_oid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_find_hash_oid.c diff --git a/src/ltc/misc/crypt/crypt_find_prng.c b/src/ltc/misc/crypt/crypt_find_prng.c index a0cad16..8b7e0dc 100644 --- a/src/ltc/misc/crypt/crypt_find_prng.c +++ b/src/ltc/misc/crypt/crypt_find_prng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_find_prng.c diff --git a/src/ltc/misc/crypt/crypt_fsa.c b/src/ltc/misc/crypt/crypt_fsa.c index dc2a570..827b94d 100644 --- a/src/ltc/misc/crypt/crypt_fsa.c +++ b/src/ltc/misc/crypt/crypt_fsa.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include /** diff --git a/src/ltc/misc/crypt/crypt_hash_descriptor.c b/src/ltc/misc/crypt/crypt_hash_descriptor.c index 6e1103f..7308003 100644 --- a/src/ltc/misc/crypt/crypt_hash_descriptor.c +++ b/src/ltc/misc/crypt/crypt_hash_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_hash_descriptor.c diff --git a/src/ltc/misc/crypt/crypt_hash_is_valid.c b/src/ltc/misc/crypt/crypt_hash_is_valid.c index ca75f05..956c817 100644 --- a/src/ltc/misc/crypt/crypt_hash_is_valid.c +++ b/src/ltc/misc/crypt/crypt_hash_is_valid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_hash_is_valid.c diff --git a/src/ltc/misc/crypt/crypt_inits.c b/src/ltc/misc/crypt/crypt_inits.c index 871417c..407b7c8 100644 --- a/src/ltc/misc/crypt/crypt_inits.c +++ b/src/ltc/misc/crypt/crypt_inits.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_inits.c diff --git a/src/ltc/misc/crypt/crypt_ltc_mp_descriptor.c b/src/ltc/misc/crypt/crypt_ltc_mp_descriptor.c index 0f1407c..2b9382d 100644 --- a/src/ltc/misc/crypt/crypt_ltc_mp_descriptor.c +++ b/src/ltc/misc/crypt/crypt_ltc_mp_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /* Initialize ltc_mp to nulls, to force allocation on all platforms, including macOS. */ ltc_math_descriptor ltc_mp = { 0 }; diff --git a/src/ltc/misc/crypt/crypt_prng_descriptor.c b/src/ltc/misc/crypt/crypt_prng_descriptor.c index 276047c..9f35c7d 100644 --- a/src/ltc/misc/crypt/crypt_prng_descriptor.c +++ b/src/ltc/misc/crypt/crypt_prng_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_prng_descriptor.c diff --git a/src/ltc/misc/crypt/crypt_prng_is_valid.c b/src/ltc/misc/crypt/crypt_prng_is_valid.c index 9930a06..e6f4936 100644 --- a/src/ltc/misc/crypt/crypt_prng_is_valid.c +++ b/src/ltc/misc/crypt/crypt_prng_is_valid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_prng_is_valid.c diff --git a/src/ltc/misc/crypt/crypt_prng_rng_descriptor.c b/src/ltc/misc/crypt/crypt_prng_rng_descriptor.c index 1a79337..bdaf8b2 100644 --- a/src/ltc/misc/crypt/crypt_prng_rng_descriptor.c +++ b/src/ltc/misc/crypt/crypt_prng_rng_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_PRNG_ENABLE_LTC_RNG unsigned long (*ltc_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void)); diff --git a/src/ltc/misc/crypt/crypt_register_all_ciphers.c b/src/ltc/misc/crypt/crypt_register_all_ciphers.c index 8d1c939..d2512e0 100644 --- a/src/ltc/misc/crypt/crypt_register_all_ciphers.c +++ b/src/ltc/misc/crypt/crypt_register_all_ciphers.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_register_all_ciphers.c diff --git a/src/ltc/misc/crypt/crypt_register_all_hashes.c b/src/ltc/misc/crypt/crypt_register_all_hashes.c index 585b9b6..a16a403 100644 --- a/src/ltc/misc/crypt/crypt_register_all_hashes.c +++ b/src/ltc/misc/crypt/crypt_register_all_hashes.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_register_all_hashes.c diff --git a/src/ltc/misc/crypt/crypt_register_all_prngs.c b/src/ltc/misc/crypt/crypt_register_all_prngs.c index aca8a36..46cdfc9 100644 --- a/src/ltc/misc/crypt/crypt_register_all_prngs.c +++ b/src/ltc/misc/crypt/crypt_register_all_prngs.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_register_all_prngs.c diff --git a/src/ltc/misc/crypt/crypt_register_cipher.c b/src/ltc/misc/crypt/crypt_register_cipher.c index 85178d2..1dc85dd 100644 --- a/src/ltc/misc/crypt/crypt_register_cipher.c +++ b/src/ltc/misc/crypt/crypt_register_cipher.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_register_cipher.c diff --git a/src/ltc/misc/crypt/crypt_register_hash.c b/src/ltc/misc/crypt/crypt_register_hash.c index fc7f4e0..5b4c599 100644 --- a/src/ltc/misc/crypt/crypt_register_hash.c +++ b/src/ltc/misc/crypt/crypt_register_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_register_hash.c diff --git a/src/ltc/misc/crypt/crypt_register_prng.c b/src/ltc/misc/crypt/crypt_register_prng.c index 9cbd634..d58501c 100644 --- a/src/ltc/misc/crypt/crypt_register_prng.c +++ b/src/ltc/misc/crypt/crypt_register_prng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_register_prng.c diff --git a/src/ltc/misc/crypt/crypt_sizes.c b/src/ltc/misc/crypt/crypt_sizes.c index af70061..1727414 100644 --- a/src/ltc/misc/crypt/crypt_sizes.c +++ b/src/ltc/misc/crypt/crypt_sizes.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_sizes.c @@ -248,9 +248,6 @@ _SZ_STRINGIFY_T(ltc_ecc_curve), _SZ_STRINGIFY_T(ecc_point), _SZ_STRINGIFY_T(ecc_key), -#endif -#ifdef LTC_MKAT - _SZ_STRINGIFY_T(katja_key), #endif /* DER handling */ diff --git a/src/ltc/misc/crypt/crypt_unregister_cipher.c b/src/ltc/misc/crypt/crypt_unregister_cipher.c index b57c736..b7f713f 100644 --- a/src/ltc/misc/crypt/crypt_unregister_cipher.c +++ b/src/ltc/misc/crypt/crypt_unregister_cipher.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_unregister_cipher.c diff --git a/src/ltc/misc/crypt/crypt_unregister_hash.c b/src/ltc/misc/crypt/crypt_unregister_hash.c index dbbff33..dee46ca 100644 --- a/src/ltc/misc/crypt/crypt_unregister_hash.c +++ b/src/ltc/misc/crypt/crypt_unregister_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_unregister_hash.c diff --git a/src/ltc/misc/crypt/crypt_unregister_prng.c b/src/ltc/misc/crypt/crypt_unregister_prng.c index f7606ef..f784b4c 100644 --- a/src/ltc/misc/crypt/crypt_unregister_prng.c +++ b/src/ltc/misc/crypt/crypt_unregister_prng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file crypt_unregister_prng.c diff --git a/src/ltc/misc/error_to_string.c b/src/ltc/misc/error_to_string.c index 3d16828..64e5e6d 100644 --- a/src/ltc/misc/error_to_string.c +++ b/src/ltc/misc/error_to_string.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file error_to_string.c diff --git a/src/ltc/misc/hkdf/hkdf.c b/src/ltc/misc/hkdf/hkdf.c index 0db4ed9..1ca3ae3 100644 --- a/src/ltc/misc/hkdf/hkdf.c +++ b/src/ltc/misc/hkdf/hkdf.c @@ -11,7 +11,7 @@ #include #include -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_HKDF diff --git a/src/ltc/misc/mem_neq.c b/src/ltc/misc/mem_neq.c index fbd0cce..8bcc6e3 100644 --- a/src/ltc/misc/mem_neq.c +++ b/src/ltc/misc/mem_neq.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file mem_neq.c diff --git a/src/ltc/misc/padding/padding_depad.c b/src/ltc/misc/padding/padding_depad.c index 8060358..e02077f 100644 --- a/src/ltc/misc/padding/padding_depad.c +++ b/src/ltc/misc/padding/padding_depad.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_PADDING diff --git a/src/ltc/misc/padding/padding_pad.c b/src/ltc/misc/padding/padding_pad.c index 653e31d..ae1a8ae 100644 --- a/src/ltc/misc/padding/padding_pad.c +++ b/src/ltc/misc/padding/padding_pad.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_PADDING diff --git a/src/ltc/misc/pk_get_oid.c b/src/ltc/misc/pk_get_oid.c index 003925a..35e35d6 100644 --- a/src/ltc/misc/pk_get_oid.c +++ b/src/ltc/misc/pk_get_oid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_DER static const oid_st rsa_oid = { diff --git a/src/ltc/misc/pk_oid_str.c b/src/ltc/misc/pk_oid_str.c index 84a47e1..ef83fb1 100644 --- a/src/ltc/misc/pk_oid_str.c +++ b/src/ltc/misc/pk_oid_str.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" int pk_oid_str_to_num(const char *OID, unsigned long *oid, unsigned long *oidlen) { diff --git a/src/ltc/misc/pkcs5/pkcs_5_1.c b/src/ltc/misc/pkcs5/pkcs_5_1.c index 10325de..0794698 100644 --- a/src/ltc/misc/pkcs5/pkcs_5_1.c +++ b/src/ltc/misc/pkcs5/pkcs_5_1.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_5_1.c diff --git a/src/ltc/misc/pkcs5/pkcs_5_2.c b/src/ltc/misc/pkcs5/pkcs_5_2.c index 2265bcb..8d45a0e 100644 --- a/src/ltc/misc/pkcs5/pkcs_5_2.c +++ b/src/ltc/misc/pkcs5/pkcs_5_2.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_5_2.c diff --git a/src/ltc/misc/zeromem.c b/src/ltc/misc/zeromem.c index 1a3b8ed..d5312d0 100644 --- a/src/ltc/misc/zeromem.c +++ b/src/ltc/misc/zeromem.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file zeromem.c diff --git a/src/ltc/modes/cbc/cbc_decrypt.c b/src/ltc/modes/cbc/cbc_decrypt.c index e9f2785..9cbf6f3 100644 --- a/src/ltc/modes/cbc/cbc_decrypt.c +++ b/src/ltc/modes/cbc/cbc_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cbc_decrypt.c diff --git a/src/ltc/modes/cbc/cbc_done.c b/src/ltc/modes/cbc/cbc_done.c index 2f1293d..da624da 100644 --- a/src/ltc/modes/cbc/cbc_done.c +++ b/src/ltc/modes/cbc/cbc_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cbc_done.c diff --git a/src/ltc/modes/cbc/cbc_encrypt.c b/src/ltc/modes/cbc/cbc_encrypt.c index 00d85fc..6ba9a0c 100644 --- a/src/ltc/modes/cbc/cbc_encrypt.c +++ b/src/ltc/modes/cbc/cbc_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cbc_encrypt.c diff --git a/src/ltc/modes/cbc/cbc_getiv.c b/src/ltc/modes/cbc/cbc_getiv.c index c3e3bd1..7fd4450 100644 --- a/src/ltc/modes/cbc/cbc_getiv.c +++ b/src/ltc/modes/cbc/cbc_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cbc_getiv.c diff --git a/src/ltc/modes/cbc/cbc_setiv.c b/src/ltc/modes/cbc/cbc_setiv.c index 255d641..2952d1b 100644 --- a/src/ltc/modes/cbc/cbc_setiv.c +++ b/src/ltc/modes/cbc/cbc_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cbc_setiv.c diff --git a/src/ltc/modes/cbc/cbc_start.c b/src/ltc/modes/cbc/cbc_start.c index 6c5c52c..5e51b17 100644 --- a/src/ltc/modes/cbc/cbc_start.c +++ b/src/ltc/modes/cbc/cbc_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cbc_start.c diff --git a/src/ltc/modes/cfb/cfb_decrypt.c b/src/ltc/modes/cfb/cfb_decrypt.c index 9749a0b..46c8f95 100644 --- a/src/ltc/modes/cfb/cfb_decrypt.c +++ b/src/ltc/modes/cfb/cfb_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cfb_decrypt.c diff --git a/src/ltc/modes/cfb/cfb_done.c b/src/ltc/modes/cfb/cfb_done.c index 24576c8..fecf912 100644 --- a/src/ltc/modes/cfb/cfb_done.c +++ b/src/ltc/modes/cfb/cfb_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cfb_done.c diff --git a/src/ltc/modes/cfb/cfb_encrypt.c b/src/ltc/modes/cfb/cfb_encrypt.c index 4503e5b..eaefd32 100644 --- a/src/ltc/modes/cfb/cfb_encrypt.c +++ b/src/ltc/modes/cfb/cfb_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cfb_encrypt.c diff --git a/src/ltc/modes/cfb/cfb_getiv.c b/src/ltc/modes/cfb/cfb_getiv.c index 8efc7c6..5bfefbe 100644 --- a/src/ltc/modes/cfb/cfb_getiv.c +++ b/src/ltc/modes/cfb/cfb_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cfb_getiv.c diff --git a/src/ltc/modes/cfb/cfb_setiv.c b/src/ltc/modes/cfb/cfb_setiv.c index 4495bf5..b1801e1 100644 --- a/src/ltc/modes/cfb/cfb_setiv.c +++ b/src/ltc/modes/cfb/cfb_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cfb_setiv.c diff --git a/src/ltc/modes/cfb/cfb_start.c b/src/ltc/modes/cfb/cfb_start.c index e49b119..caccb5a 100644 --- a/src/ltc/modes/cfb/cfb_start.c +++ b/src/ltc/modes/cfb/cfb_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file cfb_start.c diff --git a/src/ltc/modes/ctr/ctr_decrypt.c b/src/ltc/modes/ctr/ctr_decrypt.c index 5008089..16d7593 100644 --- a/src/ltc/modes/ctr/ctr_decrypt.c +++ b/src/ltc/modes/ctr/ctr_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ctr_decrypt.c diff --git a/src/ltc/modes/ctr/ctr_done.c b/src/ltc/modes/ctr/ctr_done.c index 3de13c2..55e3492 100644 --- a/src/ltc/modes/ctr/ctr_done.c +++ b/src/ltc/modes/ctr/ctr_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ctr_done.c diff --git a/src/ltc/modes/ctr/ctr_encrypt.c b/src/ltc/modes/ctr/ctr_encrypt.c index eb7328c..a5c0939 100644 --- a/src/ltc/modes/ctr/ctr_encrypt.c +++ b/src/ltc/modes/ctr/ctr_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ctr_encrypt.c diff --git a/src/ltc/modes/ctr/ctr_getiv.c b/src/ltc/modes/ctr/ctr_getiv.c index 1d950de..c822ef8 100644 --- a/src/ltc/modes/ctr/ctr_getiv.c +++ b/src/ltc/modes/ctr/ctr_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ctr_getiv.c diff --git a/src/ltc/modes/ctr/ctr_setiv.c b/src/ltc/modes/ctr/ctr_setiv.c index 64d73a1..81b9c22 100644 --- a/src/ltc/modes/ctr/ctr_setiv.c +++ b/src/ltc/modes/ctr/ctr_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ctr_setiv.c diff --git a/src/ltc/modes/ctr/ctr_start.c b/src/ltc/modes/ctr/ctr_start.c index 039fdd6..3ef3ade 100644 --- a/src/ltc/modes/ctr/ctr_start.c +++ b/src/ltc/modes/ctr/ctr_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ctr_start.c diff --git a/src/ltc/modes/ecb/ecb_decrypt.c b/src/ltc/modes/ecb/ecb_decrypt.c index 213b253..b8727d2 100644 --- a/src/ltc/modes/ecb/ecb_decrypt.c +++ b/src/ltc/modes/ecb/ecb_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecb_decrypt.c diff --git a/src/ltc/modes/ecb/ecb_done.c b/src/ltc/modes/ecb/ecb_done.c index 6df7eec..1a441b4 100644 --- a/src/ltc/modes/ecb/ecb_done.c +++ b/src/ltc/modes/ecb/ecb_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecb_done.c diff --git a/src/ltc/modes/ecb/ecb_encrypt.c b/src/ltc/modes/ecb/ecb_encrypt.c index 5d4661f..d31635b 100644 --- a/src/ltc/modes/ecb/ecb_encrypt.c +++ b/src/ltc/modes/ecb/ecb_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecb_encrypt.c diff --git a/src/ltc/modes/ecb/ecb_start.c b/src/ltc/modes/ecb/ecb_start.c index ecd301b..fd25d31 100644 --- a/src/ltc/modes/ecb/ecb_start.c +++ b/src/ltc/modes/ecb/ecb_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecb_start.c diff --git a/src/ltc/modes/ofb/ofb_decrypt.c b/src/ltc/modes/ofb/ofb_decrypt.c index f402802..37afc1c 100644 --- a/src/ltc/modes/ofb/ofb_decrypt.c +++ b/src/ltc/modes/ofb/ofb_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ofb_decrypt.c diff --git a/src/ltc/modes/ofb/ofb_done.c b/src/ltc/modes/ofb/ofb_done.c index 9caddbe..53937b4 100644 --- a/src/ltc/modes/ofb/ofb_done.c +++ b/src/ltc/modes/ofb/ofb_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ofb_done.c diff --git a/src/ltc/modes/ofb/ofb_encrypt.c b/src/ltc/modes/ofb/ofb_encrypt.c index 415842d..f23c168 100644 --- a/src/ltc/modes/ofb/ofb_encrypt.c +++ b/src/ltc/modes/ofb/ofb_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ofb_encrypt.c diff --git a/src/ltc/modes/ofb/ofb_getiv.c b/src/ltc/modes/ofb/ofb_getiv.c index bfa4eb2..9525cb8 100644 --- a/src/ltc/modes/ofb/ofb_getiv.c +++ b/src/ltc/modes/ofb/ofb_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ofb_getiv.c diff --git a/src/ltc/modes/ofb/ofb_setiv.c b/src/ltc/modes/ofb/ofb_setiv.c index 005dbc7..e8e7c15 100644 --- a/src/ltc/modes/ofb/ofb_setiv.c +++ b/src/ltc/modes/ofb/ofb_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ofb_setiv.c diff --git a/src/ltc/modes/ofb/ofb_start.c b/src/ltc/modes/ofb/ofb_start.c index fe7a764..2a19e6b 100644 --- a/src/ltc/modes/ofb/ofb_start.c +++ b/src/ltc/modes/ofb/ofb_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ofb_start.c diff --git a/src/ltc/pk/asn1/der/bit/der_decode_bit_string.c b/src/ltc/pk/asn1/der/bit/der_decode_bit_string.c index 6f25cd9..42b3523 100644 --- a/src/ltc/pk/asn1/der/bit/der_decode_bit_string.c +++ b/src/ltc/pk/asn1/der/bit/der_decode_bit_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_bit_string.c diff --git a/src/ltc/pk/asn1/der/bit/der_decode_raw_bit_string.c b/src/ltc/pk/asn1/der/bit/der_decode_raw_bit_string.c index 7e7a460..ed6440e 100644 --- a/src/ltc/pk/asn1/der/bit/der_decode_raw_bit_string.c +++ b/src/ltc/pk/asn1/der/bit/der_decode_raw_bit_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_bit_string.c diff --git a/src/ltc/pk/asn1/der/bit/der_encode_bit_string.c b/src/ltc/pk/asn1/der/bit/der_encode_bit_string.c index 7b2c6af..5621733 100644 --- a/src/ltc/pk/asn1/der/bit/der_encode_bit_string.c +++ b/src/ltc/pk/asn1/der/bit/der_encode_bit_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_bit_string.c diff --git a/src/ltc/pk/asn1/der/bit/der_encode_raw_bit_string.c b/src/ltc/pk/asn1/der/bit/der_encode_raw_bit_string.c index e884dab..a98a297 100644 --- a/src/ltc/pk/asn1/der/bit/der_encode_raw_bit_string.c +++ b/src/ltc/pk/asn1/der/bit/der_encode_raw_bit_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_bit_string.c diff --git a/src/ltc/pk/asn1/der/bit/der_length_bit_string.c b/src/ltc/pk/asn1/der/bit/der_length_bit_string.c index 7a65208..edfcc84 100644 --- a/src/ltc/pk/asn1/der/bit/der_length_bit_string.c +++ b/src/ltc/pk/asn1/der/bit/der_length_bit_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_bit_string.c diff --git a/src/ltc/pk/asn1/der/boolean/der_decode_boolean.c b/src/ltc/pk/asn1/der/boolean/der_decode_boolean.c index da60ca9..0fddf5c 100644 --- a/src/ltc/pk/asn1/der/boolean/der_decode_boolean.c +++ b/src/ltc/pk/asn1/der/boolean/der_decode_boolean.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_boolean.c diff --git a/src/ltc/pk/asn1/der/boolean/der_encode_boolean.c b/src/ltc/pk/asn1/der/boolean/der_encode_boolean.c index c5cacdd..71bdf8d 100644 --- a/src/ltc/pk/asn1/der/boolean/der_encode_boolean.c +++ b/src/ltc/pk/asn1/der/boolean/der_encode_boolean.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_boolean.c diff --git a/src/ltc/pk/asn1/der/boolean/der_length_boolean.c b/src/ltc/pk/asn1/der/boolean/der_length_boolean.c index a1a3a7b..6840e5c 100644 --- a/src/ltc/pk/asn1/der/boolean/der_length_boolean.c +++ b/src/ltc/pk/asn1/der/boolean/der_length_boolean.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_boolean.c diff --git a/src/ltc/pk/asn1/der/choice/der_decode_choice.c b/src/ltc/pk/asn1/der/choice/der_decode_choice.c index 6e17a4b..e2ba834 100644 --- a/src/ltc/pk/asn1/der/choice/der_decode_choice.c +++ b/src/ltc/pk/asn1/der/choice/der_decode_choice.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_choice.c diff --git a/src/ltc/pk/asn1/der/custom_type/der_decode_custom_type.c b/src/ltc/pk/asn1/der/custom_type/der_decode_custom_type.c index 8a0bc85..17e24b6 100644 --- a/src/ltc/pk/asn1/der/custom_type/der_decode_custom_type.c +++ b/src/ltc/pk/asn1/der/custom_type/der_decode_custom_type.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** diff --git a/src/ltc/pk/asn1/der/custom_type/der_encode_custom_type.c b/src/ltc/pk/asn1/der/custom_type/der_encode_custom_type.c index d19774c..5bbd65b 100644 --- a/src/ltc/pk/asn1/der/custom_type/der_encode_custom_type.c +++ b/src/ltc/pk/asn1/der/custom_type/der_encode_custom_type.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** diff --git a/src/ltc/pk/asn1/der/custom_type/der_length_custom_type.c b/src/ltc/pk/asn1/der/custom_type/der_length_custom_type.c index aecc464..67b40b4 100644 --- a/src/ltc/pk/asn1/der/custom_type/der_length_custom_type.c +++ b/src/ltc/pk/asn1/der/custom_type/der_length_custom_type.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_custom_type.c diff --git a/src/ltc/pk/asn1/der/general/der_asn1_maps.c b/src/ltc/pk/asn1/der/general/der_asn1_maps.c index ba9820f..a49504e 100644 --- a/src/ltc/pk/asn1/der/general/der_asn1_maps.c +++ b/src/ltc/pk/asn1/der/general/der_asn1_maps.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_asn1_maps.c diff --git a/src/ltc/pk/asn1/der/general/der_decode_asn1_identifier.c b/src/ltc/pk/asn1/der/general/der_decode_asn1_identifier.c index 27296fc..26cf20a 100644 --- a/src/ltc/pk/asn1/der/general/der_decode_asn1_identifier.c +++ b/src/ltc/pk/asn1/der/general/der_decode_asn1_identifier.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_asn1_identifier.c diff --git a/src/ltc/pk/asn1/der/general/der_decode_asn1_length.c b/src/ltc/pk/asn1/der/general/der_decode_asn1_length.c index 0e1bc6c..0021eea 100644 --- a/src/ltc/pk/asn1/der/general/der_decode_asn1_length.c +++ b/src/ltc/pk/asn1/der/general/der_decode_asn1_length.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_asn1_length.c diff --git a/src/ltc/pk/asn1/der/general/der_encode_asn1_identifier.c b/src/ltc/pk/asn1/der/general/der_encode_asn1_identifier.c index 82145d5..c366ad3 100644 --- a/src/ltc/pk/asn1/der/general/der_encode_asn1_identifier.c +++ b/src/ltc/pk/asn1/der/general/der_encode_asn1_identifier.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_asn1_identifier.c diff --git a/src/ltc/pk/asn1/der/general/der_encode_asn1_length.c b/src/ltc/pk/asn1/der/general/der_encode_asn1_length.c index 0d871af..645626a 100644 --- a/src/ltc/pk/asn1/der/general/der_encode_asn1_length.c +++ b/src/ltc/pk/asn1/der/general/der_encode_asn1_length.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_asn1_length.c diff --git a/src/ltc/pk/asn1/der/general/der_length_asn1_identifier.c b/src/ltc/pk/asn1/der/general/der_length_asn1_identifier.c index 40e76f0..ac50075 100644 --- a/src/ltc/pk/asn1/der/general/der_length_asn1_identifier.c +++ b/src/ltc/pk/asn1/der/general/der_length_asn1_identifier.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_asn1_identifier.c diff --git a/src/ltc/pk/asn1/der/general/der_length_asn1_length.c b/src/ltc/pk/asn1/der/general/der_length_asn1_length.c index 1271e1c..1ce8be4 100644 --- a/src/ltc/pk/asn1/der/general/der_length_asn1_length.c +++ b/src/ltc/pk/asn1/der/general/der_length_asn1_length.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_asn1_length.c diff --git a/src/ltc/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c b/src/ltc/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c index 016a4c2..a5f8473 100644 --- a/src/ltc/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c +++ b/src/ltc/pk/asn1/der/generalizedtime/der_decode_generalizedtime.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_generalizedtime.c diff --git a/src/ltc/pk/asn1/der/generalizedtime/der_encode_generalizedtime.c b/src/ltc/pk/asn1/der/generalizedtime/der_encode_generalizedtime.c index d7c8134..018d2ef 100644 --- a/src/ltc/pk/asn1/der/generalizedtime/der_encode_generalizedtime.c +++ b/src/ltc/pk/asn1/der/generalizedtime/der_encode_generalizedtime.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_utctime.c diff --git a/src/ltc/pk/asn1/der/generalizedtime/der_length_generalizedtime.c b/src/ltc/pk/asn1/der/generalizedtime/der_length_generalizedtime.c index f3fbcc6..a3ba189 100644 --- a/src/ltc/pk/asn1/der/generalizedtime/der_length_generalizedtime.c +++ b/src/ltc/pk/asn1/der/generalizedtime/der_length_generalizedtime.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_utctime.c diff --git a/src/ltc/pk/asn1/der/ia5/der_decode_ia5_string.c b/src/ltc/pk/asn1/der/ia5/der_decode_ia5_string.c index 15e90f8..e5aed67 100644 --- a/src/ltc/pk/asn1/der/ia5/der_decode_ia5_string.c +++ b/src/ltc/pk/asn1/der/ia5/der_decode_ia5_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_ia5_string.c diff --git a/src/ltc/pk/asn1/der/ia5/der_encode_ia5_string.c b/src/ltc/pk/asn1/der/ia5/der_encode_ia5_string.c index fee1c70..fb6a4f8 100644 --- a/src/ltc/pk/asn1/der/ia5/der_encode_ia5_string.c +++ b/src/ltc/pk/asn1/der/ia5/der_encode_ia5_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_ia5_string.c diff --git a/src/ltc/pk/asn1/der/ia5/der_length_ia5_string.c b/src/ltc/pk/asn1/der/ia5/der_length_ia5_string.c index 422c4d3..0276299 100644 --- a/src/ltc/pk/asn1/der/ia5/der_length_ia5_string.c +++ b/src/ltc/pk/asn1/der/ia5/der_length_ia5_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_ia5_string.c diff --git a/src/ltc/pk/asn1/der/integer/der_decode_integer.c b/src/ltc/pk/asn1/der/integer/der_decode_integer.c index e5c5c12..aed4c86 100644 --- a/src/ltc/pk/asn1/der/integer/der_decode_integer.c +++ b/src/ltc/pk/asn1/der/integer/der_decode_integer.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_integer.c diff --git a/src/ltc/pk/asn1/der/integer/der_encode_integer.c b/src/ltc/pk/asn1/der/integer/der_encode_integer.c index 3bd9593..3bead0a 100644 --- a/src/ltc/pk/asn1/der/integer/der_encode_integer.c +++ b/src/ltc/pk/asn1/der/integer/der_encode_integer.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_integer.c diff --git a/src/ltc/pk/asn1/der/integer/der_length_integer.c b/src/ltc/pk/asn1/der/integer/der_length_integer.c index 60daffa..7dce18e 100644 --- a/src/ltc/pk/asn1/der/integer/der_length_integer.c +++ b/src/ltc/pk/asn1/der/integer/der_length_integer.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_integer.c diff --git a/src/ltc/pk/asn1/der/object_identifier/der_decode_object_identifier.c b/src/ltc/pk/asn1/der/object_identifier/der_decode_object_identifier.c index 48a9547..f497862 100644 --- a/src/ltc/pk/asn1/der/object_identifier/der_decode_object_identifier.c +++ b/src/ltc/pk/asn1/der/object_identifier/der_decode_object_identifier.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_object_identifier.c diff --git a/src/ltc/pk/asn1/der/object_identifier/der_encode_object_identifier.c b/src/ltc/pk/asn1/der/object_identifier/der_encode_object_identifier.c index af2a8f7..881809f 100644 --- a/src/ltc/pk/asn1/der/object_identifier/der_encode_object_identifier.c +++ b/src/ltc/pk/asn1/der/object_identifier/der_encode_object_identifier.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_object_identifier.c diff --git a/src/ltc/pk/asn1/der/object_identifier/der_length_object_identifier.c b/src/ltc/pk/asn1/der/object_identifier/der_length_object_identifier.c index 9db5fe1..cc22a3c 100644 --- a/src/ltc/pk/asn1/der/object_identifier/der_length_object_identifier.c +++ b/src/ltc/pk/asn1/der/object_identifier/der_length_object_identifier.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_object_identifier.c diff --git a/src/ltc/pk/asn1/der/octet/der_decode_octet_string.c b/src/ltc/pk/asn1/der/octet/der_decode_octet_string.c index a9b3cdc..f600637 100644 --- a/src/ltc/pk/asn1/der/octet/der_decode_octet_string.c +++ b/src/ltc/pk/asn1/der/octet/der_decode_octet_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_octet_string.c diff --git a/src/ltc/pk/asn1/der/octet/der_encode_octet_string.c b/src/ltc/pk/asn1/der/octet/der_encode_octet_string.c index fd79c67..f274515 100644 --- a/src/ltc/pk/asn1/der/octet/der_encode_octet_string.c +++ b/src/ltc/pk/asn1/der/octet/der_encode_octet_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_octet_string.c diff --git a/src/ltc/pk/asn1/der/octet/der_length_octet_string.c b/src/ltc/pk/asn1/der/octet/der_length_octet_string.c index 9e5386a..8c3db1c 100644 --- a/src/ltc/pk/asn1/der/octet/der_length_octet_string.c +++ b/src/ltc/pk/asn1/der/octet/der_length_octet_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_octet_string.c diff --git a/src/ltc/pk/asn1/der/printable_string/der_decode_printable_string.c b/src/ltc/pk/asn1/der/printable_string/der_decode_printable_string.c index 1ec9e3c..2cd8824 100644 --- a/src/ltc/pk/asn1/der/printable_string/der_decode_printable_string.c +++ b/src/ltc/pk/asn1/der/printable_string/der_decode_printable_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_printable_string.c diff --git a/src/ltc/pk/asn1/der/printable_string/der_encode_printable_string.c b/src/ltc/pk/asn1/der/printable_string/der_encode_printable_string.c index bd59391..c2132de 100644 --- a/src/ltc/pk/asn1/der/printable_string/der_encode_printable_string.c +++ b/src/ltc/pk/asn1/der/printable_string/der_encode_printable_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_printable_string.c diff --git a/src/ltc/pk/asn1/der/printable_string/der_length_printable_string.c b/src/ltc/pk/asn1/der/printable_string/der_length_printable_string.c index b6eb850..3d48c77 100644 --- a/src/ltc/pk/asn1/der/printable_string/der_length_printable_string.c +++ b/src/ltc/pk/asn1/der/printable_string/der_length_printable_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_printable_string.c diff --git a/src/ltc/pk/asn1/der/sequence/der_decode_sequence_ex.c b/src/ltc/pk/asn1/der/sequence/der_decode_sequence_ex.c index 10cfd21..8143530 100644 --- a/src/ltc/pk/asn1/der/sequence/der_decode_sequence_ex.c +++ b/src/ltc/pk/asn1/der/sequence/der_decode_sequence_ex.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** diff --git a/src/ltc/pk/asn1/der/sequence/der_decode_sequence_flexi.c b/src/ltc/pk/asn1/der/sequence/der_decode_sequence_flexi.c index a6c3cf7..94c3988 100644 --- a/src/ltc/pk/asn1/der/sequence/der_decode_sequence_flexi.c +++ b/src/ltc/pk/asn1/der/sequence/der_decode_sequence_flexi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_sequence_flexi.c diff --git a/src/ltc/pk/asn1/der/sequence/der_decode_sequence_multi.c b/src/ltc/pk/asn1/der/sequence/der_decode_sequence_multi.c index 280d7cd..1bb75d2 100644 --- a/src/ltc/pk/asn1/der/sequence/der_decode_sequence_multi.c +++ b/src/ltc/pk/asn1/der/sequence/der_decode_sequence_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include diff --git a/src/ltc/pk/asn1/der/sequence/der_encode_sequence_ex.c b/src/ltc/pk/asn1/der/sequence/der_encode_sequence_ex.c index a69db8f..50b3a4c 100644 --- a/src/ltc/pk/asn1/der/sequence/der_encode_sequence_ex.c +++ b/src/ltc/pk/asn1/der/sequence/der_encode_sequence_ex.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** diff --git a/src/ltc/pk/asn1/der/sequence/der_encode_sequence_multi.c b/src/ltc/pk/asn1/der/sequence/der_encode_sequence_multi.c index c8ec59a..febb4d4 100644 --- a/src/ltc/pk/asn1/der/sequence/der_encode_sequence_multi.c +++ b/src/ltc/pk/asn1/der/sequence/der_encode_sequence_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #include diff --git a/src/ltc/pk/asn1/der/sequence/der_length_sequence.c b/src/ltc/pk/asn1/der/sequence/der_length_sequence.c index 7462854..df7f2aa 100644 --- a/src/ltc/pk/asn1/der/sequence/der_length_sequence.c +++ b/src/ltc/pk/asn1/der/sequence/der_length_sequence.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_sequence.c diff --git a/src/ltc/pk/asn1/der/sequence/der_sequence_free.c b/src/ltc/pk/asn1/der/sequence/der_sequence_free.c index 3c2a663..bff1909 100644 --- a/src/ltc/pk/asn1/der/sequence/der_sequence_free.c +++ b/src/ltc/pk/asn1/der/sequence/der_sequence_free.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_sequence_free.c diff --git a/src/ltc/pk/asn1/der/sequence/der_sequence_shrink.c b/src/ltc/pk/asn1/der/sequence/der_sequence_shrink.c index fdfe91b..eb9335f 100644 --- a/src/ltc/pk/asn1/der/sequence/der_sequence_shrink.c +++ b/src/ltc/pk/asn1/der/sequence/der_sequence_shrink.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_sequence_shrink.c diff --git a/src/ltc/pk/asn1/der/set/der_encode_set.c b/src/ltc/pk/asn1/der/set/der_encode_set.c index eba5242..636669c 100644 --- a/src/ltc/pk/asn1/der/set/der_encode_set.c +++ b/src/ltc/pk/asn1/der/set/der_encode_set.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_set.c diff --git a/src/ltc/pk/asn1/der/set/der_encode_setof.c b/src/ltc/pk/asn1/der/set/der_encode_setof.c index 3bac345..d1dc73b 100644 --- a/src/ltc/pk/asn1/der/set/der_encode_setof.c +++ b/src/ltc/pk/asn1/der/set/der_encode_setof.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_setof.c diff --git a/src/ltc/pk/asn1/der/short_integer/der_decode_short_integer.c b/src/ltc/pk/asn1/der/short_integer/der_decode_short_integer.c index 71debf3..3b01323 100644 --- a/src/ltc/pk/asn1/der/short_integer/der_decode_short_integer.c +++ b/src/ltc/pk/asn1/der/short_integer/der_decode_short_integer.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_short_integer.c diff --git a/src/ltc/pk/asn1/der/short_integer/der_encode_short_integer.c b/src/ltc/pk/asn1/der/short_integer/der_encode_short_integer.c index ea413eb..ddab980 100644 --- a/src/ltc/pk/asn1/der/short_integer/der_encode_short_integer.c +++ b/src/ltc/pk/asn1/der/short_integer/der_encode_short_integer.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_short_integer.c diff --git a/src/ltc/pk/asn1/der/short_integer/der_length_short_integer.c b/src/ltc/pk/asn1/der/short_integer/der_length_short_integer.c index 8c1de28..75c719b 100644 --- a/src/ltc/pk/asn1/der/short_integer/der_length_short_integer.c +++ b/src/ltc/pk/asn1/der/short_integer/der_length_short_integer.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_short_integer.c diff --git a/src/ltc/pk/asn1/der/teletex_string/der_decode_teletex_string.c b/src/ltc/pk/asn1/der/teletex_string/der_decode_teletex_string.c index cd530a2..9389369 100644 --- a/src/ltc/pk/asn1/der/teletex_string/der_decode_teletex_string.c +++ b/src/ltc/pk/asn1/der/teletex_string/der_decode_teletex_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_teletex_string.c diff --git a/src/ltc/pk/asn1/der/teletex_string/der_length_teletex_string.c b/src/ltc/pk/asn1/der/teletex_string/der_length_teletex_string.c index a35c6d7..13b4487 100644 --- a/src/ltc/pk/asn1/der/teletex_string/der_length_teletex_string.c +++ b/src/ltc/pk/asn1/der/teletex_string/der_length_teletex_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_teletex_string.c diff --git a/src/ltc/pk/asn1/der/utctime/der_decode_utctime.c b/src/ltc/pk/asn1/der/utctime/der_decode_utctime.c index 07fcb80..fba9184 100644 --- a/src/ltc/pk/asn1/der/utctime/der_decode_utctime.c +++ b/src/ltc/pk/asn1/der/utctime/der_decode_utctime.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_utctime.c diff --git a/src/ltc/pk/asn1/der/utctime/der_encode_utctime.c b/src/ltc/pk/asn1/der/utctime/der_encode_utctime.c index 19aa9da..258afca 100644 --- a/src/ltc/pk/asn1/der/utctime/der_encode_utctime.c +++ b/src/ltc/pk/asn1/der/utctime/der_encode_utctime.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_utctime.c diff --git a/src/ltc/pk/asn1/der/utctime/der_length_utctime.c b/src/ltc/pk/asn1/der/utctime/der_length_utctime.c index c0d1b57..c85a935 100644 --- a/src/ltc/pk/asn1/der/utctime/der_length_utctime.c +++ b/src/ltc/pk/asn1/der/utctime/der_length_utctime.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_utctime.c diff --git a/src/ltc/pk/asn1/der/utf8/der_decode_utf8_string.c b/src/ltc/pk/asn1/der/utf8/der_decode_utf8_string.c index c86d660..94555b9 100644 --- a/src/ltc/pk/asn1/der/utf8/der_decode_utf8_string.c +++ b/src/ltc/pk/asn1/der/utf8/der_decode_utf8_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_decode_utf8_string.c diff --git a/src/ltc/pk/asn1/der/utf8/der_encode_utf8_string.c b/src/ltc/pk/asn1/der/utf8/der_encode_utf8_string.c index 1c6e09b..5deb11a 100644 --- a/src/ltc/pk/asn1/der/utf8/der_encode_utf8_string.c +++ b/src/ltc/pk/asn1/der/utf8/der_encode_utf8_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_encode_utf8_string.c diff --git a/src/ltc/pk/asn1/der/utf8/der_length_utf8_string.c b/src/ltc/pk/asn1/der/utf8/der_length_utf8_string.c index b429284..48eed3b 100644 --- a/src/ltc/pk/asn1/der/utf8/der_length_utf8_string.c +++ b/src/ltc/pk/asn1/der/utf8/der_length_utf8_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file der_length_utf8_string.c diff --git a/src/ltc/pk/asn1/x509/x509_decode_subject_public_key_info.c b/src/ltc/pk/asn1/x509/x509_decode_subject_public_key_info.c index 134eac2..ba51f29 100644 --- a/src/ltc/pk/asn1/x509/x509_decode_subject_public_key_info.c +++ b/src/ltc/pk/asn1/x509/x509_decode_subject_public_key_info.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file x509_decode_subject_public_key_info.c diff --git a/src/ltc/pk/asn1/x509/x509_encode_subject_public_key_info.c b/src/ltc/pk/asn1/x509/x509_encode_subject_public_key_info.c index 25c1195..bb29fed 100644 --- a/src/ltc/pk/asn1/x509/x509_encode_subject_public_key_info.c +++ b/src/ltc/pk/asn1/x509/x509_encode_subject_public_key_info.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file x509_encode_subject_public_key_info.c diff --git a/src/ltc/pk/dh/dh.c b/src/ltc/pk/dh/dh.c index 199a83d..793b5f0 100644 --- a/src/ltc/pk/dh/dh.c +++ b/src/ltc/pk/dh/dh.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_check_pubkey.c b/src/ltc/pk/dh/dh_check_pubkey.c index 5fee550..bdd0703 100644 --- a/src/ltc/pk/dh/dh_check_pubkey.c +++ b/src/ltc/pk/dh/dh_check_pubkey.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_export.c b/src/ltc/pk/dh/dh_export.c index f28ec10..7a94fa2 100644 --- a/src/ltc/pk/dh/dh_export.c +++ b/src/ltc/pk/dh/dh_export.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_export_key.c b/src/ltc/pk/dh/dh_export_key.c index afcbce5..d42844a 100644 --- a/src/ltc/pk/dh/dh_export_key.c +++ b/src/ltc/pk/dh/dh_export_key.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_free.c b/src/ltc/pk/dh/dh_free.c index b4f58ca..3251006 100644 --- a/src/ltc/pk/dh/dh_free.c +++ b/src/ltc/pk/dh/dh_free.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_generate_key.c b/src/ltc/pk/dh/dh_generate_key.c index 69fb6f9..ba737fc 100644 --- a/src/ltc/pk/dh/dh_generate_key.c +++ b/src/ltc/pk/dh/dh_generate_key.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_import.c b/src/ltc/pk/dh/dh_import.c index 601e5e7..2e8d2f2 100644 --- a/src/ltc/pk/dh/dh_import.c +++ b/src/ltc/pk/dh/dh_import.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_set.c b/src/ltc/pk/dh/dh_set.c index 8d0af7d..fd9163f 100644 --- a/src/ltc/pk/dh/dh_set.c +++ b/src/ltc/pk/dh/dh_set.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_set_pg_dhparam.c b/src/ltc/pk/dh/dh_set_pg_dhparam.c index 7003011..98599c3 100644 --- a/src/ltc/pk/dh/dh_set_pg_dhparam.c +++ b/src/ltc/pk/dh/dh_set_pg_dhparam.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dh/dh_shared_secret.c b/src/ltc/pk/dh/dh_shared_secret.c index da36408..a3890a5 100644 --- a/src/ltc/pk/dh/dh_shared_secret.c +++ b/src/ltc/pk/dh/dh_shared_secret.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDH diff --git a/src/ltc/pk/dsa/dsa_decrypt_key.c b/src/ltc/pk/dsa/dsa_decrypt_key.c index aa7ac67..754a07b 100644 --- a/src/ltc/pk/dsa/dsa_decrypt_key.c +++ b/src/ltc/pk/dsa/dsa_decrypt_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_decrypt_key.c diff --git a/src/ltc/pk/dsa/dsa_encrypt_key.c b/src/ltc/pk/dsa/dsa_encrypt_key.c index 61dfbbd..6286985 100644 --- a/src/ltc/pk/dsa/dsa_encrypt_key.c +++ b/src/ltc/pk/dsa/dsa_encrypt_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_encrypt_key.c diff --git a/src/ltc/pk/dsa/dsa_export.c b/src/ltc/pk/dsa/dsa_export.c index e406cd8..9058dd3 100644 --- a/src/ltc/pk/dsa/dsa_export.c +++ b/src/ltc/pk/dsa/dsa_export.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_export.c diff --git a/src/ltc/pk/dsa/dsa_free.c b/src/ltc/pk/dsa/dsa_free.c index 5cac656..dc9d436 100644 --- a/src/ltc/pk/dsa/dsa_free.c +++ b/src/ltc/pk/dsa/dsa_free.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_free.c diff --git a/src/ltc/pk/dsa/dsa_generate_key.c b/src/ltc/pk/dsa/dsa_generate_key.c index 18b2df6..9e7489e 100644 --- a/src/ltc/pk/dsa/dsa_generate_key.c +++ b/src/ltc/pk/dsa/dsa_generate_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_make_key.c diff --git a/src/ltc/pk/dsa/dsa_generate_pqg.c b/src/ltc/pk/dsa/dsa_generate_pqg.c index 8c5f558..94a1c40 100644 --- a/src/ltc/pk/dsa/dsa_generate_pqg.c +++ b/src/ltc/pk/dsa/dsa_generate_pqg.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_generate_pqg.c diff --git a/src/ltc/pk/dsa/dsa_import.c b/src/ltc/pk/dsa/dsa_import.c index 5e77b1e..b43daeb 100644 --- a/src/ltc/pk/dsa/dsa_import.c +++ b/src/ltc/pk/dsa/dsa_import.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_import.c diff --git a/src/ltc/pk/dsa/dsa_make_key.c b/src/ltc/pk/dsa/dsa_make_key.c index 8ac08f8..e7628e1 100644 --- a/src/ltc/pk/dsa/dsa_make_key.c +++ b/src/ltc/pk/dsa/dsa_make_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_make_key.c diff --git a/src/ltc/pk/dsa/dsa_set.c b/src/ltc/pk/dsa/dsa_set.c index a4d4042..77461e1 100644 --- a/src/ltc/pk/dsa/dsa_set.c +++ b/src/ltc/pk/dsa/dsa_set.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDSA diff --git a/src/ltc/pk/dsa/dsa_set_pqg_dsaparam.c b/src/ltc/pk/dsa/dsa_set_pqg_dsaparam.c index edbed1c..2d55985 100644 --- a/src/ltc/pk/dsa/dsa_set_pqg_dsaparam.c +++ b/src/ltc/pk/dsa/dsa_set_pqg_dsaparam.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MDSA diff --git a/src/ltc/pk/dsa/dsa_shared_secret.c b/src/ltc/pk/dsa/dsa_shared_secret.c index 0568834..ca6ce7f 100644 --- a/src/ltc/pk/dsa/dsa_shared_secret.c +++ b/src/ltc/pk/dsa/dsa_shared_secret.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_shared_secret.c diff --git a/src/ltc/pk/dsa/dsa_sign_hash.c b/src/ltc/pk/dsa/dsa_sign_hash.c index 04ca330..cd58292 100644 --- a/src/ltc/pk/dsa/dsa_sign_hash.c +++ b/src/ltc/pk/dsa/dsa_sign_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_sign_hash.c diff --git a/src/ltc/pk/dsa/dsa_verify_hash.c b/src/ltc/pk/dsa/dsa_verify_hash.c index ea7d5ad..6bf3a01 100644 --- a/src/ltc/pk/dsa/dsa_verify_hash.c +++ b/src/ltc/pk/dsa/dsa_verify_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_verify_hash.c diff --git a/src/ltc/pk/dsa/dsa_verify_key.c b/src/ltc/pk/dsa/dsa_verify_key.c index 9061f45..5818879 100644 --- a/src/ltc/pk/dsa/dsa_verify_key.c +++ b/src/ltc/pk/dsa/dsa_verify_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file dsa_verify_key.c diff --git a/src/ltc/pk/ecc/ecc.c b/src/ltc/pk/ecc/ecc.c index 802097f..50470ee 100644 --- a/src/ltc/pk/ecc/ecc.c +++ b/src/ltc/pk/ecc/ecc.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc.c diff --git a/src/ltc/pk/ecc/ecc_ansi_x963_export.c b/src/ltc/pk/ecc/ecc_ansi_x963_export.c index b752b6b..ebecf24 100644 --- a/src/ltc/pk/ecc/ecc_ansi_x963_export.c +++ b/src/ltc/pk/ecc/ecc_ansi_x963_export.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_ansi_x963_export.c @@ -24,41 +24,7 @@ */ int ecc_ansi_x963_export(const ecc_key *key, unsigned char *out, unsigned long *outlen) { - unsigned char buf[ECC_BUF_SIZE]; - unsigned long numlen, xlen, ylen; - - LTC_ARGCHK(key != NULL); - LTC_ARGCHK(out != NULL); - LTC_ARGCHK(outlen != NULL); - - numlen = key->dp.size; - xlen = mp_unsigned_bin_size(key->pubkey.x); - ylen = mp_unsigned_bin_size(key->pubkey.y); - - if (xlen > numlen || ylen > numlen || sizeof(buf) < numlen) { - return CRYPT_BUFFER_OVERFLOW; - } - - if (*outlen < (1 + 2*numlen)) { - *outlen = 1 + 2*numlen; - return CRYPT_BUFFER_OVERFLOW; - } - - /* store byte 0x04 */ - out[0] = 0x04; - - /* pad and store x */ - zeromem(buf, sizeof(buf)); - mp_to_unsigned_bin(key->pubkey.x, buf + (numlen - xlen)); - XMEMCPY(out+1, buf, numlen); - - /* pad and store y */ - zeromem(buf, sizeof(buf)); - mp_to_unsigned_bin(key->pubkey.y, buf + (numlen - ylen)); - XMEMCPY(out+1+numlen, buf, numlen); - - *outlen = 1 + 2*numlen; - return CRYPT_OK; + return ecc_get_key(out, outlen, PK_PUBLIC, key); } #endif diff --git a/src/ltc/pk/ecc/ecc_ansi_x963_import.c b/src/ltc/pk/ecc/ecc_ansi_x963_import.c index 12b034d..6dbdd21 100644 --- a/src/ltc/pk/ecc/ecc_ansi_x963_import.c +++ b/src/ltc/pk/ecc/ecc_ansi_x963_import.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_ansi_x963_import.c diff --git a/src/ltc/pk/ecc/ecc_decrypt_key.c b/src/ltc/pk/ecc/ecc_decrypt_key.c index 6ce93d5..8c29a17 100644 --- a/src/ltc/pk/ecc/ecc_decrypt_key.c +++ b/src/ltc/pk/ecc/ecc_decrypt_key.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_decrypt_key.c diff --git a/src/ltc/pk/ecc/ecc_encrypt_key.c b/src/ltc/pk/ecc/ecc_encrypt_key.c index e0beb69..17201df 100644 --- a/src/ltc/pk/ecc/ecc_encrypt_key.c +++ b/src/ltc/pk/ecc/ecc_encrypt_key.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_encrypt_key.c @@ -42,11 +42,6 @@ LTC_ARGCHK(out != NULL); LTC_ARGCHK(outlen != NULL); LTC_ARGCHK(key != NULL); - - /* check that wprng/cipher/hash are not invalid */ - if ((err = prng_is_valid(wprng)) != CRYPT_OK) { - return err; - } if ((err = hash_is_valid(hash)) != CRYPT_OK) { return err; diff --git a/src/ltc/pk/ecc/ecc_export.c b/src/ltc/pk/ecc/ecc_export.c index eab854a..268e430 100644 --- a/src/ltc/pk/ecc/ecc_export.c +++ b/src/ltc/pk/ecc/ecc_export.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_export.c diff --git a/src/ltc/pk/ecc/ecc_export_openssl.c b/src/ltc/pk/ecc/ecc_export_openssl.c index 4f47dd3..08056fe 100644 --- a/src/ltc/pk/ecc/ecc_export_openssl.c +++ b/src/ltc/pk/ecc/ecc_export_openssl.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ecc_free.c b/src/ltc/pk/ecc/ecc_free.c index 47d3129..d15709e 100644 --- a/src/ltc/pk/ecc/ecc_free.c +++ b/src/ltc/pk/ecc/ecc_free.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_free.c diff --git a/src/ltc/pk/ecc/ecc_get_curve.c b/src/ltc/pk/ecc/ecc_get_curve.c index 7f03862..a2f52b0 100644 --- a/src/ltc/pk/ecc/ecc_get_curve.c +++ b/src/ltc/pk/ecc/ecc_get_curve.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ecc_get_key.c b/src/ltc/pk/ecc/ecc_get_key.c index 2154e7f..abae6da 100644 --- a/src/ltc/pk/ecc/ecc_get_key.c +++ b/src/ltc/pk/ecc/ecc_get_key.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ecc_get_oid_str.c b/src/ltc/pk/ecc/ecc_get_oid_str.c new file mode 100644 index 0000000..70386c6 --- /dev/null +++ b/src/ltc/pk/ecc/ecc_get_oid_str.c @@ -0,0 +1,32 @@ +/* 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. + */ + +#include "tomcrypt_private.h" + +#ifdef LTC_MECC + +/** Extract OID as a string from ECC key + @param out [out] destination buffer + @param outlen [in/out] Length of destination buffer and final output size (without terminating NUL byte) + @param key The ECC key + Return CRYPT_OK on success +*/ + +int ecc_get_oid_str(char *out, unsigned long *outlen, const ecc_key *key) +{ + LTC_ARGCHK(key != NULL); + + return pk_oid_num_to_str(key->dp.oid, key->dp.oidlen, out, outlen); +} + +#endif + +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/src/ltc/pk/ecc/ecc_get_size.c b/src/ltc/pk/ecc/ecc_get_size.c index 3f5810c..3dada78 100644 --- a/src/ltc/pk/ecc/ecc_get_size.c +++ b/src/ltc/pk/ecc/ecc_get_size.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_get_size.c diff --git a/src/ltc/pk/ecc/ecc_import.c b/src/ltc/pk/ecc/ecc_import.c index 6deea28..e691add 100644 --- a/src/ltc/pk/ecc/ecc_import.c +++ b/src/ltc/pk/ecc/ecc_import.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_import.c diff --git a/src/ltc/pk/ecc/ecc_import_openssl.c b/src/ltc/pk/ecc/ecc_import_openssl.c index a9e25a6..bf34c08 100644 --- a/src/ltc/pk/ecc/ecc_import_openssl.c +++ b/src/ltc/pk/ecc/ecc_import_openssl.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC @@ -149,9 +149,8 @@ goto success; } - /* ### 5. backward compatibility - try to load old-DER format */ - - if ((err = ecc_import(in, inlen, key)) != CRYPT_OK) { goto error; } + /* ### 5. all attempts failed */ + goto error; success: err = CRYPT_OK; diff --git a/src/ltc/pk/ecc/ecc_import_pkcs8.c b/src/ltc/pk/ecc/ecc_import_pkcs8.c index 8097eab..4bf9fbc 100644 --- a/src/ltc/pk/ecc/ecc_import_pkcs8.c +++ b/src/ltc/pk/ecc/ecc_import_pkcs8.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ecc_import_x509.c b/src/ltc/pk/ecc/ecc_import_x509.c index e57b156..1427e98 100644 --- a/src/ltc/pk/ecc/ecc_import_x509.c +++ b/src/ltc/pk/ecc/ecc_import_x509.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ecc_make_key.c b/src/ltc/pk/ecc/ecc_make_key.c index 1666017..da59585 100644 --- a/src/ltc/pk/ecc/ecc_make_key.c +++ b/src/ltc/pk/ecc/ecc_make_key.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_make_key.c @@ -49,11 +49,6 @@ LTC_ARGCHK(key != NULL); LTC_ARGCHK(key->dp.size > 0); - /* good prng? */ - if ((err = prng_is_valid(wprng)) != CRYPT_OK) { - return err; - } - /* ECC key pair generation according to FIPS-186-4 (B.4.2 Key Pair Generation by Testing Candidates): * the generated private key k should be the range [1, order-1] * a/ N = bitlen(order) diff --git a/src/ltc/pk/ecc/ecc_set_dp.c b/src/ltc/pk/ecc/ecc_set_dp.c index cecca68..4c4f487 100644 --- a/src/ltc/pk/ecc/ecc_set_dp.c +++ b/src/ltc/pk/ecc/ecc_set_dp.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ecc_set_dp_internal.c b/src/ltc/pk/ecc/ecc_set_dp_internal.c index eca7031..cf9020b 100644 --- a/src/ltc/pk/ecc/ecc_set_dp_internal.c +++ b/src/ltc/pk/ecc/ecc_set_dp_internal.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ecc_set_key.c b/src/ltc/pk/ecc/ecc_set_key.c index 9fabcf2..75e047b 100644 --- a/src/ltc/pk/ecc/ecc_set_key.c +++ b/src/ltc/pk/ecc/ecc_set_key.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ecc_shared_secret.c b/src/ltc/pk/ecc/ecc_shared_secret.c index afb8691..bdefd02 100644 --- a/src/ltc/pk/ecc/ecc_shared_secret.c +++ b/src/ltc/pk/ecc/ecc_shared_secret.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_shared_secret.c diff --git a/src/ltc/pk/ecc/ecc_sign_hash.c b/src/ltc/pk/ecc/ecc_sign_hash.c index 027ad7a..360807e 100644 --- a/src/ltc/pk/ecc/ecc_sign_hash.c +++ b/src/ltc/pk/ecc/ecc_sign_hash.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC @@ -34,10 +34,6 @@ /* is this a private key? */ if (key->type != PK_PRIVATE) { return CRYPT_PK_NOT_PRIVATE; - } - - if ((err = prng_is_valid(wprng)) != CRYPT_OK) { - return err; } /* init the bignums */ diff --git a/src/ltc/pk/ecc/ecc_sizes.c b/src/ltc/pk/ecc/ecc_sizes.c index 165c849..f57f02b 100644 --- a/src/ltc/pk/ecc/ecc_sizes.c +++ b/src/ltc/pk/ecc/ecc_sizes.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ecc_sizes.c diff --git a/src/ltc/pk/ecc/ecc_verify_hash.c b/src/ltc/pk/ecc/ecc_verify_hash.c index 5127953..f2a5894 100644 --- a/src/ltc/pk/ecc/ecc_verify_hash.c +++ b/src/ltc/pk/ecc/ecc_verify_hash.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ltc_ecc_export_point.c b/src/ltc/pk/ecc/ltc_ecc_export_point.c index 84750c8..c64e6b6 100644 --- a/src/ltc/pk/ecc/ltc_ecc_export_point.c +++ b/src/ltc/pk/ecc/ltc_ecc_export_point.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ltc_ecc_import_point.c b/src/ltc/pk/ecc/ltc_ecc_import_point.c index 7e103f4..2b776f6 100644 --- a/src/ltc/pk/ecc/ltc_ecc_import_point.c +++ b/src/ltc/pk/ecc/ltc_ecc_import_point.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ltc_ecc_is_point.c b/src/ltc/pk/ecc/ltc_ecc_is_point.c index 46e1a6d..efd954b 100644 --- a/src/ltc/pk/ecc/ltc_ecc_is_point.c +++ b/src/ltc/pk/ecc/ltc_ecc_is_point.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ltc_ecc_is_point_at_infinity.c b/src/ltc/pk/ecc/ltc_ecc_is_point_at_infinity.c index faf7631..85bd47a 100644 --- a/src/ltc/pk/ecc/ltc_ecc_is_point_at_infinity.c +++ b/src/ltc/pk/ecc/ltc_ecc_is_point_at_infinity.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MECC diff --git a/src/ltc/pk/ecc/ltc_ecc_map.c b/src/ltc/pk/ecc/ltc_ecc_map.c index 3c57019..14ec47e 100644 --- a/src/ltc/pk/ecc/ltc_ecc_map.c +++ b/src/ltc/pk/ecc/ltc_ecc_map.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ltc_ecc_map.c diff --git a/src/ltc/pk/ecc/ltc_ecc_mul2add.c b/src/ltc/pk/ecc/ltc_ecc_mul2add.c index a2dcf5f..c9913ff 100644 --- a/src/ltc/pk/ecc/ltc_ecc_mul2add.c +++ b/src/ltc/pk/ecc/ltc_ecc_mul2add.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ltc_ecc_mul2add.c diff --git a/src/ltc/pk/ecc/ltc_ecc_mulmod.c b/src/ltc/pk/ecc/ltc_ecc_mulmod.c index ec8ba9c..d6f038d 100644 --- a/src/ltc/pk/ecc/ltc_ecc_mulmod.c +++ b/src/ltc/pk/ecc/ltc_ecc_mulmod.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ltc_ecc_mulmod.c diff --git a/src/ltc/pk/ecc/ltc_ecc_mulmod_timing.c b/src/ltc/pk/ecc/ltc_ecc_mulmod_timing.c index 9ff37d8..a10285d 100644 --- a/src/ltc/pk/ecc/ltc_ecc_mulmod_timing.c +++ b/src/ltc/pk/ecc/ltc_ecc_mulmod_timing.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ltc_ecc_mulmod_timing.c diff --git a/src/ltc/pk/ecc/ltc_ecc_points.c b/src/ltc/pk/ecc/ltc_ecc_points.c index 4a890fd..cf029db 100644 --- a/src/ltc/pk/ecc/ltc_ecc_points.c +++ b/src/ltc/pk/ecc/ltc_ecc_points.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ltc_ecc_points.c diff --git a/src/ltc/pk/ecc/ltc_ecc_projective_add_point.c b/src/ltc/pk/ecc/ltc_ecc_projective_add_point.c index eff35c9..8bd91c1 100644 --- a/src/ltc/pk/ecc/ltc_ecc_projective_add_point.c +++ b/src/ltc/pk/ecc/ltc_ecc_projective_add_point.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file ltc_ecc_projective_add_point.c diff --git a/src/ltc/pk/ecc/ltc_ecc_projective_dbl_point.c b/src/ltc/pk/ecc/ltc_ecc_projective_dbl_point.c index 1b46457..da6d515 100644 --- a/src/ltc/pk/ecc/ltc_ecc_projective_dbl_point.c +++ b/src/ltc/pk/ecc/ltc_ecc_projective_dbl_point.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /* ### Point doubling in Jacobian coordinate system ### * diff --git a/src/ltc/pk/ecc/ltc_ecc_verify_key.c b/src/ltc/pk/ecc/ltc_ecc_verify_key.c index 3d76341..b75af10 100644 --- a/src/ltc/pk/ecc/ltc_ecc_verify_key.c +++ b/src/ltc/pk/ecc/ltc_ecc_verify_key.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /* origin of this code - OLPC */ diff --git a/src/ltc/pk/pkcs1/pkcs_1_i2osp.c b/src/ltc/pk/pkcs1/pkcs_1_i2osp.c index 5324c1e..5e3e072 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_i2osp.c +++ b/src/ltc/pk/pkcs1/pkcs_1_i2osp.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_1_i2osp.c diff --git a/src/ltc/pk/pkcs1/pkcs_1_mgf1.c b/src/ltc/pk/pkcs1/pkcs_1_mgf1.c index c6283ca..c0db559 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_mgf1.c +++ b/src/ltc/pk/pkcs1/pkcs_1_mgf1.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_1_mgf1.c diff --git a/src/ltc/pk/pkcs1/pkcs_1_oaep_decode.c b/src/ltc/pk/pkcs1/pkcs_1_oaep_decode.c index 27c9245..6285502 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_oaep_decode.c +++ b/src/ltc/pk/pkcs1/pkcs_1_oaep_decode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_1_oaep_decode.c diff --git a/src/ltc/pk/pkcs1/pkcs_1_oaep_encode.c b/src/ltc/pk/pkcs1/pkcs_1_oaep_encode.c index 5042946..87e7fa9 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_oaep_encode.c +++ b/src/ltc/pk/pkcs1/pkcs_1_oaep_encode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_1_oaep_encode.c diff --git a/src/ltc/pk/pkcs1/pkcs_1_os2ip.c b/src/ltc/pk/pkcs1/pkcs_1_os2ip.c index 743c70b..f3dce66 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_os2ip.c +++ b/src/ltc/pk/pkcs1/pkcs_1_os2ip.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_1_os2ip.c diff --git a/src/ltc/pk/pkcs1/pkcs_1_pss_decode.c b/src/ltc/pk/pkcs1/pkcs_1_pss_decode.c index 8e112a1..a70d296 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_pss_decode.c +++ b/src/ltc/pk/pkcs1/pkcs_1_pss_decode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_1_pss_decode.c diff --git a/src/ltc/pk/pkcs1/pkcs_1_pss_encode.c b/src/ltc/pk/pkcs1/pkcs_1_pss_encode.c index c795114..b09d300 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_pss_encode.c +++ b/src/ltc/pk/pkcs1/pkcs_1_pss_encode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_1_pss_encode.c diff --git a/src/ltc/pk/pkcs1/pkcs_1_v1_5_decode.c b/src/ltc/pk/pkcs1/pkcs_1_v1_5_decode.c index 94e1b2a..4835ddf 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_v1_5_decode.c +++ b/src/ltc/pk/pkcs1/pkcs_1_v1_5_decode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file pkcs_1_v1_5_decode.c * diff --git a/src/ltc/pk/pkcs1/pkcs_1_v1_5_encode.c b/src/ltc/pk/pkcs1/pkcs_1_v1_5_encode.c index dd92c64..493e50b 100644 --- a/src/ltc/pk/pkcs1/pkcs_1_v1_5_encode.c +++ b/src/ltc/pk/pkcs1/pkcs_1_v1_5_encode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /*! \file pkcs_1_v1_5_encode.c * diff --git a/src/ltc/pk/rsa/rsa_decrypt_key.c b/src/ltc/pk/rsa/rsa_decrypt_key.c index 0b54dc8..704b98c 100644 --- a/src/ltc/pk/rsa/rsa_decrypt_key.c +++ b/src/ltc/pk/rsa/rsa_decrypt_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_decrypt_key.c diff --git a/src/ltc/pk/rsa/rsa_encrypt_key.c b/src/ltc/pk/rsa/rsa_encrypt_key.c index cfe80ac..57b6dce 100644 --- a/src/ltc/pk/rsa/rsa_encrypt_key.c +++ b/src/ltc/pk/rsa/rsa_encrypt_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_encrypt_key.c diff --git a/src/ltc/pk/rsa/rsa_export.c b/src/ltc/pk/rsa/rsa_export.c index e185540..6bd2199 100644 --- a/src/ltc/pk/rsa/rsa_export.c +++ b/src/ltc/pk/rsa/rsa_export.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_export.c diff --git a/src/ltc/pk/rsa/rsa_exptmod.c b/src/ltc/pk/rsa/rsa_exptmod.c index 1a79dfe..ea6e298 100644 --- a/src/ltc/pk/rsa/rsa_exptmod.c +++ b/src/ltc/pk/rsa/rsa_exptmod.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_exptmod.c diff --git a/src/ltc/pk/rsa/rsa_free.c b/src/ltc/pk/rsa/rsa_free.c index 1e62f09..f2251dd 100644 --- a/src/ltc/pk/rsa/rsa_free.c +++ b/src/ltc/pk/rsa/rsa_free.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_free.c diff --git a/src/ltc/pk/rsa/rsa_get_size.c b/src/ltc/pk/rsa/rsa_get_size.c index f58f256..748314e 100644 --- a/src/ltc/pk/rsa/rsa_get_size.c +++ b/src/ltc/pk/rsa/rsa_get_size.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_get_size.c diff --git a/src/ltc/pk/rsa/rsa_import.c b/src/ltc/pk/rsa/rsa_import.c index 8577178..bb8793d 100644 --- a/src/ltc/pk/rsa/rsa_import.c +++ b/src/ltc/pk/rsa/rsa_import.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_import.c diff --git a/src/ltc/pk/rsa/rsa_import_pkcs8.c b/src/ltc/pk/rsa/rsa_import_pkcs8.c index 0546eb0..4deab5b 100644 --- a/src/ltc/pk/rsa/rsa_import_pkcs8.c +++ b/src/ltc/pk/rsa/rsa_import_pkcs8.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_import_pkcs8.c diff --git a/src/ltc/pk/rsa/rsa_import_x509.c b/src/ltc/pk/rsa/rsa_import_x509.c index aa35e64..c615b77 100644 --- a/src/ltc/pk/rsa/rsa_import_x509.c +++ b/src/ltc/pk/rsa/rsa_import_x509.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_import.c diff --git a/src/ltc/pk/rsa/rsa_make_key.c b/src/ltc/pk/rsa/rsa_make_key.c index c5c4c28..9226b23 100644 --- a/src/ltc/pk/rsa/rsa_make_key.c +++ b/src/ltc/pk/rsa/rsa_make_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_make_key.c diff --git a/src/ltc/pk/rsa/rsa_set.c b/src/ltc/pk/rsa/rsa_set.c index 0d540c4..c89ab21 100644 --- a/src/ltc/pk/rsa/rsa_set.c +++ b/src/ltc/pk/rsa/rsa_set.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_MRSA diff --git a/src/ltc/pk/rsa/rsa_sign_hash.c b/src/ltc/pk/rsa/rsa_sign_hash.c index ef9fd44..630a203 100644 --- a/src/ltc/pk/rsa/rsa_sign_hash.c +++ b/src/ltc/pk/rsa/rsa_sign_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_sign_hash.c diff --git a/src/ltc/pk/rsa/rsa_sign_saltlen_get.c b/src/ltc/pk/rsa/rsa_sign_saltlen_get.c index c8f796f..fb9bbd2 100644 --- a/src/ltc/pk/rsa/rsa_sign_saltlen_get.c +++ b/src/ltc/pk/rsa/rsa_sign_saltlen_get.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_sign_saltlen_get.c diff --git a/src/ltc/pk/rsa/rsa_verify_hash.c b/src/ltc/pk/rsa/rsa_verify_hash.c index a454ab2..f4b6af1 100644 --- a/src/ltc/pk/rsa/rsa_verify_hash.c +++ b/src/ltc/pk/rsa/rsa_verify_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file rsa_verify_hash.c diff --git a/src/ltc/prngs/chacha20.c b/src/ltc/prngs/chacha20.c index 07290b4..4e686a0 100644 --- a/src/ltc/prngs/chacha20.c +++ b/src/ltc/prngs/chacha20.c @@ -11,7 +11,7 @@ * http://bxr.su/OpenBSD/lib/libc/crypt/arc4random.c */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA20_PRNG @@ -37,10 +37,10 @@ int chacha20_prng_start(prng_state *prng) { LTC_ARGCHK(prng != NULL); - prng->chacha.ready = 0; - XMEMSET(&prng->chacha.ent, 0, sizeof(prng->chacha.ent)); - prng->chacha.idx = 0; - LTC_MUTEX_INIT(&prng->chacha.lock) + prng->ready = 0; + XMEMSET(&prng->u.chacha.ent, 0, sizeof(prng->u.chacha.ent)); + prng->u.chacha.idx = 0; + LTC_MUTEX_INIT(&prng->lock) return CRYPT_OK; } @@ -61,25 +61,25 @@ LTC_ARGCHK(in != NULL); LTC_ARGCHK(inlen > 0); - LTC_MUTEX_LOCK(&prng->chacha.lock); - if (prng->chacha.ready) { + LTC_MUTEX_LOCK(&prng->lock); + if (prng->ready) { /* chacha20_prng_ready() was already called, do "rekey" operation */ - if ((err = chacha_keystream(&prng->chacha.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = chacha_keystream(&prng->u.chacha.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; for(i = 0; i < inlen; i++) buf[i % sizeof(buf)] ^= in[i]; /* key 32 bytes, 20 rounds */ - if ((err = chacha_setup(&prng->chacha.s, buf, 32, 20)) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = chacha_setup(&prng->u.chacha.s, buf, 32, 20)) != CRYPT_OK) goto LBL_UNLOCK; /* iv 8 bytes */ - if ((err = chacha_ivctr64(&prng->chacha.s, buf + 32, 8, 0)) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = chacha_ivctr64(&prng->u.chacha.s, buf + 32, 8, 0)) != CRYPT_OK) goto LBL_UNLOCK; /* clear KEY + IV */ zeromem(buf, sizeof(buf)); } else { /* chacha20_prng_ready() was not called yet, add entropy to ent buffer */ - while (inlen--) prng->chacha.ent[prng->chacha.idx++ % sizeof(prng->chacha.ent)] ^= *in++; + while (inlen--) prng->u.chacha.ent[prng->u.chacha.idx++ % sizeof(prng->u.chacha.ent)] ^= *in++; } err = CRYPT_OK; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->chacha.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -94,17 +94,17 @@ LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->chacha.lock); - if (prng->chacha.ready) { err = CRYPT_OK; goto LBL_UNLOCK; } + LTC_MUTEX_LOCK(&prng->lock); + if (prng->ready) { err = CRYPT_OK; goto LBL_UNLOCK; } /* key 32 bytes, 20 rounds */ - if ((err = chacha_setup(&prng->chacha.s, prng->chacha.ent, 32, 20)) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = chacha_setup(&prng->u.chacha.s, prng->u.chacha.ent, 32, 20)) != CRYPT_OK) goto LBL_UNLOCK; /* iv 8 bytes */ - if ((err = chacha_ivctr64(&prng->chacha.s, prng->chacha.ent + 32, 8, 0)) != CRYPT_OK) goto LBL_UNLOCK; - XMEMSET(&prng->chacha.ent, 0, sizeof(prng->chacha.ent)); - prng->chacha.idx = 0; - prng->chacha.ready = 1; + if ((err = chacha_ivctr64(&prng->u.chacha.s, prng->u.chacha.ent + 32, 8, 0)) != CRYPT_OK) goto LBL_UNLOCK; + XMEMSET(&prng->u.chacha.ent, 0, sizeof(prng->u.chacha.ent)); + prng->u.chacha.idx = 0; + prng->ready = 1; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->chacha.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -118,11 +118,11 @@ unsigned long chacha20_prng_read(unsigned char *out, unsigned long outlen, prng_state *prng) { if (outlen == 0 || prng == NULL || out == NULL) return 0; - LTC_MUTEX_LOCK(&prng->chacha.lock); - if (!prng->chacha.ready) { outlen = 0; goto LBL_UNLOCK; } - if (chacha_keystream(&prng->chacha.s, out, outlen) != CRYPT_OK) outlen = 0; + LTC_MUTEX_LOCK(&prng->lock); + if (!prng->ready) { outlen = 0; goto LBL_UNLOCK; } + if (chacha_keystream(&prng->u.chacha.s, out, outlen) != CRYPT_OK) outlen = 0; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->chacha.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return outlen; } @@ -135,11 +135,11 @@ { int err; LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->chacha.lock); - prng->chacha.ready = 0; - err = chacha_done(&prng->chacha.s); - LTC_MUTEX_UNLOCK(&prng->chacha.lock); - LTC_MUTEX_DESTROY(&prng->chacha.lock); + LTC_MUTEX_LOCK(&prng->lock); + prng->ready = 0; + err = chacha_done(&prng->u.chacha.s); + LTC_MUTEX_UNLOCK(&prng->lock); + LTC_MUTEX_DESTROY(&prng->lock); return err; } diff --git a/src/ltc/prngs/fortuna.c b/src/ltc/prngs/fortuna.c index 340cd03..ab56def 100644 --- a/src/ltc/prngs/fortuna.c +++ b/src/ltc/prngs/fortuna.c @@ -6,12 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" - +#include "tomcrypt_private.h" + +#ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED #if defined(_WIN32) #include +#elif defined(LTC_CLOCK_GETTIME) + #include /* struct timespec + clock_gettime */ #else - #include + #include /* struct timeval + gettimeofday */ +#endif #endif /** @@ -60,7 +64,7 @@ int x; unsigned char *IV; /* update IV */ - IV = prng->fortuna.IV; + IV = prng->u.fortuna.IV; for (x = 0; x < 16; x++) { IV[x] = (IV[x] + 1) & 255; if (IV[x] != 0) break; @@ -103,27 +107,27 @@ int err, x; #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED - unsigned long now = _fortuna_current_time(); - if (now == prng->fortuna.wd) + ulong64 now = _fortuna_current_time(); + if (now == prng->u.fortuna.wd) return CRYPT_OK; #else - if (++prng->fortuna.wd < LTC_FORTUNA_WD) + if (++prng->u.fortuna.wd < LTC_FORTUNA_WD) return CRYPT_OK; #endif /* new K == LTC_SHA256(K || s) where s == LTC_SHA256(P0) || LTC_SHA256(P1) ... */ sha256_init(&md); - if ((err = sha256_process(&md, prng->fortuna.K, 32)) != CRYPT_OK) { + if ((err = sha256_process(&md, prng->u.fortuna.K, 32)) != CRYPT_OK) { sha256_done(&md, tmp); return err; } - reset_cnt = prng->fortuna.reset_cnt + 1; + reset_cnt = prng->u.fortuna.reset_cnt + 1; for (x = 0; x < LTC_FORTUNA_POOLS; x++) { if (x == 0 || ((reset_cnt >> (x-1)) & 1) == 0) { /* terminate this hash */ - if ((err = sha256_done(&prng->fortuna.pool[x], tmp)) != CRYPT_OK) { + if ((err = sha256_done(&prng->u.fortuna.pool[x], tmp)) != CRYPT_OK) { sha256_done(&md, tmp); return err; } @@ -133,7 +137,7 @@ return err; } /* reset this pool */ - if ((err = sha256_init(&prng->fortuna.pool[x])) != CRYPT_OK) { + if ((err = sha256_init(&prng->u.fortuna.pool[x])) != CRYPT_OK) { sha256_done(&md, tmp); return err; } @@ -143,22 +147,22 @@ } /* finish key */ - if ((err = sha256_done(&md, prng->fortuna.K)) != CRYPT_OK) { - return err; - } - if ((err = rijndael_setup(prng->fortuna.K, 32, 0, &prng->fortuna.skey)) != CRYPT_OK) { + if ((err = sha256_done(&md, prng->u.fortuna.K)) != CRYPT_OK) { + return err; + } + if ((err = rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey)) != CRYPT_OK) { return err; } _fortuna_update_iv(prng); /* reset/update internals */ - prng->fortuna.pool0_len = 0; + prng->u.fortuna.pool0_len = 0; #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED - prng->fortuna.wd = now; + prng->u.fortuna.wd = now; #else - prng->fortuna.wd = 0; -#endif - prng->fortuna.reset_cnt = reset_cnt; + prng->u.fortuna.wd = 0; +#endif + prng->u.fortuna.reset_cnt = reset_cnt; #ifdef LTC_CLEAN_STACK @@ -183,10 +187,10 @@ unsigned char tmp[MAXBLOCKSIZE]; hash_state md; - LTC_MUTEX_LOCK(&prng->fortuna.lock); + LTC_MUTEX_LOCK(&prng->lock); /* new K = LTC_SHA256(K || in) */ sha256_init(&md); - if ((err = sha256_process(&md, prng->fortuna.K, 32)) != CRYPT_OK) { + if ((err = sha256_process(&md, prng->u.fortuna.K, 32)) != CRYPT_OK) { sha256_done(&md, tmp); goto LBL_UNLOCK; } @@ -195,13 +199,13 @@ goto LBL_UNLOCK; } /* finish key */ - if ((err = sha256_done(&md, prng->fortuna.K)) != CRYPT_OK) { + if ((err = sha256_done(&md, prng->u.fortuna.K)) != CRYPT_OK) { goto LBL_UNLOCK; } _fortuna_update_iv(prng); LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->fortuna.lock); + LTC_MUTEX_UNLOCK(&prng->lock); #ifdef LTC_CLEAN_STACK zeromem(&md, sizeof(md)); #endif @@ -220,31 +224,31 @@ unsigned char tmp[MAXBLOCKSIZE]; LTC_ARGCHK(prng != NULL); - prng->fortuna.ready = 0; + prng->ready = 0; /* initialize the pools */ for (x = 0; x < LTC_FORTUNA_POOLS; x++) { - if ((err = sha256_init(&prng->fortuna.pool[x])) != CRYPT_OK) { + if ((err = sha256_init(&prng->u.fortuna.pool[x])) != CRYPT_OK) { for (y = 0; y < x; y++) { - sha256_done(&prng->fortuna.pool[y], tmp); + sha256_done(&prng->u.fortuna.pool[y], tmp); } return err; } } - prng->fortuna.pool_idx = prng->fortuna.pool0_len = prng->fortuna.wd = 0; - prng->fortuna.reset_cnt = 0; + prng->u.fortuna.pool_idx = prng->u.fortuna.pool0_len = prng->u.fortuna.wd = 0; + prng->u.fortuna.reset_cnt = 0; /* reset bufs */ - zeromem(prng->fortuna.K, 32); - if ((err = rijndael_setup(prng->fortuna.K, 32, 0, &prng->fortuna.skey)) != CRYPT_OK) { + zeromem(prng->u.fortuna.K, 32); + if ((err = rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey)) != CRYPT_OK) { for (x = 0; x < LTC_FORTUNA_POOLS; x++) { - sha256_done(&prng->fortuna.pool[x], tmp); + sha256_done(&prng->u.fortuna.pool[x], tmp); } return err; } - zeromem(prng->fortuna.IV, 16); - - LTC_MUTEX_INIT(&prng->fortuna.lock) + zeromem(prng->u.fortuna.IV, 16); + + LTC_MUTEX_INIT(&prng->lock) return CRYPT_OK; } @@ -263,14 +267,14 @@ tmp[0] = (unsigned char)source; tmp[1] = (unsigned char)inlen; - if ((err = sha256_process(&prng->fortuna.pool[pool], tmp, 2)) != CRYPT_OK) { - return err; - } - if ((err = sha256_process(&prng->fortuna.pool[pool], in, inlen)) != CRYPT_OK) { + if ((err = sha256_process(&prng->u.fortuna.pool[pool], tmp, 2)) != CRYPT_OK) { + return err; + } + if ((err = sha256_process(&prng->u.fortuna.pool[pool], in, inlen)) != CRYPT_OK) { return err; } if (pool == 0) { - prng->fortuna.pool0_len += inlen; + prng->u.fortuna.pool0_len += inlen; } return CRYPT_OK; /* success */ } @@ -294,11 +298,11 @@ LTC_ARGCHK(source <= 255); LTC_ARGCHK(pool < LTC_FORTUNA_POOLS); - LTC_MUTEX_LOCK(&prng->fortuna.lock); + LTC_MUTEX_LOCK(&prng->lock); err = _fortuna_add(source, pool, in, inlen, prng); - LTC_MUTEX_UNLOCK(&prng->fortuna.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -318,16 +322,16 @@ LTC_ARGCHK(in != NULL); LTC_ARGCHK(inlen > 0); - LTC_MUTEX_LOCK(&prng->fortuna.lock); - - err = _fortuna_add(0, prng->fortuna.pool_idx, in, inlen, prng); + LTC_MUTEX_LOCK(&prng->lock); + + err = _fortuna_add(0, prng->u.fortuna.pool_idx, in, inlen, prng); if (err == CRYPT_OK) { - ++(prng->fortuna.pool_idx); - prng->fortuna.pool_idx %= LTC_FORTUNA_POOLS; - } - - LTC_MUTEX_UNLOCK(&prng->fortuna.lock); + ++(prng->u.fortuna.pool_idx); + prng->u.fortuna.pool_idx %= LTC_FORTUNA_POOLS; + } + + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -342,18 +346,18 @@ int err; LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->fortuna.lock); + LTC_MUTEX_LOCK(&prng->lock); /* make sure the reseed doesn't fail because * of the chosen rate limit */ #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED - prng->fortuna.wd = _fortuna_current_time() - 1; + prng->u.fortuna.wd = _fortuna_current_time() - 1; #else - prng->fortuna.wd = LTC_FORTUNA_WD; + prng->u.fortuna.wd = LTC_FORTUNA_WD; #endif err = _fortuna_reseed(prng); - prng->fortuna.ready = (err == CRYPT_OK) ? 1 : 0; - - LTC_MUTEX_UNLOCK(&prng->fortuna.lock); + prng->ready = (err == CRYPT_OK) ? 1 : 0; + + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -371,21 +375,21 @@ if (outlen == 0 || prng == NULL || out == NULL) return 0; - LTC_MUTEX_LOCK(&prng->fortuna.lock); - - if (!prng->fortuna.ready) { + LTC_MUTEX_LOCK(&prng->lock); + + if (!prng->ready) { goto LBL_UNLOCK; } /* do we have to reseed? */ - if (prng->fortuna.pool0_len >= 64) { + if (prng->u.fortuna.pool0_len >= 64) { if (_fortuna_reseed(prng) != CRYPT_OK) { goto LBL_UNLOCK; } } /* ensure that one reseed happened before allowing to read */ - if (prng->fortuna.reset_cnt == 0) { + if (prng->u.fortuna.reset_cnt == 0) { goto LBL_UNLOCK; } @@ -395,7 +399,7 @@ /* handle whole blocks without the extra XMEMCPY */ while (outlen >= 16) { /* encrypt the IV and store it */ - rijndael_ecb_encrypt(prng->fortuna.IV, out, &prng->fortuna.skey); + rijndael_ecb_encrypt(prng->u.fortuna.IV, out, &prng->u.fortuna.skey); out += 16; outlen -= 16; _fortuna_update_iv(prng); @@ -403,19 +407,19 @@ /* left over bytes? */ if (outlen > 0) { - rijndael_ecb_encrypt(prng->fortuna.IV, tmp, &prng->fortuna.skey); + rijndael_ecb_encrypt(prng->u.fortuna.IV, tmp, &prng->u.fortuna.skey); XMEMCPY(out, tmp, outlen); _fortuna_update_iv(prng); } /* generate new key */ - rijndael_ecb_encrypt(prng->fortuna.IV, prng->fortuna.K , &prng->fortuna.skey); + rijndael_ecb_encrypt(prng->u.fortuna.IV, prng->u.fortuna.K , &prng->u.fortuna.skey); _fortuna_update_iv(prng); - rijndael_ecb_encrypt(prng->fortuna.IV, prng->fortuna.K+16, &prng->fortuna.skey); + rijndael_ecb_encrypt(prng->u.fortuna.IV, prng->u.fortuna.K+16, &prng->u.fortuna.skey); _fortuna_update_iv(prng); - if (rijndael_setup(prng->fortuna.K, 32, 0, &prng->fortuna.skey) != CRYPT_OK) { + if (rijndael_setup(prng->u.fortuna.K, 32, 0, &prng->u.fortuna.skey) != CRYPT_OK) { tlen = 0; } @@ -423,7 +427,7 @@ #ifdef LTC_CLEAN_STACK zeromem(tmp, sizeof(tmp)); #endif - LTC_MUTEX_UNLOCK(&prng->fortuna.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return tlen; } @@ -439,12 +443,12 @@ LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->fortuna.lock); - prng->fortuna.ready = 0; + LTC_MUTEX_LOCK(&prng->lock); + prng->ready = 0; /* terminate all the hashes */ for (x = 0; x < LTC_FORTUNA_POOLS; x++) { - if ((err = sha256_done(&(prng->fortuna.pool[x]), tmp)) != CRYPT_OK) { + if ((err = sha256_done(&(prng->u.fortuna.pool[x]), tmp)) != CRYPT_OK) { goto LBL_UNLOCK; } } @@ -455,8 +459,8 @@ #ifdef LTC_CLEAN_STACK zeromem(tmp, sizeof(tmp)); #endif - LTC_MUTEX_UNLOCK(&prng->fortuna.lock); - LTC_MUTEX_DESTROY(&prng->fortuna.lock); + LTC_MUTEX_UNLOCK(&prng->lock); + LTC_MUTEX_DESTROY(&prng->lock); return err; } diff --git a/src/ltc/prngs/rc4.c b/src/ltc/prngs/rc4.c index b55ad9d..3000761 100644 --- a/src/ltc/prngs/rc4.c +++ b/src/ltc/prngs/rc4.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file prngs/rc4.c @@ -37,12 +37,12 @@ int rc4_start(prng_state *prng) { LTC_ARGCHK(prng != NULL); - prng->rc4.ready = 0; + prng->ready = 0; /* set entropy (key) size to zero */ - prng->rc4.s.x = 0; + prng->u.rc4.s.x = 0; /* clear entropy (key) buffer */ - XMEMSET(&prng->rc4.s.buf, 0, sizeof(prng->rc4.s.buf)); - LTC_MUTEX_INIT(&prng->rc4.lock) + XMEMSET(&prng->u.rc4.s.buf, 0, sizeof(prng->u.rc4.s.buf)); + LTC_MUTEX_INIT(&prng->lock) return CRYPT_OK; } @@ -63,24 +63,24 @@ LTC_ARGCHK(in != NULL); LTC_ARGCHK(inlen > 0); - LTC_MUTEX_LOCK(&prng->rc4.lock); - if (prng->rc4.ready) { + LTC_MUTEX_LOCK(&prng->lock); + if (prng->ready) { /* rc4_ready() was already called, do "rekey" operation */ - if ((err = rc4_stream_keystream(&prng->rc4.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = rc4_stream_keystream(&prng->u.rc4.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; for(i = 0; i < inlen; i++) buf[i % sizeof(buf)] ^= in[i]; /* initialize RC4 */ - if ((err = rc4_stream_setup(&prng->rc4.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = rc4_stream_setup(&prng->u.rc4.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; /* drop first 3072 bytes - https://en.wikipedia.org/wiki/RC4#Fluhrer.2C_Mantin_and_Shamir_attack */ - for (i = 0; i < 12; i++) rc4_stream_keystream(&prng->rc4.s, buf, sizeof(buf)); + for (i = 0; i < 12; i++) rc4_stream_keystream(&prng->u.rc4.s, buf, sizeof(buf)); zeromem(buf, sizeof(buf)); } else { /* rc4_ready() was not called yet, add entropy to the buffer */ - while (inlen--) prng->rc4.s.buf[prng->rc4.s.x++ % sizeof(prng->rc4.s.buf)] ^= *in++; + while (inlen--) prng->u.rc4.s.buf[prng->u.rc4.s.x++ % sizeof(prng->u.rc4.s.buf)] ^= *in++; } err = CRYPT_OK; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->rc4.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -97,17 +97,17 @@ LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->rc4.lock); - if (prng->rc4.ready) { err = CRYPT_OK; goto LBL_UNLOCK; } - XMEMCPY(buf, prng->rc4.s.buf, sizeof(buf)); + LTC_MUTEX_LOCK(&prng->lock); + if (prng->ready) { err = CRYPT_OK; goto LBL_UNLOCK; } + XMEMCPY(buf, prng->u.rc4.s.buf, sizeof(buf)); /* initialize RC4 */ - len = MIN(prng->rc4.s.x, 256); /* TODO: we can perhaps always use all 256 bytes */ - if ((err = rc4_stream_setup(&prng->rc4.s, buf, len)) != CRYPT_OK) goto LBL_UNLOCK; + len = MIN(prng->u.rc4.s.x, 256); /* TODO: we can perhaps always use all 256 bytes */ + if ((err = rc4_stream_setup(&prng->u.rc4.s, buf, len)) != CRYPT_OK) goto LBL_UNLOCK; /* drop first 3072 bytes - https://en.wikipedia.org/wiki/RC4#Fluhrer.2C_Mantin_and_Shamir_attack */ - for (i = 0; i < 12; i++) rc4_stream_keystream(&prng->rc4.s, buf, sizeof(buf)); - prng->rc4.ready = 1; + for (i = 0; i < 12; i++) rc4_stream_keystream(&prng->u.rc4.s, buf, sizeof(buf)); + prng->ready = 1; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->rc4.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -121,11 +121,11 @@ unsigned long rc4_read(unsigned char *out, unsigned long outlen, prng_state *prng) { if (outlen == 0 || prng == NULL || out == NULL) return 0; - LTC_MUTEX_LOCK(&prng->rc4.lock); - if (!prng->rc4.ready) { outlen = 0; goto LBL_UNLOCK; } - if (rc4_stream_keystream(&prng->rc4.s, out, outlen) != CRYPT_OK) outlen = 0; + LTC_MUTEX_LOCK(&prng->lock); + if (!prng->ready) { outlen = 0; goto LBL_UNLOCK; } + if (rc4_stream_keystream(&prng->u.rc4.s, out, outlen) != CRYPT_OK) outlen = 0; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->rc4.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return outlen; } @@ -138,11 +138,11 @@ { int err; LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->rc4.lock); - prng->rc4.ready = 0; - err = rc4_stream_done(&prng->rc4.s); - LTC_MUTEX_UNLOCK(&prng->rc4.lock); - LTC_MUTEX_DESTROY(&prng->rc4.lock); + LTC_MUTEX_LOCK(&prng->lock); + prng->ready = 0; + err = rc4_stream_done(&prng->u.rc4.s); + LTC_MUTEX_UNLOCK(&prng->lock); + LTC_MUTEX_DESTROY(&prng->lock); return err; } diff --git a/src/ltc/prngs/rng_get_bytes.c b/src/ltc/prngs/rng_get_bytes.c index 4e9a063..10b3cad 100644 --- a/src/ltc/prngs/rng_get_bytes.c +++ b/src/ltc/prngs/rng_get_bytes.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_RNG_GET_BYTES /** diff --git a/src/ltc/prngs/rng_make_prng.c b/src/ltc/prngs/rng_make_prng.c index 19ac1ee..fba0694 100644 --- a/src/ltc/prngs/rng_make_prng.c +++ b/src/ltc/prngs/rng_make_prng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_RNG_MAKE_PRNG /** diff --git a/src/ltc/prngs/sober128.c b/src/ltc/prngs/sober128.c index 9947cac..e194fdd 100644 --- a/src/ltc/prngs/sober128.c +++ b/src/ltc/prngs/sober128.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file prngs/sober128.c @@ -39,10 +39,10 @@ int sober128_start(prng_state *prng) { LTC_ARGCHK(prng != NULL); - prng->sober128.ready = 0; - XMEMSET(&prng->sober128.ent, 0, sizeof(prng->sober128.ent)); - prng->sober128.idx = 0; - LTC_MUTEX_INIT(&prng->sober128.lock) + prng->ready = 0; + XMEMSET(&prng->u.sober128.ent, 0, sizeof(prng->u.sober128.ent)); + prng->u.sober128.idx = 0; + LTC_MUTEX_INIT(&prng->lock) return CRYPT_OK; } @@ -63,25 +63,25 @@ LTC_ARGCHK(in != NULL); LTC_ARGCHK(inlen > 0); - LTC_MUTEX_LOCK(&prng->sober128.lock); - if (prng->sober128.ready) { + LTC_MUTEX_LOCK(&prng->lock); + if (prng->ready) { /* sober128_ready() was already called, do "rekey" operation */ - if ((err = sober128_stream_keystream(&prng->sober128.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = sober128_stream_keystream(&prng->u.sober128.s, buf, sizeof(buf))) != CRYPT_OK) goto LBL_UNLOCK; for(i = 0; i < inlen; i++) buf[i % sizeof(buf)] ^= in[i]; /* key 32 bytes, 20 rounds */ - if ((err = sober128_stream_setup(&prng->sober128.s, buf, 32)) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = sober128_stream_setup(&prng->u.sober128.s, buf, 32)) != CRYPT_OK) goto LBL_UNLOCK; /* iv 8 bytes */ - if ((err = sober128_stream_setiv(&prng->sober128.s, buf + 32, 8)) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = sober128_stream_setiv(&prng->u.sober128.s, buf + 32, 8)) != CRYPT_OK) goto LBL_UNLOCK; /* clear KEY + IV */ zeromem(buf, sizeof(buf)); } else { /* sober128_ready() was not called yet, add entropy to ent buffer */ - while (inlen--) prng->sober128.ent[prng->sober128.idx++ % sizeof(prng->sober128.ent)] ^= *in++; + while (inlen--) prng->u.sober128.ent[prng->u.sober128.idx++ % sizeof(prng->u.sober128.ent)] ^= *in++; } err = CRYPT_OK; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->sober128.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -96,17 +96,17 @@ LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->sober128.lock); - if (prng->sober128.ready) { err = CRYPT_OK; goto LBL_UNLOCK; } + LTC_MUTEX_LOCK(&prng->lock); + if (prng->ready) { err = CRYPT_OK; goto LBL_UNLOCK; } /* key 32 bytes, 20 rounds */ - if ((err = sober128_stream_setup(&prng->sober128.s, prng->sober128.ent, 32)) != CRYPT_OK) goto LBL_UNLOCK; + if ((err = sober128_stream_setup(&prng->u.sober128.s, prng->u.sober128.ent, 32)) != CRYPT_OK) goto LBL_UNLOCK; /* iv 8 bytes */ - if ((err = sober128_stream_setiv(&prng->sober128.s, prng->sober128.ent + 32, 8)) != CRYPT_OK) goto LBL_UNLOCK; - XMEMSET(&prng->sober128.ent, 0, sizeof(prng->sober128.ent)); - prng->sober128.idx = 0; - prng->sober128.ready = 1; + if ((err = sober128_stream_setiv(&prng->u.sober128.s, prng->u.sober128.ent + 32, 8)) != CRYPT_OK) goto LBL_UNLOCK; + XMEMSET(&prng->u.sober128.ent, 0, sizeof(prng->u.sober128.ent)); + prng->u.sober128.idx = 0; + prng->ready = 1; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->sober128.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -120,11 +120,11 @@ unsigned long sober128_read(unsigned char *out, unsigned long outlen, prng_state *prng) { if (outlen == 0 || prng == NULL || out == NULL) return 0; - LTC_MUTEX_LOCK(&prng->sober128.lock); - if (!prng->sober128.ready) { outlen = 0; goto LBL_UNLOCK; } - if (sober128_stream_keystream(&prng->sober128.s, out, outlen) != CRYPT_OK) outlen = 0; + LTC_MUTEX_LOCK(&prng->lock); + if (!prng->ready) { outlen = 0; goto LBL_UNLOCK; } + if (sober128_stream_keystream(&prng->u.sober128.s, out, outlen) != CRYPT_OK) outlen = 0; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->sober128.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return outlen; } @@ -137,11 +137,11 @@ { int err; LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->sober128.lock); - prng->sober128.ready = 0; - err = sober128_stream_done(&prng->sober128.s); - LTC_MUTEX_UNLOCK(&prng->sober128.lock); - LTC_MUTEX_DESTROY(&prng->sober128.lock); + LTC_MUTEX_LOCK(&prng->lock); + prng->ready = 0; + err = sober128_stream_done(&prng->u.sober128.s); + LTC_MUTEX_UNLOCK(&prng->lock); + LTC_MUTEX_DESTROY(&prng->lock); return err; } diff --git a/src/ltc/prngs/sprng.c b/src/ltc/prngs/sprng.c index b74d8da..a587606 100644 --- a/src/ltc/prngs/sprng.c +++ b/src/ltc/prngs/sprng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file sprng.c diff --git a/src/ltc/prngs/yarrow.c b/src/ltc/prngs/yarrow.c index 7d3adb5..c9d13de 100644 --- a/src/ltc/prngs/yarrow.c +++ b/src/ltc/prngs/yarrow.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file yarrow.c @@ -38,88 +38,88 @@ int err; LTC_ARGCHK(prng != NULL); - prng->yarrow.ready = 0; + prng->ready = 0; /* these are the default hash/cipher combo used */ #ifdef LTC_RIJNDAEL #if LTC_YARROW_AES==0 - prng->yarrow.cipher = register_cipher(&rijndael_enc_desc); + prng->u.yarrow.cipher = register_cipher(&rijndael_enc_desc); #elif LTC_YARROW_AES==1 - prng->yarrow.cipher = register_cipher(&aes_enc_desc); + prng->u.yarrow.cipher = register_cipher(&aes_enc_desc); #elif LTC_YARROW_AES==2 - prng->yarrow.cipher = register_cipher(&rijndael_desc); + prng->u.yarrow.cipher = register_cipher(&rijndael_desc); #elif LTC_YARROW_AES==3 - prng->yarrow.cipher = register_cipher(&aes_desc); + prng->u.yarrow.cipher = register_cipher(&aes_desc); #endif #elif defined(LTC_BLOWFISH) - prng->yarrow.cipher = register_cipher(&blowfish_desc); + prng->u.yarrow.cipher = register_cipher(&blowfish_desc); #elif defined(LTC_TWOFISH) - prng->yarrow.cipher = register_cipher(&twofish_desc); + prng->u.yarrow.cipher = register_cipher(&twofish_desc); #elif defined(LTC_RC6) - prng->yarrow.cipher = register_cipher(&rc6_desc); + prng->u.yarrow.cipher = register_cipher(&rc6_desc); #elif defined(LTC_RC5) - prng->yarrow.cipher = register_cipher(&rc5_desc); + prng->u.yarrow.cipher = register_cipher(&rc5_desc); #elif defined(LTC_SAFERP) - prng->yarrow.cipher = register_cipher(&saferp_desc); + prng->u.yarrow.cipher = register_cipher(&saferp_desc); #elif defined(LTC_RC2) - prng->yarrow.cipher = register_cipher(&rc2_desc); + prng->u.yarrow.cipher = register_cipher(&rc2_desc); #elif defined(LTC_NOEKEON) - prng->yarrow.cipher = register_cipher(&noekeon_desc); + prng->u.yarrow.cipher = register_cipher(&noekeon_desc); #elif defined(LTC_ANUBIS) - prng->yarrow.cipher = register_cipher(&anubis_desc); + prng->u.yarrow.cipher = register_cipher(&anubis_desc); #elif defined(LTC_KSEED) - prng->yarrow.cipher = register_cipher(&kseed_desc); + prng->u.yarrow.cipher = register_cipher(&kseed_desc); #elif defined(LTC_KHAZAD) - prng->yarrow.cipher = register_cipher(&khazad_desc); + prng->u.yarrow.cipher = register_cipher(&khazad_desc); #elif defined(LTC_CAST5) - prng->yarrow.cipher = register_cipher(&cast5_desc); + prng->u.yarrow.cipher = register_cipher(&cast5_desc); #elif defined(LTC_XTEA) - prng->yarrow.cipher = register_cipher(&xtea_desc); + prng->u.yarrow.cipher = register_cipher(&xtea_desc); #elif defined(LTC_SAFER) - prng->yarrow.cipher = register_cipher(&safer_sk128_desc); + prng->u.yarrow.cipher = register_cipher(&safer_sk128_desc); #elif defined(LTC_DES) - prng->yarrow.cipher = register_cipher(&des3_desc); + prng->u.yarrow.cipher = register_cipher(&des3_desc); #else #error LTC_YARROW needs at least one CIPHER #endif - if ((err = cipher_is_valid(prng->yarrow.cipher)) != CRYPT_OK) { + if ((err = cipher_is_valid(prng->u.yarrow.cipher)) != CRYPT_OK) { return err; } #ifdef LTC_SHA256 - prng->yarrow.hash = register_hash(&sha256_desc); + prng->u.yarrow.hash = register_hash(&sha256_desc); #elif defined(LTC_SHA512) - prng->yarrow.hash = register_hash(&sha512_desc); + prng->u.yarrow.hash = register_hash(&sha512_desc); #elif defined(LTC_TIGER) - prng->yarrow.hash = register_hash(&tiger_desc); + prng->u.yarrow.hash = register_hash(&tiger_desc); #elif defined(LTC_SHA1) - prng->yarrow.hash = register_hash(&sha1_desc); + prng->u.yarrow.hash = register_hash(&sha1_desc); #elif defined(LTC_RIPEMD320) - prng->yarrow.hash = register_hash(&rmd320_desc); + prng->u.yarrow.hash = register_hash(&rmd320_desc); #elif defined(LTC_RIPEMD256) - prng->yarrow.hash = register_hash(&rmd256_desc); + prng->u.yarrow.hash = register_hash(&rmd256_desc); #elif defined(LTC_RIPEMD160) - prng->yarrow.hash = register_hash(&rmd160_desc); + prng->u.yarrow.hash = register_hash(&rmd160_desc); #elif defined(LTC_RIPEMD128) - prng->yarrow.hash = register_hash(&rmd128_desc); + prng->u.yarrow.hash = register_hash(&rmd128_desc); #elif defined(LTC_MD5) - prng->yarrow.hash = register_hash(&md5_desc); + prng->u.yarrow.hash = register_hash(&md5_desc); #elif defined(LTC_MD4) - prng->yarrow.hash = register_hash(&md4_desc); + prng->u.yarrow.hash = register_hash(&md4_desc); #elif defined(LTC_MD2) - prng->yarrow.hash = register_hash(&md2_desc); + prng->u.yarrow.hash = register_hash(&md2_desc); #elif defined(LTC_WHIRLPOOL) - prng->yarrow.hash = register_hash(&whirlpool_desc); + prng->u.yarrow.hash = register_hash(&whirlpool_desc); #else #error LTC_YARROW needs at least one HASH #endif - if ((err = hash_is_valid(prng->yarrow.hash)) != CRYPT_OK) { + if ((err = hash_is_valid(prng->u.yarrow.hash)) != CRYPT_OK) { return err; } /* zero the memory used */ - zeromem(prng->yarrow.pool, sizeof(prng->yarrow.pool)); - LTC_MUTEX_INIT(&prng->yarrow.lock) + zeromem(prng->u.yarrow.pool, sizeof(prng->u.yarrow.pool)); + LTC_MUTEX_INIT(&prng->lock) return CRYPT_OK; } @@ -140,33 +140,33 @@ LTC_ARGCHK(in != NULL); LTC_ARGCHK(inlen > 0); - LTC_MUTEX_LOCK(&prng->yarrow.lock); - - if ((err = hash_is_valid(prng->yarrow.hash)) != CRYPT_OK) { + LTC_MUTEX_LOCK(&prng->lock); + + if ((err = hash_is_valid(prng->u.yarrow.hash)) != CRYPT_OK) { goto LBL_UNLOCK; } /* start the hash */ - if ((err = hash_descriptor[prng->yarrow.hash].init(&md)) != CRYPT_OK) { + if ((err = hash_descriptor[prng->u.yarrow.hash].init(&md)) != CRYPT_OK) { goto LBL_UNLOCK; } /* hash the current pool */ - if ((err = hash_descriptor[prng->yarrow.hash].process(&md, prng->yarrow.pool, - hash_descriptor[prng->yarrow.hash].hashsize)) != CRYPT_OK) { + if ((err = hash_descriptor[prng->u.yarrow.hash].process(&md, prng->u.yarrow.pool, + hash_descriptor[prng->u.yarrow.hash].hashsize)) != CRYPT_OK) { goto LBL_UNLOCK; } /* add the new entropy */ - if ((err = hash_descriptor[prng->yarrow.hash].process(&md, in, inlen)) != CRYPT_OK) { + if ((err = hash_descriptor[prng->u.yarrow.hash].process(&md, in, inlen)) != CRYPT_OK) { goto LBL_UNLOCK; } /* store result */ - err = hash_descriptor[prng->yarrow.hash].done(&md, prng->yarrow.pool); + err = hash_descriptor[prng->u.yarrow.hash].done(&md, prng->u.yarrow.pool); LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->yarrow.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -181,34 +181,34 @@ LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->yarrow.lock); - - if ((err = hash_is_valid(prng->yarrow.hash)) != CRYPT_OK) { - goto LBL_UNLOCK; - } - - if ((err = cipher_is_valid(prng->yarrow.cipher)) != CRYPT_OK) { + LTC_MUTEX_LOCK(&prng->lock); + + if ((err = hash_is_valid(prng->u.yarrow.hash)) != CRYPT_OK) { + goto LBL_UNLOCK; + } + + if ((err = cipher_is_valid(prng->u.yarrow.cipher)) != CRYPT_OK) { goto LBL_UNLOCK; } /* setup CTR mode using the "pool" as the key */ - ks = (int)hash_descriptor[prng->yarrow.hash].hashsize; - if ((err = cipher_descriptor[prng->yarrow.cipher].keysize(&ks)) != CRYPT_OK) { - goto LBL_UNLOCK; - } - - if ((err = ctr_start(prng->yarrow.cipher, /* what cipher to use */ - prng->yarrow.pool, /* IV */ - prng->yarrow.pool, ks, /* KEY and key size */ + ks = (int)hash_descriptor[prng->u.yarrow.hash].hashsize; + if ((err = cipher_descriptor[prng->u.yarrow.cipher].keysize(&ks)) != CRYPT_OK) { + goto LBL_UNLOCK; + } + + if ((err = ctr_start(prng->u.yarrow.cipher, /* what cipher to use */ + prng->u.yarrow.pool, /* IV */ + prng->u.yarrow.pool, ks, /* KEY and key size */ 0, /* number of rounds */ CTR_COUNTER_LITTLE_ENDIAN, /* little endian counter */ - &prng->yarrow.ctr)) != CRYPT_OK) { - goto LBL_UNLOCK; - } - prng->yarrow.ready = 1; + &prng->u.yarrow.ctr)) != CRYPT_OK) { + goto LBL_UNLOCK; + } + prng->ready = 1; LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->yarrow.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return err; } @@ -223,9 +223,9 @@ { if (outlen == 0 || prng == NULL || out == NULL) return 0; - LTC_MUTEX_LOCK(&prng->yarrow.lock); - - if (!prng->yarrow.ready) { + LTC_MUTEX_LOCK(&prng->lock); + + if (!prng->ready) { outlen = 0; goto LBL_UNLOCK; } @@ -234,12 +234,12 @@ zeromem(out, outlen); /* now randomize it */ - if (ctr_encrypt(out, out, outlen, &prng->yarrow.ctr) != CRYPT_OK) { + if (ctr_encrypt(out, out, outlen, &prng->u.yarrow.ctr) != CRYPT_OK) { outlen = 0; } LBL_UNLOCK: - LTC_MUTEX_UNLOCK(&prng->yarrow.lock); + LTC_MUTEX_UNLOCK(&prng->lock); return outlen; } @@ -253,16 +253,16 @@ int err; LTC_ARGCHK(prng != NULL); - LTC_MUTEX_LOCK(&prng->yarrow.lock); - prng->yarrow.ready = 0; + LTC_MUTEX_LOCK(&prng->lock); + prng->ready = 0; /* call cipher done when we invent one ;-) */ /* we invented one */ - err = ctr_done(&prng->yarrow.ctr); - - LTC_MUTEX_UNLOCK(&prng->yarrow.lock); - LTC_MUTEX_DESTROY(&prng->yarrow.lock); + err = ctr_done(&prng->u.yarrow.ctr); + + LTC_MUTEX_UNLOCK(&prng->lock); + LTC_MUTEX_DESTROY(&prng->lock); return err; } @@ -312,12 +312,12 @@ } /* now let's test the hash/cipher that was chosen */ - if (cipher_descriptor[prng.yarrow.cipher].test && - ((err = cipher_descriptor[prng.yarrow.cipher].test()) != CRYPT_OK)) { - return err; - } - if (hash_descriptor[prng.yarrow.hash].test && - ((err = hash_descriptor[prng.yarrow.hash].test()) != CRYPT_OK)) { + if (cipher_descriptor[prng.u.yarrow.cipher].test && + ((err = cipher_descriptor[prng.u.yarrow.cipher].test()) != CRYPT_OK)) { + return err; + } + if (hash_descriptor[prng.u.yarrow.hash].test && + ((err = hash_descriptor[prng.u.yarrow.hash].test()) != CRYPT_OK)) { return err; } diff --git a/src/ltc/stream/chacha/chacha_crypt.c b/src/ltc/stream/chacha/chacha_crypt.c index 6814058..d72c84e 100644 --- a/src/ltc/stream/chacha/chacha_crypt.c +++ b/src/ltc/stream/chacha/chacha_crypt.c @@ -12,7 +12,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA diff --git a/src/ltc/stream/chacha/chacha_done.c b/src/ltc/stream/chacha/chacha_done.c index 9f0196e..dbf6f24 100644 --- a/src/ltc/stream/chacha/chacha_done.c +++ b/src/ltc/stream/chacha/chacha_done.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA diff --git a/src/ltc/stream/chacha/chacha_ivctr32.c b/src/ltc/stream/chacha/chacha_ivctr32.c index c9a6dbb..72856a0 100644 --- a/src/ltc/stream/chacha/chacha_ivctr32.c +++ b/src/ltc/stream/chacha/chacha_ivctr32.c @@ -12,7 +12,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA diff --git a/src/ltc/stream/chacha/chacha_ivctr64.c b/src/ltc/stream/chacha/chacha_ivctr64.c index 643d11f..f7cf721 100644 --- a/src/ltc/stream/chacha/chacha_ivctr64.c +++ b/src/ltc/stream/chacha/chacha_ivctr64.c @@ -12,7 +12,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA diff --git a/src/ltc/stream/chacha/chacha_keystream.c b/src/ltc/stream/chacha/chacha_keystream.c index 25eb63a..e399d08 100644 --- a/src/ltc/stream/chacha/chacha_keystream.c +++ b/src/ltc/stream/chacha/chacha_keystream.c @@ -12,7 +12,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA diff --git a/src/ltc/stream/chacha/chacha_setup.c b/src/ltc/stream/chacha/chacha_setup.c index e34370b..e997fc9 100644 --- a/src/ltc/stream/chacha/chacha_setup.c +++ b/src/ltc/stream/chacha/chacha_setup.c @@ -12,7 +12,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_CHACHA diff --git a/src/ltc/stream/rabbit/rabbit.c b/src/ltc/stream/rabbit/rabbit.c index cf6ec0b..4607bc9 100644 --- a/src/ltc/stream/rabbit/rabbit.c +++ b/src/ltc/stream/rabbit/rabbit.c @@ -62,7 +62,7 @@ ******************************************************************************/ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_RABBIT diff --git a/src/ltc/stream/rc4/rc4_stream.c b/src/ltc/stream/rc4/rc4_stream.c index 178489d..f1c225d 100644 --- a/src/ltc/stream/rc4/rc4_stream.c +++ b/src/ltc/stream/rc4/rc4_stream.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_RC4_STREAM diff --git a/src/ltc/stream/salsa20/salsa20_crypt.c b/src/ltc/stream/salsa20/salsa20_crypt.c index 9bf2053..bf1b001 100644 --- a/src/ltc/stream/salsa20/salsa20_crypt.c +++ b/src/ltc/stream/salsa20/salsa20_crypt.c @@ -13,7 +13,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SALSA20 @@ -62,7 +62,7 @@ LTC_ARGCHK(st != NULL); LTC_ARGCHK(in != NULL); LTC_ARGCHK(out != NULL); - LTC_ARGCHK(st->ivlen == 8); + LTC_ARGCHK(st->ivlen == 8 || st->ivlen == 24); if (st->ksleft > 0) { j = MIN(st->ksleft, inlen); diff --git a/src/ltc/stream/salsa20/salsa20_done.c b/src/ltc/stream/salsa20/salsa20_done.c index 4b7a9f9..086f263 100644 --- a/src/ltc/stream/salsa20/salsa20_done.c +++ b/src/ltc/stream/salsa20/salsa20_done.c @@ -7,7 +7,7 @@ * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SALSA20 diff --git a/src/ltc/stream/salsa20/salsa20_ivctr64.c b/src/ltc/stream/salsa20/salsa20_ivctr64.c index 0677153..9c7ac74 100644 --- a/src/ltc/stream/salsa20/salsa20_ivctr64.c +++ b/src/ltc/stream/salsa20/salsa20_ivctr64.c @@ -13,7 +13,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SALSA20 diff --git a/src/ltc/stream/salsa20/salsa20_keystream.c b/src/ltc/stream/salsa20/salsa20_keystream.c index c443a3e..dddfeaa 100644 --- a/src/ltc/stream/salsa20/salsa20_keystream.c +++ b/src/ltc/stream/salsa20/salsa20_keystream.c @@ -13,7 +13,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SALSA20 diff --git a/src/ltc/stream/salsa20/salsa20_setup.c b/src/ltc/stream/salsa20/salsa20_setup.c index 6eb65e8..872bd12 100644 --- a/src/ltc/stream/salsa20/salsa20_setup.c +++ b/src/ltc/stream/salsa20/salsa20_setup.c @@ -13,7 +13,7 @@ * Public domain from D. J. Bernstein */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SALSA20 diff --git a/src/ltc/stream/salsa20/xsalsa20_setup.c b/src/ltc/stream/salsa20/xsalsa20_setup.c new file mode 100644 index 0000000..94133a7 --- /dev/null +++ b/src/ltc/stream/salsa20/xsalsa20_setup.c @@ -0,0 +1,137 @@ +/* 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. + */ + +/* The implementation is based on: + * "Extending the Salsa20 nonce", https://cr.yp.to/snuffle/xsalsa-20081128.pdf + * "Salsa20 specification", http://cr.yp.to/snuffle/spec.pdf + * and salsa20-ref.c version 20051118 + * Public domain from D. J. Bernstein + */ + +#include "tomcrypt.h" + +#ifdef LTC_XSALSA20 + +static const char * const constants = "expand 32-byte k"; + +#define QUARTERROUND(a,b,c,d) \ + x[b] ^= (ROL((x[a] + x[d]), 7)); \ + x[c] ^= (ROL((x[b] + x[a]), 9)); \ + x[d] ^= (ROL((x[c] + x[b]), 13)); \ + x[a] ^= (ROL((x[d] + x[c]), 18)); + +/* use modified salsa20 doubleround (no final addition as in salsa20) */ +static void _xsalsa20_doubleround(ulong32 *x, int rounds) +{ + int i; + + for (i = rounds; i > 0; i -= 2) { + /* columnround */ + QUARTERROUND( 0, 4, 8,12) + QUARTERROUND( 5, 9,13, 1) + QUARTERROUND(10,14, 2, 6) + QUARTERROUND(15, 3, 7,11) + /* rowround */ + QUARTERROUND( 0, 1, 2, 3) + QUARTERROUND( 5, 6, 7, 4) + QUARTERROUND(10,11, 8, 9) + QUARTERROUND(15,12,13,14) + } +} + +#undef QUARTERROUND + +/** + Initialize an XSalsa20 context + @param st [out] The destination of the XSalsa20 state + @param key The secret key + @param keylen The length of the secret key, must be 32 (octets) + @param nonce The nonce + @param noncelen The length of the nonce, must be 24 (octets) + @param rounds Number of rounds (must be evenly divisible by 2, default is 20) + @return CRYPT_OK if successful +*/ +int xsalsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long keylen, + const unsigned char *nonce, unsigned long noncelen, + int rounds) +{ + const int sti[] = {0, 5, 10, 15, 6, 7, 8, 9}; /* indices used to build subkey fm x */ + ulong32 x[64]; /* input to & output fm doubleround */ + unsigned char subkey[32]; + int i; + + LTC_ARGCHK(st != NULL); + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(keylen == 32); + LTC_ARGCHK(nonce != NULL); + LTC_ARGCHK(noncelen == 24); + if (rounds == 0) rounds = 20; + LTC_ARGCHK(rounds % 2 == 0); /* number of rounds must be evenly divisible by 2 */ + + /* load the state to "hash" the key */ + LOAD32L(x[ 0], constants + 0); + LOAD32L(x[ 5], constants + 4); + LOAD32L(x[10], constants + 8); + LOAD32L(x[15], constants + 12); + LOAD32L(x[ 1], key + 0); + LOAD32L(x[ 2], key + 4); + LOAD32L(x[ 3], key + 8); + LOAD32L(x[ 4], key + 12); + LOAD32L(x[11], key + 16); + LOAD32L(x[12], key + 20); + LOAD32L(x[13], key + 24); + LOAD32L(x[14], key + 28); + LOAD32L(x[ 6], nonce + 0); + LOAD32L(x[ 7], nonce + 4); + LOAD32L(x[ 8], nonce + 8); + LOAD32L(x[ 9], nonce + 12); + + /* use modified salsa20 doubleround (no final addition) */ + _xsalsa20_doubleround(x, rounds); + + /* extract the subkey */ + for (i = 0; i < 8; ++i) { + STORE32L(x[sti[i]], subkey + 4 * i); + } + + /* load the final initial state */ + LOAD32L(st->input[ 0], constants + 0); + LOAD32L(st->input[ 5], constants + 4); + LOAD32L(st->input[10], constants + 8); + LOAD32L(st->input[15], constants + 12); + LOAD32L(st->input[ 1], subkey + 0); + LOAD32L(st->input[ 2], subkey + 4); + LOAD32L(st->input[ 3], subkey + 8); + LOAD32L(st->input[ 4], subkey + 12); + LOAD32L(st->input[11], subkey + 16); + LOAD32L(st->input[12], subkey + 20); + LOAD32L(st->input[13], subkey + 24); + LOAD32L(st->input[14], subkey + 28); + LOAD32L(st->input[ 6], &(nonce[16]) + 0); + LOAD32L(st->input[ 7], &(nonce[16]) + 4); + st->input[ 8] = 0; + st->input[ 9] = 0; + st->rounds = rounds; + st->ksleft = 0; + st->ivlen = 24; /* set switch to say nonce/IV has been loaded */ + +#ifdef LTC_CLEAN_STACK + zeromem(x, sizeof(x)); + zeromem(subkey, sizeof(subkey)); +#endif + + return CRYPT_OK; +} + + +#endif + +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/src/ltc/stream/sober128/sober128_stream.c b/src/ltc/stream/sober128/sober128_stream.c index 7b21edf..44e0c32 100644 --- a/src/ltc/stream/sober128/sober128_stream.c +++ b/src/ltc/stream/sober128/sober128_stream.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" /** @file sober128_stream.c diff --git a/src/ltc/stream/sosemanuk/sosemanuk.c b/src/ltc/stream/sosemanuk/sosemanuk.c index 60ce30a..7c5a602 100644 --- a/src/ltc/stream/sosemanuk/sosemanuk.c +++ b/src/ltc/stream/sosemanuk/sosemanuk.c @@ -30,7 +30,7 @@ * */ -#include "tomcrypt.h" +#include "tomcrypt_private.h" #ifdef LTC_SOSEMANUK @@ -257,16 +257,12 @@ LTC_ARGCHK(ss != NULL); LTC_ARGCHK(key != NULL); + LTC_ARGCHK(keylen > 0 && keylen <= 32); /* * The key is copied into the wbuf[] buffer and padded to 256 bits * as described in the Serpent specification. */ - if (keylen == 0 || keylen > 32) { - fprintf(stderr, "invalid key size: %lu\n", - (unsigned long)keylen); - exit(EXIT_FAILURE); - } XMEMCPY(wbuf, key, keylen); if (keylen < 32) { wbuf[keylen] = 0x01;