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 CBC 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 cbc The CBC state
23 @return CRYPT_OK if successful
25 int cbc_getiv(unsigned char *IV, unsigned long *len, symmetric_CBC *cbc)
27 LTC_ARGCHK(IV != NULL);
28 LTC_ARGCHK(len != NULL);
29 LTC_ARGCHK(cbc != NULL);
30 if ((unsigned long)cbc->blocklen > *len) {
32 return CRYPT_BUFFER_OVERFLOW;
34 XMEMCPY(IV, cbc->IV, cbc->blocklen);
42 /* ref: $Format:%D$ */
43 /* git commit: $Format:%H$ */
44 /* commit time: $Format:%ai$ */