2004-01-25 17:40:34 +00:00
|
|
|
/* 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
|
2004-05-12 20:42:16 +00:00
|
|
|
* guarantee it works.
|
2004-01-25 17:40:34 +00:00
|
|
|
*
|
2005-04-17 11:37:13 +00:00
|
|
|
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.org
|
2004-01-25 17:40:34 +00:00
|
|
|
*/
|
2004-12-30 23:55:53 +00:00
|
|
|
#include "tomcrypt.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
@file ctr_decrypt.c
|
|
|
|
CTR implementation, decrypt data, Tom St Denis
|
|
|
|
*/
|
2003-03-03 00:59:24 +00:00
|
|
|
|
2004-05-12 20:42:16 +00:00
|
|
|
#ifdef CTR
|
2003-03-03 00:59:24 +00:00
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/**
|
|
|
|
CTR decrypt
|
|
|
|
@param ct Ciphertext
|
|
|
|
@param pt [out] Plaintext
|
|
|
|
@param len Length of ciphertext (octets)
|
|
|
|
@param ctr CTR state
|
|
|
|
@return CRYPT_OK if successful
|
|
|
|
*/
|
2004-05-12 20:42:16 +00:00
|
|
|
int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CTR *ctr)
|
2003-03-03 00:59:24 +00:00
|
|
|
{
|
2004-12-30 23:55:53 +00:00
|
|
|
LTC_ARGCHK(pt != NULL);
|
|
|
|
LTC_ARGCHK(ct != NULL);
|
|
|
|
LTC_ARGCHK(ctr != NULL);
|
2004-05-12 20:42:16 +00:00
|
|
|
|
|
|
|
return ctr_encrypt(ct, pt, len, ctr);
|
2003-03-03 00:59:24 +00:00
|
|
|
}
|
|
|
|
|
2004-05-12 20:42:16 +00:00
|
|
|
#endif
|
2003-03-03 00:59:24 +00:00
|
|
|
|