1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 3 #include "tomcrypt_private.h" 4 5 /** 6 @file ofb_getiv.c 7 F8 implementation, get IV, Tom St Denis 8 */ 9 10 #ifdef LTC_F8_MODE 11 12 /** 13 Get the current initialization vector 14 @param IV [out] The destination of the initialization vector 15 @param len [in/out] The max size and resulting size of the initialization vector 16 @param f8 The F8 state 17 @return CRYPT_OK if successful 18 */ f8_getiv(unsigned char * IV,unsigned long * len,const symmetric_F8 * f8)19int f8_getiv(unsigned char *IV, unsigned long *len, const symmetric_F8 *f8) 20 { 21 LTC_ARGCHK(IV != NULL); 22 LTC_ARGCHK(len != NULL); 23 LTC_ARGCHK(f8 != NULL); 24 if ((unsigned long)f8->blocklen > *len) { 25 *len = f8->blocklen; 26 return CRYPT_BUFFER_OVERFLOW; 27 } 28 XMEMCPY(IV, f8->IV, f8->blocklen); 29 *len = f8->blocklen; 30 31 return CRYPT_OK; 32 } 33 34 #endif 35