1 // SPDX-License-Identifier: BSD-2-Clause
2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 *
4 * LibTomCrypt is a library that provides various cryptographic
5 * algorithms in a highly modular and flexible manner.
6 *
7 * The library is free for all purposes without any express
8 * guarantee it works.
9 */
10 #include "tomcrypt_private.h"
11
12 /**
13 @file ctr_decrypt.c
14 CTR implementation, decrypt data, Tom St Denis
15 */
16
17 #ifdef LTC_CTR_MODE
18
19 /**
20 CTR decrypt
21 @param ct Ciphertext
22 @param pt [out] Plaintext
23 @param len Length of ciphertext (octets)
24 @param ctr CTR state
25 @return CRYPT_OK if successful
26 */
ctr_decrypt(const unsigned char * ct,unsigned char * pt,unsigned long len,symmetric_CTR * ctr)27 int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CTR *ctr)
28 {
29 LTC_ARGCHK(pt != NULL);
30 LTC_ARGCHK(ct != NULL);
31 LTC_ARGCHK(ctr != NULL);
32
33 return ctr_encrypt(ct, pt, len, ctr);
34 }
35
36 #endif
37
38
39 /* ref: $Format:%D$ */
40 /* git commit: $Format:%H$ */
41 /* commit time: $Format:%ai$ */
42