Path: blob/master/libs/tomcrypt/src/modes/f8/f8_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 ofb_getiv.c12F8 implementation, get IV, Tom St Denis13*/1415#ifdef LTC_F8_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 f8 The F8 state22@return CRYPT_OK if successful23*/24int f8_getiv(unsigned char *IV, unsigned long *len, symmetric_F8 *f8)25{26LTC_ARGCHK(IV != NULL);27LTC_ARGCHK(len != NULL);28LTC_ARGCHK(f8 != NULL);29if ((unsigned long)f8->blocklen > *len) {30*len = f8->blocklen;31return CRYPT_BUFFER_OVERFLOW;32}33XMEMCPY(IV, f8->IV, f8->blocklen);34*len = f8->blocklen;3536return CRYPT_OK;37}3839#endif404142