added libtomcrypt-1.03
This commit is contained in:
committed by
Steffen Jaeckel
parent
65c1317eee
commit
3964a6523a
@@ -89,3 +89,7 @@ int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -36,3 +36,7 @@ int cbc_done(symmetric_CBC *cbc)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -90,3 +90,7 @@ int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -39,3 +39,7 @@ int cbc_getiv(unsigned char *IV, unsigned long *len, symmetric_CBC *cbc)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -38,3 +38,7 @@ int cbc_setiv(const unsigned char *IV, unsigned long len, symmetric_CBC *cbc)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -56,3 +56,7 @@ int cbc_start(int cipher, const unsigned char *IV, const unsigned char *key,
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -59,3 +59,7 @@ int cfb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -36,3 +36,7 @@ int cfb_done(symmetric_CFB *cfb)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -57,3 +57,7 @@ int cfb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -39,3 +39,7 @@ int cfb_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -47,3 +47,7 @@ int cfb_setiv(const unsigned char *IV, unsigned long len, symmetric_CFB *cfb)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -61,3 +61,7 @@ int cfb_start(int cipher, const unsigned char *IV, const unsigned char *key,
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -36,3 +36,7 @@ int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -36,3 +36,7 @@ int ctr_done(symmetric_CTR *ctr)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -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$ */
|
||||
|
||||
@@ -39,3 +39,7 @@ int ctr_getiv(unsigned char *IV, unsigned long *len, symmetric_CTR *ctr)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -52,3 +52,7 @@ int ctr_setiv(const unsigned char *IV, unsigned long len, symmetric_CTR *ctr)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -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$ */
|
||||
|
||||
@@ -53,3 +53,7 @@ int ecb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -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$ */
|
||||
|
||||
@@ -53,3 +53,7 @@ int ecb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -42,3 +42,7 @@ int ecb_start(int cipher, const unsigned char *key, int keylen, int num_rounds,
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -37,3 +37,7 @@ int ofb_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, s
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -36,3 +36,7 @@ int ofb_done(symmetric_OFB *ofb)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -52,3 +52,7 @@ int ofb_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, s
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -39,3 +39,7 @@ int ofb_getiv(unsigned char *IV, unsigned long *len, symmetric_OFB *ofb)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -47,3 +47,7 @@ int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -54,3 +54,7 @@ int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key,
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
Reference in New Issue
Block a user