added libtomcrypt-1.14
This commit is contained in:
committed by
Steffen Jaeckel
parent
1eed98f629
commit
479cc9c261
@@ -16,8 +16,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* version */
|
||||
#define CRYPT 0x0113
|
||||
#define SCRYPT "1.13"
|
||||
#define CRYPT 0x0114
|
||||
#define SCRYPT "1.14"
|
||||
|
||||
/* max size of either a cipher/hash block or symmetric key [largest of the two] */
|
||||
#define MAXBLOCKSIZE 128
|
||||
|
||||
@@ -27,8 +27,8 @@ void crypt_argchk(char *v, char *s, int d);
|
||||
|
||||
#elif ARGTYPE == 4
|
||||
|
||||
#define LTC_ARGCHK(x) return CRYPT_INVALID_ARG;
|
||||
#define LTC_ARGCHKVD(x) return;
|
||||
#define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG;
|
||||
#define LTC_ARGCHKVD(x) if (!(x)) return;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ typedef union Symmetric_key {
|
||||
void *data;
|
||||
} symmetric_key;
|
||||
|
||||
#ifdef ECB
|
||||
#ifdef LTC_ECB_MODE
|
||||
/** A block cipher ECB structure */
|
||||
typedef struct {
|
||||
/** The index of the cipher chosen */
|
||||
@@ -179,7 +179,7 @@ typedef struct {
|
||||
} symmetric_ECB;
|
||||
#endif
|
||||
|
||||
#ifdef CFB
|
||||
#ifdef LTC_CFB_MODE
|
||||
/** A block cipher CFB structure */
|
||||
typedef struct {
|
||||
/** The index of the cipher chosen */
|
||||
@@ -197,7 +197,7 @@ typedef struct {
|
||||
} symmetric_CFB;
|
||||
#endif
|
||||
|
||||
#ifdef OFB
|
||||
#ifdef LTC_OFB_MODE
|
||||
/** A block cipher OFB structure */
|
||||
typedef struct {
|
||||
/** The index of the cipher chosen */
|
||||
@@ -213,7 +213,7 @@ typedef struct {
|
||||
} symmetric_OFB;
|
||||
#endif
|
||||
|
||||
#ifdef CBC
|
||||
#ifdef LTC_CBC_MODE
|
||||
/** A block cipher CBC structure */
|
||||
typedef struct {
|
||||
/** The index of the cipher chosen */
|
||||
@@ -228,7 +228,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CTR
|
||||
#ifdef LTC_CTR_MODE
|
||||
/** A block cipher CTR structure */
|
||||
typedef struct {
|
||||
/** The index of the cipher chosen */
|
||||
@@ -249,7 +249,7 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LRW_MODE
|
||||
#ifdef LTC_LRW_MODE
|
||||
/** A LRW structure */
|
||||
typedef struct {
|
||||
/** The index of the cipher chosen (must be a 128-bit block cipher) */
|
||||
@@ -649,7 +649,7 @@ int anubis_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor anubis_desc;
|
||||
#endif
|
||||
|
||||
#ifdef ECB
|
||||
#ifdef LTC_ECB_MODE
|
||||
int ecb_start(int cipher, const unsigned char *key,
|
||||
int keylen, int num_rounds, symmetric_ECB *ecb);
|
||||
int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_ECB *ecb);
|
||||
@@ -657,7 +657,7 @@ int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
|
||||
int ecb_done(symmetric_ECB *ecb);
|
||||
#endif
|
||||
|
||||
#ifdef CFB
|
||||
#ifdef LTC_CFB_MODE
|
||||
int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key,
|
||||
int keylen, int num_rounds, symmetric_CFB *cfb);
|
||||
int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CFB *cfb);
|
||||
@@ -667,7 +667,7 @@ int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb);
|
||||
int cfb_done(symmetric_CFB *cfb);
|
||||
#endif
|
||||
|
||||
#ifdef OFB
|
||||
#ifdef LTC_OFB_MODE
|
||||
int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key,
|
||||
int keylen, int num_rounds, symmetric_OFB *ofb);
|
||||
int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_OFB *ofb);
|
||||
@@ -677,7 +677,7 @@ int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb);
|
||||
int ofb_done(symmetric_OFB *ofb);
|
||||
#endif
|
||||
|
||||
#ifdef CBC
|
||||
#ifdef LTC_CBC_MODE
|
||||
int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key,
|
||||
int keylen, int num_rounds, symmetric_CBC *cbc);
|
||||
int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CBC *cbc);
|
||||
@@ -687,7 +687,7 @@ int cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc);
|
||||
int cbc_done(symmetric_CBC *cbc);
|
||||
#endif
|
||||
|
||||
#ifdef CTR
|
||||
#ifdef LTC_CTR_MODE
|
||||
|
||||
#define CTR_COUNTER_LITTLE_ENDIAN 0
|
||||
#define CTR_COUNTER_BIG_ENDIAN 1
|
||||
@@ -704,7 +704,7 @@ int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr);
|
||||
int ctr_done(symmetric_CTR *ctr);
|
||||
#endif
|
||||
|
||||
#ifdef LRW_MODE
|
||||
#ifdef LTC_LRW_MODE
|
||||
|
||||
#define LRW_ENCRYPT 0
|
||||
#define LRW_DECRYPT 1
|
||||
@@ -736,6 +736,7 @@ int f8_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, sy
|
||||
int f8_getiv(unsigned char *IV, unsigned long *len, symmetric_F8 *f8);
|
||||
int f8_setiv(const unsigned char *IV, unsigned long len, symmetric_F8 *f8);
|
||||
int f8_done(symmetric_F8 *f8);
|
||||
int f8_test_mode(void);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
#define CAST5
|
||||
|
||||
#define LTC_NO_MODES
|
||||
#define ECB
|
||||
#define CBC
|
||||
#define CTR
|
||||
#define LTC_ECB_MODE
|
||||
#define LTC_CBC_MODE
|
||||
#define LTC_CTR_MODE
|
||||
|
||||
#define LTC_NO_HASHES
|
||||
#define SHA1
|
||||
@@ -55,7 +55,6 @@
|
||||
#define SHA384
|
||||
#define SHA256
|
||||
#define SHA224
|
||||
#define WHIRLPOOL
|
||||
|
||||
#define LTC_NO_MACS
|
||||
#define HMAC
|
||||
@@ -72,8 +71,6 @@
|
||||
#define MRSA
|
||||
#define MECC
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Use small code where possible */
|
||||
/* #define LTC_SMALL_CODE */
|
||||
@@ -134,17 +131,17 @@
|
||||
/* ---> Block Cipher Modes of Operation <--- */
|
||||
#ifndef LTC_NO_MODES
|
||||
|
||||
#define CFB
|
||||
#define OFB
|
||||
#define ECB
|
||||
#define CBC
|
||||
#define CTR
|
||||
#define LTC_CFB_MODE
|
||||
#define LTC_OFB_MODE
|
||||
#define LTC_ECB_MODE
|
||||
#define LTC_CBC_MODE
|
||||
#define LTC_CTR_MODE
|
||||
|
||||
/* F8 chaining mode */
|
||||
#define LTC_F8_MODE
|
||||
|
||||
/* LRW mode */
|
||||
#define LRW_MODE
|
||||
#define LTC_LRW_MODE
|
||||
#ifndef LTC_NO_TABLES
|
||||
/* like GCM mode this will enable 16 8x128 tables [64KB] that make
|
||||
* seeking very fast.
|
||||
@@ -188,7 +185,7 @@
|
||||
/* ---> Encrypt + Authenticate Modes <--- */
|
||||
|
||||
#define EAX_MODE
|
||||
#if defined(EAX_MODE) && !(defined(CTR) && defined(OMAC))
|
||||
#if defined(EAX_MODE) && !(defined(LTC_CTR_MODE) && defined(OMAC))
|
||||
#error EAX_MODE requires CTR and OMAC mode
|
||||
#endif
|
||||
|
||||
@@ -201,6 +198,11 @@
|
||||
#define GCM_TABLES
|
||||
#endif
|
||||
|
||||
/* USE SSE2? requires GCC works on x86_32 and x86_64*/
|
||||
#ifdef GCM_TABLES
|
||||
/* #define GCM_TABLES_SSE2 */
|
||||
#endif
|
||||
|
||||
#endif /* LTC_NO_MACS */
|
||||
|
||||
/* Various tidbits of modern neatoness */
|
||||
@@ -215,8 +217,8 @@
|
||||
/* 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full] */
|
||||
#define YARROW_AES 0
|
||||
|
||||
#if defined(YARROW) && !defined(CTR)
|
||||
#error YARROW requires CTR chaining mode to be defined!
|
||||
#if defined(YARROW) && !defined(LTC_CTR_MODE)
|
||||
#error YARROW requires LTC_CTR_MODE chaining mode to be defined!
|
||||
#endif
|
||||
|
||||
/* a PRNG that simply reads from an available system source */
|
||||
|
||||
@@ -98,7 +98,7 @@ void pmac_shift_xor(pmac_state *pmac);
|
||||
|
||||
#ifdef EAX_MODE
|
||||
|
||||
#if !(defined(OMAC) && defined(CTR))
|
||||
#if !(defined(OMAC) && defined(LTC_CTR_MODE))
|
||||
#error EAX_MODE requires OMAC and CTR
|
||||
#endif
|
||||
|
||||
@@ -248,9 +248,12 @@ typedef struct {
|
||||
pttotlen; /* 64-bit counter for the PT */
|
||||
|
||||
#ifdef GCM_TABLES
|
||||
unsigned char PC[16][256][16]; /* 16 tables of 8x128 */
|
||||
unsigned char PC[16][256][16] /* 16 tables of 8x128 */
|
||||
#ifdef GCM_TABLES_SSE2
|
||||
__attribute__ ((aligned (16)))
|
||||
#endif
|
||||
;
|
||||
#endif
|
||||
|
||||
} gcm_state;
|
||||
|
||||
void gcm_mult_h(gcm_state *gcm, unsigned char *I);
|
||||
|
||||
Reference in New Issue
Block a user