1 // SPDX-License-Identifier: BSD-2-Clause 2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis 3 * 4 * LibTomCrypt is a library that provides various cryptographic 5 * algorithms in a highly modular and flexible manner. 6 * 7 * The library is free for all purposes without any express 8 * guarantee it works. 9 */ 10 #include "tomcrypt_private.h" 11 12 /** 13 @file ofb_getiv.c 14 F8 implementation, get IV, Tom St Denis 15 */ 16 17 #ifdef LTC_F8_MODE 18 19 /** 20 Get the current initialization vector 21 @param IV [out] The destination of the initialization vector 22 @param len [in/out] The max size and resulting size of the initialization vector 23 @param f8 The F8 state 24 @return CRYPT_OK if successful 25 */ f8_getiv(unsigned char * IV,unsigned long * len,const symmetric_F8 * f8)26int f8_getiv(unsigned char *IV, unsigned long *len, const symmetric_F8 *f8) 27 { 28 LTC_ARGCHK(IV != NULL); 29 LTC_ARGCHK(len != NULL); 30 LTC_ARGCHK(f8 != NULL); 31 if ((unsigned long)f8->blocklen > *len) { 32 *len = f8->blocklen; 33 return CRYPT_BUFFER_OVERFLOW; 34 } 35 XMEMCPY(IV, f8->IV, f8->blocklen); 36 *len = f8->blocklen; 37 38 return CRYPT_OK; 39 } 40 41 #endif 42 43 /* ref: $Format:%D$ */ 44 /* git commit: $Format:%H$ */ 45 /* commit time: $Format:%ai$ */ 46