Path: blob/master/libs/tomcrypt/src/modes/cfb/cfb_getiv.c
5972 views
/* LibTomCrypt, modular cryptographic library -- Tom St Denis1*2* LibTomCrypt is a library that provides various cryptographic3* algorithms in a highly modular and flexible manner.4*5* The library is free for all purposes without any express6* guarantee it works.7*/8#include "tomcrypt.h"910/**11@file cfb_getiv.c12CFB implementation, get IV, Tom St Denis13*/1415#ifdef LTC_CFB_MODE1617/**18Get the current initialization vector19@param IV [out] The destination of the initialization vector20@param len [in/out] The max size and resulting size of the initialization vector21@param cfb The CFB state22@return CRYPT_OK if successful23*/24int cfb_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb)25{26LTC_ARGCHK(IV != NULL);27LTC_ARGCHK(len != NULL);28LTC_ARGCHK(cfb != NULL);29if ((unsigned long)cfb->blocklen > *len) {30*len = cfb->blocklen;31return CRYPT_BUFFER_OVERFLOW;32}33XMEMCPY(IV, cfb->IV, cfb->blocklen);34*len = cfb->blocklen;3536return CRYPT_OK;37}3839#endif404142