Path: blob/master/libs/tomcrypt/src/modes/lrw/lrw_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 lrw_getiv.c12LRW_MODE implementation, Retrieve the current IV, Tom St Denis13*/1415#ifdef LTC_LRW_MODE1617/**18Get the IV for LRW19@param IV [out] The IV, must be 16 octets20@param len Length ... must be at least 16 :-)21@param lrw The LRW state to read22@return CRYPT_OK if successful23*/24int lrw_getiv(unsigned char *IV, unsigned long *len, symmetric_LRW *lrw)25{26LTC_ARGCHK(IV != NULL);27LTC_ARGCHK(len != NULL);28LTC_ARGCHK(lrw != NULL);29if (*len < 16) {30*len = 16;31return CRYPT_BUFFER_OVERFLOW;32}3334XMEMCPY(IV, lrw->IV, 16);35*len = 16;36return CRYPT_OK;37}3839#endif404142