diff options
Diffstat (limited to 'libtomcrypt/src')
318 files changed, 3440 insertions, 2119 deletions
diff --git a/libtomcrypt/src/ciphers/aes/aes.c b/libtomcrypt/src/ciphers/aes/aes.c index 55f6333..3481fe2 100644 --- a/libtomcrypt/src/ciphers/aes/aes.c +++ b/libtomcrypt/src/ciphers/aes/aes.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* AES implementation by Tom St Denis @@ -32,7 +32,7 @@ #include "tomcrypt.h" -#ifdef RIJNDAEL +#ifdef LTC_RIJNDAEL #ifndef ENCRYPT_ONLY @@ -765,6 +765,6 @@ int ECB_KS(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/aes/aes.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/aes/aes_tab.c b/libtomcrypt/src/ciphers/aes/aes_tab.c index 0ef9731..ca7008d 100644 --- a/libtomcrypt/src/ciphers/aes/aes_tab.c +++ b/libtomcrypt/src/ciphers/aes/aes_tab.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* The precomputed tables for AES */ /* @@ -1023,6 +1023,6 @@ static const ulong32 rcon[] = { 0x1B000000UL, 0x36000000UL, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ }; -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/aes/aes_tab.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/04/02 13:19:09 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/anubis.c b/libtomcrypt/src/ciphers/anubis.c index 9a0722c..229d5e8 100644 --- a/libtomcrypt/src/ciphers/anubis.c +++ b/libtomcrypt/src/ciphers/anubis.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -17,7 +17,7 @@ #include "tomcrypt.h" -#ifdef ANUBIS +#ifdef LTC_ANUBIS const struct ltc_cipher_descriptor anubis_desc = { "anubis", @@ -48,7 +48,7 @@ const struct ltc_cipher_descriptor anubis_desc = { * (but little-endian notation would be equally suitable if consistently * employed). */ -#if defined(ANUBIS_TWEAK) +#if defined(LTC_ANUBIS_TWEAK) static const ulong32 T0[256] = { 0xba69d2bbU, 0x54a84de5U, 0x2f5ebce2U, 0x74e8cd25U, @@ -1174,8 +1174,8 @@ int anubis_test(void) int keylen; unsigned char pt[16], ct[16], key[40]; } tests[] = { -#ifndef ANUBIS_TWEAK - /**** ORIGINAL ANUBIS ****/ +#ifndef LTC_ANUBIS_TWEAK + /**** ORIGINAL LTC_ANUBIS ****/ /* 128 bit keys */ { 16, @@ -1333,7 +1333,7 @@ int anubis_test(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } } #else - /**** Tweaked ANUBIS ****/ + /**** Tweaked LTC_ANUBIS ****/ /* 128 bit keys */ { 16, @@ -1553,6 +1553,6 @@ int anubis_keysize(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/anubis.c,v $ */ -/* $Revision: 1.15 $ */ -/* $Date: 2006/11/15 12:41:28 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/blowfish.c b/libtomcrypt/src/ciphers/blowfish.c index ae8945f..6a55abc 100644 --- a/libtomcrypt/src/ciphers/blowfish.c +++ b/libtomcrypt/src/ciphers/blowfish.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file blowfish.c @@ -14,7 +14,7 @@ */ #include "tomcrypt.h" -#ifdef BLOWFISH +#ifdef LTC_BLOWFISH const struct ltc_cipher_descriptor blowfish_desc = { @@ -589,6 +589,6 @@ int blowfish_keysize(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/blowfish.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/cast5.c b/libtomcrypt/src/ciphers/cast5.c index eba39da..ffc2f28 100644 --- a/libtomcrypt/src/ciphers/cast5.c +++ b/libtomcrypt/src/ciphers/cast5.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file cast5.c - Implementation of CAST5 (RFC 2144) by Tom St Denis + Implementation of LTC_CAST5 (RFC 2144) by Tom St Denis */ #include "tomcrypt.h" -#ifdef CAST5 +#ifdef LTC_CAST5 const struct ltc_cipher_descriptor cast5_desc = { "cast5", @@ -398,7 +398,7 @@ static const ulong32 S8[256] = { #endif /** - Initialize the CAST5 block cipher + Initialize the LTC_CAST5 block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -530,7 +530,7 @@ INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr) } /** - Encrypts a block of text with CAST5 + Encrypts a block of text with LTC_CAST5 @param pt The input plaintext (8 bytes) @param ct The output ciphertext (8 bytes) @param skey The key as scheduled @@ -583,7 +583,7 @@ int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key #endif /** - Decrypts a block of text with CAST5 + Decrypts a block of text with LTC_CAST5 @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) @param skey The key as scheduled @@ -636,7 +636,7 @@ int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key #endif /** - Performs a self-test of the CAST5 block cipher + Performs a self-test of the LTC_CAST5 block cipher @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled */ int cast5_test(void) @@ -715,6 +715,6 @@ int cast5_keysize(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/cast5.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/des.c b/libtomcrypt/src/ciphers/des.c index 6005e84..338dcc2 100644 --- a/libtomcrypt/src/ciphers/des.c +++ b/libtomcrypt/src/ciphers/des.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file des.c - DES code submitted by Dobes Vandermeer + LTC_DES code submitted by Dobes Vandermeer */ -#ifdef DES +#ifdef LTC_DES #define EN0 0 #define DE1 1 @@ -1522,7 +1522,7 @@ static void desfunc(ulong32 *block, const ulong32 *keys) #if 0 /** - Initialize the DES block cipher + Initialize the LTC_DES block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -1550,7 +1550,7 @@ int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke #endif /** - Initialize the 3DES-EDE block cipher + Initialize the 3LTC_DES-EDE block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -1583,7 +1583,7 @@ int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_k #if 0 /** - Encrypts a block of text with DES + Encrypts a block of text with LTC_DES @param pt The input plaintext (8 bytes) @param ct The output ciphertext (8 bytes) @param skey The key as scheduled @@ -1604,7 +1604,7 @@ int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *s } /** - Decrypts a block of text with DES + Decrypts a block of text with LTC_DES @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) @param skey The key as scheduled @@ -1626,7 +1626,7 @@ int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s #endif /** - Encrypts a block of text with 3DES-EDE + Encrypts a block of text with 3LTC_DES-EDE @param pt The input plaintext (8 bytes) @param ct The output ciphertext (8 bytes) @param skey The key as scheduled @@ -1650,7 +1650,7 @@ int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key * } /** - Decrypts a block of text with 3DES-EDE + Decrypts a block of text with 3LTC_DES-EDE @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) @param skey The key as scheduled @@ -1674,7 +1674,7 @@ int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key * #if 0 /** - Performs a self-test of the DES block cipher + Performs a self-test of the LTC_DES block cipher @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled */ int des_test(void) @@ -1910,6 +1910,6 @@ int des3_keysize(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/des.c,v $ */ -/* $Revision: 1.13 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/kasumi.c b/libtomcrypt/src/ciphers/kasumi.c index 4a075b1..3b765d0 100644 --- a/libtomcrypt/src/ciphers/kasumi.c +++ b/libtomcrypt/src/ciphers/kasumi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -313,6 +313,6 @@ int kasumi_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/kasumi.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/09 03:05:44 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/khazad.c b/libtomcrypt/src/ciphers/khazad.c index 8490950..a3c67d5 100644 --- a/libtomcrypt/src/ciphers/khazad.c +++ b/libtomcrypt/src/ciphers/khazad.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -16,7 +16,7 @@ Authors: Paulo S.L.M. Barreto and Vincent Rijmen. */ -#ifdef KHAZAD +#ifdef LTC_KHAZAD const struct ltc_cipher_descriptor khazad_desc = { "khazad", @@ -850,6 +850,6 @@ int khazad_keysize(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/khazad.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/kseed.c b/libtomcrypt/src/ciphers/kseed.c index 4281ac5..a163c95 100644 --- a/libtomcrypt/src/ciphers/kseed.c +++ b/libtomcrypt/src/ciphers/kseed.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -17,7 +17,7 @@ #include "tomcrypt.h" -#ifdef KSEED +#ifdef LTC_KSEED const struct ltc_cipher_descriptor kseed_desc = { "seed", @@ -371,6 +371,6 @@ int kseed_keysize(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/kseed.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/multi2.c b/libtomcrypt/src/ciphers/multi2.c new file mode 100644 index 0000000..db0b3ba --- /dev/null +++ b/libtomcrypt/src/ciphers/multi2.c @@ -0,0 +1,303 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ + +/** + @file multi2.c + Multi-2 implementation (not public domain, hence the default disable) +*/ +#include "tomcrypt.h" + +#ifdef LTC_MULTI2 + +static void pi1(ulong32 *p) +{ + p[1] ^= p[0]; +} + +static void pi2(ulong32 *p, ulong32 *k) +{ + ulong32 t; + t = (p[1] + k[0]) & 0xFFFFFFFFUL; + t = (ROL(t, 1) + t - 1) & 0xFFFFFFFFUL; + t = (ROL(t, 4) ^ t) & 0xFFFFFFFFUL; + p[0] ^= t; +} + +static void pi3(ulong32 *p, ulong32 *k) +{ + ulong32 t; + t = p[0] + k[1]; + t = (ROL(t, 2) + t + 1) & 0xFFFFFFFFUL; + t = (ROL(t, 8) ^ t) & 0xFFFFFFFFUL; + t = (t + k[2]) & 0xFFFFFFFFUL; + t = (ROL(t, 1) - t) & 0xFFFFFFFFUL; + t = ROL(t, 16) ^ (p[0] | t); + p[1] ^= t; +} + +static void pi4(ulong32 *p, ulong32 *k) +{ + ulong32 t; + t = (p[1] + k[3]) & 0xFFFFFFFFUL; + t = (ROL(t, 2) + t + 1) & 0xFFFFFFFFUL; + p[0] ^= t; +} + +static void setup(ulong32 *dk, ulong32 *k, ulong32 *uk) +{ + int n, t; + ulong32 p[2]; + + p[0] = dk[0]; p[1] = dk[1]; + + t = 4; + n = 0; + pi1(p); + pi2(p, k); + uk[n++] = p[0]; + pi3(p, k); + uk[n++] = p[1]; + pi4(p, k); + uk[n++] = p[0]; + pi1(p); + uk[n++] = p[1]; + pi2(p, k+t); + uk[n++] = p[0]; + pi3(p, k+t); + uk[n++] = p[1]; + pi4(p, k+t); + uk[n++] = p[0]; + pi1(p); + uk[n++] = p[1]; +} + +static void encrypt(ulong32 *p, int N, ulong32 *uk) +{ + int n, t; + for (t = n = 0; ; ) { + pi1(p); if (++n == N) break; + pi2(p, uk+t); if (++n == N) break; + pi3(p, uk+t); if (++n == N) break; + pi4(p, uk+t); if (++n == N) break; + t ^= 4; + } +} + +static void decrypt(ulong32 *p, int N, ulong32 *uk) +{ + int n, t; + for (t = 4*((N&1)^1), n = N; ; ) { + switch (n >= 4 ? 4 : 0) { + case 4: pi4(p, uk+t); --n; + case 3: pi3(p, uk+t); --n; + case 2: pi2(p, uk+t); --n; + case 1: pi1(p); --n; break; + case 0: return; + } + t ^= 4; + } +} + +const struct ltc_cipher_descriptor multi2_desc = { + "multi2", + 22, + 40, 40, 8, 128, + &multi2_setup, + &multi2_ecb_encrypt, + &multi2_ecb_decrypt, + &multi2_test, + &multi2_done, + &multi2_keysize, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; + +int multi2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) +{ + ulong32 sk[8], dk[2]; + int x; + + LTC_ARGCHK(key != NULL); + LTC_ARGCHK(skey != NULL); + + if (keylen != 40) return CRYPT_INVALID_KEYSIZE; + if (num_rounds == 0) num_rounds = 128; + + skey->multi2.N = num_rounds; + for (x = 0; x < 8; x++) { + LOAD32H(sk[x], key + x*4); + } + LOAD32H(dk[0], key + 32); + LOAD32H(dk[1], key + 36); + setup(dk, sk, skey->multi2.uk); + + zeromem(sk, sizeof(sk)); + zeromem(dk, sizeof(dk)); + return CRYPT_OK; +} + +/** + Encrypts a block of text with multi2 + @param pt The input plaintext (8 bytes) + @param ct The output ciphertext (8 bytes) + @param skey The key as scheduled + @return CRYPT_OK if successful +*/ +int multi2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) +{ + ulong32 p[2]; + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(skey != NULL); + LOAD32H(p[0], pt); + LOAD32H(p[1], pt+4); + encrypt(p, skey->multi2.N, skey->multi2.uk); + STORE32H(p[0], ct); + STORE32H(p[1], ct+4); + return CRYPT_OK; +} + +/** + Decrypts a block of text with multi2 + @param ct The input ciphertext (8 bytes) + @param pt The output plaintext (8 bytes) + @param skey The key as scheduled + @return CRYPT_OK if successful +*/ +int multi2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) +{ + ulong32 p[2]; + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(skey != NULL); + LOAD32H(p[0], ct); + LOAD32H(p[1], ct+4); + decrypt(p, skey->multi2.N, skey->multi2.uk); + STORE32H(p[0], pt); + STORE32H(p[1], pt+4); + return CRYPT_OK; +} + +/** + Performs a self-test of the multi2 block cipher + @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled +*/ +int multi2_test(void) +{ + static const struct { + unsigned char key[40]; + unsigned char pt[8], ct[8]; + int rounds; + } tests[] = { +{ + { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x01, 0x23, 0x45, 0x67, + 0x89, 0xAB, 0xCD, 0xEF + }, + { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + }, + { + 0xf8, 0x94, 0x40, 0x84, + 0x5e, 0x11, 0xcf, 0x89 + }, + 128, +}, +{ + { + 0x35, 0x91, 0x9d, 0x96, + 0x07, 0x02, 0xe2, 0xce, + 0x8d, 0x0b, 0x58, 0x3c, + 0xc9, 0xc8, 0x9d, 0x59, + 0xa2, 0xae, 0x96, 0x4e, + 0x87, 0x82, 0x45, 0xed, + 0x3f, 0x2e, 0x62, 0xd6, + 0x36, 0x35, 0xd0, 0x67, + + 0xb1, 0x27, 0xb9, 0x06, + 0xe7, 0x56, 0x22, 0x38, + }, + { + 0x1f, 0xb4, 0x60, 0x60, + 0xd0, 0xb3, 0x4f, 0xa5 + }, + { + 0xca, 0x84, 0xa9, 0x34, + 0x75, 0xc8, 0x60, 0xe5 + }, + 216, +} +}; + unsigned char buf[8]; + symmetric_key skey; + int err, x; + + for (x = 1; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { + if ((err = multi2_setup(tests[x].key, 40, tests[x].rounds, &skey)) != CRYPT_OK) { + return err; + } + if ((err = multi2_ecb_encrypt(tests[x].pt, buf, &skey)) != CRYPT_OK) { + return err; + } + + if (XMEMCMP(buf, tests[x].ct, 8)) { + return CRYPT_FAIL_TESTVECTOR; + } + + if ((err = multi2_ecb_decrypt(buf, buf, &skey)) != CRYPT_OK) { + return err; + } + if (XMEMCMP(buf, tests[x].pt, 8)) { + return CRYPT_FAIL_TESTVECTOR; + } + } + + return CRYPT_OK; +} + +/** Terminate the context + @param skey The scheduled key +*/ +void multi2_done(symmetric_key *skey) +{ +} + +/** + Gets suitable key size + @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable. + @return CRYPT_OK if the input key size is acceptable. +*/ +int multi2_keysize(int *keysize) +{ + LTC_ARGCHK(keysize != NULL); + if (*keysize >= 40) { + *keysize = 40; + } else { + return CRYPT_INVALID_KEYSIZE; + } + return CRYPT_OK; +} + +#endif + +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/noekeon.c b/libtomcrypt/src/ciphers/noekeon.c index f467ff2..bdbcb2a 100644 --- a/libtomcrypt/src/ciphers/noekeon.c +++ b/libtomcrypt/src/ciphers/noekeon.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file noekeon.c @@ -14,7 +14,7 @@ */ #include "tomcrypt.h" -#ifdef NOEKEON +#ifdef LTC_NOEKEON const struct ltc_cipher_descriptor noekeon_desc = { @@ -298,6 +298,6 @@ int noekeon_keysize(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/noekeon.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/rc2.c b/libtomcrypt/src/ciphers/rc2.c index de62cda..256f074 100644 --- a/libtomcrypt/src/ciphers/rc2.c +++ b/libtomcrypt/src/ciphers/rc2.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /**********************************************************************\ * To commemorate the 1996 RSA Data Security Conference, the following * @@ -22,10 +22,10 @@ /** @file rc2.c - Implementation of RC2 + Implementation of LTC_RC2 */ -#ifdef RC2 +#ifdef LTC_RC2 const struct ltc_cipher_descriptor rc2_desc = { "rc2", @@ -60,7 +60,7 @@ static const unsigned char permute[256] = { }; /** - Initialize the RC2 block cipher + Initialize the LTC_RC2 block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -121,7 +121,7 @@ int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke * Encrypt an 8-byte block of plaintext using the given key. * \**********************************************************************/ /** - Encrypts a block of text with RC2 + Encrypts a block of text with LTC_RC2 @param pt The input plaintext (8 bytes) @param ct The output ciphertext (8 bytes) @param skey The key as scheduled @@ -199,7 +199,7 @@ int rc2_ecb_encrypt( const unsigned char *pt, * Decrypt an 8-byte block of ciphertext using the given key. * \**********************************************************************/ /** - Decrypts a block of text with RC2 + Decrypts a block of text with LTC_RC2 @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) @param skey The key as scheduled @@ -275,7 +275,7 @@ int rc2_ecb_decrypt( const unsigned char *ct, #endif /** - Performs a self-test of the RC2 block cipher + Performs a self-test of the LTC_RC2 block cipher @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled */ int rc2_test(void) @@ -357,6 +357,6 @@ int rc2_keysize(int *keysize) -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc2.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/rc5.c b/libtomcrypt/src/ciphers/rc5.c index 2d5fdb8..ac56451 100644 --- a/libtomcrypt/src/ciphers/rc5.c +++ b/libtomcrypt/src/ciphers/rc5.c @@ -6,17 +6,17 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file rc5.c - RC5 code by Tom St Denis + LTC_RC5 code by Tom St Denis */ #include "tomcrypt.h" -#ifdef RC5 +#ifdef LTC_RC5 const struct ltc_cipher_descriptor rc5_desc = { @@ -43,7 +43,7 @@ static const ulong32 stab[50] = { }; /** - Initialize the RC5 block cipher + Initialize the LTC_RC5 block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -119,7 +119,7 @@ int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke #endif /** - Encrypts a block of text with RC5 + Encrypts a block of text with LTC_RC5 @param pt The input plaintext (8 bytes) @param ct The output ciphertext (8 bytes) @param skey The key as scheduled @@ -174,7 +174,7 @@ int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *s #endif /** - Decrypts a block of text with RC5 + Decrypts a block of text with LTC_RC5 @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) @param skey The key as scheduled @@ -230,7 +230,7 @@ int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s #endif /** - Performs a self-test of the RC5 block cipher + Performs a self-test of the LTC_RC5 block cipher @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled */ int rc5_test(void) @@ -317,6 +317,6 @@ int rc5_keysize(int *keysize) -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc5.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/rc6.c b/libtomcrypt/src/ciphers/rc6.c index 8afa033..88639b8 100644 --- a/libtomcrypt/src/ciphers/rc6.c +++ b/libtomcrypt/src/ciphers/rc6.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file rc6.c - RC6 code by Tom St Denis + LTC_RC6 code by Tom St Denis */ #include "tomcrypt.h" -#ifdef RC6 +#ifdef LTC_RC6 const struct ltc_cipher_descriptor rc6_desc = { @@ -40,7 +40,7 @@ static const ulong32 stab[44] = { 0x708c564bUL, 0x0ec3d004UL, 0xacfb49bdUL, 0x4b32c376UL }; /** - Initialize the RC6 block cipher + Initialize the LTC_RC6 block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -114,7 +114,7 @@ int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke #endif /** - Encrypts a block of text with RC6 + Encrypts a block of text with LTC_RC6 @param pt The input plaintext (16 bytes) @param ct The output ciphertext (16 bytes) @param skey The key as scheduled @@ -168,7 +168,7 @@ int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *s #endif /** - Decrypts a block of text with RC6 + Decrypts a block of text with LTC_RC6 @param ct The input ciphertext (16 bytes) @param pt The output plaintext (16 bytes) @param skey The key as scheduled @@ -224,7 +224,7 @@ int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s #endif /** - Performs a self-test of the RC6 block cipher + Performs a self-test of the LTC_RC6 block cipher @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled */ int rc6_test(void) @@ -339,10 +339,10 @@ int rc6_keysize(int *keysize) return CRYPT_OK; } -#endif /*RC6*/ +#endif /*LTC_RC6*/ -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc6.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/safer/safer.c b/libtomcrypt/src/ciphers/safer/safer.c index 9fdaf37..5189c2f 100644 --- a/libtomcrypt/src/ciphers/safer/safer.c +++ b/libtomcrypt/src/ciphers/safer/safer.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /******************************************************************************* * * FILE: safer.c * -* DESCRIPTION: block-cipher algorithm SAFER (Secure And Fast Encryption -* Routine) in its four versions: SAFER K-64, SAFER K-128, -* SAFER SK-64 and SAFER SK-128. +* LTC_DESCRIPTION: block-cipher algorithm LTC_SAFER (Secure And Fast Encryption +* Routine) in its four versions: LTC_SAFER K-64, LTC_SAFER K-128, +* LTC_SAFER SK-64 and LTC_SAFER SK-128. * * AUTHOR: Richard De Moliner (demoliner@isi.ee.ethz.ch) * Signal and Information Processing Laboratory @@ -30,12 +30,12 @@ #include <tomcrypt.h> -#ifdef SAFER +#ifdef LTC_SAFER const struct ltc_cipher_descriptor safer_k64_desc = { "safer-k64", - 8, 8, 8, 8, SAFER_K64_DEFAULT_NOF_ROUNDS, + 8, 8, 8, 8, LTC_SAFER_K64_DEFAULT_NOF_ROUNDS, &safer_k64_setup, &safer_ecb_encrypt, &safer_ecb_decrypt, @@ -47,7 +47,7 @@ const struct ltc_cipher_descriptor safer_sk64_desc = { "safer-sk64", - 9, 8, 8, 8, SAFER_SK64_DEFAULT_NOF_ROUNDS, + 9, 8, 8, 8, LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS, &safer_sk64_setup, &safer_ecb_encrypt, &safer_ecb_decrypt, @@ -59,7 +59,7 @@ const struct ltc_cipher_descriptor safer_k128_desc = { "safer-k128", - 10, 16, 16, 8, SAFER_K128_DEFAULT_NOF_ROUNDS, + 10, 16, 16, 8, LTC_SAFER_K128_DEFAULT_NOF_ROUNDS, &safer_k128_setup, &safer_ecb_encrypt, &safer_ecb_decrypt, @@ -71,7 +71,7 @@ const struct ltc_cipher_descriptor safer_sk128_desc = { "safer-sk128", - 11, 16, 16, 8, SAFER_SK128_DEFAULT_NOF_ROUNDS, + 11, 16, 16, 8, LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS, &safer_sk128_setup, &safer_ecb_encrypt, &safer_ecb_decrypt, @@ -111,48 +111,48 @@ static void Safer_Expand_Userkey(const unsigned char *userkey_1, safer_key_t key) #endif { unsigned int i, j, k; - unsigned char ka[SAFER_BLOCK_LEN + 1]; - unsigned char kb[SAFER_BLOCK_LEN + 1]; + unsigned char ka[LTC_SAFER_BLOCK_LEN + 1]; + unsigned char kb[LTC_SAFER_BLOCK_LEN + 1]; - if (SAFER_MAX_NOF_ROUNDS < nof_rounds) - nof_rounds = SAFER_MAX_NOF_ROUNDS; + if (LTC_SAFER_MAX_NOF_ROUNDS < nof_rounds) + nof_rounds = LTC_SAFER_MAX_NOF_ROUNDS; *key++ = (unsigned char)nof_rounds; - ka[SAFER_BLOCK_LEN] = (unsigned char)0; - kb[SAFER_BLOCK_LEN] = (unsigned char)0; + ka[LTC_SAFER_BLOCK_LEN] = (unsigned char)0; + kb[LTC_SAFER_BLOCK_LEN] = (unsigned char)0; k = 0; - for (j = 0; j < SAFER_BLOCK_LEN; j++) { + for (j = 0; j < LTC_SAFER_BLOCK_LEN; j++) { ka[j] = ROL8(userkey_1[j], 5); - ka[SAFER_BLOCK_LEN] ^= ka[j]; + ka[LTC_SAFER_BLOCK_LEN] ^= ka[j]; kb[j] = *key++ = userkey_2[j]; - kb[SAFER_BLOCK_LEN] ^= kb[j]; + kb[LTC_SAFER_BLOCK_LEN] ^= kb[j]; } for (i = 1; i <= nof_rounds; i++) { - for (j = 0; j < SAFER_BLOCK_LEN + 1; j++) { + for (j = 0; j < LTC_SAFER_BLOCK_LEN + 1; j++) { ka[j] = ROL8(ka[j], 6); kb[j] = ROL8(kb[j], 6); } if (strengthened) { k = 2 * i - 1; - while (k >= (SAFER_BLOCK_LEN + 1)) { k -= SAFER_BLOCK_LEN + 1; } + while (k >= (LTC_SAFER_BLOCK_LEN + 1)) { k -= LTC_SAFER_BLOCK_LEN + 1; } } - for (j = 0; j < SAFER_BLOCK_LEN; j++) { + for (j = 0; j < LTC_SAFER_BLOCK_LEN; j++) { if (strengthened) { *key++ = (ka[k] + safer_ebox[(int)safer_ebox[(int)((18 * i + j + 1)&0xFF)]]) & 0xFF; - if (++k == (SAFER_BLOCK_LEN + 1)) { k = 0; } + if (++k == (LTC_SAFER_BLOCK_LEN + 1)) { k = 0; } } else { *key++ = (ka[j] + safer_ebox[(int)safer_ebox[(int)((18 * i + j + 1)&0xFF)]]) & 0xFF; } } if (strengthened) { k = 2 * i; - while (k >= (SAFER_BLOCK_LEN + 1)) { k -= SAFER_BLOCK_LEN + 1; } + while (k >= (LTC_SAFER_BLOCK_LEN + 1)) { k -= LTC_SAFER_BLOCK_LEN + 1; } } - for (j = 0; j < SAFER_BLOCK_LEN; j++) { + for (j = 0; j < LTC_SAFER_BLOCK_LEN; j++) { if (strengthened) { *key++ = (kb[k] + safer_ebox[(int)safer_ebox[(int)((18 * i + j + 10)&0xFF)]]) & 0xFF; - if (++k == (SAFER_BLOCK_LEN + 1)) { k = 0; } + if (++k == (LTC_SAFER_BLOCK_LEN + 1)) { k = 0; } } else { *key++ = (kb[j] + safer_ebox[(int)safer_ebox[(int)((18 * i + j + 10)&0xFF)]]) & 0xFF; } @@ -173,7 +173,7 @@ static void Safer_Expand_Userkey(const unsigned char *userkey_1, safer_key_t key) { _Safer_Expand_Userkey(userkey_1, userkey_2, nof_rounds, strengthened, key); - burn_stack(sizeof(unsigned char) * (2 * (SAFER_BLOCK_LEN + 1)) + sizeof(unsigned int)*2); + burn_stack(sizeof(unsigned char) * (2 * (LTC_SAFER_BLOCK_LEN + 1)) + sizeof(unsigned int)*2); } #endif @@ -182,7 +182,7 @@ int safer_k64_setup(const unsigned char *key, int keylen, int numrounds, symmetr LTC_ARGCHK(key != NULL); LTC_ARGCHK(skey != NULL); - if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) { + if (numrounds != 0 && (numrounds < 6 || numrounds > LTC_SAFER_MAX_NOF_ROUNDS)) { return CRYPT_INVALID_ROUNDS; } @@ -190,7 +190,7 @@ int safer_k64_setup(const unsigned char *key, int keylen, int numrounds, symmetr return CRYPT_INVALID_KEYSIZE; } - Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key); + Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:LTC_SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key); return CRYPT_OK; } @@ -199,7 +199,7 @@ int safer_sk64_setup(const unsigned char *key, int keylen, int numrounds, symmet LTC_ARGCHK(key != NULL); LTC_ARGCHK(skey != NULL); - if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) { + if (numrounds != 0 && (numrounds < 6 || numrounds > LTC_SAFER_MAX_NOF_ROUNDS)) { return CRYPT_INVALID_ROUNDS; } @@ -207,7 +207,7 @@ int safer_sk64_setup(const unsigned char *key, int keylen, int numrounds, symmet return CRYPT_INVALID_KEYSIZE; } - Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key); + Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key); return CRYPT_OK; } @@ -216,7 +216,7 @@ int safer_k128_setup(const unsigned char *key, int keylen, int numrounds, symmet LTC_ARGCHK(key != NULL); LTC_ARGCHK(skey != NULL); - if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) { + if (numrounds != 0 && (numrounds < 6 || numrounds > LTC_SAFER_MAX_NOF_ROUNDS)) { return CRYPT_INVALID_ROUNDS; } @@ -224,7 +224,7 @@ int safer_k128_setup(const unsigned char *key, int keylen, int numrounds, symmet return CRYPT_INVALID_KEYSIZE; } - Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0 ?numrounds:SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key); + Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0 ?numrounds:LTC_SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key); return CRYPT_OK; } @@ -233,7 +233,7 @@ int safer_sk128_setup(const unsigned char *key, int keylen, int numrounds, symme LTC_ARGCHK(key != NULL); LTC_ARGCHK(skey != NULL); - if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) { + if (numrounds != 0 && (numrounds < 6 || numrounds > LTC_SAFER_MAX_NOF_ROUNDS)) { return CRYPT_INVALID_ROUNDS; } @@ -241,7 +241,7 @@ int safer_sk128_setup(const unsigned char *key, int keylen, int numrounds, symme return CRYPT_INVALID_KEYSIZE; } - Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0?numrounds:SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key); + Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0?numrounds:LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key); return CRYPT_OK; } @@ -265,7 +265,7 @@ int safer_ecb_encrypt(const unsigned char *block_in, key = skey->safer.key; a = block_in[0]; b = block_in[1]; c = block_in[2]; d = block_in[3]; e = block_in[4]; f = block_in[5]; g = block_in[6]; h = block_in[7]; - if (SAFER_MAX_NOF_ROUNDS < (round = *key)) round = SAFER_MAX_NOF_ROUNDS; + if (LTC_SAFER_MAX_NOF_ROUNDS < (round = *key)) round = LTC_SAFER_MAX_NOF_ROUNDS; while(round-- > 0) { a ^= *++key; b += *++key; c += *++key; d ^= *++key; @@ -319,8 +319,8 @@ int safer_ecb_decrypt(const unsigned char *block_in, key = skey->safer.key; a = block_in[0]; b = block_in[1]; c = block_in[2]; d = block_in[3]; e = block_in[4]; f = block_in[5]; g = block_in[6]; h = block_in[7]; - if (SAFER_MAX_NOF_ROUNDS < (round = *key)) round = SAFER_MAX_NOF_ROUNDS; - key += SAFER_BLOCK_LEN * (1 + 2 * round); + if (LTC_SAFER_MAX_NOF_ROUNDS < (round = *key)) round = LTC_SAFER_MAX_NOF_ROUNDS; + key += LTC_SAFER_BLOCK_LEN * (1 + 2 * round); h ^= *key; g -= *--key; f -= *--key; e ^= *--key; d ^= *--key; c -= *--key; b -= *--key; a ^= *--key; while (round--) @@ -486,6 +486,6 @@ int safer_sk128_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/safer/safer.c,v $ */ -/* $Revision: 1.13 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/safer/safer_tab.c b/libtomcrypt/src/ciphers/safer/safer_tab.c index a542768..9a515ff 100644 --- a/libtomcrypt/src/ciphers/safer/safer_tab.c +++ b/libtomcrypt/src/ciphers/safer/safer_tab.c @@ -6,17 +6,17 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file safer_tab.c - Tables for SAFER block ciphers + Tables for LTC_SAFER block ciphers */ #include "tomcrypt.h" -#if defined(SAFERP) || defined(SAFER) +#if defined(LTC_SAFERP) || defined(LTC_SAFER) /* This is the box defined by ebox[x] = 45^x mod 257. * Its assumed that the value "256" corresponds to zero. */ @@ -63,6 +63,6 @@ const unsigned char safer_lbox[256] = { -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/safer/safer_tab.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/safer/saferp.c b/libtomcrypt/src/ciphers/safer/saferp.c index dff4ee9..8cecab0 100644 --- a/libtomcrypt/src/ciphers/safer/saferp.c +++ b/libtomcrypt/src/ciphers/safer/saferp.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file saferp.c - SAFER+ Implementation by Tom St Denis + LTC_SAFER+ Implementation by Tom St Denis */ #include "tomcrypt.h" -#ifdef SAFERP +#ifdef LTC_SAFERP const struct ltc_cipher_descriptor saferp_desc = { @@ -37,7 +37,7 @@ const struct ltc_cipher_descriptor saferp_desc = * key addition, substitution, key addition. The safer_ebox and safer_lbox * are the exponentiation box and logarithm boxes respectively. * The value of 'i' is the current round number which allows this - * function to be unrolled massively. Most of SAFER+'s speed + * function to be unrolled massively. Most of LTC_SAFER+'s speed * comes from not having to compute indirect accesses into the * array of 16 bytes b[0..15] which is the block of data */ @@ -206,7 +206,7 @@ static const unsigned char safer_bias[33][16] = { { 62, 220, 134, 119, 215, 166, 17, 251, 244, 186, 146, 145, 100, 131, 241, 51}}; /** - Initialize the SAFER+ block cipher + Initialize the LTC_SAFER+ block cipher @param key The symmetric key you wish to pass @param keylen The key length in bytes @param num_rounds The number of rounds desired (0 for default) @@ -325,7 +325,7 @@ int saferp_setup(const unsigned char *key, int keylen, int num_rounds, symmetric } /** - Encrypts a block of text with SAFER+ + Encrypts a block of text with LTC_SAFER+ @param pt The input plaintext (16 bytes) @param ct The output ciphertext (16 bytes) @param skey The key as scheduled @@ -389,7 +389,7 @@ int saferp_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key } /** - Decrypts a block of text with SAFER+ + Decrypts a block of text with LTC_SAFER+ @param ct The input ciphertext (16 bytes) @param pt The output plaintext (16 bytes) @param skey The key as scheduled @@ -453,7 +453,7 @@ int saferp_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key } /** - Performs a self-test of the SAFER+ block cipher + Performs a self-test of the LTC_SAFER+ block cipher @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled */ int saferp_test(void) @@ -554,6 +554,6 @@ int saferp_keysize(int *keysize) -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/safer/saferp.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/skipjack.c b/libtomcrypt/src/ciphers/skipjack.c index 3e0b576..89e9a56 100644 --- a/libtomcrypt/src/ciphers/skipjack.c +++ b/libtomcrypt/src/ciphers/skipjack.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef SKIPJACK +#ifdef LTC_SKIPJACK const struct ltc_cipher_descriptor skipjack_desc = { @@ -338,6 +338,6 @@ int skipjack_keysize(int *keysize) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/skipjack.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/twofish/twofish.c b/libtomcrypt/src/ciphers/twofish/twofish.c index 8f81bdd..624dadf 100644 --- a/libtomcrypt/src/ciphers/twofish/twofish.c +++ b/libtomcrypt/src/ciphers/twofish/twofish.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,12 +15,12 @@ */ #include "tomcrypt.h" -#ifdef TWOFISH +#ifdef LTC_TWOFISH -/* first TWOFISH_ALL_TABLES must ensure TWOFISH_TABLES is defined */ -#ifdef TWOFISH_ALL_TABLES -#ifndef TWOFISH_TABLES -#define TWOFISH_TABLES +/* first LTC_TWOFISH_ALL_TABLES must ensure LTC_TWOFISH_TABLES is defined */ +#ifdef LTC_TWOFISH_ALL_TABLES +#ifndef LTC_TWOFISH_TABLES +#define LTC_TWOFISH_TABLES #endif #endif @@ -68,7 +68,7 @@ static const unsigned char qord[4][5] = { { 1, 0, 1, 1, 0 } }; -#ifdef TWOFISH_TABLES +#ifdef LTC_TWOFISH_TABLES #include "twofish_tab.c" @@ -142,7 +142,7 @@ static ulong32 sbox(int i, ulong32 x) } #endif /* LTC_CLEAN_STACK */ -#endif /* TWOFISH_TABLES */ +#endif /* LTC_TWOFISH_TABLES */ /* computes ab mod p */ static ulong32 gf_mult(ulong32 a, ulong32 b, ulong32 p) @@ -167,7 +167,7 @@ static ulong32 gf_mult(ulong32 a, ulong32 b, ulong32 p) } /* computes [y0 y1 y2 y3] = MDS . [x0] */ -#ifndef TWOFISH_TABLES +#ifndef LTC_TWOFISH_TABLES static ulong32 mds_column_mult(unsigned char in, int col) { ulong32 x01, x5B, xEF; @@ -202,11 +202,11 @@ static ulong32 mds_column_mult(unsigned char in, int col) return 0; } -#else /* !TWOFISH_TABLES */ +#else /* !LTC_TWOFISH_TABLES */ #define mds_column_mult(x, i) mds_tab[i][x] -#endif /* TWOFISH_TABLES */ +#endif /* LTC_TWOFISH_TABLES */ /* Computes [y0 y1 y2 y3] = MDS . [x0 x1 x2 x3] */ static void mds_mult(const unsigned char *in, unsigned char *out) @@ -219,7 +219,7 @@ static void mds_mult(const unsigned char *in, unsigned char *out) STORE32L(tmp, out); } -#ifdef TWOFISH_ALL_TABLES +#ifdef LTC_TWOFISH_ALL_TABLES /* computes [y0 y1 y2 y3] = RS . [x0 x1 x2 x3 x4 x5 x6 x7] */ static void rs_mult(const unsigned char *in, unsigned char *out) { @@ -229,7 +229,7 @@ static void rs_mult(const unsigned char *in, unsigned char *out) STORE32L(tmp, out); } -#else /* !TWOFISH_ALL_TABLES */ +#else /* !LTC_TWOFISH_ALL_TABLES */ /* computes [y0 y1 y2 y3] = RS . [x0 x1 x2 x3 x4 x5 x6 x7] */ static void rs_mult(const unsigned char *in, unsigned char *out) @@ -273,7 +273,7 @@ static void h_func(const unsigned char *in, unsigned char *out, unsigned char *M mds_mult(y, out); } -#ifndef TWOFISH_SMALL +#ifndef LTC_TWOFISH_SMALL /* for GCC we don't use pointer aliases */ #if defined(__GNUC__) @@ -332,7 +332,7 @@ static ulong32 g_func(ulong32 x, symmetric_key *key) } #endif /* LTC_CLEAN_STACK */ -#endif /* TWOFISH_SMALL */ +#endif /* LTC_TWOFISH_SMALL */ /** Initialize the Twofish block cipher @@ -348,7 +348,7 @@ static int _twofish_setup(const unsigned char *key, int keylen, int num_rounds, int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) #endif { -#ifndef TWOFISH_SMALL +#ifndef LTC_TWOFISH_SMALL unsigned char S[4*4], tmpx0, tmpx1; #endif int k, x, y; @@ -376,7 +376,7 @@ int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetri } /* create the S[..] words */ -#ifndef TWOFISH_SMALL +#ifndef LTC_TWOFISH_SMALL for (x = 0; x < k; x++) { rs_mult(M+(x*8), S+(x*4)); } @@ -410,7 +410,7 @@ int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetri skey->twofish.K[x+x+1] = ROLc(B + B + A, 9); } -#ifndef TWOFISH_SMALL +#ifndef LTC_TWOFISH_SMALL /* make the sboxes (large ram variant) */ if (k == 2) { for (x = 0; x < 256; x++) { @@ -477,7 +477,7 @@ int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_ke { ulong32 a,b,c,d,ta,tb,tc,td,t1,t2, *k; int r; -#if !defined(TWOFISH_SMALL) && !defined(__GNUC__) +#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__) ulong32 *S1, *S2, *S3, *S4; #endif @@ -485,7 +485,7 @@ int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_ke LTC_ARGCHK(ct != NULL); LTC_ARGCHK(skey != NULL); -#if !defined(TWOFISH_SMALL) && !defined(__GNUC__) +#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__) S1 = skey->twofish.S[0]; S2 = skey->twofish.S[1]; S3 = skey->twofish.S[2]; @@ -550,7 +550,7 @@ int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_ke { ulong32 a,b,c,d,ta,tb,tc,td,t1,t2, *k; int r; -#if !defined(TWOFISH_SMALL) && !defined(__GNUC__) +#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__) ulong32 *S1, *S2, *S3, *S4; #endif @@ -558,7 +558,7 @@ int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_ke LTC_ARGCHK(ct != NULL); LTC_ARGCHK(skey != NULL); -#if !defined(TWOFISH_SMALL) && !defined(__GNUC__) +#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__) S1 = skey->twofish.S[0]; S2 = skey->twofish.S[1]; S3 = skey->twofish.S[2]; @@ -714,6 +714,6 @@ int twofish_keysize(int *keysize) -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/twofish/twofish.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/twofish/twofish_tab.c b/libtomcrypt/src/ciphers/twofish/twofish_tab.c index f8a373f..ea3eb21 100644 --- a/libtomcrypt/src/ciphers/twofish/twofish_tab.c +++ b/libtomcrypt/src/ciphers/twofish/twofish_tab.c @@ -6,14 +6,14 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file twofish_tab.c Twofish tables, Tom St Denis */ -#ifdef TWOFISH_TABLES +#ifdef LTC_TWOFISH_TABLES /* pre generated 8x8 tables from the four 4x4s */ static const unsigned char SBOX[2][256] = { @@ -212,7 +212,7 @@ static const ulong32 mds_tab[4][256] = { 0xc6baf8c6UL, 0x9d55f99dUL, 0x700dfa70UL, 0x2be2fb2bUL, 0xc3bdfcc3UL, 0x9852fd98UL, 0x750afe75UL, 0x2ee5ff2eUL }}; -#ifdef TWOFISH_ALL_TABLES +#ifdef LTC_TWOFISH_ALL_TABLES /* the 4x8 RS transform */ static const ulong32 rs_tab0[256] = { @@ -487,10 +487,10 @@ static const ulong32 rs_tab7[256] = { 0x5d8218b2LU, 0x5e9bfd2cLU, 0x5bb09fc3LU, 0x58a97a5dLU, 0x51e65b50LU, 0x52ffbeceLU, 0x57d4dc21LU, 0x54cd39bfLU, 0x454a9e3bLU, 0x46537ba5LU, 0x4378194aLU, 0x4061fcd4LU, 0x492eddd9LU, 0x4a373847LU, 0x4f1c5aa8LU, 0x4c05bf36LU }; -#endif /* TWOFISH_ALL_TABLES */ +#endif /* LTC_TWOFISH_ALL_TABLES */ #endif -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/twofish/twofish_tab.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/ciphers/xtea.c b/libtomcrypt/src/ciphers/xtea.c index ac73400..d907e54 100644 --- a/libtomcrypt/src/ciphers/xtea.c +++ b/libtomcrypt/src/ciphers/xtea.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file xtea.c - Implementation of XTEA, Tom St Denis + Implementation of LTC_XTEA, Tom St Denis */ #include "tomcrypt.h" -#ifdef XTEA +#ifdef LTC_XTEA const struct ltc_cipher_descriptor xtea_desc = { @@ -67,7 +67,7 @@ int xtea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_k } /** - Encrypts a block of text with XTEA + Encrypts a block of text with LTC_XTEA @param pt The input plaintext (8 bytes) @param ct The output ciphertext (8 bytes) @param skey The key as scheduled @@ -103,7 +103,7 @@ int xtea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key * } /** - Decrypts a block of text with XTEA + Decrypts a block of text with LTC_XTEA @param ct The input ciphertext (8 bytes) @param pt The output plaintext (8 bytes) @param skey The key as scheduled @@ -139,7 +139,7 @@ int xtea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key * } /** - Performs a self-test of the XTEA block cipher + Performs a self-test of the LTC_XTEA block cipher @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled */ int xtea_test(void) @@ -206,6 +206,6 @@ int xtea_keysize(int *keysize) -/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/xtea.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ccm/ccm_memory.c b/libtomcrypt/src/encauth/ccm/ccm_memory.c index c5eee18..abd8653 100644 --- a/libtomcrypt/src/encauth/ccm/ccm_memory.c +++ b/libtomcrypt/src/encauth/ccm/ccm_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ CCM support, process a block of memory, Tom St Denis */ -#ifdef CCM_MODE +#ifdef LTC_CCM_MODE /** CCM encrypt/decrypt and produce an authentication tag @@ -346,6 +346,6 @@ error: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ccm/ccm_memory.c,v $ */ -/* $Revision: 1.18 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ccm/ccm_test.c b/libtomcrypt/src/encauth/ccm/ccm_test.c index 3a45bfb..9b63ffc 100644 --- a/libtomcrypt/src/encauth/ccm/ccm_test.c +++ b/libtomcrypt/src/encauth/ccm/ccm_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ CCM support, process a block of memory, Tom St Denis */ -#ifdef CCM_MODE +#ifdef LTC_CCM_MODE int ccm_test(void) { @@ -175,6 +175,6 @@ int ccm_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ccm/ccm_test.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/21 00:18:23 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/eax/eax_addheader.c b/libtomcrypt/src/encauth/eax/eax_addheader.c index b1054e5..d06e921 100644 --- a/libtomcrypt/src/encauth/eax/eax_addheader.c +++ b/libtomcrypt/src/encauth/eax/eax_addheader.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file eax_addheader.c @@ -14,7 +14,7 @@ */ #include "tomcrypt.h" -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE /** add header (metadata) to the stream @@ -33,6 +33,6 @@ int eax_addheader(eax_state *eax, const unsigned char *header, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_addheader.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/eax/eax_decrypt.c b/libtomcrypt/src/encauth/eax/eax_decrypt.c index 22a66ab..185330f 100644 --- a/libtomcrypt/src/encauth/eax/eax_decrypt.c +++ b/libtomcrypt/src/encauth/eax/eax_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE /** Decrypt data with the EAX protocol @@ -45,6 +45,6 @@ int eax_decrypt(eax_state *eax, const unsigned char *ct, unsigned char *pt, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_decrypt.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c b/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c index 693ddfa..7956142 100644 --- a/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c +++ b/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE /** Decrypt a block of memory and verify the provided MAC tag with EAX @@ -103,6 +103,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/eax/eax_done.c b/libtomcrypt/src/encauth/eax/eax_done.c index 1e02939..0bb0b33 100644 --- a/libtomcrypt/src/encauth/eax/eax_done.c +++ b/libtomcrypt/src/encauth/eax/eax_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE /** Terminate an EAX session and get the tag. @@ -89,6 +89,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_done.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/eax/eax_encrypt.c b/libtomcrypt/src/encauth/eax/eax_encrypt.c index dc8bc3d..79f9dc5 100644 --- a/libtomcrypt/src/encauth/eax/eax_encrypt.c +++ b/libtomcrypt/src/encauth/eax/eax_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE /** Encrypt with EAX a block of data. @@ -46,6 +46,6 @@ int eax_encrypt(eax_state *eax, const unsigned char *pt, unsigned char *ct, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_encrypt.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c b/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c index e9e52d0..fc58ce6 100644 --- a/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c +++ b/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE /** EAX encrypt and produce an authentication tag @@ -77,6 +77,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/eax/eax_init.c b/libtomcrypt/src/encauth/eax/eax_init.c index 48512b5..563eabf 100644 --- a/libtomcrypt/src/encauth/eax/eax_init.c +++ b/libtomcrypt/src/encauth/eax/eax_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE /** Initialized an EAX state @@ -66,7 +66,7 @@ int eax_init(eax_state *eax, int cipher, return CRYPT_MEM; } - /* N = OMAC_0K(nonce) */ + /* N = LTC_OMAC_0K(nonce) */ zeromem(buf, MAXBLOCKSIZE); if ((err = omac_init(omac, cipher, key, keylen)) != CRYPT_OK) { goto LBL_ERR; @@ -86,7 +86,7 @@ int eax_init(eax_state *eax, int cipher, goto LBL_ERR; } - /* H = OMAC_1K(header) */ + /* H = LTC_OMAC_1K(header) */ zeromem(buf, MAXBLOCKSIZE); buf[blklen - 1] = 1; @@ -112,7 +112,7 @@ int eax_init(eax_state *eax, int cipher, goto LBL_ERR; } - /* setup the OMAC for the ciphertext */ + /* setup the LTC_OMAC for the ciphertext */ if ((err = omac_init(&eax->ctomac, cipher, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } @@ -139,6 +139,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_init.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/eax/eax_test.c b/libtomcrypt/src/encauth/eax/eax_test.c index d154271..5babef2 100644 --- a/libtomcrypt/src/encauth/eax/eax_test.c +++ b/libtomcrypt/src/encauth/eax/eax_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE /** Test the EAX implementation @@ -275,8 +275,8 @@ int eax_test(void) #endif /* LTC_TEST */ } -#endif /* EAX_MODE */ +#endif /* LTC_EAX_MODE */ -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_test.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_add_aad.c b/libtomcrypt/src/encauth/gcm/gcm_add_aad.c index 6037c6c..26e47f6 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_add_aad.c +++ b/libtomcrypt/src/encauth/gcm/gcm_add_aad.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE /** Add AAD to the GCM state @@ -47,7 +47,7 @@ int gcm_add_aad(gcm_state *gcm, } /* in IV mode? */ - if (gcm->mode == GCM_MODE_IV) { + if (gcm->mode == LTC_GCM_MODE_IV) { /* let's process the IV */ if (gcm->ivmode || gcm->buflen != 12) { for (x = 0; x < (unsigned long)gcm->buflen; x++) { @@ -80,10 +80,10 @@ int gcm_add_aad(gcm_state *gcm, zeromem(gcm->buf, 16); gcm->buflen = 0; gcm->totlen = 0; - gcm->mode = GCM_MODE_AAD; + gcm->mode = LTC_GCM_MODE_AAD; } - if (gcm->mode != GCM_MODE_AAD || gcm->buflen >= 16) { + if (gcm->mode != LTC_GCM_MODE_AAD || gcm->buflen >= 16) { return CRYPT_INVALID_ARG; } @@ -119,6 +119,6 @@ int gcm_add_aad(gcm_state *gcm, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_add_aad.c,v $ */ -/* $Revision: 1.16 $ */ -/* $Date: 2006/09/23 19:24:21 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_add_iv.c b/libtomcrypt/src/encauth/gcm/gcm_add_iv.c index 44e3167..0ac79b6 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_add_iv.c +++ b/libtomcrypt/src/encauth/gcm/gcm_add_iv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE /** Add IV data to the GCM state @@ -36,7 +36,7 @@ int gcm_add_iv(gcm_state *gcm, } /* must be in IV mode */ - if (gcm->mode != GCM_MODE_IV) { + if (gcm->mode != LTC_GCM_MODE_IV) { return CRYPT_INVALID_ARG; } @@ -89,6 +89,6 @@ int gcm_add_iv(gcm_state *gcm, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_add_iv.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_done.c b/libtomcrypt/src/encauth/gcm/gcm_done.c index 4cbd09f..bbc9bbe 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_done.c +++ b/libtomcrypt/src/encauth/gcm/gcm_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE /** Terminate a GCM stream @@ -43,7 +43,7 @@ int gcm_done(gcm_state *gcm, } - if (gcm->mode != GCM_MODE_TEXT) { + if (gcm->mode != LTC_GCM_MODE_TEXT) { return CRYPT_INVALID_ARG; } @@ -78,6 +78,6 @@ int gcm_done(gcm_state *gcm, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_done.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c b/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c index 52e82dd..72e0624 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c +++ b/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#if defined(GCM_TABLES) || defined(LRW_TABLES) || ((defined(GCM_MODE) || defined(GCM_MODE)) && defined(LTC_FAST)) +#if defined(LTC_GCM_TABLES) || defined(LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST)) /* this is x*2^128 mod p(x) ... the results are 16 bytes each stored in a packed format. Since only the * lower 16 bits are not zero'ed I removed the upper 14 bytes */ @@ -56,7 +56,7 @@ const unsigned char gcm_shift_table[256*2] = { #endif -#if defined(GCM_MODE) || defined(LRW_MODE) +#if defined(LTC_GCM_MODE) || defined(LRW_MODE) #ifndef LTC_FAST /* right shift */ @@ -215,7 +215,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char * #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c,v $ */ -/* $Revision: 1.23 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_init.c b/libtomcrypt/src/encauth/gcm/gcm_init.c index c0f7a5a..8e1c496 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_init.c +++ b/libtomcrypt/src/encauth/gcm/gcm_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE /** Initialize a GCM state @@ -30,7 +30,7 @@ int gcm_init(gcm_state *gcm, int cipher, { int err; unsigned char B[16]; -#ifdef GCM_TABLES +#ifdef LTC_GCM_TABLES int x, y, z, t; #endif @@ -66,13 +66,13 @@ int gcm_init(gcm_state *gcm, int cipher, zeromem(gcm->buf, sizeof(gcm->buf)); zeromem(gcm->X, sizeof(gcm->X)); gcm->cipher = cipher; - gcm->mode = GCM_MODE_IV; + gcm->mode = LTC_GCM_MODE_IV; gcm->ivmode = 0; gcm->buflen = 0; gcm->totlen = 0; gcm->pttotlen = 0; -#ifdef GCM_TABLES +#ifdef LTC_GCM_TABLES /* setup tables */ /* generate the first table as it has no shifting (from which we make the other tables) */ @@ -102,6 +102,6 @@ int gcm_init(gcm_state *gcm, int cipher, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_init.c,v $ */ -/* $Revision: 1.18 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_memory.c b/libtomcrypt/src/encauth/gcm/gcm_memory.c index ddec010..451e3fa 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_memory.c +++ b/libtomcrypt/src/encauth/gcm/gcm_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE /** Process an entire GCM packet in one call. @@ -65,7 +65,7 @@ int gcm_memory( int cipher, -#ifndef GCM_TABLES_SSE2 +#ifndef LTC_GCM_TABLES_SSE2 orig = gcm = XMALLOC(sizeof(*gcm)); #else orig = gcm = XMALLOC(sizeof(*gcm) + 16); @@ -78,7 +78,7 @@ int gcm_memory( int cipher, * note that we only modify gcm and keep orig intact. This code is not portable * but again it's only for SSE2 anyways, so who cares? */ -#ifdef GCM_TABLES_SSE2 +#ifdef LTC_GCM_TABLES_SSE2 if ((unsigned long)gcm & 15) { gcm = (gcm_state *)((unsigned long)gcm + (16 - ((unsigned long)gcm & 15))); } @@ -104,6 +104,6 @@ LTC_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_memory.c,v $ */ -/* $Revision: 1.23 $ */ -/* $Date: 2006/09/07 10:00:57 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_mult_h.c b/libtomcrypt/src/encauth/gcm/gcm_mult_h.c index 8391e00..2cda6a4 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_mult_h.c +++ b/libtomcrypt/src/encauth/gcm/gcm_mult_h.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#if defined(GCM_MODE) +#if defined(LTC_GCM_MODE) /** GCM multiply by H @param gcm The GCM state which holds the H value @@ -24,9 +24,9 @@ void gcm_mult_h(gcm_state *gcm, unsigned char *I) { unsigned char T[16]; -#ifdef GCM_TABLES +#ifdef LTC_GCM_TABLES int x, y; -#ifdef GCM_TABLES_SSE2 +#ifdef LTC_GCM_TABLES_SSE2 asm("movdqa (%0),%%xmm0"::"r"(&gcm->PC[0][I[0]][0])); for (x = 1; x < 16; x++) { asm("pxor (%0),%%xmm0"::"r"(&gcm->PC[x][I[x]][0])); @@ -45,7 +45,7 @@ void gcm_mult_h(gcm_state *gcm, unsigned char *I) } #endif /* LTC_FAST */ } -#endif /* GCM_TABLES_SSE2 */ +#endif /* LTC_GCM_TABLES_SSE2 */ #else gcm_gf_mult(gcm->H, I, T); #endif @@ -53,6 +53,6 @@ void gcm_mult_h(gcm_state *gcm, unsigned char *I) } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_mult_h.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/08/23 20:40:23 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_process.c b/libtomcrypt/src/encauth/gcm/gcm_process.c index f4d21d3..af0444d 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_process.c +++ b/libtomcrypt/src/encauth/gcm/gcm_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE /** Process plaintext/ciphertext through GCM @@ -50,7 +50,7 @@ int gcm_process(gcm_state *gcm, } /* in AAD mode? */ - if (gcm->mode == GCM_MODE_AAD) { + if (gcm->mode == LTC_GCM_MODE_AAD) { /* let's process the AAD */ if (gcm->buflen) { gcm->totlen += gcm->buflen * CONST64(8); @@ -67,10 +67,10 @@ int gcm_process(gcm_state *gcm, } gcm->buflen = 0; - gcm->mode = GCM_MODE_TEXT; + gcm->mode = LTC_GCM_MODE_TEXT; } - if (gcm->mode != GCM_MODE_TEXT) { + if (gcm->mode != LTC_GCM_MODE_TEXT) { return CRYPT_INVALID_ARG; } @@ -147,6 +147,6 @@ int gcm_process(gcm_state *gcm, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_process.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2006/11/19 19:33:36 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_reset.c b/libtomcrypt/src/encauth/gcm/gcm_reset.c index a6a8522..c9e13d9 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_reset.c +++ b/libtomcrypt/src/encauth/gcm/gcm_reset.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE /** Reset a GCM state to as if you just called gcm_init(). This saves the initialization time. @@ -28,7 +28,7 @@ int gcm_reset(gcm_state *gcm) zeromem(gcm->buf, sizeof(gcm->buf)); zeromem(gcm->X, sizeof(gcm->X)); - gcm->mode = GCM_MODE_IV; + gcm->mode = LTC_GCM_MODE_IV; gcm->ivmode = 0; gcm->buflen = 0; gcm->totlen = 0; @@ -39,6 +39,6 @@ int gcm_reset(gcm_state *gcm) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_reset.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/gcm/gcm_test.c b/libtomcrypt/src/encauth/gcm/gcm_test.c index 2f8539b..7380c81 100644 --- a/libtomcrypt/src/encauth/gcm/gcm_test.c +++ b/libtomcrypt/src/encauth/gcm/gcm_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE /** Test the GCM code @@ -408,6 +408,6 @@ int gcm_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_test.c,v $ */ -/* $Revision: 1.20 $ */ -/* $Date: 2006/12/03 17:25:44 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_decrypt.c b/libtomcrypt/src/encauth/ocb/ocb_decrypt.c index 58f3825..61003db 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_decrypt.c +++ b/libtomcrypt/src/encauth/ocb/ocb_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Decrypt a block with OCB. @@ -74,6 +74,6 @@ int ocb_decrypt(ocb_state *ocb, const unsigned char *ct, unsigned char *pt) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_decrypt.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c b/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c index b7b8840..6644618 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c +++ b/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Decrypt and compare the tag with OCB. @@ -81,6 +81,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c b/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c index 2a3ae39..d604b36 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c +++ b/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Terminate a decrypting OCB state @@ -75,6 +75,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c b/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c index 5948d82..276d50e 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c +++ b/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Terminate an encryption OCB state @@ -41,6 +41,6 @@ int ocb_done_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned long ptle #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_encrypt.c b/libtomcrypt/src/encauth/ocb/ocb_encrypt.c index 3c4991c..84afa66 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_encrypt.c +++ b/libtomcrypt/src/encauth/ocb/ocb_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Encrypt a block of data with OCB. @@ -67,6 +67,6 @@ int ocb_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned char *ct) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_encrypt.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c b/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c index e58975e..f81cc4b 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c +++ b/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Encrypt and generate an authentication code for a buffer of memory @@ -79,6 +79,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_init.c b/libtomcrypt/src/encauth/ocb/ocb_init.c index 536af87..604ae0e 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_init.c +++ b/libtomcrypt/src/encauth/ocb/ocb_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE static const struct { int len; @@ -132,6 +132,6 @@ int ocb_init(ocb_state *ocb, int cipher, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_init.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_ntz.c b/libtomcrypt/src/encauth/ocb/ocb_ntz.c index 8100ec0..c3e42f1 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_ntz.c +++ b/libtomcrypt/src/encauth/ocb/ocb_ntz.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -16,7 +16,7 @@ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Returns the number of leading zero bits [from lsb up] @@ -37,6 +37,6 @@ int ocb_ntz(unsigned long x) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_ntz.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c b/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c index dea43ee..145f4c4 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c +++ b/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Compute the shift/xor for OCB (internal function) @@ -34,6 +34,6 @@ void ocb_shift_xor(ocb_state *ocb, unsigned char *Z) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/ocb_test.c b/libtomcrypt/src/encauth/ocb/ocb_test.c index 4d7ed78..8de1a57 100644 --- a/libtomcrypt/src/encauth/ocb/ocb_test.c +++ b/libtomcrypt/src/encauth/ocb/ocb_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /** Test the OCB protocol @@ -222,7 +222,7 @@ int ocb_test(void) #endif /* LTC_TEST */ } -#endif /* OCB_MODE */ +#endif /* LTC_OCB_MODE */ /* some comments @@ -232,6 +232,6 @@ int ocb_test(void) -- The setup is somewhat complicated... */ -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_test.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/encauth/ocb/s_ocb_done.c b/libtomcrypt/src/encauth/ocb/s_ocb_done.c index 7688a42..37a7cb7 100644 --- a/libtomcrypt/src/encauth/ocb/s_ocb_done.c +++ b/libtomcrypt/src/encauth/ocb/s_ocb_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @@ -15,7 +15,7 @@ */ #include "tomcrypt.h" -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE /* Since the last block is encrypted in CTR mode the same code can * be used to finish a decrypt or encrypt stream. The only difference @@ -143,6 +143,6 @@ error: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/s_ocb_done.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/chc/chc.c b/libtomcrypt/src/hashes/chc/chc.c index 3f86270..2c061e3 100644 --- a/libtomcrypt/src/hashes/chc/chc.c +++ b/libtomcrypt/src/hashes/chc/chc.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -16,7 +16,7 @@ CHC support. (Tom St Denis) */ -#ifdef CHC_HASH +#ifdef LTC_CHC_HASH #define UNDEFED_HASH -17 @@ -293,6 +293,6 @@ int chc_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/chc/chc.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/helper/hash_file.c b/libtomcrypt/src/hashes/helper/hash_file.c index df31606..e40c147 100644 --- a/libtomcrypt/src/hashes/helper/hash_file.c +++ b/libtomcrypt/src/hashes/helper/hash_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -53,6 +53,6 @@ int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *ou } -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_file.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/helper/hash_filehandle.c b/libtomcrypt/src/hashes/helper/hash_filehandle.c index 03155ea..af8164a 100644 --- a/libtomcrypt/src/hashes/helper/hash_filehandle.c +++ b/libtomcrypt/src/hashes/helper/hash_filehandle.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -67,6 +67,6 @@ int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outle } -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_filehandle.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/helper/hash_memory.c b/libtomcrypt/src/hashes/helper/hash_memory.c index def9fa7..853183a 100644 --- a/libtomcrypt/src/hashes/helper/hash_memory.c +++ b/libtomcrypt/src/hashes/helper/hash_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -64,6 +64,6 @@ LBL_ERR: return err; } -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_memory.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/helper/hash_memory_multi.c b/libtomcrypt/src/hashes/helper/hash_memory_multi.c index 91f2d0c..ef39646 100644 --- a/libtomcrypt/src/hashes/helper/hash_memory_multi.c +++ b/libtomcrypt/src/hashes/helper/hash_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> @@ -82,6 +82,6 @@ LBL_ERR: return err; } -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_memory_multi.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/md2.c b/libtomcrypt/src/hashes/md2.c index b917213..5a65d7e 100644 --- a/libtomcrypt/src/hashes/md2.c +++ b/libtomcrypt/src/hashes/md2.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @param md2.c - MD2 (RFC 1319) hash function implementation by Tom St Denis + LTC_MD2 (RFC 1319) hash function implementation by Tom St Denis */ -#ifdef MD2 +#ifdef LTC_MD2 const struct ltc_hash_descriptor md2_desc = { @@ -102,7 +102,7 @@ int md2_init(hash_state *md) { LTC_ARGCHK(md != NULL); - /* MD2 uses a zero'ed state... */ + /* LTC_MD2 uses a zero'ed state... */ zeromem(md->md2.X, sizeof(md->md2.X)); zeromem(md->md2.chksum, sizeof(md->md2.chksum)); zeromem(md->md2.buf, sizeof(md->md2.buf)); @@ -246,6 +246,6 @@ int md2_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md2.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/md4.c b/libtomcrypt/src/hashes/md4.c index 42645ef..adf916b 100644 --- a/libtomcrypt/src/hashes/md4.c +++ b/libtomcrypt/src/hashes/md4.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ Submitted by Dobes Vandermeer (dobes@smartt.com) */ -#ifdef MD4 +#ifdef LTC_MD4 const struct ltc_hash_descriptor md4_desc = { @@ -48,7 +48,7 @@ const struct ltc_hash_descriptor md4_desc = #define S33 11 #define S34 15 -/* F, G and H are basic MD4 functions. */ +/* F, G and H are basic LTC_MD4 functions. */ #define F(x, y, z) (z ^ (x & (y ^ z))) #define G(x, y, z) ((x & y) | (z & (x | y))) #define H(x, y, z) ((x) ^ (y) ^ (z)) @@ -302,6 +302,6 @@ int md4_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md4.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/md5.c b/libtomcrypt/src/hashes/md5.c index f6274f9..4fa1e9e 100644 --- a/libtomcrypt/src/hashes/md5.c +++ b/libtomcrypt/src/hashes/md5.c @@ -6,17 +6,17 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file md5.c - MD5 hash function by Tom St Denis + LTC_MD5 hash function by Tom St Denis */ -#ifdef MD5 +#ifdef LTC_MD5 const struct ltc_hash_descriptor md5_desc = { @@ -363,6 +363,6 @@ int md5_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md5.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/rmd128.c b/libtomcrypt/src/hashes/rmd128.c index d294626..58ae927 100644 --- a/libtomcrypt/src/hashes/rmd128.c +++ b/libtomcrypt/src/hashes/rmd128.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,13 +15,13 @@ RMD128 Hash function */ -/* Implementation of RIPEMD-128 based on the source by Antoon Bosselaers, ESAT-COSIC +/* Implementation of LTC_RIPEMD-128 based on the source by Antoon Bosselaers, ESAT-COSIC * * This source has been radically overhauled to be portable and work within * the LibTomCrypt API by Tom St Denis */ -#ifdef RIPEMD128 +#ifdef LTC_RIPEMD128 const struct ltc_hash_descriptor rmd128_desc = { @@ -405,6 +405,6 @@ int rmd128_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd128.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/rmd160.c b/libtomcrypt/src/hashes/rmd160.c index a1c090a..1313e41 100644 --- a/libtomcrypt/src/hashes/rmd160.c +++ b/libtomcrypt/src/hashes/rmd160.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,13 +15,13 @@ RMD160 hash function */ -/* Implementation of RIPEMD-160 based on the source by Antoon Bosselaers, ESAT-COSIC +/* Implementation of LTC_RIPEMD-160 based on the source by Antoon Bosselaers, ESAT-COSIC * * This source has been radically overhauled to be portable and work within * the LibTomCrypt API by Tom St Denis */ -#ifdef RIPEMD160 +#ifdef LTC_RIPEMD160 const struct ltc_hash_descriptor rmd160_desc = { @@ -464,6 +464,6 @@ int rmd160_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd160.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/rmd256.c b/libtomcrypt/src/hashes/rmd256.c index 4540ef9..0188bf7 100644 --- a/libtomcrypt/src/hashes/rmd256.c +++ b/libtomcrypt/src/hashes/rmd256.c @@ -6,22 +6,22 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @param rmd256.c - RMD256 Hash function + RLTC_MD256 Hash function */ -#ifdef RIPEMD256 +#ifdef LTC_RIPEMD256 const struct ltc_hash_descriptor rmd256_desc = { "rmd256", 8, - 16, + 32, 64, /* OID */ diff --git a/libtomcrypt/src/hashes/rmd320.c b/libtomcrypt/src/hashes/rmd320.c index a11fca4..858d7bb 100644 --- a/libtomcrypt/src/hashes/rmd320.c +++ b/libtomcrypt/src/hashes/rmd320.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,13 +15,13 @@ RMD320 hash function */ -#ifdef RIPEMD320 +#ifdef LTC_RIPEMD320 const struct ltc_hash_descriptor rmd320_desc = { "rmd320", 9, - 20, + 40, 64, /* OID */ diff --git a/libtomcrypt/src/hashes/sha1.c b/libtomcrypt/src/hashes/sha1.c index 8cc6855..8c846b0 100644 --- a/libtomcrypt/src/hashes/sha1.c +++ b/libtomcrypt/src/hashes/sha1.c @@ -6,17 +6,17 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file sha1.c - SHA1 code by Tom St Denis + LTC_SHA1 code by Tom St Denis */ -#ifdef SHA1 +#ifdef LTC_SHA1 const struct ltc_hash_descriptor sha1_desc = { @@ -283,6 +283,6 @@ int sha1_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha1.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/sha2/sha224.c b/libtomcrypt/src/hashes/sha2/sha224.c index f085d50..5d7dfb2 100644 --- a/libtomcrypt/src/hashes/sha2/sha224.c +++ b/libtomcrypt/src/hashes/sha2/sha224.c @@ -6,11 +6,11 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @param sha224.c - SHA-224 new NIST standard based off of SHA-256 truncated to 224 bits (Tom St Denis) + LTC_SHA-224 new NIST standard based off of LTC_SHA-256 truncated to 224 bits (Tom St Denis) */ const struct ltc_hash_descriptor sha224_desc = @@ -120,6 +120,6 @@ int sha224_test(void) } -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha224.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/sha2/sha256.c b/libtomcrypt/src/hashes/sha2/sha256.c index 2b42cb7..ad1386a 100644 --- a/libtomcrypt/src/hashes/sha2/sha256.c +++ b/libtomcrypt/src/hashes/sha2/sha256.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file sha256.c - SHA256 by Tom St Denis + LTC_SHA256 by Tom St Denis */ -#ifdef SHA256 +#ifdef LTC_SHA256 const struct ltc_hash_descriptor sha256_desc = { @@ -327,7 +327,7 @@ int sha256_test(void) #endif } -#ifdef SHA224 +#ifdef LTC_SHA224 #include "sha224.c" #endif @@ -335,6 +335,6 @@ int sha256_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha256.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/sha2/sha384.c b/libtomcrypt/src/hashes/sha2/sha384.c index ac7709c..cf4d7dc 100644 --- a/libtomcrypt/src/hashes/sha2/sha384.c +++ b/libtomcrypt/src/hashes/sha2/sha384.c @@ -6,11 +6,11 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @param sha384.c - SHA384 hash included in sha512.c, Tom St Denis + LTC_SHA384 hash included in sha512.c, Tom St Denis */ const struct ltc_hash_descriptor sha384_desc = @@ -130,6 +130,6 @@ int sha384_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha384.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/sha2/sha512.c b/libtomcrypt/src/hashes/sha2/sha512.c index 08c95ef..4b7e761 100644 --- a/libtomcrypt/src/hashes/sha2/sha512.c +++ b/libtomcrypt/src/hashes/sha2/sha512.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @param sha512.c - SHA512 by Tom St Denis + LTC_SHA512 by Tom St Denis */ -#ifdef SHA512 +#ifdef LTC_SHA512 const struct ltc_hash_descriptor sha512_desc = { @@ -305,7 +305,7 @@ int sha512_test(void) #endif } -#ifdef SHA384 +#ifdef LTC_SHA384 #include "sha384.c" #endif @@ -314,6 +314,6 @@ int sha512_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha512.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/tiger.c b/libtomcrypt/src/hashes/tiger.c index 9a4052c..4d8c659 100644 --- a/libtomcrypt/src/hashes/tiger.c +++ b/libtomcrypt/src/hashes/tiger.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -16,7 +16,7 @@ Tiger hash function, Tom St Denis */ -#ifdef TIGER +#ifdef LTC_TIGER const struct ltc_hash_descriptor tiger_desc = { @@ -809,6 +809,6 @@ Hash of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFG -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/tiger.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/whirl/whirl.c b/libtomcrypt/src/hashes/whirl/whirl.c index 65e38a7..102d6f1 100644 --- a/libtomcrypt/src/hashes/whirl/whirl.c +++ b/libtomcrypt/src/hashes/whirl/whirl.c @@ -6,17 +6,17 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /** @file whirl.c - WHIRLPOOL (using their new sbox) hash function by Tom St Denis + LTC_WHIRLPOOL (using their new sbox) hash function by Tom St Denis */ #include "tomcrypt.h" -#ifdef WHIRLPOOL +#ifdef LTC_WHIRLPOOL const struct ltc_hash_descriptor whirlpool_desc = { @@ -309,6 +309,6 @@ int whirlpool_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/whirl/whirl.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/hashes/whirl/whirltab.c b/libtomcrypt/src/hashes/whirl/whirltab.c index c83d0b2..85ba312 100644 --- a/libtomcrypt/src/hashes/whirl/whirltab.c +++ b/libtomcrypt/src/hashes/whirl/whirltab.c @@ -1,6 +1,6 @@ /** @file whirltab.c - WHIRLPOOL tables, Tom St Denis + LTC_WHIRLPOOL tables, Tom St Denis */ static const ulong64 sbox0[] = { CONST64(0x18186018c07830d8), CONST64(0x23238c2305af4626), CONST64(0xc6c63fc67ef991b8), CONST64(0xe8e887e8136fcdfb), @@ -578,6 +578,6 @@ CONST64(0x6302aa71c81949d9), }; -/* $Source: /cvs/libtom/libtomcrypt/src/hashes/whirl/whirltab.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2005/05/05 14:35:58 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt.h b/libtomcrypt/src/headers/tomcrypt.h index ba9f181..ad4b7ec 100644 --- a/libtomcrypt/src/headers/tomcrypt.h +++ b/libtomcrypt/src/headers/tomcrypt.h @@ -16,8 +16,8 @@ extern "C" { #endif /* version */ -#define CRYPT 0x0116 -#define SCRYPT "1.16" +#define CRYPT 0x0117 +#define SCRYPT "1.17" /* max size of either a cipher/hash block or symmetric key [largest of the two] */ #define MAXBLOCKSIZE 128 @@ -83,6 +83,6 @@ enum { #endif /* TOMCRYPT_H_ */ -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt.h,v $ */ -/* $Revision: 1.20 $ */ -/* $Date: 2006/11/26 01:45:14 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_argchk.h b/libtomcrypt/src/headers/tomcrypt_argchk.h index 38e1bdd..63a6ef0 100644 --- a/libtomcrypt/src/headers/tomcrypt_argchk.h +++ b/libtomcrypt/src/headers/tomcrypt_argchk.h @@ -41,6 +41,6 @@ void crypt_argchk(char *v, char *s, int d) ATTRIB_NORETURN; #endif -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_argchk.h,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/08/27 20:50:21 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_cfg.h b/libtomcrypt/src/headers/tomcrypt_cfg.h index 7feae6e..f7ad3cc 100644 --- a/libtomcrypt/src/headers/tomcrypt_cfg.h +++ b/libtomcrypt/src/headers/tomcrypt_cfg.h @@ -131,6 +131,6 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2); #endif -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cfg.h,v $ */ -/* $Revision: 1.19 $ */ -/* $Date: 2006/12/04 02:19:48 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_cipher.h b/libtomcrypt/src/headers/tomcrypt_cipher.h index 62a26c7..f23fd97 100644 --- a/libtomcrypt/src/headers/tomcrypt_cipher.h +++ b/libtomcrypt/src/headers/tomcrypt_cipher.h @@ -3,41 +3,41 @@ * We put each of the ciphers scheduled keys in their own structs then we put all of * the key formats in one union. This makes the function prototypes easier to use. */ -#ifdef BLOWFISH +#ifdef LTC_BLOWFISH struct blowfish_key { ulong32 S[4][256]; ulong32 K[18]; }; #endif -#ifdef RC5 +#ifdef LTC_RC5 struct rc5_key { int rounds; ulong32 K[50]; }; #endif -#ifdef RC6 +#ifdef LTC_RC6 struct rc6_key { ulong32 K[44]; }; #endif -#ifdef SAFERP +#ifdef LTC_SAFERP struct saferp_key { unsigned char K[33][16]; long rounds; }; #endif -#ifdef RIJNDAEL +#ifdef LTC_RIJNDAEL struct rijndael_key { ulong32 eK[60], dK[60]; int Nr; }; #endif -#ifdef KSEED +#ifdef LTC_KSEED struct kseed_key { ulong32 K[32], dK[32]; }; @@ -51,14 +51,14 @@ struct kasumi_key { }; #endif -#ifdef XTEA +#ifdef LTC_XTEA struct xtea_key { unsigned long A[32], B[32]; }; #endif -#ifdef TWOFISH -#ifndef TWOFISH_SMALL +#ifdef LTC_TWOFISH +#ifndef LTC_TWOFISH_SMALL struct twofish_key { ulong32 S[4][256], K[40]; }; @@ -70,24 +70,24 @@ struct xtea_key { #endif #endif -#ifdef SAFER -#define SAFER_K64_DEFAULT_NOF_ROUNDS 6 -#define SAFER_K128_DEFAULT_NOF_ROUNDS 10 -#define SAFER_SK64_DEFAULT_NOF_ROUNDS 8 -#define SAFER_SK128_DEFAULT_NOF_ROUNDS 10 -#define SAFER_MAX_NOF_ROUNDS 13 -#define SAFER_BLOCK_LEN 8 -#define SAFER_KEY_LEN (1 + SAFER_BLOCK_LEN * (1 + 2 * SAFER_MAX_NOF_ROUNDS)) -typedef unsigned char safer_block_t[SAFER_BLOCK_LEN]; -typedef unsigned char safer_key_t[SAFER_KEY_LEN]; +#ifdef LTC_SAFER +#define LTC_SAFER_K64_DEFAULT_NOF_ROUNDS 6 +#define LTC_SAFER_K128_DEFAULT_NOF_ROUNDS 10 +#define LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS 8 +#define LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS 10 +#define LTC_SAFER_MAX_NOF_ROUNDS 13 +#define LTC_SAFER_BLOCK_LEN 8 +#define LTC_SAFER_KEY_LEN (1 + LTC_SAFER_BLOCK_LEN * (1 + 2 * LTC_SAFER_MAX_NOF_ROUNDS)) +typedef unsigned char safer_block_t[LTC_SAFER_BLOCK_LEN]; +typedef unsigned char safer_key_t[LTC_SAFER_KEY_LEN]; struct safer_key { safer_key_t key; }; #endif -#ifdef RC2 +#ifdef LTC_RC2 struct rc2_key { unsigned xkey[64]; }; #endif -#ifdef DES +#ifdef LTC_DES struct des_key { ulong32 ek[32], dk[32]; }; @@ -97,32 +97,32 @@ struct des3_key { }; #endif -#ifdef CAST5 +#ifdef LTC_CAST5 struct cast5_key { ulong32 K[32], keylen; }; #endif -#ifdef NOEKEON +#ifdef LTC_NOEKEON struct noekeon_key { ulong32 K[4], dK[4]; }; #endif -#ifdef SKIPJACK +#ifdef LTC_SKIPJACK struct skipjack_key { unsigned char key[10]; }; #endif -#ifdef KHAZAD +#ifdef LTC_KHAZAD struct khazad_key { ulong64 roundKeyEnc[8 + 1]; ulong64 roundKeyDec[8 + 1]; }; #endif -#ifdef ANUBIS +#ifdef LTC_ANUBIS struct anubis_key { int keyBits; int R; @@ -131,59 +131,69 @@ struct anubis_key { }; #endif +#ifdef LTC_MULTI2 +struct multi2_key { + int N; + ulong32 uk[8]; +}; +#endif + typedef union Symmetric_key { -#ifdef DES +#ifdef LTC_DES struct des_key des; struct des3_key des3; #endif -#ifdef RC2 +#ifdef LTC_RC2 struct rc2_key rc2; #endif -#ifdef SAFER +#ifdef LTC_SAFER struct safer_key safer; #endif -#ifdef TWOFISH +#ifdef LTC_TWOFISH struct twofish_key twofish; #endif -#ifdef BLOWFISH +#ifdef LTC_BLOWFISH struct blowfish_key blowfish; #endif -#ifdef RC5 +#ifdef LTC_RC5 struct rc5_key rc5; #endif -#ifdef RC6 +#ifdef LTC_RC6 struct rc6_key rc6; #endif -#ifdef SAFERP +#ifdef LTC_SAFERP struct saferp_key saferp; #endif -#ifdef RIJNDAEL +#ifdef LTC_RIJNDAEL struct rijndael_key rijndael; #endif -#ifdef XTEA +#ifdef LTC_XTEA struct xtea_key xtea; #endif -#ifdef CAST5 +#ifdef LTC_CAST5 struct cast5_key cast5; #endif -#ifdef NOEKEON +#ifdef LTC_NOEKEON struct noekeon_key noekeon; #endif -#ifdef SKIPJACK +#ifdef LTC_SKIPJACK struct skipjack_key skipjack; #endif -#ifdef KHAZAD +#ifdef LTC_KHAZAD struct khazad_key khazad; #endif -#ifdef ANUBIS +#ifdef LTC_ANUBIS struct anubis_key anubis; #endif -#ifdef KSEED +#ifdef LTC_KSEED struct kseed_key kseed; #endif #ifdef LTC_KASUMI struct kasumi_key kasumi; #endif +#ifdef LTC_MULTI2 + struct multi2_key multi2; +#endif void *data; } symmetric_key; @@ -257,8 +267,11 @@ typedef struct { blocklen, /** The padding offset */ padlen, - /** The mode (endianess) of the CTR, 0==little, 1==big */ - mode; + /** The mode (endianess) of the CTR, 0==little, 1==big */ + mode, + /** counter width */ + ctrlen; + /** The counter */ unsigned char ctr[MAXBLOCKSIZE], /** The pad used to encrypt/decrypt */ @@ -488,7 +501,7 @@ extern struct ltc_cipher_descriptor { unsigned char *tag, unsigned long *taglen, int direction); - /** Accelerated one shot OMAC + /** Accelerated one shot LTC_OMAC @param key The secret key @param keylen The key length (octets) @param in The message @@ -532,7 +545,7 @@ extern struct ltc_cipher_descriptor { unsigned char *out, unsigned long *outlen); } cipher_descriptor[]; -#ifdef BLOWFISH +#ifdef LTC_BLOWFISH int blowfish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -542,7 +555,7 @@ int blowfish_keysize(int *keysize); extern const struct ltc_cipher_descriptor blowfish_desc; #endif -#ifdef RC5 +#ifdef LTC_RC5 int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -552,7 +565,7 @@ int rc5_keysize(int *keysize); extern const struct ltc_cipher_descriptor rc5_desc; #endif -#ifdef RC6 +#ifdef LTC_RC6 int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -562,7 +575,7 @@ int rc6_keysize(int *keysize); extern const struct ltc_cipher_descriptor rc6_desc; #endif -#ifdef RC2 +#ifdef LTC_RC2 int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int rc2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int rc2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -572,7 +585,7 @@ int rc2_keysize(int *keysize); extern const struct ltc_cipher_descriptor rc2_desc; #endif -#ifdef SAFERP +#ifdef LTC_SAFERP int saferp_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int saferp_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int saferp_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -582,7 +595,7 @@ int saferp_keysize(int *keysize); extern const struct ltc_cipher_descriptor saferp_desc; #endif -#ifdef SAFER +#ifdef LTC_SAFER int safer_k64_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int safer_sk64_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int safer_k128_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); @@ -598,7 +611,7 @@ int safer_128_keysize(int *keysize); extern const struct ltc_cipher_descriptor safer_k64_desc, safer_k128_desc, safer_sk64_desc, safer_sk128_desc; #endif -#ifdef RIJNDAEL +#ifdef LTC_RIJNDAEL /* make aes an alias */ #define aes_setup rijndael_setup @@ -626,7 +639,7 @@ extern const struct ltc_cipher_descriptor rijndael_desc, aes_desc; extern const struct ltc_cipher_descriptor rijndael_enc_desc, aes_enc_desc; #endif -#ifdef XTEA +#ifdef LTC_XTEA int xtea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int xtea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int xtea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -636,7 +649,7 @@ int xtea_keysize(int *keysize); extern const struct ltc_cipher_descriptor xtea_desc; #endif -#ifdef TWOFISH +#ifdef LTC_TWOFISH int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -646,7 +659,7 @@ int twofish_keysize(int *keysize); extern const struct ltc_cipher_descriptor twofish_desc; #endif -#ifdef DES +#ifdef LTC_DES int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -662,7 +675,7 @@ int des3_keysize(int *keysize); extern const struct ltc_cipher_descriptor des_desc, des3_desc; #endif -#ifdef CAST5 +#ifdef LTC_CAST5 int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -672,7 +685,7 @@ int cast5_keysize(int *keysize); extern const struct ltc_cipher_descriptor cast5_desc; #endif -#ifdef NOEKEON +#ifdef LTC_NOEKEON int noekeon_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -682,7 +695,7 @@ int noekeon_keysize(int *keysize); extern const struct ltc_cipher_descriptor noekeon_desc; #endif -#ifdef SKIPJACK +#ifdef LTC_SKIPJACK int skipjack_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -692,7 +705,7 @@ int skipjack_keysize(int *keysize); extern const struct ltc_cipher_descriptor skipjack_desc; #endif -#ifdef KHAZAD +#ifdef LTC_KHAZAD int khazad_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int khazad_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int khazad_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -702,7 +715,7 @@ int khazad_keysize(int *keysize); extern const struct ltc_cipher_descriptor khazad_desc; #endif -#ifdef ANUBIS +#ifdef LTC_ANUBIS int anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int anubis_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int anubis_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -712,7 +725,7 @@ int anubis_keysize(int *keysize); extern const struct ltc_cipher_descriptor anubis_desc; #endif -#ifdef KSEED +#ifdef LTC_KSEED int kseed_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); int kseed_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); int kseed_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); @@ -732,6 +745,17 @@ int kasumi_keysize(int *keysize); extern const struct ltc_cipher_descriptor kasumi_desc; #endif + +#ifdef LTC_MULTI2 +int multi2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey); +int multi2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey); +int multi2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey); +int multi2_test(void); +void multi2_done(symmetric_key *skey); +int multi2_keysize(int *keysize); +extern const struct ltc_cipher_descriptor multi2_desc; +#endif + #ifdef LTC_ECB_MODE int ecb_start(int cipher, const unsigned char *key, int keylen, int num_rounds, symmetric_ECB *ecb); @@ -772,9 +796,9 @@ int cbc_done(symmetric_CBC *cbc); #ifdef LTC_CTR_MODE -#define CTR_COUNTER_LITTLE_ENDIAN 0 -#define CTR_COUNTER_BIG_ENDIAN 1 -#define LTC_CTR_RFC3686 2 +#define CTR_COUNTER_LITTLE_ENDIAN 0x0000 +#define CTR_COUNTER_BIG_ENDIAN 0x1000 +#define LTC_CTR_RFC3686 0x2000 int ctr_start( int cipher, const unsigned char *IV, @@ -824,6 +848,34 @@ int f8_done(symmetric_F8 *f8); int f8_test_mode(void); #endif +#ifdef LTC_XTS_MODE +typedef struct { + symmetric_key key1, key2; + int cipher; +} symmetric_xts; + +int xts_start( int cipher, + const unsigned char *key1, + const unsigned char *key2, + unsigned long keylen, + int num_rounds, + symmetric_xts *xts); + +int xts_encrypt( + const unsigned char *pt, unsigned long ptlen, + unsigned char *ct, + const unsigned char *tweak, + symmetric_xts *xts); +int xts_decrypt( + const unsigned char *ct, unsigned long ptlen, + unsigned char *pt, + const unsigned char *tweak, + symmetric_xts *xts); + +void xts_done(symmetric_xts *xts); +int xts_test(void); +void xts_mult_x(unsigned char *I); +#endif int find_cipher(const char *name); int find_cipher_any(const char *name, int blocklen, int keylen); @@ -834,6 +886,6 @@ int cipher_is_valid(int idx); LTC_MUTEX_PROTO(ltc_cipher_mutex) -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cipher.h,v $ */ -/* $Revision: 1.46 $ */ -/* $Date: 2006/11/13 23:09:38 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_custom.h b/libtomcrypt/src/headers/tomcrypt_custom.h index 82cb26e..b6f4f1f 100644 --- a/libtomcrypt/src/headers/tomcrypt_custom.h +++ b/libtomcrypt/src/headers/tomcrypt_custom.h @@ -69,6 +69,13 @@ #endif /* These spit out warnings etc */ #define LTC_NO_ROLC +#ifndef XQSORT + #ifdef qsort + #define LTC_NO_PROTOTYPES + #endif +#define XQSORT qsort +#endif + /* Enable self-test test vector checking */ /* Not for dropbear */ @@ -91,25 +98,27 @@ #ifdef DROPBEAR_BLOWFISH -#define BLOWFISH +#define LTC_BLOWFISH #endif #ifdef DROPBEAR_AES -#define RIJNDAEL +#define LTC_RIJNDAEL #endif #ifdef DROPBEAR_TWOFISH -#define TWOFISH +#define LTC_TWOFISH +/* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format + * (saves 4KB of ram), _ALL_TABLES enables all tables during setup */ /* enabling just TWOFISH_SMALL will make the binary ~1kB smaller, turning on * TWOFISH_TABLES will make it a few kB bigger, but perhaps reduces runtime * memory usage? */ -#define TWOFISH_SMALL -/*#define TWOFISH_TABLES*/ +#define LTC_TWOFISH_SMALL +/*#define LTC_TWOFISH_TABLES*/ #endif #ifdef DROPBEAR_3DES -#define DES +#define LTC_DES #endif #define LTC_CBC_MODE @@ -118,26 +127,26 @@ #define LTC_CTR_MODE #endif -#define SHA1 +#define LTC_SHA1 #ifdef DROPBEAR_MD5 -#define MD5 +#define LTC_MD5 #endif #ifdef DROPBEAR_SHA256 -#define SHA256 +#define LTC_SHA256 #endif #ifdef DROPBEAR_SHA384 -#define SHA384 +#define LTC_SHA384 #endif #ifdef DROPBEAR_SHA512 -#define SHA512 +#define LTC_SHA512 #endif #define LTC_HMAC #ifdef DROPBEAR_ECC -#define MECC +#define LTC_MECC #define LTC_ECC_SHAMIR #define LTC_ECC_TIMING_RESISTANT #define MPI @@ -154,7 +163,7 @@ #endif /* Various tidbits of modern neatoness */ -#define BASE64 +#define LTC_BASE64 /* default no pthread functions */ #define LTC_MUTEX_GLOBAL(x) @@ -167,13 +176,13 @@ /* Debuggers */ -/* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and RC4 work (see the code) */ +/* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and LTC_RC4 work (see the code) */ /* #define LTC_VALGRIND */ #endif -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_custom.h,v $ */ -/* $Revision: 1.66 $ */ -/* $Date: 2006/12/04 02:50:11 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_hash.h b/libtomcrypt/src/headers/tomcrypt_hash.h index d9916ac..56b272a 100644 --- a/libtomcrypt/src/headers/tomcrypt_hash.h +++ b/libtomcrypt/src/headers/tomcrypt_hash.h @@ -1,5 +1,5 @@ /* ---- HASH FUNCTIONS ---- */ -#ifdef SHA512 +#ifdef LTC_SHA512 struct sha512_state { ulong64 length, state[8]; unsigned long curlen; @@ -7,7 +7,7 @@ struct sha512_state { }; #endif -#ifdef SHA256 +#ifdef LTC_SHA256 struct sha256_state { ulong64 length; ulong32 state[8], curlen; @@ -15,7 +15,7 @@ struct sha256_state { }; #endif -#ifdef SHA1 +#ifdef LTC_SHA1 struct sha1_state { ulong64 length; ulong32 state[5], curlen; @@ -23,7 +23,7 @@ struct sha1_state { }; #endif -#ifdef MD5 +#ifdef LTC_MD5 struct md5_state { ulong64 length; ulong32 state[4], curlen; @@ -31,7 +31,7 @@ struct md5_state { }; #endif -#ifdef MD4 +#ifdef LTC_MD4 struct md4_state { ulong64 length; ulong32 state[4], curlen; @@ -39,7 +39,7 @@ struct md4_state { }; #endif -#ifdef TIGER +#ifdef LTC_TIGER struct tiger_state { ulong64 state[3], length; unsigned long curlen; @@ -47,14 +47,14 @@ struct tiger_state { }; #endif -#ifdef MD2 +#ifdef LTC_MD2 struct md2_state { unsigned char chksum[16], X[48], buf[16]; unsigned long curlen; }; #endif -#ifdef RIPEMD128 +#ifdef LTC_RIPEMD128 struct rmd128_state { ulong64 length; unsigned char buf[64]; @@ -62,7 +62,7 @@ struct rmd128_state { }; #endif -#ifdef RIPEMD160 +#ifdef LTC_RIPEMD160 struct rmd160_state { ulong64 length; unsigned char buf[64]; @@ -70,7 +70,7 @@ struct rmd160_state { }; #endif -#ifdef RIPEMD256 +#ifdef LTC_RIPEMD256 struct rmd256_state { ulong64 length; unsigned char buf[64]; @@ -78,7 +78,7 @@ struct rmd256_state { }; #endif -#ifdef RIPEMD320 +#ifdef LTC_RIPEMD320 struct rmd320_state { ulong64 length; unsigned char buf[64]; @@ -86,7 +86,7 @@ struct rmd320_state { }; #endif -#ifdef WHIRLPOOL +#ifdef LTC_WHIRLPOOL struct whirlpool_state { ulong64 length, state[8]; unsigned char buf[64]; @@ -94,7 +94,7 @@ struct whirlpool_state { }; #endif -#ifdef CHC_HASH +#ifdef LTC_CHC_HASH struct chc_state { ulong64 length; unsigned char state[MAXBLOCKSIZE], buf[MAXBLOCKSIZE]; @@ -104,43 +104,43 @@ struct chc_state { typedef union Hash_state { char dummy[1]; -#ifdef CHC_HASH +#ifdef LTC_CHC_HASH struct chc_state chc; #endif -#ifdef WHIRLPOOL +#ifdef LTC_WHIRLPOOL struct whirlpool_state whirlpool; #endif -#ifdef SHA512 +#ifdef LTC_SHA512 struct sha512_state sha512; #endif -#ifdef SHA256 +#ifdef LTC_SHA256 struct sha256_state sha256; #endif -#ifdef SHA1 +#ifdef LTC_SHA1 struct sha1_state sha1; #endif -#ifdef MD5 +#ifdef LTC_MD5 struct md5_state md5; #endif -#ifdef MD4 +#ifdef LTC_MD4 struct md4_state md4; #endif -#ifdef MD2 +#ifdef LTC_MD2 struct md2_state md2; #endif -#ifdef TIGER +#ifdef LTC_TIGER struct tiger_state tiger; #endif -#ifdef RIPEMD128 +#ifdef LTC_RIPEMD128 struct rmd128_state rmd128; #endif -#ifdef RIPEMD160 +#ifdef LTC_RIPEMD160 struct rmd160_state rmd160; #endif -#ifdef RIPEMD256 +#ifdef LTC_RIPEMD256 struct rmd256_state rmd256; #endif -#ifdef RIPEMD320 +#ifdef LTC_RIPEMD320 struct rmd320_state rmd320; #endif void *data; @@ -191,7 +191,7 @@ extern struct ltc_hash_descriptor { } hash_descriptor[]; -#ifdef CHC_HASH +#ifdef LTC_CHC_HASH int chc_register(int cipher); int chc_init(hash_state * md); int chc_process(hash_state * md, const unsigned char *in, unsigned long inlen); @@ -200,7 +200,7 @@ int chc_test(void); extern const struct ltc_hash_descriptor chc_desc; #endif -#ifdef WHIRLPOOL +#ifdef LTC_WHIRLPOOL int whirlpool_init(hash_state * md); int whirlpool_process(hash_state * md, const unsigned char *in, unsigned long inlen); int whirlpool_done(hash_state * md, unsigned char *hash); @@ -208,7 +208,7 @@ int whirlpool_test(void); extern const struct ltc_hash_descriptor whirlpool_desc; #endif -#ifdef SHA512 +#ifdef LTC_SHA512 int sha512_init(hash_state * md); int sha512_process(hash_state * md, const unsigned char *in, unsigned long inlen); int sha512_done(hash_state * md, unsigned char *hash); @@ -216,9 +216,9 @@ int sha512_test(void); extern const struct ltc_hash_descriptor sha512_desc; #endif -#ifdef SHA384 -#ifndef SHA512 - #error SHA512 is required for SHA384 +#ifdef LTC_SHA384 +#ifndef LTC_SHA512 + #error LTC_SHA512 is required for LTC_SHA384 #endif int sha384_init(hash_state * md); #define sha384_process sha512_process @@ -227,16 +227,16 @@ int sha384_test(void); extern const struct ltc_hash_descriptor sha384_desc; #endif -#ifdef SHA256 +#ifdef LTC_SHA256 int sha256_init(hash_state * md); int sha256_process(hash_state * md, const unsigned char *in, unsigned long inlen); int sha256_done(hash_state * md, unsigned char *hash); int sha256_test(void); extern const struct ltc_hash_descriptor sha256_desc; -#ifdef SHA224 -#ifndef SHA256 - #error SHA256 is required for SHA224 +#ifdef LTC_SHA224 +#ifndef LTC_SHA256 + #error LTC_SHA256 is required for LTC_SHA224 #endif int sha224_init(hash_state * md); #define sha224_process sha256_process @@ -246,7 +246,7 @@ extern const struct ltc_hash_descriptor sha224_desc; #endif #endif -#ifdef SHA1 +#ifdef LTC_SHA1 int sha1_init(hash_state * md); int sha1_process(hash_state * md, const unsigned char *in, unsigned long inlen); int sha1_done(hash_state * md, unsigned char *hash); @@ -254,7 +254,7 @@ int sha1_test(void); extern const struct ltc_hash_descriptor sha1_desc; #endif -#ifdef MD5 +#ifdef LTC_MD5 int md5_init(hash_state * md); int md5_process(hash_state * md, const unsigned char *in, unsigned long inlen); int md5_done(hash_state * md, unsigned char *hash); @@ -262,7 +262,7 @@ int md5_test(void); extern const struct ltc_hash_descriptor md5_desc; #endif -#ifdef MD4 +#ifdef LTC_MD4 int md4_init(hash_state * md); int md4_process(hash_state * md, const unsigned char *in, unsigned long inlen); int md4_done(hash_state * md, unsigned char *hash); @@ -270,7 +270,7 @@ int md4_test(void); extern const struct ltc_hash_descriptor md4_desc; #endif -#ifdef MD2 +#ifdef LTC_MD2 int md2_init(hash_state * md); int md2_process(hash_state * md, const unsigned char *in, unsigned long inlen); int md2_done(hash_state * md, unsigned char *hash); @@ -278,7 +278,7 @@ int md2_test(void); extern const struct ltc_hash_descriptor md2_desc; #endif -#ifdef TIGER +#ifdef LTC_TIGER int tiger_init(hash_state * md); int tiger_process(hash_state * md, const unsigned char *in, unsigned long inlen); int tiger_done(hash_state * md, unsigned char *hash); @@ -286,7 +286,7 @@ int tiger_test(void); extern const struct ltc_hash_descriptor tiger_desc; #endif -#ifdef RIPEMD128 +#ifdef LTC_RIPEMD128 int rmd128_init(hash_state * md); int rmd128_process(hash_state * md, const unsigned char *in, unsigned long inlen); int rmd128_done(hash_state * md, unsigned char *hash); @@ -294,7 +294,7 @@ int rmd128_test(void); extern const struct ltc_hash_descriptor rmd128_desc; #endif -#ifdef RIPEMD160 +#ifdef LTC_RIPEMD160 int rmd160_init(hash_state * md); int rmd160_process(hash_state * md, const unsigned char *in, unsigned long inlen); int rmd160_done(hash_state * md, unsigned char *hash); @@ -302,7 +302,7 @@ int rmd160_test(void); extern const struct ltc_hash_descriptor rmd160_desc; #endif -#ifdef RIPEMD256 +#ifdef LTC_RIPEMD256 int rmd256_init(hash_state * md); int rmd256_process(hash_state * md, const unsigned char *in, unsigned long inlen); int rmd256_done(hash_state * md, unsigned char *hash); @@ -310,7 +310,7 @@ int rmd256_test(void); extern const struct ltc_hash_descriptor rmd256_desc; #endif -#ifdef RIPEMD320 +#ifdef LTC_RIPEMD320 int rmd320_init(hash_state * md); int rmd320_process(hash_state * md, const unsigned char *in, unsigned long inlen); int rmd320_done(hash_state * md, unsigned char *hash); @@ -374,6 +374,6 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen) return CRYPT_OK; \ } -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_hash.h,v $ */ -/* $Revision: 1.19 $ */ -/* $Date: 2006/11/05 01:36:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_mac.h b/libtomcrypt/src/headers/tomcrypt_mac.h index 42bf680..d030d73 100644 --- a/libtomcrypt/src/headers/tomcrypt_mac.h +++ b/libtomcrypt/src/headers/tomcrypt_mac.h @@ -51,7 +51,7 @@ int omac_file(int cipher, const char *filename, unsigned char *out, unsigned long *outlen); int omac_test(void); -#endif /* OMAC */ +#endif /* LTC_OMAC */ #ifdef LTC_PMAC @@ -96,10 +96,10 @@ void pmac_shift_xor(pmac_state *pmac); #endif /* PMAC */ -#ifdef EAX_MODE +#ifdef LTC_EAX_MODE #if !(defined(LTC_OMAC) && defined(LTC_CTR_MODE)) - #error EAX_MODE requires OMAC and CTR + #error LTC_EAX_MODE requires LTC_OMAC and CTR #endif typedef struct { @@ -137,7 +137,7 @@ int eax_decrypt_verify_memory(int cipher, int eax_test(void); #endif /* EAX MODE */ -#ifdef OCB_MODE +#ifdef LTC_OCB_MODE typedef struct { unsigned char L[MAXBLOCKSIZE], /* L value */ Ls[32][MAXBLOCKSIZE], /* L shifted by i bits to the left */ @@ -191,9 +191,9 @@ int ocb_ntz(unsigned long x); int s_ocb_done(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen, unsigned char *ct, unsigned char *tag, unsigned long *taglen, int mode); -#endif /* OCB_MODE */ +#endif /* LTC_OCB_MODE */ -#ifdef CCM_MODE +#ifdef LTC_CCM_MODE #define CCM_ENCRYPT 0 #define CCM_DECRYPT 1 @@ -210,26 +210,26 @@ int ccm_memory(int cipher, int ccm_test(void); -#endif /* CCM_MODE */ +#endif /* LTC_CCM_MODE */ -#if defined(LRW_MODE) || defined(GCM_MODE) +#if defined(LRW_MODE) || defined(LTC_GCM_MODE) void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *c); #endif /* table shared between GCM and LRW */ -#if defined(GCM_TABLES) || defined(LRW_TABLES) || ((defined(GCM_MODE) || defined(GCM_MODE)) && defined(LTC_FAST)) +#if defined(LTC_GCM_TABLES) || defined(LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST)) extern const unsigned char gcm_shift_table[]; #endif -#ifdef GCM_MODE +#ifdef LTC_GCM_MODE #define GCM_ENCRYPT 0 #define GCM_DECRYPT 1 -#define GCM_MODE_IV 0 -#define GCM_MODE_AAD 1 -#define GCM_MODE_TEXT 2 +#define LTC_GCM_MODE_IV 0 +#define LTC_GCM_MODE_AAD 1 +#define LTC_GCM_MODE_TEXT 2 typedef struct { symmetric_key K; @@ -247,9 +247,9 @@ typedef struct { ulong64 totlen, /* 64-bit counter used for IV and AAD */ pttotlen; /* 64-bit counter for the PT */ -#ifdef GCM_TABLES +#ifdef LTC_GCM_TABLES unsigned char PC[16][256][16] /* 16 tables of 8x128 */ -#ifdef GCM_TABLES_SSE2 +#ifdef LTC_GCM_TABLES_SSE2 __attribute__ ((aligned (16))) #endif ; @@ -287,9 +287,9 @@ int gcm_memory( int cipher, int direction); int gcm_test(void); -#endif /* GCM_MODE */ +#endif /* LTC_GCM_MODE */ -#ifdef PELICAN +#ifdef LTC_PELICAN typedef struct pelican_state { @@ -311,6 +311,9 @@ int pelican_memory(const unsigned char *key, unsigned long keylen, #ifdef LTC_XCBC +/* add this to "keylen" to xcbc_init to use a pure three-key XCBC MAC */ +#define LTC_XCBC_PURE 0x8000UL + typedef struct { unsigned char K[3][MAXBLOCKSIZE], IV[MAXBLOCKSIZE]; @@ -376,6 +379,6 @@ int f9_test(void); #endif -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_mac.h,v $ */ -/* $Revision: 1.20 $ */ -/* $Date: 2006/11/08 21:57:04 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_macros.h b/libtomcrypt/src/headers/tomcrypt_macros.h index 53bda9b..6e4d757 100644 --- a/libtomcrypt/src/headers/tomcrypt_macros.h +++ b/libtomcrypt/src/headers/tomcrypt_macros.h @@ -419,6 +419,6 @@ static inline unsigned long ROR64c(unsigned long word, const int i) #define byte(x, n) (((x) >> (8 * (n))) & 255) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_macros.h,v $ */ -/* $Revision: 1.15 $ */ -/* $Date: 2006/11/29 23:43:57 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_math.h b/libtomcrypt/src/headers/tomcrypt_math.h index c996e41..aee6105 100644 --- a/libtomcrypt/src/headers/tomcrypt_math.h +++ b/libtomcrypt/src/headers/tomcrypt_math.h @@ -7,11 +7,11 @@ #define LTC_MP_NO 0 #define LTC_MP_YES 1 -#ifndef MECC +#ifndef LTC_MECC typedef void ecc_point; #endif -#ifndef MRSA +#ifndef LTC_MRSA typedef void rsa_key; #endif @@ -495,6 +495,6 @@ extern const ltc_math_descriptor gmp_desc; #endif -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_math.h,v $ */ -/* $Revision: 1.43 $ */ -/* $Date: 2006/12/02 19:23:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_misc.h b/libtomcrypt/src/headers/tomcrypt_misc.h index 0b444f8..239ad77 100644 --- a/libtomcrypt/src/headers/tomcrypt_misc.h +++ b/libtomcrypt/src/headers/tomcrypt_misc.h @@ -1,5 +1,5 @@ -/* ---- BASE64 Routines ---- */ -#ifdef BASE64 +/* ---- LTC_BASE64 Routines ---- */ +#ifdef LTC_BASE64 int base64_encode(const unsigned char *in, unsigned long len, unsigned char *out, unsigned long *outlen); @@ -18,6 +18,6 @@ extern const char *crypt_build_settings; /* ---- HMM ---- */ int crypt_fsa(void *mp, ...); -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_misc.h,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/06 03:03:01 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_pk.h b/libtomcrypt/src/headers/tomcrypt_pk.h index 3a0d7ab..cc05f6c 100644 --- a/libtomcrypt/src/headers/tomcrypt_pk.h +++ b/libtomcrypt/src/headers/tomcrypt_pk.h @@ -8,13 +8,13 @@ enum { int rand_prime(void *N, long len, prng_state *prng, int wprng); /* ---- RSA ---- */ -#ifdef MRSA +#ifdef LTC_MRSA /* Min and Max RSA key sizes (in bits) */ #define MIN_RSA_SIZE 1024 #define MAX_RSA_SIZE 4096 -/** RSA PKCS style key */ +/** RSA LTC_PKCS style key */ typedef struct Rsa_key { /** Type of key, PK_PRIVATE or PK_PUBLIC */ int type; @@ -44,20 +44,20 @@ int rsa_exptmod(const unsigned char *in, unsigned long inlen, void rsa_free(rsa_key *key); -/* These use PKCS #1 v2.0 padding */ +/* These use LTC_PKCS #1 v2.0 padding */ #define rsa_encrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, _key) \ - rsa_encrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, LTC_PKCS_1_OAEP, _key) + rsa_encrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, LTC_LTC_PKCS_1_OAEP, _key) #define rsa_decrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, _stat, _key) \ - rsa_decrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, LTC_PKCS_1_OAEP, _stat, _key) + rsa_decrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _hash_idx, LTC_LTC_PKCS_1_OAEP, _stat, _key) #define rsa_sign_hash(_in, _inlen, _out, _outlen, _prng, _prng_idx, _hash_idx, _saltlen, _key) \ - rsa_sign_hash_ex(_in, _inlen, _out, _outlen, LTC_PKCS_1_PSS, _prng, _prng_idx, _hash_idx, _saltlen, _key) + rsa_sign_hash_ex(_in, _inlen, _out, _outlen, LTC_LTC_PKCS_1_PSS, _prng, _prng_idx, _hash_idx, _saltlen, _key) #define rsa_verify_hash(_sig, _siglen, _hash, _hashlen, _hash_idx, _saltlen, _stat, _key) \ - rsa_verify_hash_ex(_sig, _siglen, _hash, _hashlen, LTC_PKCS_1_PSS, _hash_idx, _saltlen, _stat, _key) + rsa_verify_hash_ex(_sig, _siglen, _hash, _hashlen, LTC_LTC_PKCS_1_PSS, _hash_idx, _saltlen, _stat, _key) -/* These can be switched between PKCS #1 v2.x and PKCS #1 v1.5 paddings */ +/* These can be switched between LTC_PKCS #1 v2.x and LTC_PKCS #1 v1.5 paddings */ int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen, const unsigned char *lparam, unsigned long lparamlen, @@ -82,7 +82,7 @@ int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen, int hash_idx, unsigned long saltlen, int *stat, rsa_key *key); -/* PKCS #1 import/export */ +/* LTC_PKCS #1 import/export */ int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key); int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key); @@ -95,7 +95,7 @@ int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key); #define MIN_KAT_SIZE 1024 #define MAX_KAT_SIZE 4096 -/** Katja PKCS style key */ +/** Katja LTC_PKCS style key */ typedef struct KAT_key { /** Type of key, PK_PRIVATE or PK_PUBLIC */ int type; @@ -125,7 +125,7 @@ int katja_exptmod(const unsigned char *in, unsigned long inlen, void katja_free(katja_key *key); -/* These use PKCS #1 v2.0 padding */ +/* These use LTC_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, @@ -137,14 +137,14 @@ int katja_decrypt_key(const unsigned char *in, unsigned long inlen, int hash_idx, int *stat, katja_key *key); -/* PKCS #1 import/export */ +/* LTC_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 /* ---- ECC Routines ---- */ -#ifdef MECC +#ifdef LTC_MECC /* size of our temp buffers for exported keys */ #define ECC_BUF_SIZE 256 @@ -251,7 +251,7 @@ void ltc_ecc_del_point(ecc_point *p); int ltc_ecc_is_valid_idx(int n); /* point ops (mp == montgomery digit) */ -#if !defined(MECC_ACCEL) || defined(LTM_DESC) || defined(GMP_DESC) +#if !defined(LTC_MECC_ACCEL) || defined(LTM_LTC_DESC) || defined(GMP_LTC_DESC) /* R = 2P */ int ltc_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulus, void *mp); @@ -259,11 +259,18 @@ int ltc_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulus, void int ltc_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R, void *modulus, void *mp); #endif -#if defined(MECC_FP) +#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 *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 */ @@ -276,7 +283,8 @@ int ltc_ecc_mul2add(ecc_point *A, void *kA, ecc_point *C, void *modulus); -#ifdef MECC_FP +#ifdef LTC_MECC_FP +/* Shamir's trick with optimized point multiplication using fixed point cache */ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA, ecc_point *B, void *kB, ecc_point *C, void *modulus); @@ -290,13 +298,13 @@ int ltc_ecc_map(ecc_point *P, void *modulus, void *mp); #endif -#ifdef MDSA +#ifdef LTC_MDSA /* Max diff between group and modulus size in bytes */ -#define MDSA_DELTA 512 +#define LTC_MDSA_DELTA 512 /* Max DSA group size in bytes (default allows 4k-bit groups) */ -#define MDSA_MAX_GROUP 512 +#define LTC_MDSA_MAX_GROUP 512 /** DSA key structure */ typedef struct { @@ -496,7 +504,7 @@ int der_printable_char_encode(int c); int der_printable_value_decode(int v); /* UTF-8 */ -#if (defined(SIZE_MAX) || __STDC_VERSION__ >= 199901L || defined(WCHAR_MAX) || defined(_WCHAR_T) || defined(_WCHAR_T_DEFINED)) && !defined(LTC_NO_WCHAR) +#if (defined(SIZE_MAX) || __STDC_VERSION__ >= 199901L || defined(WCHAR_MAX) || defined(_WCHAR_T) || defined(_WCHAR_T_DEFINED) || defined (__WCHAR_TYPE__)) && !defined(LTC_NO_WCHAR) #include <wchar.h> #else typedef ulong32 wchar_t; @@ -539,6 +547,6 @@ int der_length_utctime(ltc_utctime *utctime, unsigned long *outlen); #endif -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_pk.h,v $ */ -/* $Revision: 1.77 $ */ -/* $Date: 2006/12/03 00:39:56 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_pkcs.h b/libtomcrypt/src/headers/tomcrypt_pkcs.h index 71bcdb9..8c8c7e4 100644 --- a/libtomcrypt/src/headers/tomcrypt_pkcs.h +++ b/libtomcrypt/src/headers/tomcrypt_pkcs.h @@ -1,19 +1,19 @@ -/* PKCS Header Info */ +/* LTC_PKCS Header Info */ -/* ===> PKCS #1 -- RSA Cryptography <=== */ -#ifdef PKCS_1 +/* ===> LTC_PKCS #1 -- RSA Cryptography <=== */ +#ifdef LTC_PKCS_1 enum ltc_pkcs_1_v1_5_blocks { - LTC_PKCS_1_EMSA = 1, /* Block type 1 (PKCS #1 v1.5 signature padding) */ - LTC_PKCS_1_EME = 2 /* Block type 2 (PKCS #1 v1.5 encryption padding) */ + LTC_LTC_PKCS_1_EMSA = 1, /* Block type 1 (LTC_PKCS #1 v1.5 signature padding) */ + LTC_LTC_PKCS_1_EME = 2 /* Block type 2 (LTC_PKCS #1 v1.5 encryption padding) */ }; enum ltc_pkcs_1_paddings { - LTC_PKCS_1_V1_5 = 1, /* PKCS #1 v1.5 padding (\sa ltc_pkcs_1_v1_5_blocks) */ - LTC_PKCS_1_OAEP = 2, /* PKCS #1 v2.0 encryption padding */ - LTC_PKCS_1_PSS = 3 /* PKCS #1 v2.1 signature padding */ + LTC_LTC_PKCS_1_V1_5 = 1, /* LTC_PKCS #1 v1.5 padding (\sa ltc_pkcs_1_v1_5_blocks) */ + LTC_LTC_PKCS_1_OAEP = 2, /* LTC_PKCS #1 v2.0 encryption padding */ + LTC_LTC_PKCS_1_PSS = 3 /* LTC_PKCS #1 v2.1 signature padding */ }; int pkcs_1_mgf1( int hash_idx, @@ -65,10 +65,10 @@ int pkcs_1_pss_decode(const unsigned char *msghash, unsigned long msghashlen, unsigned long saltlen, int hash_idx, unsigned long modulus_bitlen, int *res); -#endif /* PKCS_1 */ +#endif /* LTC_PKCS_1 */ -/* ===> PKCS #5 -- Password Based Cryptography <=== */ -#ifdef PKCS_5 +/* ===> LTC_PKCS #5 -- Password Based Cryptography <=== */ +#ifdef LTC_PKCS_5 /* Algorithm #1 (old) */ int pkcs_5_alg1(const unsigned char *password, unsigned long password_len, @@ -82,8 +82,8 @@ int pkcs_5_alg2(const unsigned char *password, unsigned long password_len, int iteration_count, int hash_idx, unsigned char *out, unsigned long *outlen); -#endif /* PKCS_5 */ +#endif /* LTC_PKCS_5 */ -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_pkcs.h,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/15 12:44:59 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/headers/tomcrypt_prng.h b/libtomcrypt/src/headers/tomcrypt_prng.h index dd640c9..508159d 100644 --- a/libtomcrypt/src/headers/tomcrypt_prng.h +++ b/libtomcrypt/src/headers/tomcrypt_prng.h @@ -1,5 +1,5 @@ /* ---- PRNG Stuff ---- */ -#ifdef YARROW +#ifdef LTC_YARROW struct yarrow_prng { int cipher, hash; unsigned char pool[MAXBLOCKSIZE]; @@ -8,16 +8,16 @@ struct yarrow_prng { }; #endif -#ifdef RC4 +#ifdef LTC_RC4 struct rc4_prng { int x, y; unsigned char buf[256]; }; #endif -#ifdef FORTUNA +#ifdef LTC_FORTUNA struct fortuna_prng { - hash_state pool[FORTUNA_POOLS]; /* the pools */ + hash_state pool[LTC_FORTUNA_POOLS]; /* the pools */ symmetric_key skey; @@ -33,7 +33,7 @@ struct fortuna_prng { }; #endif -#ifdef SOBER128 +#ifdef LTC_SOBER128 struct sober128_prng { ulong32 R[17], /* Working storage for the shift register */ initR[17], /* saved register contents */ @@ -49,16 +49,16 @@ struct sober128_prng { typedef union Prng_state { char dummy[1]; -#ifdef YARROW +#ifdef LTC_YARROW struct yarrow_prng yarrow; #endif -#ifdef RC4 +#ifdef LTC_RC4 struct rc4_prng rc4; #endif -#ifdef FORTUNA +#ifdef LTC_FORTUNA struct fortuna_prng fortuna; #endif -#ifdef SOBER128 +#ifdef LTC_SOBER128 struct sober128_prng sober128; #endif } prng_state; @@ -118,7 +118,7 @@ extern struct ltc_prng_descriptor { int (*test)(void); } prng_descriptor[]; -#ifdef YARROW +#ifdef LTC_YARROW int yarrow_start(prng_state *prng); int yarrow_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); int yarrow_ready(prng_state *prng); @@ -130,7 +130,7 @@ int yarrow_test(void); extern const struct ltc_prng_descriptor yarrow_desc; #endif -#ifdef FORTUNA +#ifdef LTC_FORTUNA int fortuna_start(prng_state *prng); int fortuna_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); int fortuna_ready(prng_state *prng); @@ -142,7 +142,7 @@ int fortuna_test(void); extern const struct ltc_prng_descriptor fortuna_desc; #endif -#ifdef RC4 +#ifdef LTC_RC4 int rc4_start(prng_state *prng); int rc4_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); int rc4_ready(prng_state *prng); @@ -154,7 +154,7 @@ int rc4_test(void); extern const struct ltc_prng_descriptor rc4_desc; #endif -#ifdef SPRNG +#ifdef LTC_SPRNG int sprng_start(prng_state *prng); int sprng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); int sprng_ready(prng_state *prng); @@ -166,7 +166,7 @@ int sprng_test(void); extern const struct ltc_prng_descriptor sprng_desc; #endif -#ifdef SOBER128 +#ifdef LTC_SOBER128 int sober128_start(prng_state *prng); int sober128_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng); int sober128_ready(prng_state *prng); @@ -194,6 +194,6 @@ unsigned long rng_get_bytes(unsigned char *out, int rng_make_prng(int bits, int wprng, prng_state *prng, void (*callback)(void)); -/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_prng.h,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/05 01:36:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/f9/f9_done.c b/libtomcrypt/src/mac/f9/f9_done.c index 1794ecc..8da4c73 100644 --- a/libtomcrypt/src/mac/f9/f9_done.c +++ b/libtomcrypt/src/mac/f9/f9_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -71,7 +71,7 @@ int f9_done(f9_state *f9, unsigned char *out, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_done.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/09 01:53:32 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/f9/f9_file.c b/libtomcrypt/src/mac/f9/f9_file.c index 4c53e76..88216a9 100644 --- a/libtomcrypt/src/mac/f9/f9_file.c +++ b/libtomcrypt/src/mac/f9/f9_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -78,6 +78,6 @@ int f9_file(int cipher, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_file.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/21 00:18:23 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/f9/f9_init.c b/libtomcrypt/src/mac/f9/f9_init.c index aefd8a7..b6b878f 100644 --- a/libtomcrypt/src/mac/f9/f9_init.c +++ b/libtomcrypt/src/mac/f9/f9_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -64,7 +64,7 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_init.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/08 22:54:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/f9/f9_memory.c b/libtomcrypt/src/mac/f9/f9_memory.c index 2b3901a..0850dc3 100644 --- a/libtomcrypt/src/mac/f9/f9_memory.c +++ b/libtomcrypt/src/mac/f9/f9_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -66,6 +66,6 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_memory.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/21 23:02:42 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/f9/f9_memory_multi.c b/libtomcrypt/src/mac/f9/f9_memory_multi.c index 5b315f5..7a13ff9 100644 --- a/libtomcrypt/src/mac/f9/f9_memory_multi.c +++ b/libtomcrypt/src/mac/f9/f9_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> @@ -85,6 +85,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_memory_multi.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/11/08 21:50:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/f9/f9_process.c b/libtomcrypt/src/mac/f9/f9_process.c index e8bd88b..bf54d71 100644 --- a/libtomcrypt/src/mac/f9/f9_process.c +++ b/libtomcrypt/src/mac/f9/f9_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -72,7 +72,7 @@ int f9_process(f9_state *f9, const unsigned char *in, unsigned long inlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_process.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/12/16 17:41:21 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/f9/f9_test.c b/libtomcrypt/src/mac/f9/f9_test.c index 4cddfe6..b92c630 100644 --- a/libtomcrypt/src/mac/f9/f9_test.c +++ b/libtomcrypt/src/mac/f9/f9_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -72,7 +72,7 @@ int f9_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/f9/f9_test.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/21 23:02:42 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/hmac/hmac_done.c b/libtomcrypt/src/mac/hmac/hmac_done.c index f48d672..9046110 100644 --- a/libtomcrypt/src/mac/hmac/hmac_done.c +++ b/libtomcrypt/src/mac/hmac/hmac_done.c @@ -6,24 +6,24 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file hmac_done.c - HMAC support, terminate stream, Tom St Denis/Dobes Vandermeer + LTC_HMAC support, terminate stream, Tom St Denis/Dobes Vandermeer */ #ifdef LTC_HMAC -#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize +#define LTC_HMAC_BLOCKSIZE hash_descriptor[hash].blocksize /** - Terminate an HMAC session - @param hmac The HMAC state - @param out [out] The destination of the HMAC authentication tag - @param outlen [in/out] The max size and resulting size of the HMAC authentication tag + Terminate an LTC_HMAC session + @param hmac The LTC_HMAC state + @param out [out] The destination of the LTC_HMAC authentication tag + @param outlen [in/out] The max size and resulting size of the LTC_HMAC authentication tag @return CRYPT_OK if successful */ int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen) @@ -44,13 +44,12 @@ int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen) /* get the hash message digest size */ hashsize = hash_descriptor[hash].hashsize; - /* Get the hash of the first HMAC vector plus the data */ if ((err = hash_descriptor[hash].done(&hmac->md, isha)) != CRYPT_OK) { goto LBL_ERR; } - /* Create the second HMAC vector vector for step (3) */ - for(i=0; i < HMAC_BLOCKSIZE; i++) { + /* Create the second LTC_HMAC vector vector for step (3) */ + for(i=0; i < LTC_HMAC_BLOCKSIZE; i++) { buf[i] = hmac->key[i] ^ 0x5C; } @@ -58,7 +57,7 @@ int hmac_done(hmac_state *hmac, unsigned char *out, unsigned long *outlen) if ((err = hash_descriptor[hash].init(&hmac->md)) != CRYPT_OK) { goto LBL_ERR; } - if ((err = hash_descriptor[hash].process(&hmac->md, buf, HMAC_BLOCKSIZE)) != CRYPT_OK) { + if ((err = hash_descriptor[hash].process(&hmac->md, buf, LTC_HMAC_BLOCKSIZE)) != CRYPT_OK) { goto LBL_ERR; } if ((err = hash_descriptor[hash].process(&hmac->md, isha, hashsize)) != CRYPT_OK) { @@ -88,6 +87,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_done.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/hmac/hmac_file.c b/libtomcrypt/src/mac/hmac/hmac_file.c index d7c40b1..d9841bd 100644 --- a/libtomcrypt/src/mac/hmac/hmac_file.c +++ b/libtomcrypt/src/mac/hmac/hmac_file.c @@ -6,24 +6,24 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file hmac_file.c - HMAC support, process a file, Tom St Denis/Dobes Vandermeer + LTC_HMAC support, process a file, Tom St Denis/Dobes Vandermeer */ #ifdef LTC_HMAC /** - HMAC a file + LTC_HMAC a file @param hash The index of the hash you wish to use - @param fname The name of the file you wish to HMAC + @param fname The name of the file you wish to LTC_HMAC @param key The secret key @param keylen The length of the secret key - @param out [out] The HMAC authentication tag + @param out [out] The LTC_HMAC authentication tag @param outlen [in/out] The max size and resulting size of the authentication tag @return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled */ @@ -89,6 +89,6 @@ int hmac_file(int hash, const char *fname, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_file.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/hmac/hmac_init.c b/libtomcrypt/src/mac/hmac/hmac_init.c index a4a4377..262002e 100644 --- a/libtomcrypt/src/mac/hmac/hmac_init.c +++ b/libtomcrypt/src/mac/hmac/hmac_init.c @@ -6,22 +6,22 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file hmac_init.c - HMAC support, initialize state, Tom St Denis/Dobes Vandermeer + LTC_HMAC support, initialize state, Tom St Denis/Dobes Vandermeer */ #ifdef LTC_HMAC -#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize +#define LTC_HMAC_BLOCKSIZE hash_descriptor[hash].blocksize /** - Initialize an HMAC context. - @param hmac The HMAC state + Initialize an LTC_HMAC context. + @param hmac The LTC_HMAC state @param hash The index of the hash you want to use @param key The secret key @param keylen The length of the secret key (octets) @@ -50,30 +50,30 @@ int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned lon } /* allocate memory for key */ - hmac->key = XMALLOC(HMAC_BLOCKSIZE); + hmac->key = XMALLOC(LTC_HMAC_BLOCKSIZE); if (hmac->key == NULL) { return CRYPT_MEM; } /* (1) make sure we have a large enough key */ - if(keylen > HMAC_BLOCKSIZE) { - z = HMAC_BLOCKSIZE; + if(keylen > LTC_HMAC_BLOCKSIZE) { + z = LTC_HMAC_BLOCKSIZE; if ((err = hash_memory(hash, key, keylen, hmac->key, &z)) != CRYPT_OK) { goto LBL_ERR; } - if(hashsize < HMAC_BLOCKSIZE) { - zeromem((hmac->key) + hashsize, (size_t)(HMAC_BLOCKSIZE - hashsize)); + if(hashsize < LTC_HMAC_BLOCKSIZE) { + zeromem((hmac->key) + hashsize, (size_t)(LTC_HMAC_BLOCKSIZE - hashsize)); } keylen = hashsize; } else { XMEMCPY(hmac->key, key, (size_t)keylen); - if(keylen < HMAC_BLOCKSIZE) { - zeromem((hmac->key) + keylen, (size_t)(HMAC_BLOCKSIZE - keylen)); + if(keylen < LTC_HMAC_BLOCKSIZE) { + zeromem((hmac->key) + keylen, (size_t)(LTC_HMAC_BLOCKSIZE - keylen)); } } /* Create the initial vector for step (3) */ - for(i=0; i < HMAC_BLOCKSIZE; i++) { + for(i=0; i < LTC_HMAC_BLOCKSIZE; i++) { buf[i] = hmac->key[i] ^ 0x36; } @@ -82,7 +82,7 @@ int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned lon goto LBL_ERR; } - if ((err = hash_descriptor[hash].process(&hmac->md, buf, HMAC_BLOCKSIZE)) != CRYPT_OK) { + if ((err = hash_descriptor[hash].process(&hmac->md, buf, LTC_HMAC_BLOCKSIZE)) != CRYPT_OK) { goto LBL_ERR; } goto done; @@ -91,7 +91,7 @@ LBL_ERR: XFREE(hmac->key); done: #ifdef LTC_CLEAN_STACK - zeromem(buf, HMAC_BLOCKSIZE); + zeromem(buf, LTC_HMAC_BLOCKSIZE); #endif return err; @@ -99,6 +99,6 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_init.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/hmac/hmac_memory.c b/libtomcrypt/src/mac/hmac/hmac_memory.c index 7dc364a..9df80ea 100644 --- a/libtomcrypt/src/mac/hmac/hmac_memory.c +++ b/libtomcrypt/src/mac/hmac/hmac_memory.c @@ -6,24 +6,24 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file hmac_memory.c - HMAC support, process a block of memory, Tom St Denis/Dobes Vandermeer + LTC_HMAC support, process a block of memory, Tom St Denis/Dobes Vandermeer */ #ifdef LTC_HMAC /** - HMAC a block of memory to produce the authentication tag + LTC_HMAC a block of memory to produce the authentication tag @param hash The index of the hash to use @param key The secret key @param keylen The length of the secret key (octets) - @param in The data to HMAC - @param inlen The length of the data to HMAC (octets) + @param in The data to LTC_HMAC + @param inlen The length of the data to LTC_HMAC (octets) @param out [out] Destination of the authentication tag @param outlen [in/out] Max size and resulting size of authentication tag @return CRYPT_OK if successful @@ -83,6 +83,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_memory.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/hmac/hmac_memory_multi.c b/libtomcrypt/src/mac/hmac/hmac_memory_multi.c index 2382502..c3d461b 100644 --- a/libtomcrypt/src/mac/hmac/hmac_memory_multi.c +++ b/libtomcrypt/src/mac/hmac/hmac_memory_multi.c @@ -6,28 +6,28 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> /** @file hmac_memory_multi.c - HMAC support, process multiple blocks of memory, Tom St Denis/Dobes Vandermeer + LTC_HMAC support, process multiple blocks of memory, Tom St Denis/Dobes Vandermeer */ #ifdef LTC_HMAC /** - HMAC multiple blocks of memory to produce the authentication tag + LTC_HMAC multiple blocks of memory to produce the authentication tag @param hash The index of the hash to use @param key The secret key @param keylen The length of the secret key (octets) @param out [out] Destination of the authentication tag @param outlen [in/out] Max size and resulting size of authentication tag - @param in The data to HMAC - @param inlen The length of the data to HMAC (octets) - @param ... tuples of (data,len) pairs to HMAC, terminated with a (NULL,x) (x=don't care) + @param in The data to LTC_HMAC + @param inlen The length of the data to LTC_HMAC (octets) + @param ... tuples of (data,len) pairs to LTC_HMAC, terminated with a (NULL,x) (x=don't care) @return CRYPT_OK if successful */ int hmac_memory_multi(int hash, @@ -87,6 +87,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_memory_multi.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/hmac/hmac_process.c b/libtomcrypt/src/mac/hmac/hmac_process.c index 04b5ee2..802de1f 100644 --- a/libtomcrypt/src/mac/hmac/hmac_process.c +++ b/libtomcrypt/src/mac/hmac/hmac_process.c @@ -6,22 +6,22 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file hmac_process.c - HMAC support, process data, Tom St Denis/Dobes Vandermeer + LTC_HMAC support, process data, Tom St Denis/Dobes Vandermeer */ #ifdef LTC_HMAC /** - Process data through HMAC + Process data through LTC_HMAC @param hmac The hmac state - @param in The data to send through HMAC - @param inlen The length of the data to HMAC (octets) + @param in The data to send through LTC_HMAC + @param inlen The length of the data to LTC_HMAC (octets) @return CRYPT_OK if successful */ int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen) @@ -38,6 +38,6 @@ int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_process.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/hmac/hmac_test.c b/libtomcrypt/src/mac/hmac/hmac_test.c index 4a03f87..af43da6 100644 --- a/libtomcrypt/src/mac/hmac/hmac_test.c +++ b/libtomcrypt/src/mac/hmac/hmac_test.c @@ -6,18 +6,18 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file hmac_test.c - HMAC support, self-test, Tom St Denis/Dobes Vandermeer + LTC_HMAC support, self-test, Tom St Denis/Dobes Vandermeer */ #ifdef LTC_HMAC -#define HMAC_BLOCKSIZE hash_descriptor[hash].blocksize +#define LTC_HMAC_BLOCKSIZE hash_descriptor[hash].blocksize /* TEST CASES SOURCE: @@ -27,11 +27,11 @@ Request for Comments: 2202 IBM Category: Informational R. Glenn NIST September 1997 - Test Cases for HMAC-MD5 and HMAC-SHA-1 + Test Cases for LTC_HMAC-LTC_MD5 and LTC_HMAC-LTC_SHA-1 */ /** - HMAC self-test + LTC_HMAC self-test @return CRYPT_OK if successful, CRYPT_NOP if tests have been disabled. */ int hmac_test(void) @@ -52,7 +52,7 @@ int hmac_test(void) unsigned char digest[MAXBLOCKSIZE]; } cases[] = { /* - 3. Test Cases for HMAC-SHA-1 + 3. Test Cases for LTC_HMAC-LTC_SHA-1 test_case = 1 key = 0x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c @@ -118,7 +118,7 @@ int hmac_test(void) 0x6b, 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91} }, /* - 2. Test Cases for HMAC-MD5 + 2. Test Cases for LTC_HMAC-LTC_MD5 test_case = 1 key = 0x0b 0b 0b 0b @@ -272,7 +272,7 @@ Key First" outlen = sizeof(digest); if((err = hmac_memory(hash, cases[i].key, cases[i].keylen, cases[i].data, cases[i].datalen, digest, &outlen)) != CRYPT_OK) { #if 0 - printf("HMAC-%s test #%d, %s\n", cases[i].algo, cases[i].num, error_to_string(err)); + printf("LTC_HMAC-%s test #%d, %s\n", cases[i].algo, cases[i].num, error_to_string(err)); #endif return err; } @@ -281,7 +281,7 @@ Key First" failed++; #if 0 unsigned int j; - printf("\nHMAC-%s test #%d:\n", cases[i].algo, cases[i].num); + printf("\nLTC_HMAC-%s test #%d:\n", cases[i].algo, cases[i].num); printf( "Result: 0x"); for(j=0; j < hash_descriptor[hash].hashsize; j++) { printf("%2x ", digest[j]); @@ -294,7 +294,7 @@ Key First" return CRYPT_ERROR; #endif } else { - /* printf("HMAC-%s test #%d: Passed\n", cases[i].algo, cases[i].num); */ + /* printf("LTC_HMAC-%s test #%d: Passed\n", cases[i].algo, cases[i].num); */ } } @@ -311,6 +311,6 @@ Key First" #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_test.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/omac/omac_done.c b/libtomcrypt/src/mac/omac/omac_done.c index 7a0453b..796bdf9 100644 --- a/libtomcrypt/src/mac/omac/omac_done.c +++ b/libtomcrypt/src/mac/omac/omac_done.c @@ -6,20 +6,20 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file omac_done.c - OMAC1 support, terminate a stream, Tom St Denis + LTC_OMAC1 support, terminate a stream, Tom St Denis */ #ifdef LTC_OMAC /** - Terminate an OMAC stream - @param omac The OMAC state + Terminate an LTC_OMAC stream + @param omac The LTC_OMAC state @param out [out] Destination for the authentication tag @param outlen [in/out] The max size and resulting size of the authentication tag @return CRYPT_OK if successful @@ -81,6 +81,6 @@ int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_done.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/omac/omac_file.c b/libtomcrypt/src/mac/omac/omac_file.c index 7117ae3..54871e0 100644 --- a/libtomcrypt/src/mac/omac/omac_file.c +++ b/libtomcrypt/src/mac/omac/omac_file.c @@ -6,23 +6,23 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file omac_file.c - OMAC1 support, process a file, Tom St Denis + LTC_OMAC1 support, process a file, Tom St Denis */ #ifdef LTC_OMAC /** - OMAC a file + LTC_OMAC a file @param cipher The index of the cipher desired @param key The secret key @param keylen The length of the secret key (octets) - @param filename The name of the file you wish to OMAC + @param filename The name of the file you wish to LTC_OMAC @param out [out] Where the authentication tag is to be stored @param outlen [in/out] The max size and resulting size of the authentication tag @return CRYPT_OK if successful, CRYPT_NOP if file support has been disabled @@ -78,6 +78,6 @@ int omac_file(int cipher, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_file.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/omac/omac_init.c b/libtomcrypt/src/mac/omac/omac_init.c index cbf26a2..36a4a3d 100644 --- a/libtomcrypt/src/mac/omac/omac_init.c +++ b/libtomcrypt/src/mac/omac/omac_init.c @@ -6,21 +6,21 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file omac_init.c - OMAC1 support, initialize state, by Tom St Denis + LTC_OMAC1 support, initialize state, by Tom St Denis */ #ifdef LTC_OMAC /** - Initialize an OMAC state - @param omac The OMAC state to initialize + Initialize an LTC_OMAC state + @param omac The LTC_OMAC state to initialize @param cipher The index of the desired cipher @param key The secret key @param keylen The length of the secret key (octets) @@ -96,6 +96,6 @@ int omac_init(omac_state *omac, int cipher, const unsigned char *key, unsigned l #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_init.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/omac/omac_memory.c b/libtomcrypt/src/mac/omac/omac_memory.c index 50b2db0..c9f3392 100644 --- a/libtomcrypt/src/mac/omac/omac_memory.c +++ b/libtomcrypt/src/mac/omac/omac_memory.c @@ -6,24 +6,24 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file omac_memory.c - OMAC1 support, process a block of memory, Tom St Denis + LTC_OMAC1 support, process a block of memory, Tom St Denis */ #ifdef LTC_OMAC /** - OMAC a block of memory + LTC_OMAC a block of memory @param cipher The index of the desired cipher @param key The secret key @param keylen The length of the secret key (octets) - @param in The data to send through OMAC - @param inlen The length of the data to send through OMAC (octets) + @param in The data to send through LTC_OMAC + @param inlen The length of the data to send through LTC_OMAC (octets) @param out [out] The destination of the authentication tag @param outlen [in/out] The max size and resulting size of the authentication tag (octets) @return CRYPT_OK if successful @@ -80,6 +80,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_memory.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/omac/omac_memory_multi.c b/libtomcrypt/src/mac/omac/omac_memory_multi.c index 4445ca2..3db8270 100644 --- a/libtomcrypt/src/mac/omac/omac_memory_multi.c +++ b/libtomcrypt/src/mac/omac/omac_memory_multi.c @@ -6,28 +6,28 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> /** @file omac_memory_multi.c - OMAC1 support, process multiple blocks of memory, Tom St Denis + LTC_OMAC1 support, process multiple blocks of memory, Tom St Denis */ #ifdef LTC_OMAC /** - OMAC multiple blocks of memory + LTC_OMAC multiple blocks of memory @param cipher The index of the desired cipher @param key The secret key @param keylen The length of the secret key (octets) @param out [out] The destination of the authentication tag @param outlen [in/out] The max size and resulting size of the authentication tag (octets) - @param in The data to send through OMAC - @param inlen The length of the data to send through OMAC (octets) - @param ... tuples of (data,len) pairs to OMAC, terminated with a (NULL,x) (x=don't care) + @param in The data to send through LTC_OMAC + @param inlen The length of the data to send through LTC_OMAC (octets) + @param ... tuples of (data,len) pairs to LTC_OMAC, terminated with a (NULL,x) (x=don't care) @return CRYPT_OK if successful */ int omac_memory_multi(int cipher, @@ -85,6 +85,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_memory_multi.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/omac/omac_process.c b/libtomcrypt/src/mac/omac/omac_process.c index f4b96f5..a70b179 100644 --- a/libtomcrypt/src/mac/omac/omac_process.c +++ b/libtomcrypt/src/mac/omac/omac_process.c @@ -6,28 +6,28 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file omac_process.c - OMAC1 support, process data, Tom St Denis + LTC_OMAC1 support, process data, Tom St Denis */ #ifdef LTC_OMAC /** - Process data through OMAC - @param omac The OMAC state - @param in The input data to send through OMAC + Process data through LTC_OMAC + @param omac The LTC_OMAC state + @param in The input data to send through LTC_OMAC @param inlen The length of the input (octets) @return CRYPT_OK if successful */ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen) { - unsigned long n, x; + unsigned long n, x, blklen; int err; LTC_ARGCHK(omac != NULL); @@ -42,13 +42,14 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen) } #ifdef LTC_FAST - if (omac->buflen == 0 && inlen > 16) { - int y; - for (x = 0; x < (inlen - 16); x += 16) { - for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) { + blklen = cipher_descriptor[omac->cipher_idx].block_length; + if (omac->buflen == 0 && inlen > blklen) { + unsigned long y; + for (x = 0; x < (inlen - blklen); x += blklen) { + for (y = 0; y < blklen; y += sizeof(LTC_FAST_TYPE)) { *((LTC_FAST_TYPE*)(&omac->prev[y])) ^= *((LTC_FAST_TYPE*)(&in[y])); } - in += 16; + in += blklen; if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->prev, omac->prev, &omac->key)) != CRYPT_OK) { return err; } @@ -83,6 +84,6 @@ int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_process.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/omac/omac_test.c b/libtomcrypt/src/mac/omac/omac_test.c index 3230a8c..10f5725 100644 --- a/libtomcrypt/src/mac/omac/omac_test.c +++ b/libtomcrypt/src/mac/omac/omac_test.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file omac_test.c - OMAC1 support, self-test, by Tom St Denis + LTC_OMAC1 support, self-test, by Tom St Denis */ #ifdef LTC_OMAC /** - Test the OMAC setup + Test the LTC_OMAC setup @return CRYPT_OK if successful, CRYPT_NOP if tests have been disabled */ int omac_test(void) @@ -105,6 +105,6 @@ int omac_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_test.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pelican/pelican.c b/libtomcrypt/src/mac/pelican/pelican.c index 734cd38..47640a3 100644 --- a/libtomcrypt/src/mac/pelican/pelican.c +++ b/libtomcrypt/src/mac/pelican/pelican.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ Pelican MAC, initialize state, by Tom St Denis */ -#ifdef PELICAN +#ifdef LTC_PELICAN #define ENCRYPT_ONLY #define PELI_TAB @@ -160,6 +160,6 @@ int pelican_done(pelican_state *pelmac, unsigned char *out) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pelican/pelican.c,v $ */ -/* $Revision: 1.18 $ */ -/* $Date: 2006/04/02 13:19:10 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pelican/pelican_memory.c b/libtomcrypt/src/mac/pelican/pelican_memory.c index 7dde843..6eabaa1 100644 --- a/libtomcrypt/src/mac/pelican/pelican_memory.c +++ b/libtomcrypt/src/mac/pelican/pelican_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ Pelican MAC, MAC a block of memory, by Tom St Denis */ -#ifdef PELICAN +#ifdef LTC_PELICAN /** Pelican block of memory @@ -54,6 +54,6 @@ int pelican_memory(const unsigned char *key, unsigned long keylen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pelican/pelican_memory.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pelican/pelican_test.c b/libtomcrypt/src/mac/pelican/pelican_test.c index 3cff8ec..e743faa 100644 --- a/libtomcrypt/src/mac/pelican/pelican_test.c +++ b/libtomcrypt/src/mac/pelican/pelican_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ Pelican MAC, test, by Tom St Denis */ -#ifdef PELICAN +#ifdef LTC_PELICAN int pelican_test(void) { @@ -115,6 +115,6 @@ int pelican_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pelican/pelican_test.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/21 00:18:23 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_done.c b/libtomcrypt/src/mac/pmac/pmac_done.c index 005f94f..88076c6 100644 --- a/libtomcrypt/src/mac/pmac/pmac_done.c +++ b/libtomcrypt/src/mac/pmac/pmac_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -69,6 +69,6 @@ int pmac_done(pmac_state *state, unsigned char *out, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_done.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_file.c b/libtomcrypt/src/mac/pmac/pmac_file.c index f8809e8..c7a9f74 100644 --- a/libtomcrypt/src/mac/pmac/pmac_file.c +++ b/libtomcrypt/src/mac/pmac/pmac_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -79,6 +79,6 @@ int pmac_file(int cipher, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_file.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_init.c b/libtomcrypt/src/mac/pmac/pmac_init.c index c842160..e4cf571 100644 --- a/libtomcrypt/src/mac/pmac/pmac_init.c +++ b/libtomcrypt/src/mac/pmac/pmac_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -142,6 +142,6 @@ error: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_init.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_memory.c b/libtomcrypt/src/mac/pmac/pmac_memory.c index ca15e63..70b9616 100644 --- a/libtomcrypt/src/mac/pmac/pmac_memory.c +++ b/libtomcrypt/src/mac/pmac/pmac_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -69,6 +69,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_memory.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_memory_multi.c b/libtomcrypt/src/mac/pmac/pmac_memory_multi.c index 70e2398..36783d3 100644 --- a/libtomcrypt/src/mac/pmac/pmac_memory_multi.c +++ b/libtomcrypt/src/mac/pmac/pmac_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> @@ -84,6 +84,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_memory_multi.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_ntz.c b/libtomcrypt/src/mac/pmac/pmac_ntz.c index 8322563..b5137da 100644 --- a/libtomcrypt/src/mac/pmac/pmac_ntz.c +++ b/libtomcrypt/src/mac/pmac/pmac_ntz.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -34,6 +34,6 @@ int pmac_ntz(unsigned long x) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_ntz.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_process.c b/libtomcrypt/src/mac/pmac/pmac_process.c index a191812..e32e65f 100644 --- a/libtomcrypt/src/mac/pmac/pmac_process.c +++ b/libtomcrypt/src/mac/pmac/pmac_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -95,6 +95,6 @@ int pmac_process(pmac_state *pmac, const unsigned char *in, unsigned long inlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_process.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_shift_xor.c b/libtomcrypt/src/mac/pmac/pmac_shift_xor.c index 694a423..122cadb 100644 --- a/libtomcrypt/src/mac/pmac/pmac_shift_xor.c +++ b/libtomcrypt/src/mac/pmac/pmac_shift_xor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -39,6 +39,6 @@ void pmac_shift_xor(pmac_state *pmac) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_shift_xor.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/pmac/pmac_test.c b/libtomcrypt/src/mac/pmac/pmac_test.c index a635e15..5d2e42a 100644 --- a/libtomcrypt/src/mac/pmac/pmac_test.c +++ b/libtomcrypt/src/mac/pmac/pmac_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -19,7 +19,7 @@ #ifdef LTC_PMAC /** - Test the OMAC implementation + Test the LTC_OMAC implementation @return CRYPT_OK if successful, CRYPT_NOP if testing has been disabled */ int pmac_test(void) @@ -160,6 +160,6 @@ int pmac_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_test.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/03 00:39:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/xcbc/xcbc_done.c b/libtomcrypt/src/mac/xcbc/xcbc_done.c index 687c24d..6640eeb 100644 --- a/libtomcrypt/src/mac/xcbc/xcbc_done.c +++ b/libtomcrypt/src/mac/xcbc/xcbc_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -71,7 +71,7 @@ int xcbc_done(xcbc_state *xcbc, unsigned char *out, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_done.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/07 03:23:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/xcbc/xcbc_file.c b/libtomcrypt/src/mac/xcbc/xcbc_file.c index 4a8f7af..3d75b4e 100644 --- a/libtomcrypt/src/mac/xcbc/xcbc_file.c +++ b/libtomcrypt/src/mac/xcbc/xcbc_file.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -78,6 +78,6 @@ int xcbc_file(int cipher, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_file.c,v $ */ -/* $Revision: 1.1 $ */ -/* $Date: 2006/11/03 01:56:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/xcbc/xcbc_init.c b/libtomcrypt/src/mac/xcbc/xcbc_init.c index 3a0dcaf..94c9d79 100644 --- a/libtomcrypt/src/mac/xcbc/xcbc_init.c +++ b/libtomcrypt/src/mac/xcbc/xcbc_init.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -28,6 +28,7 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l { int x, y, err; symmetric_key *skey; + unsigned long k1; LTC_ARGCHK(xcbc != NULL); LTC_ARGCHK(key != NULL); @@ -43,26 +44,45 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l } #endif - /* schedule the user key */ - skey = XCALLOC(1, sizeof(*skey)); - if (skey == NULL) { - return CRYPT_MEM; - } + skey = NULL; - if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, skey)) != CRYPT_OK) { - goto done; - } + /* are we in pure XCBC mode with three keys? */ + if (keylen & LTC_XCBC_PURE) { + keylen &= ~LTC_XCBC_PURE; + + if (keylen < 2UL*cipher_descriptor[cipher].block_length) { + return CRYPT_INVALID_ARG; + } + + k1 = keylen - 2*cipher_descriptor[cipher].block_length; + XMEMCPY(xcbc->K[0], key, k1); + XMEMCPY(xcbc->K[1], key+k1, cipher_descriptor[cipher].block_length); + XMEMCPY(xcbc->K[2], key+k1 + cipher_descriptor[cipher].block_length, cipher_descriptor[cipher].block_length); + } else { + /* use the key expansion */ + k1 = cipher_descriptor[cipher].block_length; + + /* schedule the user key */ + skey = XCALLOC(1, sizeof(*skey)); + if (skey == NULL) { + return CRYPT_MEM; + } + + if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, skey)) != CRYPT_OK) { + goto done; + } - /* make the three keys */ - for (y = 0; y < 3; y++) { - for (x = 0; x < cipher_descriptor[cipher].block_length; x++) { - xcbc->K[y][x] = y + 1; - } - cipher_descriptor[cipher].ecb_encrypt(xcbc->K[y], xcbc->K[y], skey); + /* make the three keys */ + for (y = 0; y < 3; y++) { + for (x = 0; x < cipher_descriptor[cipher].block_length; x++) { + xcbc->K[y][x] = y + 1; + } + cipher_descriptor[cipher].ecb_encrypt(xcbc->K[y], xcbc->K[y], skey); + } } - + /* setup K1 */ - err = cipher_descriptor[cipher].setup(xcbc->K[0], cipher_descriptor[cipher].block_length, 0, &xcbc->key); + err = cipher_descriptor[cipher].setup(xcbc->K[0], k1, 0, &xcbc->key); /* setup struct */ zeromem(xcbc->IV, cipher_descriptor[cipher].block_length); @@ -71,16 +91,18 @@ int xcbc_init(xcbc_state *xcbc, int cipher, const unsigned char *key, unsigned l xcbc->buflen = 0; done: cipher_descriptor[cipher].done(skey); + if (skey != NULL) { #ifdef LTC_CLEAN_STACK - zeromem(skey, sizeof(*skey)); + zeromem(skey, sizeof(*skey)); #endif - XFREE(skey); + XFREE(skey); + } return err; } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_init.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/07 03:23:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/xcbc/xcbc_memory.c b/libtomcrypt/src/mac/xcbc/xcbc_memory.c index 1826b6b..124817a 100644 --- a/libtomcrypt/src/mac/xcbc/xcbc_memory.c +++ b/libtomcrypt/src/mac/xcbc/xcbc_memory.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -66,6 +66,6 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_memory.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/21 23:02:42 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c b/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c index ccae9de..a237907 100644 --- a/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c +++ b/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> @@ -85,6 +85,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c,v $ */ -/* $Revision: 1.1 $ */ -/* $Date: 2006/11/03 01:53:25 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/xcbc/xcbc_process.c b/libtomcrypt/src/mac/xcbc/xcbc_process.c index 4dd63b5..46ab4a0 100644 --- a/libtomcrypt/src/mac/xcbc/xcbc_process.c +++ b/libtomcrypt/src/mac/xcbc/xcbc_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -69,7 +69,7 @@ int xcbc_process(xcbc_state *xcbc, const unsigned char *in, unsigned long inlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_process.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/11/09 22:43:52 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/mac/xcbc/xcbc_test.c b/libtomcrypt/src/mac/xcbc/xcbc_test.c index 2c56c0a..1bd5840 100644 --- a/libtomcrypt/src/mac/xcbc/xcbc_test.c +++ b/libtomcrypt/src/mac/xcbc/xcbc_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -122,7 +122,7 @@ int xcbc_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/mac/xcbc/xcbc_test.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/21 23:02:42 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c b/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c index d3c02c3..b9819e3 100644 --- a/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c +++ b/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && defined(MECC_FP) +#if defined(LTC_MECC) && defined(LTC_MECC_FP) #include <limits.h> /* number of entries in the cache */ @@ -38,6 +38,7 @@ static struct { *LUT[1U<<FP_LUT]; /* fixed point lookup */ void *mu; /* copy of the montgomery constant */ int lru_count; /* amount of times this entry has been used */ + int lock; /* flag to indicate cache eviction permitted (0) or not (1) */ } fp_cache[FP_ENTRIES]; LTC_MUTEX_GLOBAL(ltc_ecc_fp_lock) @@ -572,13 +573,13 @@ static const struct { #endif }; -/* find a hole and free as required */ +/* find a hole and free as required, return -1 if no hole found */ static int find_hole(void) { unsigned x; int y, z; - for (z = 0, y = INT_MAX, x = 0; x < FP_ENTRIES; x++) { - if (fp_cache[x].lru_count < y) { + for (z = -1, y = INT_MAX, x = 0; x < FP_ENTRIES; x++) { + if (fp_cache[x].lru_count < y && fp_cache[x].lock == 0) { z = x; y = fp_cache[x].lru_count; } @@ -592,7 +593,7 @@ static int find_hole(void) } /* free entry z */ - if (fp_cache[z].g) { + if (z >= 0 && fp_cache[z].g) { if (fp_cache[z].mu != NULL) { mp_clear(fp_cache[z].mu); fp_cache[z].mu = NULL; @@ -1100,13 +1101,15 @@ static int accel_fp_mul2add(int idx1, int idx2, } /** ECC Fixed Point mulmod global - @param k The multiplicand - @param G Base point to multiply - @param R [out] Destination of product - @param modulus The modulus for the curve - @param map [boolean] If non-zero maps the point back to affine co-ordinates, otherwise it's left in jacobian-montgomery form - @return CRYPT_OK if successful -*/ + Computes kA*A + kB*B = C using Shamir's Trick + @param A First point to multiply + @param kA What to multiple A by + @param B Second point to multiply + @param kB What to multiple B by + @param C [out] Destination point (can overlap with A or B) + @param modulus Modulus for curve + @return CRYPT_OK on success +*/ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA, ecc_point *B, void *kB, ecc_point *C, void *modulus) @@ -1123,34 +1126,36 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA, /* no entry? */ if (idx1 == -1) { /* find hole and add it */ - idx1 = find_hole(); - - if ((err = add_entry(idx1, A)) != CRYPT_OK) { - goto LBL_ERR; + if ((idx1 = find_hole()) >= 0) { + if ((err = add_entry(idx1, A)) != CRYPT_OK) { + goto LBL_ERR; + } } } + if (idx1 != -1) { + /* increment LRU */ + ++(fp_cache[idx1].lru_count); + } - /* increment LRU */ - ++(fp_cache[idx1].lru_count); - /* find point */ idx2 = find_base(B); /* no entry? */ if (idx2 == -1) { /* find hole and add it */ - idx2 = find_hole(); - - if ((err = add_entry(idx2, B)) != CRYPT_OK) { - goto LBL_ERR; + if ((idx2 = find_hole()) >= 0) { + if ((err = add_entry(idx2, B)) != CRYPT_OK) { + goto LBL_ERR; + } } } - - /* increment LRU */ - ++(fp_cache[idx2].lru_count); + if (idx2 != -1) { + /* increment LRU */ + ++(fp_cache[idx2].lru_count); + } /* if it's 2 build the LUT, if it's higher just use the LUT */ - if (fp_cache[idx1].lru_count == 2) { + if (idx1 >= 0 && fp_cache[idx1].lru_count == 2) { /* compute mp */ if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; } @@ -1169,7 +1174,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA, } /* if it's 2 build the LUT, if it's higher just use the LUT */ - if (fp_cache[idx2].lru_count == 2) { + if (idx2 >= 0 && fp_cache[idx2].lru_count == 2) { if (mp == NULL) { /* compute mp */ if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; } @@ -1190,7 +1195,7 @@ int ltc_ecc_fp_mul2add(ecc_point *A, void *kA, } - if (fp_cache[idx1].lru_count >= 2 && fp_cache[idx2].lru_count >= 2) { + if (idx1 >=0 && idx2 >= 0 && fp_cache[idx1].lru_count >= 2 && fp_cache[idx2].lru_count >= 2) { if (mp == NULL) { /* compute mp */ if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; } @@ -1235,16 +1240,20 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int ma /* find hole and add it */ idx = find_hole(); - if ((err = add_entry(idx, G)) != CRYPT_OK) { - goto LBL_ERR; + if (idx >= 0) { + if ((err = add_entry(idx, G)) != CRYPT_OK) { + goto LBL_ERR; + } } } + if (idx != -1) { + /* increment LRU */ + ++(fp_cache[idx].lru_count); + } - /* increment LRU */ - ++(fp_cache[idx].lru_count); /* if it's 2 build the LUT, if it's higher just use the LUT */ - if (fp_cache[idx].lru_count == 2) { + if (idx >= 0 && fp_cache[idx].lru_count == 2) { /* compute mp */ if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; } @@ -1262,7 +1271,7 @@ int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int ma } } - if (fp_cache[idx].lru_count >= 2) { + if (idx >= 0 && fp_cache[idx].lru_count >= 2) { if (mp == NULL) { /* compute mp */ if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto LBL_ERR; } @@ -1282,11 +1291,10 @@ LBL_ERR: return err; } -/** Free the Fixed Point tables */ -void ltc_ecc_fp_free(void) +/* helper function for freeing the cache ... must be called with the cache mutex locked */ +static void ltc_ecc_fp_free_cache(void) { unsigned x, y; - LTC_MUTEX_LOCK(<c_ecc_fp_lock); for (x = 0; x < FP_ENTRIES; x++) { if (fp_cache[x].g != NULL) { for (y = 0; y < (1U<<FP_LUT); y++) { @@ -1300,15 +1308,280 @@ void ltc_ecc_fp_free(void) fp_cache[x].mu = NULL; } fp_cache[x].lru_count = 0; + fp_cache[x].lock = 0; } } - LTC_MUTEX_UNLOCK(<c_ecc_fp_lock); } +/** Free the Fixed Point cache */ +void ltc_ecc_fp_free(void) +{ + LTC_MUTEX_LOCK(<c_ecc_fp_lock); + ltc_ecc_fp_free_cache(); + LTC_MUTEX_UNLOCK(<c_ecc_fp_lock); +} + +/** Add a point to the cache and initialize the LUT + @param g The point to add + @param modulus Modulus for curve + @param lock Flag to indicate if this entry should be locked into the cache or not + @return CRYPT_OK on success +*/ +int +ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock) +{ + int idx; + int err; + void *mp = NULL; + void *mu = NULL; + + LTC_MUTEX_LOCK(<c_ecc_fp_lock); + if ((idx = find_base(g)) >= 0) { + /* it is already in the cache ... just check that the LUT is initialized */ + if(fp_cache[idx].lru_count >= 2) { + LTC_MUTEX_UNLOCK(<c_ecc_fp_lock); + return CRYPT_OK; + } + } + + if(idx == -1 && (idx = find_hole()) == -1) { + err = CRYPT_BUFFER_OVERFLOW; + goto LBL_ERR; + } + if ((err = add_entry(idx, g)) != CRYPT_OK) { + goto LBL_ERR; + } + /* compute mp */ + if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { + goto LBL_ERR; + } + + /* compute mu */ + if ((err = mp_init(&mu)) != CRYPT_OK) { + goto LBL_ERR; + } + if ((err = mp_montgomery_normalization(mu, modulus)) != CRYPT_OK) { + goto LBL_ERR; + } + + /* build the LUT */ + if ((err = build_lut(idx, modulus, mp, mu)) != CRYPT_OK) { + goto LBL_ERR; + } + fp_cache[idx].lru_count = 2; + fp_cache[idx].lock = lock; +LBL_ERR: + LTC_MUTEX_UNLOCK(<c_ecc_fp_lock); + if (mp != NULL) { + mp_montgomery_free(mp); + } + if (mu != NULL) { + mp_clear(mu); + } + return err; +} + +/** Prevent/permit the FP cache from being updated + @param flag If flag is 0, remove cache lock (unlock), otherwise lock it +*/ +void ltc_ecc_fp_tablelock(int lock) +{ + int i; + + LTC_MUTEX_LOCK(<c_ecc_fp_lock); + for (i = 0; i < FP_ENTRIES; i++) { + fp_cache[i].lock = lock; + } + LTC_MUTEX_UNLOCK(<c_ecc_fp_lock); +} + +/** Export the current cache as a binary packet + @param out [out] pointer to malloc'ed space containing the packet + @param outlen [out] size of exported packet + @return CRYPT_OK if successful +*/ +int ltc_ecc_fp_save_state(unsigned char **out, unsigned long *outlen) +{ + ltc_asn1_list *cache_entry; + unsigned int i, j, k; + unsigned long fp_entries, fp_lut, num_entries; + int err; + + LTC_ARGCHK(out != NULL); + LTC_ARGCHK(outlen != NULL); + + fp_entries = FP_ENTRIES; + fp_lut = FP_LUT; + num_entries = 0; + + LTC_MUTEX_LOCK(<c_ecc_fp_lock); + /* + * build the list; + Cache DEFINITIONS ::= + BEGIN + CacheDump ::= SEQUENCE { + numEntries SHORTINTEGER, + maxEntries SHORTINTEGER, + numLUT SHORTINTEGER, + cache SEQUENCE OF INTEGER + } + END + * + */ + /* + * The cache itself is a point (3 INTEGERS), + * the LUT as pairs of INTEGERS (2 * 1<<FP_LUT), + * and the mu INTEGER + */ + cache_entry = XCALLOC(FP_ENTRIES*(2*(1U<<FP_LUT)+4)+3, sizeof(ltc_asn1_list)); + if (cache_entry == NULL) + return CRYPT_MEM; + j = 1; /* handle the zero'th element later */ + + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_SHORT_INTEGER, &fp_entries, 1); + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_SHORT_INTEGER, &fp_lut, 1); + + for (i = 0; i < FP_ENTRIES; i++) { + /* + * do not save empty entries, or entries that have not yet had the lut built + */ + if (fp_cache[i].g == NULL || fp_cache[i].lru_count < 2) { + continue; + } + num_entries++; + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_INTEGER, fp_cache[i].g->x, 1); + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_INTEGER, fp_cache[i].g->y, 1); + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_INTEGER, fp_cache[i].g->z, 1); + for (k = 0; k < (1U<<FP_LUT); k++) { + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_INTEGER, fp_cache[i].LUT[k]->x, 1); + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_INTEGER, fp_cache[i].LUT[k]->y, 1); + } + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_INTEGER, fp_cache[i].mu, 1); + } + LTC_SET_ASN1(cache_entry, j++, LTC_ASN1_EOL, 0, 0); + + LTC_SET_ASN1(cache_entry, 0, LTC_ASN1_SHORT_INTEGER, &num_entries, 1); + + if ((err = der_length_sequence(cache_entry, j, outlen)) != CRYPT_OK) { + goto save_err; + } + if ((*out = XMALLOC(*outlen)) == NULL) { + err = CRYPT_MEM; + goto save_err; + } + err = der_encode_sequence(cache_entry, j, *out, outlen); +save_err: + XFREE(cache_entry); + LTC_MUTEX_UNLOCK(<c_ecc_fp_lock); + return err; +} + +/** Import a binary packet into the current cache + @param in [in] pointer to packet + @param inlen [in] size of packet (bytes) + @return CRYPT_OK if successful +*/ +int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen) +{ + int err; + ltc_asn1_list *asn1_list; + unsigned long num_entries, fp_entries, fp_lut; + unsigned long i, j; + unsigned int x; + + LTC_ARGCHK(in != NULL); + if (inlen == 0) { + return CRYPT_INVALID_ARG; + } + + /* zero indecies */ + i = 0; + j = 0; + asn1_list = NULL; + + LTC_MUTEX_LOCK(<c_ecc_fp_lock); + /* + * start with an empty cache + */ + ltc_ecc_fp_free_cache(); + + /* + * decode the input packet: It consists of a sequence with a few + * integers (including the FP_ENTRIES and FP_LUT sizes), followed by a + * SEQUENCE which is the cache itself. + * + * use standard decoding for the first part, then flexible for the second + */ + if((err = der_decode_sequence_multi(in, inlen, + LTC_ASN1_SHORT_INTEGER, 1, &num_entries, + LTC_ASN1_SHORT_INTEGER, 1, &fp_entries, + LTC_ASN1_SHORT_INTEGER, 1, &fp_lut, + LTC_ASN1_EOL, 0, 0)) != CRYPT_OK) { + goto ERR_OUT; + } + if (fp_entries != FP_ENTRIES || fp_lut != FP_LUT || num_entries > fp_entries) { + err = CRYPT_INVALID_PACKET; + goto ERR_OUT; + } + if ((asn1_list = XCALLOC(3+num_entries*(4+2*(1<<FP_LUT))+1, sizeof(ltc_asn1_list))) == NULL) { + err = CRYPT_MEM; + goto ERR_OUT; + } + j = 0; + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_SHORT_INTEGER, &num_entries, 1); + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_SHORT_INTEGER, &fp_entries, 1); + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_SHORT_INTEGER, &fp_lut, 1); + for (i = 0; i < num_entries; i++) { + if((fp_cache[i].g = ltc_ecc_new_point()) == NULL) { + err = CRYPT_MEM; + goto ERR_OUT; + } + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_INTEGER, fp_cache[i].g->x, 1); + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_INTEGER, fp_cache[i].g->y, 1); + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_INTEGER, fp_cache[i].g->z, 1); + for (x = 0; x < (1U<<FP_LUT); x++) { + /* since we don't store z in the cache, don't use ltc_ecc_new_point() + * (which allocates space for z, only to have to free it later) */ + ecc_point *p = XCALLOC(1, sizeof(*p)); + + if (p == NULL) { + err = CRYPT_MEM; + goto ERR_OUT; + } + fp_cache[i].LUT[x] = p; + if ((err = mp_init_multi(&p->x, &p->y, NULL)) != CRYPT_OK) { + goto ERR_OUT; + } + p->z = NULL; + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_INTEGER, p->x, 1); + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_INTEGER, p->y, 1); + } + if((err = mp_init(&fp_cache[i].mu)) != CRYPT_OK) { + goto ERR_OUT; + } + LTC_SET_ASN1(asn1_list, j++, LTC_ASN1_INTEGER, fp_cache[i].mu, 1); + fp_cache[i].lru_count = 3; + fp_cache[i].lock = 1; + } + + if ((err = der_decode_sequence(in, inlen, asn1_list, j)) != CRYPT_OK) { + goto ERR_OUT; + } + XFREE(asn1_list); + LTC_MUTEX_UNLOCK(<c_ecc_fp_lock); + return CRYPT_OK; +ERR_OUT: + if(asn1_list) + XFREE(asn1_list); + ltc_ecc_fp_free_cache(); + LTC_MUTEX_UNLOCK(<c_ecc_fp_lock); + return err; +} + #endif -/* $Source: /cvs/libtom/libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c,v $ */ -/* $Revision: 1.27 $ */ -/* $Date: 2006/12/03 00:39:56 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/math/gmp_desc.c b/libtomcrypt/src/math/gmp_desc.c index 66c279e..c61bafe 100644 --- a/libtomcrypt/src/math/gmp_desc.c +++ b/libtomcrypt/src/math/gmp_desc.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #define DESC_DEF_ONLY @@ -439,29 +439,29 @@ const ltc_math_descriptor gmp_desc = { &exptmod, &isprime, -#ifdef MECC -#ifdef MECC_FP +#ifdef LTC_MECC +#ifdef LTC_MECC_FP <c_ecc_fp_mulmod, #else <c_ecc_mulmod, -#endif /* MECC_FP */ +#endif /* LTC_MECC_FP */ <c_ecc_projective_add_point, <c_ecc_projective_dbl_point, <c_ecc_map, #ifdef LTC_ECC_SHAMIR -#ifdef MECC_FP +#ifdef LTC_MECC_FP <c_ecc_fp_mul2add, #else <c_ecc_mul2add, -#endif /* MECC_FP */ +#endif /* LTC_MECC_FP */ #else NULL, #endif /* LTC_ECC_SHAMIR */ #else NULL, NULL, NULL, NULL, NULL -#endif /* MECC */ +#endif /* LTC_MECC */ -#ifdef MRSA +#ifdef LTC_MRSA &rsa_make_key, &rsa_exptmod, #else @@ -473,6 +473,6 @@ const ltc_math_descriptor gmp_desc = { #endif -/* $Source: /cvs/libtom/libtomcrypt/src/math/gmp_desc.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2006/12/03 00:39:56 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/math/ltm_desc.c b/libtomcrypt/src/math/ltm_desc.c index 07fdd5a..de0d898 100644 --- a/libtomcrypt/src/math/ltm_desc.c +++ b/libtomcrypt/src/math/ltm_desc.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #define DESC_DEF_ONLY @@ -445,8 +445,8 @@ const ltc_math_descriptor ltm_desc = { &exptmod, &isprime, -#ifdef MECC -#ifdef MECC_FP +#ifdef LTC_MECC +#ifdef LTC_MECC_FP <c_ecc_fp_mulmod, #else <c_ecc_mulmod, @@ -455,19 +455,19 @@ const ltc_math_descriptor ltm_desc = { <c_ecc_projective_dbl_point, <c_ecc_map, #ifdef LTC_ECC_SHAMIR -#ifdef MECC_FP +#ifdef LTC_MECC_FP <c_ecc_fp_mul2add, #else <c_ecc_mul2add, -#endif /* MECC_FP */ +#endif /* LTC_MECC_FP */ #else NULL, #endif /* LTC_ECC_SHAMIR */ #else NULL, NULL, NULL, NULL, NULL, -#endif /* MECC */ +#endif /* LTC_MECC */ -#ifdef MRSA +#ifdef LTC_MRSA &rsa_make_key, &rsa_exptmod, #else @@ -478,6 +478,6 @@ const ltc_math_descriptor ltm_desc = { #endif -/* $Source: /cvs/libtom/libtomcrypt/src/math/ltm_desc.c,v $ */ -/* $Revision: 1.29 $ */ -/* $Date: 2006/12/03 00:39:56 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/math/multi.c b/libtomcrypt/src/math/multi.c index 8ee4d79..593f353 100644 --- a/libtomcrypt/src/math/multi.c +++ b/libtomcrypt/src/math/multi.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -56,6 +56,6 @@ void ltc_deinit_multi(void *a, ...) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/math/multi.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/math/rand_prime.c b/libtomcrypt/src/math/rand_prime.c index 05477fe..f228429 100644 --- a/libtomcrypt/src/math/rand_prime.c +++ b/libtomcrypt/src/math/rand_prime.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -82,6 +82,6 @@ int rand_prime(void *N, long len, prng_state *prng, int wprng) -/* $Source: /cvs/libtom/libtomcrypt/src/math/rand_prime.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/math/tfm_desc.c b/libtomcrypt/src/math/tfm_desc.c index 023756d..f568044 100644 --- a/libtomcrypt/src/math/tfm_desc.c +++ b/libtomcrypt/src/math/tfm_desc.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #define DESC_DEF_ONLY @@ -403,7 +403,7 @@ static int isprime(void *a, int *b) return CRYPT_OK; } -#if defined(MECC) && defined(MECC_ACCEL) +#if defined(LTC_MECC) && defined(LTC_MECC_ACCEL) static int tfm_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulus, void *Mp) { @@ -733,34 +733,34 @@ const ltc_math_descriptor tfm_desc = { &exptmod, &isprime, -#ifdef MECC -#ifdef MECC_FP +#ifdef LTC_MECC +#ifdef LTC_MECC_FP <c_ecc_fp_mulmod, #else <c_ecc_mulmod, -#endif /* MECC_FP */ -#ifdef MECC_ACCEL +#endif /* LTC_MECC_FP */ +#ifdef LTC_MECC_ACCEL &tfm_ecc_projective_add_point, &tfm_ecc_projective_dbl_point, #else <c_ecc_projective_add_point, <c_ecc_projective_dbl_point, -#endif /* MECC_ACCEL */ +#endif /* LTC_MECC_ACCEL */ <c_ecc_map, #ifdef LTC_ECC_SHAMIR -#ifdef MECC_FP +#ifdef LTC_MECC_FP <c_ecc_fp_mul2add, #else <c_ecc_mul2add, -#endif /* MECC_FP */ +#endif /* LTC_MECC_FP */ #else NULL, #endif /* LTC_ECC_SHAMIR */ #else NULL, NULL, NULL, NULL, NULL, -#endif /* MECC */ +#endif /* LTC_MECC */ -#ifdef MRSA +#ifdef LTC_MRSA &rsa_make_key, &rsa_exptmod, #else @@ -772,6 +772,6 @@ const ltc_math_descriptor tfm_desc = { #endif -/* $Source: /cvs/libtom/libtomcrypt/src/math/tfm_desc.c,v $ */ -/* $Revision: 1.26 $ */ -/* $Date: 2006/12/03 00:39:56 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/base64/base64_decode.c b/libtomcrypt/src/misc/base64/base64_decode.c index 6a39baf..6fd0ba2 100644 --- a/libtomcrypt/src/misc/base64/base64_decode.c +++ b/libtomcrypt/src/misc/base64/base64_decode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -16,7 +16,7 @@ */ -#ifdef BASE64 +#ifdef LTC_BASE64 static const unsigned char map[256] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, @@ -99,6 +99,6 @@ int base64_decode(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/misc/base64/base64_decode.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/base64/base64_encode.c b/libtomcrypt/src/misc/base64/base64_encode.c index ac4df35..58a82df 100644 --- a/libtomcrypt/src/misc/base64/base64_encode.c +++ b/libtomcrypt/src/misc/base64/base64_encode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -16,7 +16,7 @@ */ -#ifdef BASE64 +#ifdef LTC_BASE64 static const char *codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -76,6 +76,6 @@ int base64_encode(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/misc/base64/base64_encode.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/burn_stack.c b/libtomcrypt/src/misc/burn_stack.c index 0beee92..2610c06 100644 --- a/libtomcrypt/src/misc/burn_stack.c +++ b/libtomcrypt/src/misc/burn_stack.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -29,6 +29,6 @@ void burn_stack(unsigned long len) -/* $Source: /cvs/libtom/libtomcrypt/src/misc/burn_stack.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt.c b/libtomcrypt/src/misc/crypt/crypt.c index 8603943..054f4b7 100644 --- a/libtomcrypt/src/misc/crypt/crypt.c +++ b/libtomcrypt/src/misc/crypt/crypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -45,118 +45,124 @@ const char *crypt_build_settings = "disabled\n" #endif "Ciphers built-in:\n" -#if defined(BLOWFISH) +#if defined(LTC_BLOWFISH) " Blowfish\n" #endif -#if defined(RC2) - " RC2\n" +#if defined(LTC_RC2) + " LTC_RC2\n" #endif -#if defined(RC5) - " RC5\n" +#if defined(LTC_RC5) + " LTC_RC5\n" #endif -#if defined(RC6) - " RC6\n" +#if defined(LTC_RC6) + " LTC_RC6\n" #endif -#if defined(SAFERP) +#if defined(LTC_SAFERP) " Safer+\n" #endif -#if defined(SAFER) +#if defined(LTC_SAFER) " Safer\n" #endif -#if defined(RIJNDAEL) +#if defined(LTC_RIJNDAEL) " Rijndael\n" #endif -#if defined(XTEA) - " XTEA\n" +#if defined(LTC_XTEA) + " LTC_XTEA\n" #endif -#if defined(TWOFISH) +#if defined(LTC_TWOFISH) " Twofish " - #if defined(TWOFISH_SMALL) && defined(TWOFISH_TABLES) && defined(TWOFISH_ALL_TABLES) + #if defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES) "(small, tables, all_tables)\n" - #elif defined(TWOFISH_SMALL) && defined(TWOFISH_TABLES) + #elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES) "(small, tables)\n" - #elif defined(TWOFISH_SMALL) && defined(TWOFISH_ALL_TABLES) + #elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_ALL_TABLES) "(small, all_tables)\n" - #elif defined(TWOFISH_TABLES) && defined(TWOFISH_ALL_TABLES) + #elif defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES) "(tables, all_tables)\n" - #elif defined(TWOFISH_SMALL) + #elif defined(LTC_TWOFISH_SMALL) "(small)\n" - #elif defined(TWOFISH_TABLES) + #elif defined(LTC_TWOFISH_TABLES) "(tables)\n" - #elif defined(TWOFISH_ALL_TABLES) + #elif defined(LTC_TWOFISH_ALL_TABLES) "(all_tables)\n" #else "\n" #endif #endif -#if defined(DES) - " DES\n" +#if defined(LTC_DES) + " LTC_DES\n" #endif -#if defined(CAST5) - " CAST5\n" +#if defined(LTC_CAST5) + " LTC_CAST5\n" #endif -#if defined(NOEKEON) +#if defined(LTC_NOEKEON) " Noekeon\n" #endif -#if defined(SKIPJACK) +#if defined(LTC_SKIPJACK) " Skipjack\n" #endif -#if defined(KHAZAD) +#if defined(LTC_KHAZAD) " Khazad\n" #endif -#if defined(ANUBIS) +#if defined(LTC_ANUBIS) " Anubis " #endif -#if defined(ANUBIS_TWEAK) +#if defined(LTC_ANUBIS_TWEAK) " (tweaked)" #endif "\n" -#if defined(KSEED) - " KSEED\n" +#if defined(LTC_KSEED) + " LTC_KSEED\n" #endif #if defined(LTC_KASUMI) " KASUMI\n" #endif "\nHashes built-in:\n" -#if defined(SHA512) - " SHA-512\n" +#if defined(LTC_SHA512) + " LTC_SHA-512\n" #endif -#if defined(SHA384) - " SHA-384\n" +#if defined(LTC_SHA384) + " LTC_SHA-384\n" #endif -#if defined(SHA256) - " SHA-256\n" +#if defined(LTC_SHA256) + " LTC_SHA-256\n" #endif -#if defined(SHA224) - " SHA-224\n" +#if defined(LTC_SHA224) + " LTC_SHA-224\n" #endif -#if defined(TIGER) - " TIGER\n" +#if defined(LTC_TIGER) + " LTC_TIGER\n" #endif -#if defined(SHA1) - " SHA1\n" +#if defined(LTC_SHA1) + " LTC_SHA1\n" #endif -#if defined(MD5) - " MD5\n" +#if defined(LTC_MD5) + " LTC_MD5\n" #endif -#if defined(MD4) - " MD4\n" +#if defined(LTC_MD4) + " LTC_MD4\n" #endif -#if defined(MD2) - " MD2\n" +#if defined(LTC_MD2) + " LTC_MD2\n" #endif -#if defined(RIPEMD128) - " RIPEMD128\n" +#if defined(LTC_RIPEMD128) + " LTC_RIPEMD128\n" #endif -#if defined(RIPEMD160) - " RIPEMD160\n" +#if defined(LTC_RIPEMD160) + " LTC_RIPEMD160\n" #endif -#if defined(WHIRLPOOL) - " WHIRLPOOL\n" +#if defined(LTC_RIPEMD256) + " LTC_RIPEMD256\n" #endif -#if defined(CHC_HASH) - " CHC_HASH \n" +#if defined(LTC_RIPEMD320) + " LTC_RIPEMD320\n" +#endif +#if defined(LTC_WHIRLPOOL) + " LTC_WHIRLPOOL\n" +#endif +#if defined(LTC_CHC_HASH) + " LTC_CHC_HASH \n" #endif "\nBlock Chaining Modes:\n" @@ -189,19 +195,22 @@ const char *crypt_build_settings = #if defined(LTC_F8_MODE) " F8 MODE\n" #endif +#if defined(LTC_XTS_MODE) + " LTC_XTS_MODE\n" +#endif "\nMACs:\n" #if defined(LTC_HMAC) - " HMAC\n" + " LTC_HMAC\n" #endif #if defined(LTC_OMAC) - " OMAC\n" + " LTC_OMAC\n" #endif #if defined(LTC_PMAC) " PMAC\n" #endif -#if defined(PELICAN) - " PELICAN\n" +#if defined(LTC_PELICAN) + " LTC_PELICAN\n" #endif #if defined(LTC_XCBC) " XCBC-MAC\n" @@ -211,48 +220,48 @@ const char *crypt_build_settings = #endif "\nENC + AUTH modes:\n" -#if defined(EAX_MODE) - " EAX_MODE\n" +#if defined(LTC_EAX_MODE) + " LTC_EAX_MODE\n" #endif -#if defined(OCB_MODE) - " OCB_MODE\n" +#if defined(LTC_OCB_MODE) + " LTC_OCB_MODE\n" #endif -#if defined(CCM_MODE) - " CCM_MODE\n" +#if defined(LTC_CCM_MODE) + " LTC_CCM_MODE\n" #endif -#if defined(GCM_MODE) - " GCM_MODE " +#if defined(LTC_GCM_MODE) + " LTC_GCM_MODE " #endif -#if defined(GCM_TABLES) - " (GCM_TABLES) " +#if defined(LTC_GCM_TABLES) + " (LTC_GCM_TABLES) " #endif "\n" "\nPRNG:\n" -#if defined(YARROW) +#if defined(LTC_YARROW) " Yarrow\n" #endif -#if defined(SPRNG) - " SPRNG\n" +#if defined(LTC_SPRNG) + " LTC_SPRNG\n" #endif -#if defined(RC4) - " RC4\n" +#if defined(LTC_RC4) + " LTC_RC4\n" #endif -#if defined(FORTUNA) +#if defined(LTC_FORTUNA) " Fortuna\n" #endif -#if defined(SOBER128) - " SOBER128\n" +#if defined(LTC_SOBER128) + " LTC_SOBER128\n" #endif "\nPK Algs:\n" -#if defined(MRSA) +#if defined(LTC_MRSA) " RSA \n" #endif -#if defined(MECC) +#if defined(LTC_MECC) " ECC\n" #endif -#if defined(MDSA) +#if defined(LTC_MDSA) " DSA\n" #endif #if defined(MKAT) @@ -286,8 +295,8 @@ const char *crypt_build_settings = #endif "\nVarious others: " -#if defined(BASE64) - " BASE64 " +#if defined(LTC_BASE64) + " LTC_BASE64 " #endif #if defined(MPI) " MPI " @@ -298,11 +307,11 @@ const char *crypt_build_settings = #if defined(LTC_TEST) " LTC_TEST " #endif -#if defined(PKCS_1) - " PKCS#1 " +#if defined(LTC_PKCS_1) + " LTC_PKCS#1 " #endif -#if defined(PKCS_5) - " PKCS#5 " +#if defined(LTC_PKCS_5) + " LTC_PKCS#5 " #endif #if defined(LTC_SMALL_CODE) " LTC_SMALL_CODE " @@ -334,23 +343,23 @@ const char *crypt_build_settings = #if defined(LTC_PTHREAD) " LTC_PTHREAD " #endif -#if defined(LTM_DESC) +#if defined(LTM_LTC_DESC) " LTM_DESC " #endif -#if defined(TFM_DESC) +#if defined(TFM_LTC_DESC) " TFM_DESC " #endif -#if defined(MECC_ACCEL) - " MECC_ACCEL " +#if defined(LTC_MECC_ACCEL) + " LTC_MECC_ACCEL " #endif -#if defined(GMP_DESC) +#if defined(GMP_LTC_DESC) " GMP_DESC " #endif #if defined(LTC_EASY) " (easy) " #endif -#if defined(MECC_FP) - " MECC_FP " +#if defined(LTC_MECC_FP) + " LTC_MECC_FP " #endif #if defined(LTC_ECC_SHAMIR) " LTC_ECC_SHAMIR " @@ -361,6 +370,6 @@ const char *crypt_build_settings = */ -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt.c,v $ */ -/* $Revision: 1.27 $ */ -/* $Date: 2006/12/03 03:50:45 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_argchk.c b/libtomcrypt/src/misc/crypt/crypt_argchk.c index a6d2a48..2f2faa7 100644 --- a/libtomcrypt/src/misc/crypt/crypt_argchk.c +++ b/libtomcrypt/src/misc/crypt/crypt_argchk.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <signal.h> @@ -25,6 +25,6 @@ void crypt_argchk(char *v, char *s, int d) } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_argchk.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c b/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c index 880c149..20aac57 100644 --- a/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c +++ b/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -22,6 +22,6 @@ struct ltc_cipher_descriptor cipher_descriptor[TAB_SIZE] = { LTC_MUTEX_GLOBAL(ltc_cipher_mutex) -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/08 23:01:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c b/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c index 0f8202b..35f1ace 100644 --- a/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c +++ b/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -31,6 +31,6 @@ int cipher_is_valid(int idx) return CRYPT_OK; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_find_cipher.c b/libtomcrypt/src/misc/crypt/crypt_find_cipher.c index 27c59eb..0c563b0 100644 --- a/libtomcrypt/src/misc/crypt/crypt_find_cipher.c +++ b/libtomcrypt/src/misc/crypt/crypt_find_cipher.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -36,6 +36,6 @@ int find_cipher(const char *name) } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_cipher.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/29 23:43:57 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c b/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c index 393eded..c528e6e 100644 --- a/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c +++ b/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -45,6 +45,6 @@ int find_cipher_any(const char *name, int blocklen, int keylen) return -1; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c b/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c index 8de73c6..be4e0fa 100644 --- a/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c +++ b/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -35,6 +35,6 @@ int find_cipher_id(unsigned char ID) return -1; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_find_hash.c b/libtomcrypt/src/misc/crypt/crypt_find_hash.c index cd60413..12ef320 100644 --- a/libtomcrypt/src/misc/crypt/crypt_find_hash.c +++ b/libtomcrypt/src/misc/crypt/crypt_find_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -35,6 +35,6 @@ int find_hash(const char *name) return -1; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/29 23:43:57 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c b/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c index b2cfccd..65ecce7 100644 --- a/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c +++ b/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -44,6 +44,6 @@ return z; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash_any.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c b/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c index e59ca00..f8e75fc 100644 --- a/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c +++ b/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -35,6 +35,6 @@ int find_hash_id(unsigned char ID) return -1; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash_id.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c b/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c index d04f80c..19aece7 100644 --- a/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c +++ b/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -30,6 +30,6 @@ int find_hash_oid(const unsigned long *ID, unsigned long IDlen) return -1; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_find_prng.c b/libtomcrypt/src/misc/crypt/crypt_find_prng.c index 4b3bc5a..af3f7b6 100644 --- a/libtomcrypt/src/misc/crypt/crypt_find_prng.c +++ b/libtomcrypt/src/misc/crypt/crypt_find_prng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -36,6 +36,6 @@ int find_prng(const char *name) } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_find_prng.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/29 23:43:57 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_fsa.c b/libtomcrypt/src/misc/crypt/crypt_fsa.c index a9569b7..3d6d86d 100644 --- a/libtomcrypt/src/misc/crypt/crypt_fsa.c +++ b/libtomcrypt/src/misc/crypt/crypt_fsa.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> @@ -54,6 +54,6 @@ int crypt_fsa(void *mp, ...) } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_fsa.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/13 23:14:33 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c b/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c index 5fa59f1..a0c3c1a 100644 --- a/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c +++ b/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -22,6 +22,6 @@ struct ltc_hash_descriptor hash_descriptor[TAB_SIZE] = { LTC_MUTEX_GLOBAL(ltc_hash_mutex) -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c b/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c index 54a91eb..011f829 100644 --- a/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c +++ b/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -31,6 +31,6 @@ int hash_is_valid(int idx) return CRYPT_OK; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c b/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c index e042910..8e565d2 100644 --- a/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c +++ b/libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" diff --git a/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c b/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c index a2b5f0e..3af9df5 100644 --- a/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c +++ b/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -21,6 +21,6 @@ struct ltc_prng_descriptor prng_descriptor[TAB_SIZE] = { LTC_MUTEX_GLOBAL(ltc_prng_mutex) -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c b/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c index 6af0a3c..ccc6e04 100644 --- a/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c +++ b/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -31,6 +31,6 @@ int prng_is_valid(int idx) return CRYPT_OK; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_register_cipher.c b/libtomcrypt/src/misc/crypt/crypt_register_cipher.c index 8d74cc5..d7feedf 100644 --- a/libtomcrypt/src/misc/crypt/crypt_register_cipher.c +++ b/libtomcrypt/src/misc/crypt/crypt_register_cipher.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -49,6 +49,6 @@ int register_cipher(const struct ltc_cipher_descriptor *cipher) return -1; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_register_cipher.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_register_hash.c b/libtomcrypt/src/misc/crypt/crypt_register_hash.c index 45d0e85..10ccee4 100644 --- a/libtomcrypt/src/misc/crypt/crypt_register_hash.c +++ b/libtomcrypt/src/misc/crypt/crypt_register_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -49,6 +49,6 @@ int register_hash(const struct ltc_hash_descriptor *hash) return -1; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_register_hash.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_register_prng.c b/libtomcrypt/src/misc/crypt/crypt_register_prng.c index a834c47..1724df0 100644 --- a/libtomcrypt/src/misc/crypt/crypt_register_prng.c +++ b/libtomcrypt/src/misc/crypt/crypt_register_prng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -49,6 +49,6 @@ int register_prng(const struct ltc_prng_descriptor *prng) return -1; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_register_prng.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c b/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c index 3cb46c4..b75785f 100644 --- a/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c +++ b/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -40,6 +40,6 @@ int unregister_cipher(const struct ltc_cipher_descriptor *cipher) return CRYPT_ERROR; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c b/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c index a87a399..ac95d2d 100644 --- a/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c +++ b/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -39,6 +39,6 @@ int unregister_hash(const struct ltc_hash_descriptor *hash) return CRYPT_ERROR; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_unregister_hash.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c b/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c index 694cbcf..bb34501 100644 --- a/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c +++ b/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -39,6 +39,6 @@ int unregister_prng(const struct ltc_prng_descriptor *prng) return CRYPT_ERROR; } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt_unregister_prng.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/error_to_string.c b/libtomcrypt/src/misc/error_to_string.c index 1da2597..034cd18 100644 --- a/libtomcrypt/src/misc/error_to_string.c +++ b/libtomcrypt/src/misc/error_to_string.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -69,6 +69,6 @@ const char *error_to_string(int err) } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/error_to_string.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c b/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c index e6f7b0c..519e7aa 100644 --- a/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c +++ b/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c @@ -6,21 +6,21 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include <tomcrypt.h> /** @file pkcs_5_1.c - PKCS #5, Algorithm #1, Tom St Denis + LTC_PKCS #5, Algorithm #1, Tom St Denis */ -#ifdef PKCS_5 +#ifdef LTC_PKCS_5 /** - Execute PKCS #5 v1 + Execute LTC_PKCS #5 v1 @param password The password (or key) @param password_len The length of the password (octet) @param salt The salt (or nonce) which is 8 octets long - @param iteration_count The PKCS #5 v1 iteration count + @param iteration_count The LTC_PKCS #5 v1 iteration count @param hash_idx The index of the hash desired @param out [out] The destination for this algorithm @param outlen [in/out] The max size and resulting size of the algorithm output @@ -101,6 +101,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/misc/pkcs5/pkcs_5_1.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c b/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c index 6e8d161..0d76d62 100644 --- a/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c +++ b/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c @@ -6,23 +6,23 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include <tomcrypt.h> /** @file pkcs_5_2.c - PKCS #5, Algorithm #2, Tom St Denis + LTC_PKCS #5, Algorithm #2, Tom St Denis */ -#ifdef PKCS_5 +#ifdef LTC_PKCS_5 /** - Execute PKCS #5 v2 + Execute LTC_PKCS #5 v2 @param password The input password (or key) @param password_len The length of the password (octets) @param salt The salt (or nonce) @param salt_len The length of the salt (octets) - @param iteration_count # of iterations desired for PKCS #5 v2 [read specs for more] + @param iteration_count # of iterations desired for LTC_PKCS #5 v2 [read specs for more] @param hash_idx The index of the hash desired @param out [out] The destination for this algorithm @param outlen [in/out] The max size and resulting size of the algorithm output @@ -124,6 +124,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/misc/zeromem.c b/libtomcrypt/src/misc/zeromem.c index 9f6ba9b..2ddead8 100644 --- a/libtomcrypt/src/misc/zeromem.c +++ b/libtomcrypt/src/misc/zeromem.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include "dbhelpers.h" @@ -26,6 +26,6 @@ void zeromem(void *out, size_t outlen) m_burn(out, outlen); } -/* $Source: /cvs/libtom/libtomcrypt/src/misc/zeromem.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/09 01:38:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cbc/cbc_decrypt.c b/libtomcrypt/src/modes/cbc/cbc_decrypt.c index d768d88..3751f14 100644 --- a/libtomcrypt/src/modes/cbc/cbc_decrypt.c +++ b/libtomcrypt/src/modes/cbc/cbc_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -92,6 +92,6 @@ int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_decrypt.c,v $ */ -/* $Revision: 1.15 $ */ -/* $Date: 2006/11/21 00:18:23 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cbc/cbc_done.c b/libtomcrypt/src/modes/cbc/cbc_done.c index 99b035e..75b9742 100644 --- a/libtomcrypt/src/modes/cbc/cbc_done.c +++ b/libtomcrypt/src/modes/cbc/cbc_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -37,6 +37,6 @@ int cbc_done(symmetric_CBC *cbc) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_done.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:46:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cbc/cbc_encrypt.c b/libtomcrypt/src/modes/cbc/cbc_encrypt.c index bbfd1c4..1f28204 100644 --- a/libtomcrypt/src/modes/cbc/cbc_encrypt.c +++ b/libtomcrypt/src/modes/cbc/cbc_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -93,6 +93,6 @@ int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_encrypt.c,v $ */ -/* $Revision: 1.13 $ */ -/* $Date: 2006/11/21 00:18:23 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cbc/cbc_getiv.c b/libtomcrypt/src/modes/cbc/cbc_getiv.c index c54d558..6587743 100644 --- a/libtomcrypt/src/modes/cbc/cbc_getiv.c +++ b/libtomcrypt/src/modes/cbc/cbc_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -41,6 +41,6 @@ int cbc_getiv(unsigned char *IV, unsigned long *len, symmetric_CBC *cbc) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_getiv.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:46:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cbc/cbc_setiv.c b/libtomcrypt/src/modes/cbc/cbc_setiv.c index 6fb70ca..cd2e32e 100644 --- a/libtomcrypt/src/modes/cbc/cbc_setiv.c +++ b/libtomcrypt/src/modes/cbc/cbc_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -39,6 +39,6 @@ int cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_setiv.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/29 01:46:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cbc/cbc_start.c b/libtomcrypt/src/modes/cbc/cbc_start.c index 86ec7b9..832e77a 100644 --- a/libtomcrypt/src/modes/cbc/cbc_start.c +++ b/libtomcrypt/src/modes/cbc/cbc_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -57,6 +57,6 @@ int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_start.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/29 01:46:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cfb/cfb_decrypt.c b/libtomcrypt/src/modes/cfb/cfb_decrypt.c index 76a4de1..13ac5a6 100644 --- a/libtomcrypt/src/modes/cfb/cfb_decrypt.c +++ b/libtomcrypt/src/modes/cfb/cfb_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -62,6 +62,6 @@ int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_decrypt.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/26 01:45:14 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cfb/cfb_done.c b/libtomcrypt/src/modes/cfb/cfb_done.c index 4ee9d50..1ee9a98 100644 --- a/libtomcrypt/src/modes/cfb/cfb_done.c +++ b/libtomcrypt/src/modes/cfb/cfb_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -37,6 +37,6 @@ int cfb_done(symmetric_CFB *cfb) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_done.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cfb/cfb_encrypt.c b/libtomcrypt/src/modes/cfb/cfb_encrypt.c index b619682..8ac5f5c 100644 --- a/libtomcrypt/src/modes/cfb/cfb_encrypt.c +++ b/libtomcrypt/src/modes/cfb/cfb_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -60,6 +60,6 @@ int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_encrypt.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/26 01:45:14 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cfb/cfb_getiv.c b/libtomcrypt/src/modes/cfb/cfb_getiv.c index 1689a75..b6786e1 100644 --- a/libtomcrypt/src/modes/cfb/cfb_getiv.c +++ b/libtomcrypt/src/modes/cfb/cfb_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -41,6 +41,6 @@ int cfb_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_getiv.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cfb/cfb_setiv.c b/libtomcrypt/src/modes/cfb/cfb_setiv.c index efb848b..0fc8757 100644 --- a/libtomcrypt/src/modes/cfb/cfb_setiv.c +++ b/libtomcrypt/src/modes/cfb/cfb_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -47,6 +47,6 @@ int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_setiv.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/cfb/cfb_start.c b/libtomcrypt/src/modes/cfb/cfb_start.c index e70d635..a8e5b8b 100644 --- a/libtomcrypt/src/modes/cfb/cfb_start.c +++ b/libtomcrypt/src/modes/cfb/cfb_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -60,6 +60,6 @@ int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/cfb/cfb_start.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ctr/ctr_decrypt.c b/libtomcrypt/src/modes/ctr/ctr_decrypt.c index f32821f..9537249 100644 --- a/libtomcrypt/src/modes/ctr/ctr_decrypt.c +++ b/libtomcrypt/src/modes/ctr/ctr_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -37,6 +37,6 @@ int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_decrypt.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/29 01:46:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ctr/ctr_done.c b/libtomcrypt/src/modes/ctr/ctr_done.c index 074c8b6..26391fd 100644 --- a/libtomcrypt/src/modes/ctr/ctr_done.c +++ b/libtomcrypt/src/modes/ctr/ctr_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -37,6 +37,6 @@ int ctr_done(symmetric_CTR *ctr) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_done.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:46:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ctr/ctr_encrypt.c b/libtomcrypt/src/modes/ctr/ctr_encrypt.c index 84dd65b..0b08359 100644 --- a/libtomcrypt/src/modes/ctr/ctr_encrypt.c +++ b/libtomcrypt/src/modes/ctr/ctr_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -64,7 +64,7 @@ int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s /* increment counter */ if (ctr->mode == CTR_COUNTER_LITTLE_ENDIAN) { /* little-endian */ - for (x = 0; x < ctr->blocklen; x++) { + for (x = 0; x < ctr->ctrlen; x++) { ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; if (ctr->ctr[x] != (unsigned char)0) { break; @@ -72,7 +72,7 @@ int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s } } else { /* big-endian */ - for (x = ctr->blocklen-1; x >= 0; x--) { + for (x = ctr->blocklen-1; x >= ctr->ctrlen; x--) { ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; if (ctr->ctr[x] != (unsigned char)0) { break; @@ -107,6 +107,6 @@ int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_encrypt.c,v $ */ -/* $Revision: 1.20 $ */ -/* $Date: 2006/11/21 00:18:23 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ctr/ctr_getiv.c b/libtomcrypt/src/modes/ctr/ctr_getiv.c index 2fbf888..6242323 100644 --- a/libtomcrypt/src/modes/ctr/ctr_getiv.c +++ b/libtomcrypt/src/modes/ctr/ctr_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -41,6 +41,6 @@ int ctr_getiv(unsigned char *IV, unsigned long *len, symmetric_CTR *ctr) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_getiv.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:46:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ctr/ctr_setiv.c b/libtomcrypt/src/modes/ctr/ctr_setiv.c index 8e8649f..56a3c97 100644 --- a/libtomcrypt/src/modes/ctr/ctr_setiv.c +++ b/libtomcrypt/src/modes/ctr/ctr_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -51,6 +51,6 @@ int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_setiv.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:46:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ctr/ctr_start.c b/libtomcrypt/src/modes/ctr/ctr_start.c index 895c8a4..b27bed0 100644 --- a/libtomcrypt/src/modes/ctr/ctr_start.c +++ b/libtomcrypt/src/modes/ctr/ctr_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -46,6 +46,16 @@ int ctr_start( int cipher, return err; } + /* ctrlen == counter width */ + ctr->ctrlen = (ctr_mode & 255) ? (ctr_mode & 255) : cipher_descriptor[cipher].block_length; + if (ctr->ctrlen > cipher_descriptor[cipher].block_length) { + return CRYPT_INVALID_ARG; + } + + if ((ctr_mode & 0x1000) == CTR_COUNTER_BIG_ENDIAN) { + ctr->ctrlen = cipher_descriptor[cipher].block_length - ctr->ctrlen; + } + /* setup cipher */ if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &ctr->key)) != CRYPT_OK) { return err; @@ -55,7 +65,7 @@ int ctr_start( int cipher, ctr->blocklen = cipher_descriptor[cipher].block_length; ctr->cipher = cipher; ctr->padlen = 0; - ctr->mode = ctr_mode & 1; + ctr->mode = ctr_mode & 0x1000; for (x = 0; x < ctr->blocklen; x++) { ctr->ctr[x] = IV[x]; } @@ -64,7 +74,7 @@ int ctr_start( int cipher, /* increment the IV as per RFC 3686 */ if (ctr->mode == CTR_COUNTER_LITTLE_ENDIAN) { /* little-endian */ - for (x = 0; x < ctr->blocklen; x++) { + for (x = 0; x < ctr->ctrlen; x++) { ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; if (ctr->ctr[x] != (unsigned char)0) { break; @@ -72,7 +82,7 @@ int ctr_start( int cipher, } } else { /* big-endian */ - for (x = ctr->blocklen-1; x >= 0; x--) { + for (x = ctr->blocklen-1; x >= ctr->ctrlen; x--) { ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; if (ctr->ctr[x] != (unsigned char)0) { break; @@ -86,6 +96,6 @@ int ctr_start( int cipher, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_start.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/11/05 01:46:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ctr/ctr_test.c b/libtomcrypt/src/modes/ctr/ctr_test.c index ad20778..9962afd 100644 --- a/libtomcrypt/src/modes/ctr/ctr_test.c +++ b/libtomcrypt/src/modes/ctr/ctr_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -77,9 +77,9 @@ int ctr_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_test.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/11/05 02:06:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ecb/ecb_decrypt.c b/libtomcrypt/src/modes/ecb/ecb_decrypt.c index c16fce0..84842c2 100644 --- a/libtomcrypt/src/modes/ecb/ecb_decrypt.c +++ b/libtomcrypt/src/modes/ecb/ecb_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -56,6 +56,6 @@ int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_decrypt.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ecb/ecb_done.c b/libtomcrypt/src/modes/ecb/ecb_done.c index 2af3a83..961ec97 100644 --- a/libtomcrypt/src/modes/ecb/ecb_done.c +++ b/libtomcrypt/src/modes/ecb/ecb_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -37,6 +37,6 @@ int ecb_done(symmetric_ECB *ecb) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_done.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ecb/ecb_encrypt.c b/libtomcrypt/src/modes/ecb/ecb_encrypt.c index f6910c6..801e0fd 100644 --- a/libtomcrypt/src/modes/ecb/ecb_encrypt.c +++ b/libtomcrypt/src/modes/ecb/ecb_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -56,6 +56,6 @@ int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_encrypt.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ecb/ecb_start.c b/libtomcrypt/src/modes/ecb/ecb_start.c index cc84579..cec583a 100644 --- a/libtomcrypt/src/modes/ecb/ecb_start.c +++ b/libtomcrypt/src/modes/ecb/ecb_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -43,6 +43,6 @@ int ecb_start(int cipher, const unsigned char *key, int keylen, int num_rounds, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ecb/ecb_start.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/f8/f8_decrypt.c b/libtomcrypt/src/modes/f8/f8_decrypt.c index fc8f61a..9c4525d 100644 --- a/libtomcrypt/src/modes/f8/f8_decrypt.c +++ b/libtomcrypt/src/modes/f8/f8_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -38,6 +38,6 @@ int f8_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, sy -/* $Source: /cvs/libtom/libtomcrypt/src/modes/f8/f8_decrypt.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/06/16 22:49:25 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/f8/f8_done.c b/libtomcrypt/src/modes/f8/f8_done.c index c864767..867d603 100644 --- a/libtomcrypt/src/modes/f8/f8_done.c +++ b/libtomcrypt/src/modes/f8/f8_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -37,6 +37,6 @@ int f8_done(symmetric_F8 *f8) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/f8/f8_done.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/06/16 22:49:25 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/f8/f8_encrypt.c b/libtomcrypt/src/modes/f8/f8_encrypt.c index fc33be9..d1a96df 100644 --- a/libtomcrypt/src/modes/f8/f8_encrypt.c +++ b/libtomcrypt/src/modes/f8/f8_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -98,6 +98,6 @@ int f8_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, sy #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/f8/f8_encrypt.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/11/05 04:16:32 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/f8/f8_getiv.c b/libtomcrypt/src/modes/f8/f8_getiv.c index 2c5d92f..ff7cb91 100644 --- a/libtomcrypt/src/modes/f8/f8_getiv.c +++ b/libtomcrypt/src/modes/f8/f8_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -41,6 +41,6 @@ int f8_getiv(unsigned char *IV, unsigned long *len, symmetric_F8 *f8) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/f8/f8_getiv.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/06/16 22:49:25 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/f8/f8_setiv.c b/libtomcrypt/src/modes/f8/f8_setiv.c index 469cc15..d1cafcf 100644 --- a/libtomcrypt/src/modes/f8/f8_setiv.c +++ b/libtomcrypt/src/modes/f8/f8_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -47,6 +47,6 @@ int f8_setiv(const unsigned char *IV, unsigned long len, symmetric_F8 *f8) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/f8/f8_setiv.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/06/16 22:49:25 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/f8/f8_start.c b/libtomcrypt/src/modes/f8/f8_start.c index bb05c16..4cd58de 100644 --- a/libtomcrypt/src/modes/f8/f8_start.c +++ b/libtomcrypt/src/modes/f8/f8_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -93,6 +93,6 @@ int f8_start( int cipher, const unsigned char *IV, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/f8/f8_start.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/05 01:36:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/f8/f8_test_mode.c b/libtomcrypt/src/modes/f8/f8_test_mode.c index 68160ea..5cc391b 100644 --- a/libtomcrypt/src/modes/f8/f8_test_mode.c +++ b/libtomcrypt/src/modes/f8/f8_test_mode.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -71,6 +71,6 @@ int f8_test_mode(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/f8/f8_test_mode.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/11/13 11:55:25 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/lrw/lrw_decrypt.c b/libtomcrypt/src/modes/lrw/lrw_decrypt.c index 24eece8..e2858c0 100644 --- a/libtomcrypt/src/modes/lrw/lrw_decrypt.c +++ b/libtomcrypt/src/modes/lrw/lrw_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -46,6 +46,6 @@ int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/lrw/lrw_decrypt.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/06/29 01:53:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/lrw/lrw_done.c b/libtomcrypt/src/modes/lrw/lrw_done.c index 4ae75c3..e123d28 100644 --- a/libtomcrypt/src/modes/lrw/lrw_done.c +++ b/libtomcrypt/src/modes/lrw/lrw_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -37,6 +37,6 @@ int lrw_done(symmetric_LRW *lrw) } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/lrw/lrw_done.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:53:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/lrw/lrw_encrypt.c b/libtomcrypt/src/modes/lrw/lrw_encrypt.c index 5ed11c9..d84cbdd 100644 --- a/libtomcrypt/src/modes/lrw/lrw_encrypt.c +++ b/libtomcrypt/src/modes/lrw/lrw_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -45,6 +45,6 @@ int lrw_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/lrw/lrw_encrypt.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/06/29 01:53:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/lrw/lrw_getiv.c b/libtomcrypt/src/modes/lrw/lrw_getiv.c index 00159ce..575e322 100644 --- a/libtomcrypt/src/modes/lrw/lrw_getiv.c +++ b/libtomcrypt/src/modes/lrw/lrw_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -40,6 +40,6 @@ int lrw_getiv(unsigned char *IV, unsigned long *len, symmetric_LRW *lrw) } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/lrw/lrw_getiv.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/06/29 01:53:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/lrw/lrw_process.c b/libtomcrypt/src/modes/lrw/lrw_process.c index 451d4ce..25661e7 100644 --- a/libtomcrypt/src/modes/lrw/lrw_process.c +++ b/libtomcrypt/src/modes/lrw/lrw_process.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -115,6 +115,6 @@ int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, i } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/lrw/lrw_process.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/06/29 01:53:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/lrw/lrw_setiv.c b/libtomcrypt/src/modes/lrw/lrw_setiv.c index bb3c0aa..2ff9a80 100644 --- a/libtomcrypt/src/modes/lrw/lrw_setiv.c +++ b/libtomcrypt/src/modes/lrw/lrw_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -74,6 +74,6 @@ int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/lrw/lrw_setiv.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/06/29 01:53:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/lrw/lrw_start.c b/libtomcrypt/src/modes/lrw/lrw_start.c index a9f24b5..f378789 100644 --- a/libtomcrypt/src/modes/lrw/lrw_start.c +++ b/libtomcrypt/src/modes/lrw/lrw_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -98,6 +98,6 @@ int lrw_start( int cipher, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/lrw/lrw_start.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/06/29 01:53:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/lrw/lrw_test.c b/libtomcrypt/src/modes/lrw/lrw_test.c index fe33845..63e014a 100644 --- a/libtomcrypt/src/modes/lrw/lrw_test.c +++ b/libtomcrypt/src/modes/lrw/lrw_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -131,6 +131,6 @@ int lrw_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/modes/lrw/lrw_test.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/06/29 01:53:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ofb/ofb_decrypt.c b/libtomcrypt/src/modes/ofb/ofb_decrypt.c index 1ada1ed..2c8780e 100644 --- a/libtomcrypt/src/modes/ofb/ofb_decrypt.c +++ b/libtomcrypt/src/modes/ofb/ofb_decrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -38,6 +38,6 @@ int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_decrypt.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ofb/ofb_done.c b/libtomcrypt/src/modes/ofb/ofb_done.c index 50a9de2..10506b3 100644 --- a/libtomcrypt/src/modes/ofb/ofb_done.c +++ b/libtomcrypt/src/modes/ofb/ofb_done.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -37,6 +37,6 @@ int ofb_done(symmetric_OFB *ofb) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_done.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ofb/ofb_encrypt.c b/libtomcrypt/src/modes/ofb/ofb_encrypt.c index 2c19f1d..8c97a4d 100644 --- a/libtomcrypt/src/modes/ofb/ofb_encrypt.c +++ b/libtomcrypt/src/modes/ofb/ofb_encrypt.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -55,6 +55,6 @@ int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_encrypt.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/26 01:45:14 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ofb/ofb_getiv.c b/libtomcrypt/src/modes/ofb/ofb_getiv.c index 641d14b..c009e33 100644 --- a/libtomcrypt/src/modes/ofb/ofb_getiv.c +++ b/libtomcrypt/src/modes/ofb/ofb_getiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -41,6 +41,6 @@ int ofb_getiv(unsigned char *IV, unsigned long *len, symmetric_OFB *ofb) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_getiv.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ofb/ofb_setiv.c b/libtomcrypt/src/modes/ofb/ofb_setiv.c index 35a84e9..826caa9 100644 --- a/libtomcrypt/src/modes/ofb/ofb_setiv.c +++ b/libtomcrypt/src/modes/ofb/ofb_setiv.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -47,6 +47,6 @@ int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_setiv.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/ofb/ofb_start.c b/libtomcrypt/src/modes/ofb/ofb_start.c index 1f0f65a..cf87545 100644 --- a/libtomcrypt/src/modes/ofb/ofb_start.c +++ b/libtomcrypt/src/modes/ofb/ofb_start.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -55,6 +55,6 @@ int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/modes/ofb/ofb_start.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/29 01:51:34 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/modes/xts/xts_decrypt.c b/libtomcrypt/src/modes/xts/xts_decrypt.c new file mode 100644 index 0000000..3e46c53 --- /dev/null +++ b/libtomcrypt/src/modes/xts/xts_decrypt.c @@ -0,0 +1,141 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include "tomcrypt.h" + +/** + Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects +*/ + +#ifdef LTC_XTS_MODE + +static int tweak_uncrypt(const unsigned char *C, unsigned char *P, unsigned char *T, symmetric_xts *xts) +{ + unsigned long x; + int err; + + /* tweak encrypt block i */ +#ifdef LTC_FAST + for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { + *((LTC_FAST_TYPE*)&P[x]) = *((LTC_FAST_TYPE*)&C[x]) ^ *((LTC_FAST_TYPE*)&T[x]); + } +#else + for (x = 0; x < 16; x++) { + P[x] = C[x] ^ T[x]; + } +#endif + + err = cipher_descriptor[xts->cipher].ecb_decrypt(P, P, &xts->key1); + +#ifdef LTC_FAST + for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { + *((LTC_FAST_TYPE*)&P[x]) ^= *((LTC_FAST_TYPE*)&T[x]); + } +#else + for (x = 0; x < 16; x++) { + P[x] = P[x] ^ T[x]; + } +#endif + + /* LFSR the tweak */ + xts_mult_x(T); + + return err; +} + +/** XTS Decryption + @param ct [in] Ciphertext + @param ptlen Length of plaintext (and ciphertext) + @param pt [out] Plaintext + @param tweak [in] The 128--bit encryption tweak (e.g. sector number) + @param xts The XTS structure + Returns CRYPT_OK upon success +*/int xts_decrypt( + const unsigned char *ct, unsigned long ptlen, + unsigned char *pt, + const unsigned char *tweak, + symmetric_xts *xts) +{ + unsigned char PP[16], CC[16], T[16]; + unsigned long i, m, mo, lim; + int err; + + /* check inputs */ + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(tweak != NULL); + LTC_ARGCHK(xts != NULL); + + /* check if valid */ + if ((err = cipher_is_valid(xts->cipher)) != CRYPT_OK) { + return err; + } + + /* get number of blocks */ + m = ptlen >> 4; + mo = ptlen & 15; + + /* must have at least one full block */ + if (m == 0) { + return CRYPT_INVALID_ARG; + } + + /* encrypt the tweak */ + if ((err = cipher_descriptor[xts->cipher].ecb_encrypt(tweak, T, &xts->key2)) != CRYPT_OK) { + return err; + } + + /* for i = 0 to m-2 do */ + if (mo == 0) { + lim = m; + } else { + lim = m - 1; + } + + for (i = 0; i < lim; i++) { + err = tweak_uncrypt(ct, pt, T, xts); + ct += 16; + pt += 16; + } + + /* if ptlen not divide 16 then */ + if (mo > 0) { + XMEMCPY(CC, T, 16); + xts_mult_x(CC); + + /* PP = tweak decrypt block m-1 */ + if ((err = tweak_uncrypt(ct, PP, CC, xts)) != CRYPT_OK) { + return err; + } + + /* Pm = first ptlen % 16 bytes of PP */ + for (i = 0; i < mo; i++) { + CC[i] = ct[16+i]; + pt[16+i] = PP[i]; + } + for (; i < 16; i++) { + CC[i] = PP[i]; + } + + /* Pm-1 = Tweak uncrypt CC */ + if ((err = tweak_uncrypt(CC, pt, T, xts)) != CRYPT_OK) { + return err; + } + } + + return CRYPT_OK; +} + +#endif + +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ + diff --git a/libtomcrypt/src/modes/xts/xts_done.c b/libtomcrypt/src/modes/xts/xts_done.c new file mode 100644 index 0000000..7c04277 --- /dev/null +++ b/libtomcrypt/src/modes/xts/xts_done.c @@ -0,0 +1,34 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include "tomcrypt.h" + +/** + Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects +*/ + +#ifdef LTC_XTS_MODE + +/** Terminate XTS state + @param XTS The state to terminate +*/ +void xts_done(symmetric_xts *xts) +{ + LTC_ARGCHKVD(xts != NULL); + cipher_descriptor[xts->cipher].done(&xts->key1); + cipher_descriptor[xts->cipher].done(&xts->key2); +} + +#endif + +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ + diff --git a/libtomcrypt/src/modes/xts/xts_encrypt.c b/libtomcrypt/src/modes/xts/xts_encrypt.c new file mode 100644 index 0000000..ab53d3c --- /dev/null +++ b/libtomcrypt/src/modes/xts/xts_encrypt.c @@ -0,0 +1,142 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include "tomcrypt.h" + +/** + Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects +*/ + +#ifdef LTC_XTS_MODE + +static int tweak_crypt(const unsigned char *P, unsigned char *C, unsigned char *T, symmetric_xts *xts) +{ + unsigned long x; + int err; + + /* tweak encrypt block i */ +#ifdef LTC_FAST + for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { + *((LTC_FAST_TYPE*)&C[x]) = *((LTC_FAST_TYPE*)&P[x]) ^ *((LTC_FAST_TYPE*)&T[x]); + } +#else + for (x = 0; x < 16; x++) { + C[x] = P[x] ^ T[x]; + } +#endif + + if ((err = cipher_descriptor[xts->cipher].ecb_encrypt(C, C, &xts->key1)) != CRYPT_OK) { + return err; + } + +#ifdef LTC_FAST + for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { + *((LTC_FAST_TYPE*)&C[x]) ^= *((LTC_FAST_TYPE*)&T[x]); + } +#else + for (x = 0; x < 16; x++) { + C[x] = C[x] ^ T[x]; + } +#endif + + /* LFSR the tweak */ + xts_mult_x(T); + + return CRYPT_OK; +} + +/** XTS Encryption + @param pt [in] Plaintext + @param ptlen Length of plaintext (and ciphertext) + @param ct [out] Ciphertext + @param tweak [in] The 128--bit encryption tweak (e.g. sector number) + @param xts The XTS structure + Returns CRYPT_OK upon success +*/ +int xts_encrypt( + const unsigned char *pt, unsigned long ptlen, + unsigned char *ct, + const unsigned char *tweak, + symmetric_xts *xts) +{ + unsigned char PP[16], CC[16], T[16]; + unsigned long i, m, mo, lim; + int err; + + /* check inputs */ + LTC_ARGCHK(pt != NULL); + LTC_ARGCHK(ct != NULL); + LTC_ARGCHK(tweak != NULL); + LTC_ARGCHK(xts != NULL); + + /* check if valid */ + if ((err = cipher_is_valid(xts->cipher)) != CRYPT_OK) { + return err; + } + + /* get number of blocks */ + m = ptlen >> 4; + mo = ptlen & 15; + + /* must have at least one full block */ + if (m == 0) { + return CRYPT_INVALID_ARG; + } + + /* encrypt the tweak */ + if ((err = cipher_descriptor[xts->cipher].ecb_encrypt(tweak, T, &xts->key2)) != CRYPT_OK) { + return err; + } + + /* for i = 0 to m-2 do */ + if (mo == 0) { + lim = m; + } else { + lim = m - 1; + } + + for (i = 0; i < lim; i++) { + err = tweak_crypt(pt, ct, T, xts); + ct += 16; + pt += 16; + } + + /* if ptlen not divide 16 then */ + if (mo > 0) { + /* CC = tweak encrypt block m-1 */ + if ((err = tweak_crypt(pt, CC, T, xts)) != CRYPT_OK) { + return err; + } + + /* Cm = first ptlen % 16 bytes of CC */ + for (i = 0; i < mo; i++) { + PP[i] = pt[16+i]; + ct[16+i] = CC[i]; + } + + for (; i < 16; i++) { + PP[i] = CC[i]; + } + + /* Cm-1 = Tweak encrypt PP */ + if ((err = tweak_crypt(PP, ct, T, xts)) != CRYPT_OK) { + return err; + } + } + + return err; +} + +#endif + +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ + diff --git a/libtomcrypt/src/modes/xts/xts_init.c b/libtomcrypt/src/modes/xts/xts_init.c new file mode 100644 index 0000000..f38c01e --- /dev/null +++ b/libtomcrypt/src/modes/xts/xts_init.c @@ -0,0 +1,69 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include "tomcrypt.h" + +/** + Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects +*/ + +#ifdef LTC_XTS_MODE + + +/** Start XTS mode + @param cipher The index of the cipher to use + @param key1 The encrypt key + @param key2 The tweak encrypt key + @param keylen The length of the keys (each) in octets + @param num_rounds The number of rounds for the cipher (0 == default) + @param xts [out] XTS structure + Returns CRYPT_OK upon success. +*/ +int xts_start( int cipher, + const unsigned char *key1, + const unsigned char *key2, + unsigned long keylen, + int num_rounds, + symmetric_xts *xts) +{ + int err; + + /* check inputs */ + LTC_ARGCHK(key1 != NULL); + LTC_ARGCHK(key2 != NULL); + LTC_ARGCHK(xts != NULL); + + /* check if valid */ + if ((err = cipher_is_valid(cipher)) != CRYPT_OK) { + return err; + } + + if (cipher_descriptor[cipher].block_length != 16) { + return CRYPT_INVALID_ARG; + } + + /* schedule the two ciphers */ + if ((err = cipher_descriptor[cipher].setup(key1, keylen, num_rounds, &xts->key1)) != CRYPT_OK) { + return err; + } + if ((err = cipher_descriptor[cipher].setup(key2, keylen, num_rounds, &xts->key2)) != CRYPT_OK) { + return err; + } + xts->cipher = cipher; + + return err; +} + +#endif + +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ + diff --git a/libtomcrypt/src/modes/xts/xts_mult_x.c b/libtomcrypt/src/modes/xts/xts_mult_x.c new file mode 100644 index 0000000..e5b7c11 --- /dev/null +++ b/libtomcrypt/src/modes/xts/xts_mult_x.c @@ -0,0 +1,42 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include "tomcrypt.h" + +/** + Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects +*/ + +#ifdef LTC_XTS_MODE + +/** multiply by x + @param I The value to multiply by x (LFSR shift) +*/ +void xts_mult_x(unsigned char *I) +{ + int x; + unsigned char t, tt; + + for (x = t = 0; x < 16; x++) { + tt = I[x] >> 7; + I[x] = ((I[x] << 1) | t) & 0xFF; + t = tt; + } + if (tt) { + I[0] ^= 0x87; + } +} + +#endif + +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ + diff --git a/libtomcrypt/src/modes/xts/xts_test.c b/libtomcrypt/src/modes/xts/xts_test.c new file mode 100644 index 0000000..b91e0f4 --- /dev/null +++ b/libtomcrypt/src/modes/xts/xts_test.c @@ -0,0 +1,199 @@ +/* LibTomCrypt, modular cryptographic library -- Tom St Denis + * + * LibTomCrypt is a library that provides various cryptographic + * algorithms in a highly modular and flexible manner. + * + * The library is free for all purposes without any express + * guarantee it works. + * + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + */ +#include "tomcrypt.h" + +#ifdef LTC_XTS_MODE + +/** + Source donated by Elliptic Semiconductor Inc (www.ellipticsemi.com) to the LibTom Projects + Returns CRYPT_OK upon success. +*/ +int xts_test(void) +{ +#ifdef LTC_NO_TEST + return CRYPT_NOP; +#else + static const struct { + int keylen; + unsigned char key1[32]; + unsigned char key2[32]; + ulong64 seqnum; + unsigned long PTLEN; + unsigned char PTX[512], CTX[512]; + } tests[] = { + +/* #1 32 byte key, 32 byte PTX */ +{ + 32, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + 0, + 32, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x91,0x7c,0xf6,0x9e,0xbd,0x68,0xb2,0xec,0x9b,0x9f,0xe9,0xa3,0xea,0xdd,0xa6,0x92,0xcd,0x43,0xd2,0xf5,0x95,0x98,0xed,0x85,0x8c,0x02,0xc2,0x65,0x2f,0xbf,0x92,0x2e }, +}, + +/* #2, 32 byte key, 32 byte PTX */ +{ + 32, + { 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11 }, + { 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22 }, + CONST64(0x3333333333), + 32, + { 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44 }, + { 0xc4,0x54,0x18,0x5e,0x6a,0x16,0x93,0x6e,0x39,0x33,0x40,0x38,0xac,0xef,0x83,0x8b,0xfb,0x18,0x6f,0xff,0x74,0x80,0xad,0xc4,0x28,0x93,0x82,0xec,0xd6,0xd3,0x94,0xf0 }, +}, + +/* #5 from xts.7, 32 byte key, 32 byte PTX */ +{ + 32, + { 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0 }, + { 0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,0xb7,0xb6,0xb5,0xb4,0xb3,0xb2,0xb1,0xb0 }, + CONST64(0x123456789a), + 32, + { 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44 }, + { 0xb0,0x1f,0x86,0xf8,0xed,0xc1,0x86,0x37,0x06,0xfa,0x8a,0x42,0x53,0xe3,0x4f,0x28,0xaf,0x31,0x9d,0xe3,0x83,0x34,0x87,0x0f,0x4d,0xd1,0xf9,0x4c,0xbe,0x98,0x32,0xf1 }, +}, + +/* #4, 32 byte key, 512 byte PTX */ +{ + 32, + { 0x27,0x18,0x28,0x18,0x28,0x45,0x90,0x45,0x23,0x53,0x60,0x28,0x74,0x71,0x35,0x26 }, + { 0x31,0x41,0x59,0x26,0x53,0x58,0x97,0x93,0x23,0x84,0x62,0x64,0x33,0x83,0x27,0x95 }, + 0, + 512, + { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, +0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, +0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, +0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff, +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, +0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, +0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, +0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff, + }, + { +0x27,0xa7,0x47,0x9b,0xef,0xa1,0xd4,0x76,0x48,0x9f,0x30,0x8c,0xd4,0xcf,0xa6,0xe2,0xa9,0x6e,0x4b,0xbe,0x32,0x08,0xff,0x25,0x28,0x7d,0xd3,0x81,0x96,0x16,0xe8,0x9c, +0xc7,0x8c,0xf7,0xf5,0xe5,0x43,0x44,0x5f,0x83,0x33,0xd8,0xfa,0x7f,0x56,0x00,0x00,0x05,0x27,0x9f,0xa5,0xd8,0xb5,0xe4,0xad,0x40,0xe7,0x36,0xdd,0xb4,0xd3,0x54,0x12, +0x32,0x80,0x63,0xfd,0x2a,0xab,0x53,0xe5,0xea,0x1e,0x0a,0x9f,0x33,0x25,0x00,0xa5,0xdf,0x94,0x87,0xd0,0x7a,0x5c,0x92,0xcc,0x51,0x2c,0x88,0x66,0xc7,0xe8,0x60,0xce, +0x93,0xfd,0xf1,0x66,0xa2,0x49,0x12,0xb4,0x22,0x97,0x61,0x46,0xae,0x20,0xce,0x84,0x6b,0xb7,0xdc,0x9b,0xa9,0x4a,0x76,0x7a,0xae,0xf2,0x0c,0x0d,0x61,0xad,0x02,0x65, +0x5e,0xa9,0x2d,0xc4,0xc4,0xe4,0x1a,0x89,0x52,0xc6,0x51,0xd3,0x31,0x74,0xbe,0x51,0xa1,0x0c,0x42,0x11,0x10,0xe6,0xd8,0x15,0x88,0xed,0xe8,0x21,0x03,0xa2,0x52,0xd8, +0xa7,0x50,0xe8,0x76,0x8d,0xef,0xff,0xed,0x91,0x22,0x81,0x0a,0xae,0xb9,0x9f,0x91,0x72,0xaf,0x82,0xb6,0x04,0xdc,0x4b,0x8e,0x51,0xbc,0xb0,0x82,0x35,0xa6,0xf4,0x34, +0x13,0x32,0xe4,0xca,0x60,0x48,0x2a,0x4b,0xa1,0xa0,0x3b,0x3e,0x65,0x00,0x8f,0xc5,0xda,0x76,0xb7,0x0b,0xf1,0x69,0x0d,0xb4,0xea,0xe2,0x9c,0x5f,0x1b,0xad,0xd0,0x3c, +0x5c,0xcf,0x2a,0x55,0xd7,0x05,0xdd,0xcd,0x86,0xd4,0x49,0x51,0x1c,0xeb,0x7e,0xc3,0x0b,0xf1,0x2b,0x1f,0xa3,0x5b,0x91,0x3f,0x9f,0x74,0x7a,0x8a,0xfd,0x1b,0x13,0x0e, +0x94,0xbf,0xf9,0x4e,0xff,0xd0,0x1a,0x91,0x73,0x5c,0xa1,0x72,0x6a,0xcd,0x0b,0x19,0x7c,0x4e,0x5b,0x03,0x39,0x36,0x97,0xe1,0x26,0x82,0x6f,0xb6,0xbb,0xde,0x8e,0xcc, +0x1e,0x08,0x29,0x85,0x16,0xe2,0xc9,0xed,0x03,0xff,0x3c,0x1b,0x78,0x60,0xf6,0xde,0x76,0xd4,0xce,0xcd,0x94,0xc8,0x11,0x98,0x55,0xef,0x52,0x97,0xca,0x67,0xe9,0xf3, +0xe7,0xff,0x72,0xb1,0xe9,0x97,0x85,0xca,0x0a,0x7e,0x77,0x20,0xc5,0xb3,0x6d,0xc6,0xd7,0x2c,0xac,0x95,0x74,0xc8,0xcb,0xbc,0x2f,0x80,0x1e,0x23,0xe5,0x6f,0xd3,0x44, +0xb0,0x7f,0x22,0x15,0x4b,0xeb,0xa0,0xf0,0x8c,0xe8,0x89,0x1e,0x64,0x3e,0xd9,0x95,0xc9,0x4d,0x9a,0x69,0xc9,0xf1,0xb5,0xf4,0x99,0x02,0x7a,0x78,0x57,0x2a,0xee,0xbd, +0x74,0xd2,0x0c,0xc3,0x98,0x81,0xc2,0x13,0xee,0x77,0x0b,0x10,0x10,0xe4,0xbe,0xa7,0x18,0x84,0x69,0x77,0xae,0x11,0x9f,0x7a,0x02,0x3a,0xb5,0x8c,0xca,0x0a,0xd7,0x52, +0xaf,0xe6,0x56,0xbb,0x3c,0x17,0x25,0x6a,0x9f,0x6e,0x9b,0xf1,0x9f,0xdd,0x5a,0x38,0xfc,0x82,0xbb,0xe8,0x72,0xc5,0x53,0x9e,0xdb,0x60,0x9e,0xf4,0xf7,0x9c,0x20,0x3e, +0xbb,0x14,0x0f,0x2e,0x58,0x3c,0xb2,0xad,0x15,0xb4,0xaa,0x5b,0x65,0x50,0x16,0xa8,0x44,0x92,0x77,0xdb,0xd4,0x77,0xef,0x2c,0x8d,0x6c,0x01,0x7d,0xb7,0x38,0xb1,0x8d, +0xeb,0x4a,0x42,0x7d,0x19,0x23,0xce,0x3f,0xf2,0x62,0x73,0x57,0x79,0xa4,0x18,0xf2,0x0a,0x28,0x2d,0xf9,0x20,0x14,0x7b,0xea,0xbe,0x42,0x1e,0xe5,0x31,0x9d,0x05,0x68, + } +}, + +/* #7, 32 byte key, 17 byte PTX */ +{ + 32, + { 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0 }, + { 0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,0xb7,0xb6,0xb5,0xb4,0xb3,0xb2,0xb1,0xb0 }, + CONST64(0x123456789a), + 17, + { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 }, + { 0x6c,0x16,0x25,0xdb,0x46,0x71,0x52,0x2d,0x3d,0x75,0x99,0x60,0x1d,0xe7,0xca,0x09,0xed }, +}, + +/* #15, 32 byte key, 25 byte PTX */ +{ + 32, + { 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0 }, + { 0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,0xb7,0xb6,0xb5,0xb4,0xb3,0xb2,0xb1,0xb0 }, + CONST64(0x123456789a), + 25, + { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18 }, + { 0x8f,0x4d,0xcb,0xad,0x55,0x55,0x8d,0x7b,0x4e,0x01,0xd9,0x37,0x9c,0xd4,0xea,0x22,0xed,0xbf,0x9d,0xac,0xe4,0x5d,0x6f,0x6a,0x73 }, +}, + +/* #21, 32 byte key, 31 byte PTX */ +{ + 32, + { 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf7,0xf6,0xf5,0xf4,0xf3,0xf2,0xf1,0xf0 }, + { 0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,0xb7,0xb6,0xb5,0xb4,0xb3,0xb2,0xb1,0xb0 }, + CONST64(0x123456789a), + 31, + { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e }, + { 0xd0,0x5b,0xc0,0x90,0xa8,0xe0,0x4f,0x1b,0x3d,0x3e,0xcd,0xd5,0xba,0xec,0x0f,0xd4,0xed,0xbf,0x9d,0xac,0xe4,0x5d,0x6f,0x6a,0x73,0x06,0xe6,0x4b,0xe5,0xdd,0x82 }, +}, + +}; + unsigned char OUT[512], T[16]; + ulong64 seq; + symmetric_xts xts; + int i, err, idx; + + /* AES can be under rijndael or aes... try to find it */ + if ((idx = find_cipher("aes")) == -1) { + if ((idx = find_cipher("rijndael")) == -1) { + return CRYPT_NOP; + } + } + + for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) { + err = xts_start(idx, tests[i].key1, tests[i].key2, tests[i].keylen/2, 0, &xts); + if (err != CRYPT_OK) { + return err; + } + + seq = tests[i].seqnum; + STORE64L(seq,T); + XMEMSET(T+8, 0, 8); + + err = xts_encrypt(tests[i].PTX, tests[i].PTLEN, OUT, T, &xts); + if (err != CRYPT_OK) { + xts_done(&xts); + return err; + } + + if (XMEMCMP(OUT, tests[i].CTX, tests[i].PTLEN)) { + xts_done(&xts); + return CRYPT_FAIL_TESTVECTOR; + } + + err = xts_decrypt(tests[i].CTX, tests[i].PTLEN, OUT, T, &xts); + if (err != CRYPT_OK) { + xts_done(&xts); + return err; + } + + if (XMEMCMP(OUT, tests[i].PTX, tests[i].PTLEN)) { + xts_done(&xts); + return CRYPT_FAIL_TESTVECTOR; + } + xts_done(&xts); + } + return CRYPT_OK; +#endif +} + +#endif + +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ + diff --git a/libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c b/libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c index 1d3569c..bace8c8 100644 --- a/libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -97,6 +97,6 @@ int der_decode_bit_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c b/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c index 757963c..e64bd1f 100644 --- a/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -84,6 +84,6 @@ int der_encode_bit_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c b/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c index 3dc2abf..3ec5f58 100644 --- a/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -49,6 +49,6 @@ int der_length_bit_string(unsigned long nbits, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c b/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c index 7259e51..e7c5699 100644 --- a/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -42,6 +42,6 @@ int der_decode_boolean(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c,v $ */ -/* $Revision: 1.1 $ */ -/* $Date: 2006/04/22 17:01:59 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c b/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c index 9344a79..b40fae6 100644 --- a/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -46,6 +46,6 @@ int der_encode_boolean(int in, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c b/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c index cd5bf2d..5437031 100644 --- a/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -30,6 +30,6 @@ int der_length_boolean(unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/04/22 17:28:38 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c b/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c index 4ff6f17..1220b37 100644 --- a/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -177,6 +177,6 @@ int der_decode_choice(const unsigned char *in, unsigned long *inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/06 02:23:49 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c b/libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c index 2514b77..1880ada 100644 --- a/libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -91,6 +91,6 @@ int der_decode_ia5_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c b/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c index aff3392..6009dbc 100644 --- a/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -80,6 +80,6 @@ int der_encode_ia5_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c b/libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c index 6278dd2..f10c1b8 100644 --- a/libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -189,6 +189,6 @@ int der_length_ia5_string(const unsigned char *octets, unsigned long noctets, un #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c b/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c index aef87a3..0ed8ad7 100644 --- a/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -105,6 +105,6 @@ int der_decode_integer(const unsigned char *in, unsigned long inlen, void *num) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c b/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c index ff4fce6..e80bb3c 100644 --- a/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -125,6 +125,6 @@ int der_encode_integer(void *num, unsigned char *out, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c b/libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c index bcc331d..9d49683 100644 --- a/libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -77,6 +77,6 @@ int der_length_integer(void *num, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/04/22 01:22:55 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c b/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c index 1fa87d8..406acdc 100644 --- a/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -94,6 +94,6 @@ int der_decode_object_identifier(const unsigned char *in, unsigned long inle #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/11/21 00:18:23 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c b/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c index b343aaa..f018ba9 100644 --- a/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -106,6 +106,6 @@ int der_encode_object_identifier(unsigned long *words, unsigned long nwords, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c b/libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c index a4cf53f..ccb1e6d 100644 --- a/libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -84,6 +84,6 @@ int der_length_object_identifier(unsigned long *words, unsigned long nwords, uns #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/04/16 20:17:42 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c b/libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c index b937e63..952d739 100644 --- a/libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -86,6 +86,6 @@ int der_decode_octet_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c b/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c index fe0f163..9a16c3b 100644 --- a/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -81,6 +81,6 @@ int der_encode_octet_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c b/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c index 3caf352..07da058 100644 --- a/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -48,6 +48,6 @@ int der_length_octet_string(unsigned long noctets, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c b/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c index cae96d8..56bf376 100644 --- a/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -91,6 +91,6 @@ int der_decode_printable_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c b/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c index 9061b1f..7d7cfd2 100644 --- a/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -80,6 +80,6 @@ int der_encode_printable_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c b/libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c index 799b6b6..9f78f20 100644 --- a/libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -161,6 +161,6 @@ int der_length_printable_string(const unsigned char *octets, unsigned long nocte #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c b/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c index 1f65602..5042b18 100644 --- a/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> @@ -282,6 +282,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c,v $ */ -/* $Revision: 1.15 $ */ -/* $Date: 2006/11/26 02:25:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c b/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c index 19d8c86..4fd3aaa 100644 --- a/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -381,6 +381,6 @@ error: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c,v $ */ -/* $Revision: 1.25 $ */ -/* $Date: 2006/11/26 02:25:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c b/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c index a15c182..4202eb3 100644 --- a/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> @@ -134,6 +134,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/11/26 02:25:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_ex.c b/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_ex.c index cdb4f1e..e92f7c3 100644 --- a/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_ex.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> diff --git a/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c b/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c index da34c64..659f029 100644 --- a/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" #include <stdarg.h> @@ -133,6 +133,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/11/26 02:25:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c b/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c index 36f4a2a..7221f99 100644 --- a/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -164,6 +164,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c,v $ */ -/* $Revision: 1.13 $ */ -/* $Date: 2006/11/26 02:25:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c b/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c index dc826e3..c933f58 100644 --- a/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -60,6 +60,6 @@ void der_sequence_free(ltc_asn1_list *in) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c b/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c index a08d2b0..a2d0128 100644 --- a/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -98,6 +98,6 @@ int der_encode_set(ltc_asn1_list *list, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/11/26 02:27:37 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c b/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c index 6c12eb4..8e87f84 100644 --- a/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -157,6 +157,6 @@ int der_encode_setof(ltc_asn1_list *list, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c b/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c index 1407e9a..a174740 100644 --- a/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -63,6 +63,6 @@ int der_decode_short_integer(const unsigned char *in, unsigned long inlen, unsig #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c b/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c index 95da2fa..903ceb4 100644 --- a/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -92,6 +92,6 @@ int der_encode_short_integer(unsigned long num, unsigned char *out, unsigned lon #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c b/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c index 073e294..0b8fdcf 100644 --- a/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -65,6 +65,6 @@ int der_length_short_integer(unsigned long num, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c b/libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c index 8a1f5fb..c86bc75 100644 --- a/libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -122,6 +122,6 @@ YYMMDDhhmmss-hh'mm' #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c b/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c index ae2ccbe..f8d0c56 100644 --- a/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -78,6 +78,6 @@ int der_encode_utctime(ltc_utctime *utctime, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c b/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c index 60f09de..e33c4f3 100644 --- a/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -41,6 +41,6 @@ int der_length_utctime(ltc_utctime *utctime, unsigned long *outlen) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c b/libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c index 28b5520..d9cbdaf 100644 --- a/libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -106,6 +106,6 @@ int der_decode_utf8_string(const unsigned char *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/11/26 02:27:37 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c b/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c index 2dd6081..847a726 100644 --- a/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -65,19 +65,19 @@ int der_encode_utf8_string(const wchar_t *in, unsigned long inlen, x = 0; out[x++] = 0x0C; if (len < 128) { - out[x++] = len; + out[x++] = (unsigned char)len; } else if (len < 256) { out[x++] = 0x81; - out[x++] = len; + out[x++] = (unsigned char)len; } else if (len < 65536UL) { out[x++] = 0x82; - out[x++] = (len>>8)&255; - out[x++] = len&255; + out[x++] = (unsigned char)((len>>8)&255); + out[x++] = (unsigned char)(len&255); } else if (len < 16777216UL) { out[x++] = 0x83; - out[x++] = (len>>16)&255; - out[x++] = (len>>8)&255; - out[x++] = len&255; + out[x++] = (unsigned char)((len>>16)&255); + out[x++] = (unsigned char)((len>>8)&255); + out[x++] = (unsigned char)(len&255); } else { return CRYPT_INVALID_ARG; } @@ -85,7 +85,7 @@ int der_encode_utf8_string(const wchar_t *in, unsigned long inlen, /* store UTF8 */ for (y = 0; y < inlen; y++) { switch (der_utf8_charsize(in[y])) { - case 1: out[x++] = in[y]; break; + case 1: out[x++] = (unsigned char)in[y]; break; case 2: out[x++] = 0xC0 | ((in[y] >> 6) & 0x1F); out[x++] = 0x80 | (in[y] & 0x3F); break; case 3: out[x++] = 0xE0 | ((in[y] >> 12) & 0x0F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break; case 4: out[x++] = 0xF0 | ((in[y] >> 18) & 0x07); out[x++] = 0x80 | ((in[y] >> 12) & 0x3F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break; @@ -100,6 +100,6 @@ int der_encode_utf8_string(const wchar_t *in, unsigned long inlen, #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/16 17:41:21 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c b/libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c index b5b2bc6..3321f94 100644 --- a/libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c +++ b/libtomcrypt/src/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. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -78,6 +78,6 @@ int der_length_utf8_string(const wchar_t *in, unsigned long noctets, unsigned lo #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/16 17:41:21 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c b/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c index 5cbedc6..c622c78 100644 --- a/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c +++ b/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA Crypto, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Decrypt an DSA encrypted key @@ -133,7 +133,7 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/12/04 03:18:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c b/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c index cefa4de..a082969 100644 --- a/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c +++ b/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA Crypto, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Encrypt a symmetric key with DSA @@ -129,7 +129,7 @@ LBL_ERR: } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_encrypt_key.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/04 03:18:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_export.c b/libtomcrypt/src/pk/dsa/dsa_export.c index d882779..e4c4508 100644 --- a/libtomcrypt/src/pk/dsa/dsa_export.c +++ b/libtomcrypt/src/pk/dsa/dsa_export.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA implementation, export key, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Export a DSA key to a binary packet @@ -67,6 +67,6 @@ int dsa_export(unsigned char *out, unsigned long *outlen, int type, dsa_key *key #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_export.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_free.c b/libtomcrypt/src/pk/dsa/dsa_free.c index 92a1eb7..5f5ce72 100644 --- a/libtomcrypt/src/pk/dsa/dsa_free.c +++ b/libtomcrypt/src/pk/dsa/dsa_free.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA implementation, free a DSA key, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Free a DSA key @@ -29,6 +29,6 @@ void dsa_free(dsa_key *key) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_free.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/06/09 01:38:13 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_import.c b/libtomcrypt/src/pk/dsa/dsa_import.c index bb2272a..47a68ca 100644 --- a/libtomcrypt/src/pk/dsa/dsa_import.c +++ b/libtomcrypt/src/pk/dsa/dsa_import.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA implementation, import a DSA key, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Import a DSA key @@ -71,8 +71,8 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key) } key->qord = mp_unsigned_bin_size(key->q); - if (key->qord >= MDSA_MAX_GROUP || key->qord <= 15 || - (unsigned long)key->qord >= mp_unsigned_bin_size(key->p) || (mp_unsigned_bin_size(key->p) - key->qord) >= MDSA_DELTA) { + if (key->qord >= LTC_MDSA_MAX_GROUP || key->qord <= 15 || + (unsigned long)key->qord >= mp_unsigned_bin_size(key->p) || (mp_unsigned_bin_size(key->p) - key->qord) >= LTC_MDSA_DELTA) { err = CRYPT_INVALID_PACKET; goto error; } @@ -85,6 +85,6 @@ error: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_import.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_make_key.c b/libtomcrypt/src/pk/dsa/dsa_make_key.c index 293e814..1c16d03 100644 --- a/libtomcrypt/src/pk/dsa/dsa_make_key.c +++ b/libtomcrypt/src/pk/dsa/dsa_make_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA implementation, generate a DSA key, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Create a DSA key @@ -41,13 +41,13 @@ int dsa_make_key(prng_state *prng, int wprng, int group_size, int modulus_size, } /* check size */ - if (group_size >= MDSA_MAX_GROUP || group_size <= 15 || - group_size >= modulus_size || (modulus_size - group_size) >= MDSA_DELTA) { + if (group_size >= LTC_MDSA_MAX_GROUP || group_size <= 15 || + group_size >= modulus_size || (modulus_size - group_size) >= LTC_MDSA_DELTA) { return CRYPT_INVALID_ARG; } /* allocate ram */ - buf = XMALLOC(MDSA_DELTA); + buf = XMALLOC(LTC_MDSA_DELTA); if (buf == NULL) { return CRYPT_MEM; } @@ -117,7 +117,7 @@ int dsa_make_key(prng_state *prng, int wprng, int group_size, int modulus_size, key->qord = group_size; #ifdef LTC_CLEAN_STACK - zeromem(buf, MDSA_DELTA); + zeromem(buf, LTC_MDSA_DELTA); #endif err = CRYPT_OK; @@ -132,6 +132,6 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_make_key.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/12/04 03:18:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_shared_secret.c b/libtomcrypt/src/pk/dsa/dsa_shared_secret.c index 570d637..5adaa5f 100644 --- a/libtomcrypt/src/pk/dsa/dsa_shared_secret.c +++ b/libtomcrypt/src/pk/dsa/dsa_shared_secret.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA Crypto, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Create a DSA shared secret between two keys @@ -66,7 +66,7 @@ done: } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_shared_secret.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/04 03:18:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_sign_hash.c b/libtomcrypt/src/pk/dsa/dsa_sign_hash.c index f84dd28..3fc7e99 100644 --- a/libtomcrypt/src/pk/dsa/dsa_sign_hash.c +++ b/libtomcrypt/src/pk/dsa/dsa_sign_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA implementation, sign a hash, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Sign a hash with DSA @@ -49,11 +49,11 @@ int dsa_sign_hash_raw(const unsigned char *in, unsigned long inlen, } /* check group order size */ - if (key->qord >= MDSA_MAX_GROUP) { + if (key->qord >= LTC_MDSA_MAX_GROUP) { return CRYPT_INVALID_ARG; } - buf = XMALLOC(MDSA_MAX_GROUP); + buf = XMALLOC(LTC_MDSA_MAX_GROUP); if (buf == NULL) { return CRYPT_MEM; } @@ -102,7 +102,7 @@ error: mp_clear_multi(k, kinv, tmp, NULL); ERRBUF: #ifdef LTC_CLEAN_STACK - zeromem(buf, MDSA_MAX_GROUP); + zeromem(buf, LTC_MDSA_MAX_GROUP); #endif XFREE(buf); return err; @@ -151,6 +151,6 @@ error: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_sign_hash.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/12/04 22:27:56 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_verify_hash.c b/libtomcrypt/src/pk/dsa/dsa_verify_hash.c index 0e8ff22..59beec2 100644 --- a/libtomcrypt/src/pk/dsa/dsa_verify_hash.c +++ b/libtomcrypt/src/pk/dsa/dsa_verify_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -16,7 +16,7 @@ */ -#ifdef MDSA +#ifdef LTC_MDSA /** Verify a DSA signature @@ -121,6 +121,6 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_verify_hash.c,v $ */ -/* $Revision: 1.13 $ */ -/* $Date: 2006/12/04 03:18:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/dsa/dsa_verify_key.c b/libtomcrypt/src/pk/dsa/dsa_verify_key.c index 27054d6..fa839ef 100644 --- a/libtomcrypt/src/pk/dsa/dsa_verify_key.c +++ b/libtomcrypt/src/pk/dsa/dsa_verify_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ DSA implementation, verify a key, Tom St Denis */ -#ifdef MDSA +#ifdef LTC_MDSA /** Verify a DSA key for validity @@ -95,6 +95,6 @@ error: } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/dsa/dsa_verify_key.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/04 03:18:43 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc.c b/libtomcrypt/src/pk/ecc/ecc.c index 90bbed4..56ed526 100644 --- a/libtomcrypt/src/pk/ecc/ecc.c +++ b/libtomcrypt/src/pk/ecc/ecc.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /* This holds the key settings. ***MUST*** be organized by size from smallest to largest. */ const ltc_ecc_set_type ltc_ecc_sets[] = { @@ -121,7 +121,7 @@ const ltc_ecc_set_type ltc_ecc_sets[] = { #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc.c,v $ */ -/* $Revision: 1.38 $ */ -/* $Date: 2006/11/07 23:14:28 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c b/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c index 2a32912..09dae07 100644 --- a/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c +++ b/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** ECC X9.63 (Sec. 4.3.6) uncompressed export @param key Key to export @@ -67,6 +67,6 @@ int ecc_ansi_x963_export(ecc_key *key, unsigned char *out, unsigned long *outlen #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/12/04 02:50:11 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c b/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c index e92f5f4..ec34245 100644 --- a/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c +++ b/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Import an ANSI X9.63 format public key @param in The input data to read @@ -99,6 +99,6 @@ error: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/12/04 22:17:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c b/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c index 97039d0..49df8e8 100644 --- a/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c +++ b/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && defined(LTC_DER) +#if defined(LTC_MECC) && defined(LTC_DER) /** Decrypt an ECC encrypted key @@ -144,7 +144,7 @@ LBL_ERR: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_decrypt_key.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c b/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c index d11ffe4..e97e737 100644 --- a/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c +++ b/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && defined(LTC_DER) +#if defined(LTC_MECC) && defined(LTC_DER) /** Encrypt a symmetric key with ECC @@ -130,7 +130,7 @@ LBL_ERR: } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_encrypt_key.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/21 00:10:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_export.c b/libtomcrypt/src/pk/ecc/ecc_export.c index 08c8d31..6a712fd 100644 --- a/libtomcrypt/src/pk/ecc/ecc_export.c +++ b/libtomcrypt/src/pk/ecc/ecc_export.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && defined(LTC_DER) +#if defined(LTC_MECC) && defined(LTC_DER) /** Export an ECC key as a binary packet @@ -76,7 +76,7 @@ int ecc_export(unsigned char *out, unsigned long *outlen, int type, ecc_key *key } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_export.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/21 00:10:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_free.c b/libtomcrypt/src/pk/ecc/ecc_free.c index 039178d..c9e5d6c 100644 --- a/libtomcrypt/src/pk/ecc/ecc_free.c +++ b/libtomcrypt/src/pk/ecc/ecc_free.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Free an ECC key from memory @@ -34,7 +34,7 @@ void ecc_free(ecc_key *key) } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_free.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/06/09 01:38:14 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_get_size.c b/libtomcrypt/src/pk/ecc/ecc_get_size.c index 9eafdeb..a824aa4 100644 --- a/libtomcrypt/src/pk/ecc/ecc_get_size.c +++ b/libtomcrypt/src/pk/ecc/ecc_get_size.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Get the size of an ECC key @@ -38,7 +38,7 @@ int ecc_get_size(ecc_key *key) } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_get_size.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/21 00:10:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_import.c b/libtomcrypt/src/pk/ecc/ecc_import.c index 97eaa7d..9506076 100644 --- a/libtomcrypt/src/pk/ecc/ecc_import.c +++ b/libtomcrypt/src/pk/ecc/ecc_import.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && defined(LTC_DER) +#if defined(LTC_MECC) && defined(LTC_DER) static int is_point(ecc_key *key) { @@ -166,7 +166,7 @@ done: return err; } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_import.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/12/04 02:19:48 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_make_key.c b/libtomcrypt/src/pk/ecc/ecc_make_key.c index 796b674..9bbeb44 100644 --- a/libtomcrypt/src/pk/ecc/ecc_make_key.c +++ b/libtomcrypt/src/pk/ecc/ecc_make_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Make a new ECC key @@ -51,7 +51,7 @@ int ecc_make_key_ex(prng_state *prng, int wprng, ecc_key *key, const ltc_ecc_set { int err; ecc_point *base; - void *prime; + void *prime, *order; unsigned char *buf; int keysize; @@ -82,7 +82,7 @@ int ecc_make_key_ex(prng_state *prng, int wprng, ecc_key *key, const ltc_ecc_set } /* setup the key variables */ - if ((err = mp_init_multi(&key->pubkey.x, &key->pubkey.y, &key->pubkey.z, &key->k, &prime, NULL)) != CRYPT_OK) { + if ((err = mp_init_multi(&key->pubkey.x, &key->pubkey.y, &key->pubkey.z, &key->k, &prime, &order, NULL)) != CRYPT_OK) { goto ERR_BUF; } base = ltc_ecc_new_point(); @@ -93,11 +93,16 @@ int ecc_make_key_ex(prng_state *prng, int wprng, ecc_key *key, const ltc_ecc_set /* read in the specs for this key */ if ((err = mp_read_radix(prime, (char *)key->dp->prime, 16)) != CRYPT_OK) { goto errkey; } + if ((err = mp_read_radix(order, (char *)key->dp->order, 16)) != CRYPT_OK) { goto errkey; } if ((err = mp_read_radix(base->x, (char *)key->dp->Gx, 16)) != CRYPT_OK) { goto errkey; } if ((err = mp_read_radix(base->y, (char *)key->dp->Gy, 16)) != CRYPT_OK) { goto errkey; } if ((err = mp_set(base->z, 1)) != CRYPT_OK) { goto errkey; } if ((err = mp_read_unsigned_bin(key->k, (unsigned char *)buf, keysize)) != CRYPT_OK) { goto errkey; } + /* the key should be smaller than the order of base point */ + if (mp_cmp(key->k, order) != LTC_MP_LT) { + if((err = mp_mod(key->k, order, key->k)) != CRYPT_OK) { goto errkey; } + } /* make the public key */ if ((err = ltc_mp.ecc_ptmul(key->k, base, &key->pubkey, prime, 1)) != CRYPT_OK) { goto errkey; } key->type = PK_PRIVATE; @@ -109,7 +114,7 @@ errkey: mp_clear_multi(key->pubkey.x, key->pubkey.y, key->pubkey.z, key->k, NULL); cleanup: ltc_ecc_del_point(base); - mp_clear(prime); + mp_clear_multi(prime, order, NULL); ERR_BUF: #ifdef LTC_CLEAN_STACK zeromem(buf, ECC_MAXSIZE); @@ -119,7 +124,7 @@ ERR_BUF: } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_make_key.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/12/04 02:50:11 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_shared_secret.c b/libtomcrypt/src/pk/ecc/ecc_shared_secret.c index ddef847..5aece5e 100644 --- a/libtomcrypt/src/pk/ecc/ecc_shared_secret.c +++ b/libtomcrypt/src/pk/ecc/ecc_shared_secret.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Create an ECC shared secret between two keys @@ -89,7 +89,7 @@ done: } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_shared_secret.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/04 02:19:48 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_sign_hash.c b/libtomcrypt/src/pk/ecc/ecc_sign_hash.c index 34c5893..0ef7e2b 100644 --- a/libtomcrypt/src/pk/ecc/ecc_sign_hash.c +++ b/libtomcrypt/src/pk/ecc/ecc_sign_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && defined(LTC_DER) +#if defined(LTC_MECC) && defined(LTC_DER) /** Sign a message digest @@ -108,7 +108,7 @@ errnokey: } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_sign_hash.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/12/04 02:50:11 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_sizes.c b/libtomcrypt/src/pk/ecc/ecc_sizes.c index f4b2d82..b02a9f9 100644 --- a/libtomcrypt/src/pk/ecc/ecc_sizes.c +++ b/libtomcrypt/src/pk/ecc/ecc_sizes.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC void ecc_sizes(int *low, int *high) { @@ -42,7 +42,7 @@ void ecc_sizes(int *low, int *high) } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_sizes.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/06/09 01:38:14 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_test.c b/libtomcrypt/src/pk/ecc/ecc_test.c index faa167c..873e70b 100644 --- a/libtomcrypt/src/pk/ecc/ecc_test.c +++ b/libtomcrypt/src/pk/ecc/ecc_test.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Perform on the ECC system @@ -89,7 +89,7 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_test.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/12/04 02:19:48 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ecc_verify_hash.c b/libtomcrypt/src/pk/ecc/ecc_verify_hash.c index 65a96e6..c10076b 100644 --- a/libtomcrypt/src/pk/ecc/ecc_verify_hash.c +++ b/libtomcrypt/src/pk/ecc/ecc_verify_hash.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && defined(LTC_DER) +#if defined(LTC_MECC) && defined(LTC_DER) /* verify * @@ -159,7 +159,7 @@ error: } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ecc_verify_hash.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/12/04 05:07:59 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c b/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c index cf81f24..4a02068 100644 --- a/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c +++ b/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Returns whether an ECC idx is valid or not @param n The idx number to check @@ -33,14 +33,14 @@ int ltc_ecc_is_valid_idx(int n) for (x = 0; ltc_ecc_sets[x].size != 0; x++); /* -1 is a valid index --- indicating that the domain params were supplied by the user */ - if ((n >= -1) || (n < x)) { + if ((n >= -1) && (n < x)) { return 1; } return 0; } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/11/21 00:10:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ltc_ecc_map.c b/libtomcrypt/src/pk/ecc/ltc_ecc_map.c index eec28b3..4f3ec09 100644 --- a/libtomcrypt/src/pk/ecc/ltc_ecc_map.c +++ b/libtomcrypt/src/pk/ecc/ltc_ecc_map.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Map a projective jacbobian point back to affine space @@ -70,7 +70,7 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_map.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/04 02:50:11 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c b/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c index ac1c24f..a6d1aab 100644 --- a/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c +++ b/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Shamir's Trick, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC #ifdef LTC_ECC_SHAMIR @@ -202,6 +202,6 @@ ERR_T: #endif #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/12/04 05:07:59 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c b/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c index 0e4c92b..4b11392 100644 --- a/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c +++ b/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC #ifndef LTC_ECC_TIMING_RESISTANT /* size of sliding window, don't change this! */ @@ -217,6 +217,6 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c,v $ */ -/* $Revision: 1.24 $ */ -/* $Date: 2006/12/04 05:07:59 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c b/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c index 8cbcdf3..25dcf0a 100644 --- a/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c +++ b/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC #ifdef LTC_ECC_TIMING_RESISTANT @@ -159,7 +159,7 @@ done: #endif #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/12/04 22:17:46 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ltc_ecc_points.c b/libtomcrypt/src/pk/ecc/ltc_ecc_points.c index 39f1321..9be9eff 100644 --- a/libtomcrypt/src/pk/ecc/ltc_ecc_points.c +++ b/libtomcrypt/src/pk/ecc/ltc_ecc_points.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#ifdef MECC +#ifdef LTC_MECC /** Allocate a new ECC point @@ -54,7 +54,7 @@ void ltc_ecc_del_point(ecc_point *p) } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_points.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/04 02:19:48 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c b/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c index c8e359f..c45a47b 100644 --- a/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c +++ b/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && (!defined(MECC_ACCEL) || defined(LTM_DESC)) +#if defined(LTC_MECC) && (!defined(LTC_MECC_ACCEL) || defined(LTM_LTC_DESC)) /** Add two ECC points @@ -190,7 +190,7 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c,v $ */ -/* $Revision: 1.13 $ */ -/* $Date: 2006/12/04 05:07:59 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c b/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c index f0b3e1d..ce31ccc 100644 --- a/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c +++ b/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b @@ -21,7 +21,7 @@ ECC Crypto, Tom St Denis */ -#if defined(MECC) && (!defined(MECC_ACCEL) || defined(LTM_DESC)) +#if defined(LTC_MECC) && (!defined(LTC_MECC_ACCEL) || defined(LTM_LTC_DESC)) /** Double an ECC point @@ -141,7 +141,7 @@ done: return err; } #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/04 05:07:59 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/katja/katja_decrypt_key.c b/libtomcrypt/src/pk/katja/katja_decrypt_key.c index 1e10d6c..e8819d9 100644 --- a/libtomcrypt/src/pk/katja/katja_decrypt_key.c +++ b/libtomcrypt/src/pk/katja/katja_decrypt_key.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file katja_decrypt_key.c - Katja PKCS #1 OAEP Decryption, Tom St Denis + Katja LTC_PKCS #1 OAEP Decryption, Tom St Denis */ #ifdef MKAT /** - (PKCS #1 v2.0) decrypt then OAEP depad + (LTC_PKCS #1 v2.0) decrypt then OAEP depad @param in The ciphertext @param inlen The length of the ciphertext (octets) @param out [out] The plaintext @@ -94,12 +94,12 @@ int katja_decrypt_key(const unsigned char *in, unsigned long inlen, return err; } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/katja/katja_decrypt_key.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/katja/katja_encrypt_key.c b/libtomcrypt/src/pk/katja/katja_encrypt_key.c index ce93356..ef59e92 100644 --- a/libtomcrypt/src/pk/katja/katja_encrypt_key.c +++ b/libtomcrypt/src/pk/katja/katja_encrypt_key.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file katja_encrypt_key.c - Katja PKCS-style OAEP encryption, Tom St Denis + Katja LTC_PKCS-style OAEP encryption, Tom St Denis */ #ifdef MKAT /** - (PKCS #1 v2.0) OAEP pad then encrypt + (LTC_PKCS #1 v2.0) OAEP pad then encrypt @param in The plaintext @param inlen The length of the plaintext (octets) @param out [out] The ciphertext @@ -80,8 +80,8 @@ int katja_encrypt_key(const unsigned char *in, unsigned long inlen, return katja_exptmod(out, x, out, outlen, PK_PUBLIC, key); } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/katja/katja_encrypt_key.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/katja/katja_export.c b/libtomcrypt/src/pk/katja/katja_export.c index 9e55654..5f4d327 100644 --- a/libtomcrypt/src/pk/katja/katja_export.c +++ b/libtomcrypt/src/pk/katja/katja_export.c @@ -6,13 +6,13 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file katja_export.c - Export Katja PKCS-style keys, Tom St Denis + Export Katja LTC_PKCS-style keys, Tom St Denis */ #ifdef MKAT @@ -68,8 +68,8 @@ int katja_export(unsigned char *out, unsigned long *outlen, int type, katja_key } } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/katja/katja_export.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/katja/katja_exptmod.c b/libtomcrypt/src/pk/katja/katja_exptmod.c index 8cc47d8..5df8908 100644 --- a/libtomcrypt/src/pk/katja/katja_exptmod.c +++ b/libtomcrypt/src/pk/katja/katja_exptmod.c @@ -6,13 +6,13 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file katja_exptmod.c - Katja PKCS-style exptmod, Tom St Denis + Katja LTC_PKCS-style exptmod, Tom St Denis */ #ifdef MKAT @@ -110,6 +110,6 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/katja/katja_exptmod.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/katja/katja_free.c b/libtomcrypt/src/pk/katja/katja_free.c index 8aed3fb..c5a46af 100644 --- a/libtomcrypt/src/pk/katja/katja_free.c +++ b/libtomcrypt/src/pk/katja/katja_free.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -30,6 +30,6 @@ void katja_free(katja_key *key) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/katja/katja_free.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/katja/katja_import.c b/libtomcrypt/src/pk/katja/katja_import.c index efdbe07..425f498 100644 --- a/libtomcrypt/src/pk/katja/katja_import.c +++ b/libtomcrypt/src/pk/katja/katja_import.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file katja_import.c - Import a PKCS-style Katja key, Tom St Denis + Import a LTC_PKCS-style Katja key, Tom St Denis */ #ifdef MKAT /** - Import an KatjaPublicKey or KatjaPrivateKey [two-prime only, only support >= 1024-bit keys, defined in PKCS #1 v2.1] + Import an KatjaPublicKey or KatjaPrivateKey [two-prime only, only support >= 1024-bit keys, defined in LTC_PKCS #1 v2.1] @param in The packet to import from @param inlen It's length (octets) @param key [out] Destination for newly imported key @@ -73,9 +73,9 @@ LBL_ERR: return err; } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/katja/katja_import.c,v $ */ -/* $Revision: 1.3 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/katja/katja_make_key.c b/libtomcrypt/src/pk/katja/katja_make_key.c index 08016c8..eec8e98 100644 --- a/libtomcrypt/src/pk/katja/katja_make_key.c +++ b/libtomcrypt/src/pk/katja/katja_make_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -96,6 +96,6 @@ done: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/katja/katja_make_key.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c index 4a39bd5..2d9df75 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,14 +15,14 @@ Integer to Octet I2OSP, Tom St Denis */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 /* always stores the same # of bytes, pads with leading zero bytes as required */ /** - PKCS #1 Integer to binary + LTC_PKCS #1 Integer to binary @param n The integer to store @param modulus_len The length of the RSA modulus @param out [out] The destination for the integer @@ -43,9 +43,9 @@ int pkcs_1_i2osp(void *n, unsigned long modulus_len, unsigned char *out) return mp_to_unsigned_bin(n, out+(modulus_len-size)); } -#endif /* PKCS_1 */ +#endif /* LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c index bfc80bd..af8f7e2 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file pkcs_1_mgf1.c - The Mask Generation Function (MGF1) for PKCS #1, Tom St Denis + The Mask Generation Function (MGF1) for LTC_PKCS #1, Tom St Denis */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 /** - Perform PKCS #1 MGF1 (internal) + Perform LTC_PKCS #1 MGF1 (internal) @param seed The seed for MGF1 @param seedlen The length of the seed @param hash_idx The index of the hash desired @@ -101,8 +101,8 @@ LBL_ERR: return err; } -#endif /* PKCS_1 */ +#endif /* LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c,v $ */ -/* $Revision: 1.6 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c index e70a016..9ac9976 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file pkcs_1_oaep_decode.c - OAEP Padding for PKCS #1, Tom St Denis + OAEP Padding for LTC_PKCS #1, Tom St Denis */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 /** - PKCS #1 v2.00 OAEP decode + LTC_PKCS #1 v2.00 OAEP decode @param msg The encoded data to decode @param msglen The length of the encoded data (octets) @param lparam The session or system data (can be NULL) @@ -182,8 +182,8 @@ LBL_ERR: return err; } -#endif /* PKCS_1 */ +#endif /* LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/11/01 09:28:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c index 99e1ac6..4403477 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file pkcs_1_oaep_encode.c - OAEP Padding for PKCS #1, Tom St Denis + OAEP Padding for LTC_PKCS #1, Tom St Denis */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 /** - PKCS #1 v2.00 OAEP encode + LTC_PKCS #1 v2.00 OAEP encode @param msg The data to encode @param msglen The length of the data to encode (octets) @param lparam A session or system parameter (can be NULL) @@ -165,9 +165,9 @@ LBL_ERR: return err; } -#endif /* PKCS_1 */ +#endif /* LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c index 563ae8d..2df7574 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -14,7 +14,7 @@ @file pkcs_1_os2ip.c Octet to Integer OS2IP, Tom St Denis */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 /** Read a binary string into an mp_int @@ -28,9 +28,9 @@ int pkcs_1_os2ip(void *n, unsigned char *in, unsigned long inlen) return mp_read_unsigned_bin(n, in, inlen); } -#endif /* PKCS_1 */ +#endif /* LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c index 2c16d50..222048c 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file pkcs_1_pss_decode.c - PKCS #1 PSS Signature Padding, Tom St Denis + LTC_PKCS #1 PSS Signature Padding, Tom St Denis */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 /** - PKCS #1 v2.00 PSS decode + LTC_PKCS #1 v2.00 PSS decode @param msghash The hash to verify @param msghashlen The length of the hash (octets) @param sig The signature data (encoded data) @@ -170,8 +170,8 @@ LBL_ERR: return err; } -#endif /* PKCS_1 */ +#endif /* LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/11/30 02:37:21 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c index 64bd312..b22a99f 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file pkcs_1_pss_encode.c - PKCS #1 PSS Signature Padding, Tom St Denis + LTC_PKCS #1 PSS Signature Padding, Tom St Denis */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 /** - PKCS #1 v2.00 Signature Encoding + LTC_PKCS #1 v2.00 Signature Encoding @param msghash The hash to encode @param msghashlen The length of the hash (octets) @param saltlen The length of the salt desired (octets) @@ -168,8 +168,8 @@ LBL_ERR: return err; } -#endif /* PKCS_1 */ +#endif /* LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/06/16 21:53:41 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c index b0a7c2d..8345601 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c @@ -6,18 +6,18 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file pkcs_1_v1_5_decode.c * - * PKCS #1 v1.5 Padding. (Andreas Lange) + * LTC_PKCS #1 v1.5 Padding. (Andreas Lange) */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 -/** @brief PKCS #1 v1.5 decode. +/** @brief LTC_PKCS #1 v1.5 decode. * * @param msg The encoded data to decode * @param msglen The length of the encoded data (octets) @@ -58,7 +58,7 @@ int pkcs_1_v1_5_decode(const unsigned char *msg, goto bail; } - if (block_type == LTC_PKCS_1_EME) { + if (block_type == LTC_LTC_PKCS_1_EME) { for (i = 2; i < modulus_len; i++) { /* separator */ if (msg[i] == 0x00) { break; } @@ -103,8 +103,8 @@ bail: return result; } /* pkcs_1_v1_5_decode */ -#endif /* #ifdef PKCS_1 */ +#endif /* #ifdef LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/16 17:41:21 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c b/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c index 7edd1e6..1c35069 100644 --- a/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c +++ b/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c @@ -6,25 +6,25 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /*! \file pkcs_1_v1_5_encode.c * - * PKCS #1 v1.5 Padding (Andreas Lange) + * LTC_PKCS #1 v1.5 Padding (Andreas Lange) */ -#ifdef PKCS_1 +#ifdef LTC_PKCS_1 -/*! \brief PKCS #1 v1.5 encode. +/*! \brief LTC_PKCS #1 v1.5 encode. * * \param msg The data to encode * \param msglen The length of the data to encode (octets) * \param block_type Block type to use in padding (\sa ltc_pkcs_1_v1_5_blocks) * \param modulus_bitlen The bit length of the RSA modulus - * \param prng An active PRNG state (only for LTC_PKCS_1_EME) - * \param prng_idx The index of the PRNG desired (only for LTC_PKCS_1_EME) + * \param prng An active PRNG state (only for LTC_LTC_PKCS_1_EME) + * \param prng_idx The index of the PRNG desired (only for LTC_LTC_PKCS_1_EME) * \param out [out] The destination for the encoded data * \param outlen [in/out] The max size and resulting size of the encoded data * @@ -44,12 +44,12 @@ int pkcs_1_v1_5_encode(const unsigned char *msg, int result; /* valid block_type? */ - if ((block_type != LTC_PKCS_1_EMSA) && - (block_type != LTC_PKCS_1_EME)) { + if ((block_type != LTC_LTC_PKCS_1_EMSA) && + (block_type != LTC_LTC_PKCS_1_EME)) { return CRYPT_PK_INVALID_PADDING; } - if (block_type == LTC_PKCS_1_EME) { /* encryption padding, we need a valid PRNG */ + if (block_type == LTC_LTC_PKCS_1_EME) { /* encryption padding, we need a valid PRNG */ if ((result = prng_is_valid(prng_idx)) != CRYPT_OK) { return result; } @@ -72,7 +72,7 @@ int pkcs_1_v1_5_encode(const unsigned char *msg, ps = &out[2]; ps_len = modulus_len - msglen - 3; - if (block_type == LTC_PKCS_1_EME) { + if (block_type == LTC_LTC_PKCS_1_EME) { /* now choose a random ps */ if (prng_descriptor[prng_idx].read(ps, ps_len, prng) != ps_len) { result = CRYPT_ERROR_READPRNG; @@ -104,8 +104,8 @@ bail: return result; } /* pkcs_1_v1_5_encode */ -#endif /* #ifdef PKCS_1 */ +#endif /* #ifdef LTC_PKCS_1 */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2006/11/01 09:12:06 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c b/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c index 3dce20f..31d841f 100644 --- a/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c +++ b/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file rsa_decrypt_key.c - RSA PKCS #1 Decryption, Tom St Denis and Andreas Lange + RSA LTC_PKCS #1 Decryption, Tom St Denis and Andreas Lange */ -#ifdef MRSA +#ifdef LTC_MRSA /** - PKCS #1 decrypt then v1.5 or OAEP depad + LTC_PKCS #1 decrypt then v1.5 or OAEP depad @param in The ciphertext @param inlen The length of the ciphertext (octets) @param out [out] The plaintext @@ -26,7 +26,7 @@ @param lparam The system "lparam" value @param lparamlen The length of the lparam value (octets) @param hash_idx The index of the hash desired - @param padding Type of padding (LTC_PKCS_1_OAEP or LTC_PKCS_1_V1_5) + @param padding Type of padding (LTC_LTC_PKCS_1_OAEP or LTC_LTC_PKCS_1_V1_5) @param stat [out] Result of the decryption, 1==valid, 0==invalid @param key The corresponding private RSA key @return CRYPT_OK if succcessul (even if invalid) @@ -51,12 +51,12 @@ int rsa_decrypt_key_ex(const unsigned char *in, unsigned long inlen, /* valid padding? */ - if ((padding != LTC_PKCS_1_V1_5) && - (padding != LTC_PKCS_1_OAEP)) { + if ((padding != LTC_LTC_PKCS_1_V1_5) && + (padding != LTC_LTC_PKCS_1_OAEP)) { return CRYPT_PK_INVALID_PADDING; } - if (padding == LTC_PKCS_1_OAEP) { + if (padding == LTC_LTC_PKCS_1_OAEP) { /* valid hash ? */ if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) { return err; @@ -85,21 +85,21 @@ int rsa_decrypt_key_ex(const unsigned char *in, unsigned long inlen, return err; } - if (padding == LTC_PKCS_1_OAEP) { + if (padding == LTC_LTC_PKCS_1_OAEP) { /* now OAEP decode the packet */ err = pkcs_1_oaep_decode(tmp, x, lparam, lparamlen, modulus_bitlen, hash_idx, out, outlen, stat); } else { - /* now PKCS #1 v1.5 depad the packet */ - err = pkcs_1_v1_5_decode(tmp, x, LTC_PKCS_1_EME, modulus_bitlen, out, outlen, stat); + /* now LTC_PKCS #1 v1.5 depad the packet */ + err = pkcs_1_v1_5_decode(tmp, x, LTC_LTC_PKCS_1_EME, modulus_bitlen, out, outlen, stat); } XFREE(tmp); return err; } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_decrypt_key.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:18:22 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c b/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c index 8d2c228..edb7e65 100644 --- a/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c +++ b/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file rsa_encrypt_key.c - RSA PKCS #1 encryption, Tom St Denis and Andreas Lange + RSA LTC_PKCS #1 encryption, Tom St Denis and Andreas Lange */ -#ifdef MRSA +#ifdef LTC_MRSA /** - (PKCS #1 v2.0) OAEP pad then encrypt + (LTC_PKCS #1 v2.0) OAEP pad then encrypt @param in The plaintext @param inlen The length of the plaintext (octets) @param out [out] The ciphertext @@ -28,7 +28,7 @@ @param prng An active PRNG @param prng_idx The index of the desired prng @param hash_idx The index of the desired hash - @param padding Type of padding (LTC_PKCS_1_OAEP or LTC_PKCS_1_V1_5) + @param padding Type of padding (LTC_LTC_PKCS_1_OAEP or LTC_LTC_PKCS_1_V1_5) @param key The RSA key to encrypt to @return CRYPT_OK if successful */ @@ -46,8 +46,8 @@ int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen, LTC_ARGCHK(key != NULL); /* valid padding? */ - if ((padding != LTC_PKCS_1_V1_5) && - (padding != LTC_PKCS_1_OAEP)) { + if ((padding != LTC_LTC_PKCS_1_V1_5) && + (padding != LTC_LTC_PKCS_1_OAEP)) { return CRYPT_PK_INVALID_PADDING; } @@ -56,7 +56,7 @@ int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen, return err; } - if (padding == LTC_PKCS_1_OAEP) { + if (padding == LTC_LTC_PKCS_1_OAEP) { /* valid hash? */ if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) { return err; @@ -73,7 +73,7 @@ int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen, return CRYPT_BUFFER_OVERFLOW; } - if (padding == LTC_PKCS_1_OAEP) { + if (padding == LTC_LTC_PKCS_1_OAEP) { /* OAEP pad the key */ x = *outlen; if ((err = pkcs_1_oaep_encode(in, inlen, lparam, @@ -82,21 +82,21 @@ int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen, return err; } } else { - /* PKCS #1 v1.5 pad the key */ + /* LTC_PKCS #1 v1.5 pad the key */ x = *outlen; - if ((err = pkcs_1_v1_5_encode(in, inlen, LTC_PKCS_1_EME, + if ((err = pkcs_1_v1_5_encode(in, inlen, LTC_LTC_PKCS_1_EME, modulus_bitlen, prng, prng_idx, out, &x)) != CRYPT_OK) { return err; } } - /* rsa exptmod the OAEP or PKCS #1 v1.5 pad */ + /* rsa exptmod the OAEP or LTC_PKCS #1 v1.5 pad */ return ltc_mp.rsa_me(out, x, out, outlen, PK_PUBLIC, key); } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_encrypt_key.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/01 09:18:22 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_export.c b/libtomcrypt/src/pk/rsa/rsa_export.c index 5b389ec..40cb066 100644 --- a/libtomcrypt/src/pk/rsa/rsa_export.c +++ b/libtomcrypt/src/pk/rsa/rsa_export.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file rsa_export.c - Export RSA PKCS keys, Tom St Denis + Export RSA LTC_PKCS keys, Tom St Denis */ -#ifdef MRSA +#ifdef LTC_MRSA /** - This will export either an RSAPublicKey or RSAPrivateKey [defined in PKCS #1 v2.1] + This will export either an RSAPublicKey or RSAPrivateKey [defined in LTC_PKCS #1 v2.1] @param out [out] Destination of the packet @param outlen [in/out] The max size and resulting size of the packet @param type The type of exported key (PK_PRIVATE or PK_PUBLIC) @@ -62,8 +62,8 @@ int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key } } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_export.c,v $ */ -/* $Revision: 1.15 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_exptmod.c b/libtomcrypt/src/pk/rsa/rsa_exptmod.c index 53dbf6b..101a766 100644 --- a/libtomcrypt/src/pk/rsa/rsa_exptmod.c +++ b/libtomcrypt/src/pk/rsa/rsa_exptmod.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file rsa_exptmod.c - RSA PKCS exptmod, Tom St Denis + RSA LTC_PKCS exptmod, Tom St Denis */ -#ifdef MRSA +#ifdef LTC_MRSA /** Compute an RSA modular exponentiation @@ -108,6 +108,6 @@ error: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_exptmod.c,v $ */ -/* $Revision: 1.16 $ */ -/* $Date: 2006/12/04 03:09:28 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_free.c b/libtomcrypt/src/pk/rsa/rsa_free.c index f48976a..bb6daef 100644 --- a/libtomcrypt/src/pk/rsa/rsa_free.c +++ b/libtomcrypt/src/pk/rsa/rsa_free.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ Free an RSA key, Tom St Denis */ -#ifdef MRSA +#ifdef LTC_MRSA /** Free an RSA key from memory @@ -29,6 +29,6 @@ void rsa_free(rsa_key *key) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_free.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/12/04 22:23:27 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_import.c b/libtomcrypt/src/pk/rsa/rsa_import.c index 7b12fd9..85c676b 100644 --- a/libtomcrypt/src/pk/rsa/rsa_import.c +++ b/libtomcrypt/src/pk/rsa/rsa_import.c @@ -6,19 +6,19 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file rsa_import.c - Import a PKCS RSA key, Tom St Denis + Import a LTC_PKCS RSA key, Tom St Denis */ -#ifdef MRSA +#ifdef LTC_MRSA /** - Import an RSAPublicKey or RSAPrivateKey [two-prime only, only support >= 1024-bit keys, defined in PKCS #1 v2.1] + Import an RSAPublicKey or RSAPrivateKey [two-prime only, only support >= 1024-bit keys, defined in LTC_PKCS #1 v2.1] @param in The packet to import from @param inlen It's length (octets) @param key [out] Destination for newly imported key @@ -87,7 +87,7 @@ int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key) } XFREE(tmpbuf); - /* not SSL public key, try to match against PKCS #1 standards */ + /* not SSL public key, try to match against LTC_PKCS #1 standards */ if ((err = der_decode_sequence_multi(in, inlen, LTC_ASN1_INTEGER, 1UL, key->N, LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) { @@ -135,9 +135,9 @@ LBL_ERR: return err; } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_import.c,v $ */ -/* $Revision: 1.21 $ */ -/* $Date: 2006/12/04 22:23:27 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_make_key.c b/libtomcrypt/src/pk/rsa/rsa_make_key.c index bd2a29b..d62e37e 100644 --- a/libtomcrypt/src/pk/rsa/rsa_make_key.c +++ b/libtomcrypt/src/pk/rsa/rsa_make_key.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ RSA key generation, Tom St Denis */ -#ifdef MRSA +#ifdef LTC_MRSA /** Create an RSA key @@ -107,6 +107,6 @@ cleanup: #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_make_key.c,v $ */ -/* $Revision: 1.14 $ */ -/* $Date: 2006/12/04 22:23:27 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_sign_hash.c b/libtomcrypt/src/pk/rsa/rsa_sign_hash.c index f10a97a..3b64095 100644 --- a/libtomcrypt/src/pk/rsa/rsa_sign_hash.c +++ b/libtomcrypt/src/pk/rsa/rsa_sign_hash.c @@ -6,24 +6,24 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file rsa_sign_hash.c - RSA PKCS #1 v1.5 and v2 PSS sign hash, Tom St Denis and Andreas Lange + RSA LTC_PKCS #1 v1.5 and v2 PSS sign hash, Tom St Denis and Andreas Lange */ -#ifdef MRSA +#ifdef LTC_MRSA /** - PKCS #1 pad then sign + LTC_PKCS #1 pad then sign @param in The hash to sign @param inlen The length of the hash to sign (octets) @param out [out] The signature @param outlen [in/out] The max size and resulting size of the signature - @param padding Type of padding (LTC_PKCS_1_PSS or LTC_PKCS_1_V1_5) + @param padding Type of padding (LTC_LTC_PKCS_1_PSS or LTC_LTC_PKCS_1_V1_5) @param prng An active PRNG state @param prng_idx The index of the PRNG desired @param hash_idx The index of the hash desired @@ -47,11 +47,11 @@ int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, LTC_ARGCHK(key != NULL); /* valid padding? */ - if ((padding != LTC_PKCS_1_V1_5) && (padding != LTC_PKCS_1_PSS)) { + if ((padding != LTC_LTC_PKCS_1_V1_5) && (padding != LTC_LTC_PKCS_1_PSS)) { return CRYPT_PK_INVALID_PADDING; } - if (padding == LTC_PKCS_1_PSS) { + if (padding == LTC_LTC_PKCS_1_PSS) { /* valid prng and hash ? */ if ((err = prng_is_valid(prng_idx)) != CRYPT_OK) { return err; @@ -71,7 +71,7 @@ int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, return CRYPT_BUFFER_OVERFLOW; } - if (padding == LTC_PKCS_1_PSS) { + if (padding == LTC_LTC_PKCS_1_PSS) { /* PSS pad the key */ x = *outlen; if ((err = pkcs_1_pss_encode(in, inlen, saltlen, prng, prng_idx, @@ -79,7 +79,7 @@ int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, return err; } } else { - /* PKCS #1 v1.5 pad the hash */ + /* LTC_PKCS #1 v1.5 pad the hash */ unsigned char *tmpin; ltc_asn1_list digestinfo[2], siginfo[2]; @@ -114,7 +114,7 @@ int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, } x = *outlen; - if ((err = pkcs_1_v1_5_encode(tmpin, y, LTC_PKCS_1_EMSA, + if ((err = pkcs_1_v1_5_encode(tmpin, y, LTC_LTC_PKCS_1_EMSA, modulus_bitlen, NULL, 0, out, &x)) != CRYPT_OK) { XFREE(tmpin); @@ -127,8 +127,8 @@ int rsa_sign_hash_ex(const unsigned char *in, unsigned long inlen, return ltc_mp.rsa_me(out, x, out, outlen, PK_PRIVATE, key); } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_sign_hash.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/11/09 23:15:39 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/pk/rsa/rsa_verify_hash.c b/libtomcrypt/src/pk/rsa/rsa_verify_hash.c index 4b61029..fe83690 100644 --- a/libtomcrypt/src/pk/rsa/rsa_verify_hash.c +++ b/libtomcrypt/src/pk/rsa/rsa_verify_hash.c @@ -6,24 +6,24 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file rsa_verify_hash.c - RSA PKCS #1 v1.5 or v2 PSS signature verification, Tom St Denis and Andreas Lange + RSA LTC_PKCS #1 v1.5 or v2 PSS signature verification, Tom St Denis and Andreas Lange */ -#ifdef MRSA +#ifdef LTC_MRSA /** - PKCS #1 de-sign then v1.5 or PSS depad + LTC_PKCS #1 de-sign then v1.5 or PSS depad @param sig The signature data @param siglen The length of the signature data (octets) @param hash The hash of the message that was signed @param hashlen The length of the hash of the message that was signed (octets) - @param padding Type of padding (LTC_PKCS_1_PSS or LTC_PKCS_1_V1_5) + @param padding Type of padding (LTC_LTC_PKCS_1_PSS or LTC_LTC_PKCS_1_V1_5) @param hash_idx The index of the desired hash @param saltlen The length of the salt used during signature @param stat [out] The result of the signature comparison, 1==valid, 0==invalid @@ -50,12 +50,12 @@ int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen, /* valid padding? */ - if ((padding != LTC_PKCS_1_V1_5) && - (padding != LTC_PKCS_1_PSS)) { + if ((padding != LTC_LTC_PKCS_1_V1_5) && + (padding != LTC_LTC_PKCS_1_PSS)) { return CRYPT_PK_INVALID_PADDING; } - if (padding == LTC_PKCS_1_PSS) { + if (padding == LTC_LTC_PKCS_1_PSS) { /* valid hash ? */ if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) { return err; @@ -90,11 +90,11 @@ int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen, return CRYPT_INVALID_PACKET; } - if (padding == LTC_PKCS_1_PSS) { + if (padding == LTC_LTC_PKCS_1_PSS) { /* PSS decode and verify it */ err = pkcs_1_pss_decode(hash, hashlen, tmpbuf, x, saltlen, hash_idx, modulus_bitlen, stat); } else { - /* PKCS #1 v1.5 decode it */ + /* LTC_PKCS #1 v1.5 decode it */ unsigned char *out; unsigned long outlen, loid[16]; int decoded; @@ -114,7 +114,7 @@ int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen, goto bail_2; } - if ((err = pkcs_1_v1_5_decode(tmpbuf, x, LTC_PKCS_1_EMSA, modulus_bitlen, out, &outlen, &decoded)) != CRYPT_OK) { + if ((err = pkcs_1_v1_5_decode(tmpbuf, x, LTC_LTC_PKCS_1_EMSA, modulus_bitlen, out, &outlen, &decoded)) != CRYPT_OK) { XFREE(out); goto bail_2; } @@ -160,8 +160,8 @@ bail_2: return err; } -#endif /* MRSA */ +#endif /* LTC_MRSA */ -/* $Source: /cvs/libtom/libtomcrypt/src/pk/rsa/rsa_verify_hash.c,v $ */ -/* $Revision: 1.11 $ */ -/* $Date: 2006/12/04 03:09:28 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/prngs/fortuna.c b/libtomcrypt/src/prngs/fortuna.c index 159db52..d262a0b 100644 --- a/libtomcrypt/src/prngs/fortuna.c +++ b/libtomcrypt/src/prngs/fortuna.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -19,22 +19,22 @@ We deviate slightly here for reasons of simplicity [and to fit in the API]. First all "sources" in the AddEntropy function are fixed to 0. Second since no reliable timer is provided -we reseed automatically when len(pool0) >= 64 or every FORTUNA_WD calls to the read function */ +we reseed automatically when len(pool0) >= 64 or every LTC_FORTUNA_WD calls to the read function */ -#ifdef FORTUNA +#ifdef LTC_FORTUNA -/* requries SHA256 and AES */ -#if !(defined(RIJNDAEL) && defined(SHA256)) - #error FORTUNA requires SHA256 and RIJNDAEL (AES) +/* requries LTC_SHA256 and AES */ +#if !(defined(LTC_RIJNDAEL) && defined(LTC_SHA256)) + #error LTC_FORTUNA requires LTC_SHA256 and LTC_RIJNDAEL (AES) #endif -#ifndef FORTUNA_POOLS - #warning FORTUNA_POOLS was not previously defined (old headers?) - #define FORTUNA_POOLS 32 +#ifndef LTC_FORTUNA_POOLS + #warning LTC_FORTUNA_POOLS was not previously defined (old headers?) + #define LTC_FORTUNA_POOLS 32 #endif -#if FORTUNA_POOLS < 4 || FORTUNA_POOLS > 32 - #error FORTUNA_POOLS must be in [4..32] +#if LTC_FORTUNA_POOLS < 4 || LTC_FORTUNA_POOLS > 32 + #error LTC_FORTUNA_POOLS must be in [4..32] #endif const struct ltc_prng_descriptor fortuna_desc = { @@ -71,14 +71,14 @@ static int fortuna_reseed(prng_state *prng) ++prng->fortuna.reset_cnt; - /* new K == SHA256(K || s) where s == SHA256(P0) || SHA256(P1) ... */ + /* 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) { sha256_done(&md, tmp); return err; } - for (x = 0; x < FORTUNA_POOLS; x++) { + for (x = 0; x < LTC_FORTUNA_POOLS; x++) { if (x == 0 || ((prng->fortuna.reset_cnt >> (x-1)) & 1) == 0) { /* terminate this hash */ if ((err = sha256_done(&prng->fortuna.pool[x], tmp)) != CRYPT_OK) { @@ -135,7 +135,7 @@ int fortuna_start(prng_state *prng) LTC_ARGCHK(prng != NULL); /* initialize the pools */ - for (x = 0; x < FORTUNA_POOLS; x++) { + for (x = 0; x < LTC_FORTUNA_POOLS; x++) { if ((err = sha256_init(&prng->fortuna.pool[x])) != CRYPT_OK) { for (y = 0; y < x; y++) { sha256_done(&prng->fortuna.pool[y], tmp); @@ -149,7 +149,7 @@ int fortuna_start(prng_state *prng) /* reset bufs */ zeromem(prng->fortuna.K, 32); if ((err = rijndael_setup(prng->fortuna.K, 32, 0, &prng->fortuna.skey)) != CRYPT_OK) { - for (x = 0; x < FORTUNA_POOLS; x++) { + for (x = 0; x < LTC_FORTUNA_POOLS; x++) { sha256_done(&prng->fortuna.pool[x], tmp); } return err; @@ -198,7 +198,7 @@ int fortuna_add_entropy(const unsigned char *in, unsigned long inlen, prng_state if (prng->fortuna.pool_idx == 0) { prng->fortuna.pool0_len += inlen; } - if (++(prng->fortuna.pool_idx) == FORTUNA_POOLS) { + if (++(prng->fortuna.pool_idx) == LTC_FORTUNA_POOLS) { prng->fortuna.pool_idx = 0; } @@ -235,7 +235,7 @@ unsigned long fortuna_read(unsigned char *out, unsigned long outlen, prng_state LTC_MUTEX_LOCK(&prng->fortuna.prng_lock); /* do we have to reseed? */ - if (++prng->fortuna.wd == FORTUNA_WD || prng->fortuna.pool0_len >= 64) { + if (++prng->fortuna.wd == LTC_FORTUNA_WD || prng->fortuna.pool0_len >= 64) { if ((err = fortuna_reseed(prng)) != CRYPT_OK) { LTC_MUTEX_UNLOCK(&prng->fortuna.prng_lock); return 0; @@ -290,7 +290,7 @@ int fortuna_done(prng_state *prng) LTC_MUTEX_LOCK(&prng->fortuna.prng_lock); /* terminate all the hashes */ - for (x = 0; x < FORTUNA_POOLS; x++) { + for (x = 0; x < LTC_FORTUNA_POOLS; x++) { if ((err = sha256_done(&(prng->fortuna.pool[x]), tmp)) != CRYPT_OK) { LTC_MUTEX_UNLOCK(&prng->fortuna.prng_lock); return err; @@ -325,9 +325,9 @@ int fortuna_export(unsigned char *out, unsigned long *outlen, prng_state *prng) LTC_MUTEX_LOCK(&prng->fortuna.prng_lock); /* we'll write bytes for s&g's */ - if (*outlen < 32*FORTUNA_POOLS) { + if (*outlen < 32*LTC_FORTUNA_POOLS) { LTC_MUTEX_UNLOCK(&prng->fortuna.prng_lock); - *outlen = 32*FORTUNA_POOLS; + *outlen = 32*LTC_FORTUNA_POOLS; return CRYPT_BUFFER_OVERFLOW; } @@ -340,7 +340,7 @@ int fortuna_export(unsigned char *out, unsigned long *outlen, prng_state *prng) /* to emit the state we copy each pool, terminate it then hash it again so * an attacker who sees the state can't determine the current state of the PRNG */ - for (x = 0; x < FORTUNA_POOLS; x++) { + for (x = 0; x < LTC_FORTUNA_POOLS; x++) { /* copy the PRNG */ XMEMCPY(md, &(prng->fortuna.pool[x]), sizeof(*md)); @@ -360,7 +360,7 @@ int fortuna_export(unsigned char *out, unsigned long *outlen, prng_state *prng) goto LBL_ERR; } } - *outlen = 32*FORTUNA_POOLS; + *outlen = 32*LTC_FORTUNA_POOLS; err = CRYPT_OK; LBL_ERR: @@ -386,14 +386,14 @@ int fortuna_import(const unsigned char *in, unsigned long inlen, prng_state *prn LTC_ARGCHK(in != NULL); LTC_ARGCHK(prng != NULL); - if (inlen != 32*FORTUNA_POOLS) { + if (inlen != 32*LTC_FORTUNA_POOLS) { return CRYPT_INVALID_ARG; } if ((err = fortuna_start(prng)) != CRYPT_OK) { return err; } - for (x = 0; x < FORTUNA_POOLS; x++) { + for (x = 0; x < LTC_FORTUNA_POOLS; x++) { if ((err = fortuna_add_entropy(in+x*32, 32, prng)) != CRYPT_OK) { return err; } @@ -422,6 +422,6 @@ int fortuna_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/prngs/fortuna.c,v $ */ -/* $Revision: 1.12 $ */ -/* $Date: 2006/12/04 21:34:03 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/prngs/rc4.c b/libtomcrypt/src/prngs/rc4.c index cf118ad..15c74e3 100644 --- a/libtomcrypt/src/prngs/rc4.c +++ b/libtomcrypt/src/prngs/rc4.c @@ -6,16 +6,16 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" /** @file rc4.c - RC4 PRNG, Tom St Denis + LTC_RC4 PRNG, Tom St Denis */ -#ifdef RC4 +#ifdef LTC_RC4 const struct ltc_prng_descriptor rc4_desc = { @@ -93,7 +93,7 @@ int rc4_ready(prng_state *prng) XMEMCPY(key, s, 256); keylen = prng->rc4.x; - /* make RC4 perm and shuffle */ + /* make LTC_RC4 perm and shuffle */ for (x = 0; x < 256; x++) { s[x] = x; } @@ -250,7 +250,7 @@ int rc4_test(void) if (XMEMCMP(dst, tests[x].ct, 8)) { #if 0 int y; - printf("\n\nRC4 failed, I got:\n"); + printf("\n\nLTC_RC4 failed, I got:\n"); for (y = 0; y < 8; y++) printf("%02x ", dst[y]); printf("\n"); #endif @@ -264,6 +264,6 @@ int rc4_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/prngs/rc4.c,v $ */ -/* $Revision: 1.9 $ */ -/* $Date: 2006/11/16 00:32:18 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/prngs/rng_get_bytes.c b/libtomcrypt/src/prngs/rng_get_bytes.c index 7d332b5..b8cc6f5 100644 --- a/libtomcrypt/src/prngs/rng_get_bytes.c +++ b/libtomcrypt/src/prngs/rng_get_bytes.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ portable way to get secure random bits to feed a PRNG (Tom St Denis) */ -#ifdef DEVRANDOM +#ifdef LTC_DEVRANDOM /* on *NIX read /dev/random */ static unsigned long rng_nix(unsigned char *buf, unsigned long len, void (*callback)(void)) @@ -47,7 +47,7 @@ static unsigned long rng_nix(unsigned char *buf, unsigned long len, #endif /* LTC_NO_FILE */ } -#endif /* DEVRANDOM */ +#endif /* LTC_DEVRANDOM */ /* on ANSI C platforms with 100 < CLOCKS_PER_SEC < 10000 */ #if defined(CLOCKS_PER_SEC) && !defined(WINCE) @@ -131,7 +131,7 @@ unsigned long rng_get_bytes(unsigned char *out, unsigned long outlen, LTC_ARGCHK(out != NULL); -#if defined(DEVRANDOM) +#if defined(LTC_DEVRANDOM) x = rng_nix(out, outlen, callback); if (x != 0) { return x; } #endif #ifdef WIN32 @@ -143,6 +143,6 @@ unsigned long rng_get_bytes(unsigned char *out, unsigned long outlen, return 0; } -/* $Source: /cvs/libtom/libtomcrypt/src/prngs/rng_get_bytes.c,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2006/12/06 02:01:29 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/prngs/rng_make_prng.c b/libtomcrypt/src/prngs/rng_make_prng.c index 35631ab..6ba2cbe 100644 --- a/libtomcrypt/src/prngs/rng_make_prng.c +++ b/libtomcrypt/src/prngs/rng_make_prng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -64,6 +64,6 @@ int rng_make_prng(int bits, int wprng, prng_state *prng, } -/* $Source: /cvs/libtom/libtomcrypt/src/prngs/rng_make_prng.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/prngs/sober128.c b/libtomcrypt/src/prngs/sober128.c index 0361387..9bc7727 100644 --- a/libtomcrypt/src/prngs/sober128.c +++ b/libtomcrypt/src/prngs/sober128.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -16,7 +16,7 @@ Based on s128fast.c reference code supplied by Greg Rose of QUALCOMM. */ -#ifdef SOBER128 +#ifdef LTC_SOBER128 #include "sober128tab.c" @@ -481,7 +481,7 @@ int sober128_test(void) sober128_done(&prng); if (XMEMCMP(dst, tests[x].out, tests[x].len)) { #if 0 - printf("\n\nSOBER128 failed, I got:\n"); + printf("\n\nLTC_SOBER128 failed, I got:\n"); for (y = 0; y < tests[x].len; y++) printf("%02x ", dst[y]); printf("\n"); #endif @@ -495,6 +495,6 @@ int sober128_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/prngs/sober128.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2006/11/05 00:11:36 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/prngs/sober128tab.c b/libtomcrypt/src/prngs/sober128tab.c index b50c77b..a5754c7 100644 --- a/libtomcrypt/src/prngs/sober128tab.c +++ b/libtomcrypt/src/prngs/sober128tab.c @@ -2,7 +2,7 @@ @file sober128tab.c SOBER-128 Tables */ -/* $Id: sober128tab.c,v 1.2 2005/05/05 14:35:59 tom Exp $ */ +/* $ID$ */ /* @(#)TuringMultab.h 1.3 (QUALCOMM) 02/09/03 */ /* Multiplication table for Turing using 0xD02B4367 */ static const ulong32 Multab[256] = { @@ -72,7 +72,7 @@ static const ulong32 Multab[256] = { 0xEF72A3F1, 0x3F59E096, 0x0224253F, 0xD20F6658, }; -/* $Id: sober128tab.c,v 1.2 2005/05/05 14:35:59 tom Exp $ */ +/* $ID$ */ /* Sbox for SOBER-128 */ /* * This is really the combination of two SBoxes; the least significant @@ -157,6 +157,6 @@ static const ulong32 Sbox[256] = { 0xf9e6053f, 0xa4b0d300, 0xd499cbcc, 0xb95e3d40, }; -/* $Source: /cvs/libtom/libtomcrypt/src/prngs/sober128tab.c,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2005/05/05 14:35:59 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/prngs/sprng.c b/libtomcrypt/src/prngs/sprng.c index 190e33d..d86b081 100644 --- a/libtomcrypt/src/prngs/sprng.c +++ b/libtomcrypt/src/prngs/sprng.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -20,7 +20,7 @@ * in the various other functions. */ -#ifdef SPRNG +#ifdef LTC_SPRNG const struct ltc_prng_descriptor sprng_desc = { @@ -131,6 +131,6 @@ int sprng_test(void) -/* $Source: /cvs/libtom/libtomcrypt/src/prngs/sprng.c,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/03/31 14:15:35 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ diff --git a/libtomcrypt/src/prngs/yarrow.c b/libtomcrypt/src/prngs/yarrow.c index 9fbd4f6..c94671f 100644 --- a/libtomcrypt/src/prngs/yarrow.c +++ b/libtomcrypt/src/prngs/yarrow.c @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com + * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" @@ -15,7 +15,7 @@ Yarrow PRNG, Tom St Denis */ -#ifdef YARROW +#ifdef LTC_YARROW const struct ltc_prng_descriptor yarrow_desc = { @@ -42,77 +42,77 @@ int yarrow_start(prng_state *prng) LTC_ARGCHK(prng != NULL); /* these are the default hash/cipher combo used */ -#ifdef RIJNDAEL -#if YARROW_AES==0 +#ifdef LTC_RIJNDAEL +#if LTC_YARROW_AES==0 prng->yarrow.cipher = register_cipher(&rijndael_enc_desc); -#elif YARROW_AES==1 +#elif LTC_YARROW_AES==1 prng->yarrow.cipher = register_cipher(&aes_enc_desc); -#elif YARROW_AES==2 +#elif LTC_YARROW_AES==2 prng->yarrow.cipher = register_cipher(&rijndael_desc); -#elif YARROW_AES==3 +#elif LTC_YARROW_AES==3 prng->yarrow.cipher = register_cipher(&aes_desc); #endif -#elif defined(BLOWFISH) +#elif defined(LTC_BLOWFISH) prng->yarrow.cipher = register_cipher(&blowfish_desc); -#elif defined(TWOFISH) +#elif defined(LTC_TWOFISH) prng->yarrow.cipher = register_cipher(&twofish_desc); -#elif defined(RC6) +#elif defined(LTC_RC6) prng->yarrow.cipher = register_cipher(&rc6_desc); -#elif defined(RC5) +#elif defined(LTC_RC5) prng->yarrow.cipher = register_cipher(&rc5_desc); -#elif defined(SAFERP) +#elif defined(LTC_SAFERP) prng->yarrow.cipher = register_cipher(&saferp_desc); -#elif defined(RC2) +#elif defined(LTC_RC2) prng->yarrow.cipher = register_cipher(&rc2_desc); -#elif defined(NOEKEON) +#elif defined(LTC_NOEKEON) prng->yarrow.cipher = register_cipher(&noekeon_desc); -#elif defined(ANUBIS) +#elif defined(LTC_ANUBIS) prng->yarrow.cipher = register_cipher(&anubis_desc); -#elif defined(KSEED) +#elif defined(LTC_KSEED) prng->yarrow.cipher = register_cipher(&kseed_desc); -#elif defined(KHAZAD) +#elif defined(LTC_KHAZAD) prng->yarrow.cipher = register_cipher(&khazad_desc); -#elif defined(CAST5) +#elif defined(LTC_CAST5) prng->yarrow.cipher = register_cipher(&cast5_desc); -#elif defined(XTEA) +#elif defined(LTC_XTEA) prng->yarrow.cipher = register_cipher(&xtea_desc); -#elif defined(SAFER) +#elif defined(LTC_SAFER) prng->yarrow.cipher = register_cipher(&safer_sk128_desc); -#elif defined(DES) +#elif defined(LTC_DES) prng->yarrow.cipher = register_cipher(&des3_desc); #else - #error YARROW needs at least one CIPHER + #error LTC_YARROW needs at least one CIPHER #endif if ((err = cipher_is_valid(prng->yarrow.cipher)) != CRYPT_OK) { return err; } -#ifdef SHA256 +#ifdef LTC_SHA256 prng->yarrow.hash = register_hash(&sha256_desc); -#elif defined(SHA512) +#elif defined(LTC_SHA512) prng->yarrow.hash = register_hash(&sha512_desc); -#elif defined(TIGER) +#elif defined(LTC_TIGER) prng->yarrow.hash = register_hash(&tiger_desc); -#elif defined(SHA1) +#elif defined(LTC_SHA1) prng->yarrow.hash = register_hash(&sha1_desc); -#elif defined(RIPEMD320) +#elif defined(LTC_RIPEMD320) prng->yarrow.hash = register_hash(&rmd320_desc); -#elif defined(RIPEMD256) +#elif defined(LTC_RIPEMD256) prng->yarrow.hash = register_hash(&rmd256_desc); -#elif defined(RIPEMD160) +#elif defined(LTC_RIPEMD160) prng->yarrow.hash = register_hash(&rmd160_desc); -#elif defined(RIPEMD128) +#elif defined(LTC_RIPEMD128) prng->yarrow.hash = register_hash(&rmd128_desc); -#elif defined(MD5) +#elif defined(LTC_MD5) prng->yarrow.hash = register_hash(&md5_desc); -#elif defined(MD4) +#elif defined(LTC_MD4) prng->yarrow.hash = register_hash(&md4_desc); -#elif defined(MD2) +#elif defined(LTC_MD2) prng->yarrow.hash = register_hash(&md2_desc); -#elif defined(WHIRLPOOL) +#elif defined(LTC_WHIRLPOOL) prng->yarrow.hash = register_hash(&whirlpool_desc); #else - #error YARROW needs at least one HASH + #error LTC_YARROW needs at least one HASH #endif if ((err = hash_is_valid(prng->yarrow.hash)) != CRYPT_OK) { return err; @@ -357,6 +357,6 @@ int yarrow_test(void) #endif -/* $Source: /cvs/libtom/libtomcrypt/src/prngs/yarrow.c,v $ */ -/* $Revision: 1.10 $ */ -/* $Date: 2006/11/14 04:21:17 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */ |