1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
6 * The library is free for all purposes without any express
13 CTR implementation, get IV, Tom St Denis
19 Get the current initialization vector
20 @param IV [out] The destination of the initialization vector
21 @param len [in/out] The max size and resulting size of the initialization vector
22 @param ctr The CTR state
23 @return CRYPT_OK if successful
25 int ctr_getiv(unsigned char *IV, unsigned long *len, symmetric_CTR *ctr)
27 LTC_ARGCHK(IV != NULL);
28 LTC_ARGCHK(len != NULL);
29 LTC_ARGCHK(ctr != NULL);
30 if ((unsigned long)ctr->blocklen > *len) {
32 return CRYPT_BUFFER_OVERFLOW;
34 XMEMCPY(IV, ctr->ctr, ctr->blocklen);
42 /* ref: $Format:%D$ */
43 /* git commit: $Format:%H$ */
44 /* commit time: $Format:%ai$ */