added libtomcrypt-1.03

This commit is contained in:
Tom St Denis
2005-06-09 00:08:13 +00:00
committed by Steffen Jaeckel
parent 65c1317eee
commit 3964a6523a
285 changed files with 5920 additions and 2287 deletions
+4
View File
@@ -89,3 +89,7 @@ int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -36,3 +36,7 @@ int cbc_done(symmetric_CBC *cbc)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -90,3 +90,7 @@ int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -39,3 +39,7 @@ int cbc_getiv(unsigned char *IV, unsigned long *len, symmetric_CBC *cbc)
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -38,3 +38,7 @@ int cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -56,3 +56,7 @@ int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key,
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -59,3 +59,7 @@ int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -36,3 +36,7 @@ int cfb_done(symmetric_CFB *cfb)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -57,3 +57,7 @@ int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -39,3 +39,7 @@ int cfb_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb)
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -47,3 +47,7 @@ int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -61,3 +61,7 @@ int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key,
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -36,3 +36,7 @@ int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -36,3 +36,7 @@ int ctr_done(symmetric_CTR *ctr)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+5 -1
View File
@@ -60,7 +60,7 @@ int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
/* is the pad empty? */
if (ctr->padlen == ctr->blocklen) {
/* increment counter */
if (ctr->mode == 0) {
if (ctr->mode == CTR_COUNTER_LITTLE_ENDIAN) {
/* little-endian */
for (x = 0; x < ctr->blocklen; x++) {
ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255;
@@ -102,3 +102,7 @@ int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -39,3 +39,7 @@ int ctr_getiv(unsigned char *IV, unsigned long *len, symmetric_CTR *ctr)
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -52,3 +52,7 @@ int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+14 -6
View File
@@ -21,19 +21,23 @@
/**
Initialize a CTR context
@param cipher The index of the cipher desired
@param count The initial vector
@param IV The initial vector
@param key The secret key
@param keylen The length of the secret key (octets)
@param num_rounds Number of rounds in the cipher desired (0 for default)
@param ctr_mode The counter mode (CTR_COUNTER_LITTLE_ENDIAN or CTR_COUNTER_BIG_ENDIAN)
@param ctr The CTR state to initialize
@return CRYPT_OK if successful
*/
int ctr_start(int cipher, const unsigned char *count, const unsigned char *key, int keylen,
int num_rounds, symmetric_CTR *ctr)
int ctr_start( int cipher,
const unsigned char *IV,
const unsigned char *key, int keylen,
int num_rounds, int ctr_mode,
symmetric_CTR *ctr)
{
int x, err;
LTC_ARGCHK(count != NULL);
LTC_ARGCHK(IV != NULL);
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(ctr != NULL);
@@ -51,12 +55,16 @@ int ctr_start(int cipher, const unsigned char *count, const unsigned char *key,
ctr->blocklen = cipher_descriptor[cipher].block_length;
ctr->cipher = cipher;
ctr->padlen = 0;
ctr->mode = 0;
ctr->mode = ctr_mode;
for (x = 0; x < ctr->blocklen; x++) {
ctr->ctr[x] = count[x];
ctr->ctr[x] = IV[x];
}
cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key);
return CRYPT_OK;
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -53,3 +53,7 @@ int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+5 -1
View File
@@ -18,7 +18,7 @@
#ifdef ECB
/** Terminate the chain
@param rcb The ECB chain to terminate
@param ecb The ECB chain to terminate
@return CRYPT_OK on success
*/
int ecb_done(symmetric_ECB *ecb)
@@ -36,3 +36,7 @@ int ecb_done(symmetric_ECB *ecb)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -53,3 +53,7 @@ int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -42,3 +42,7 @@ int ecb_start(int cipher, const unsigned char *key, int keylen, int num_rounds,
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -37,3 +37,7 @@ int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -36,3 +36,7 @@ int ofb_done(symmetric_OFB *ofb)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -52,3 +52,7 @@ int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -39,3 +39,7 @@ int ofb_getiv(unsigned char *IV, unsigned long *len, symmetric_OFB *ofb)
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -47,3 +47,7 @@ int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb)
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */
+4
View File
@@ -54,3 +54,7 @@ int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key,
}
#endif
/* $Source$ */
/* $Revision$ */
/* $Date$ */