diff options
Diffstat (limited to 'libtomcrypt/src/headers')
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt.h | 10 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_argchk.h | 6 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_cfg.h | 6 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_cipher.h | 186 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_custom.h | 43 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_hash.h | 96 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_mac.h | 43 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_macros.h | 6 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_math.h | 10 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_misc.h | 10 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_pk.h | 54 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_pkcs.h | 30 | ||||
-rw-r--r-- | libtomcrypt/src/headers/tomcrypt_prng.h | 34 |
13 files changed, 303 insertions, 231 deletions
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$ */ |