]> pd.if.org Git - zpackage/blob - libtomcrypt/src/modes/lrw/lrw_getiv.c
remove gmp math descriptor
[zpackage] / libtomcrypt / src / modes / lrw / lrw_getiv.c
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
2  *
3  * LibTomCrypt is a library that provides various cryptographic
4  * algorithms in a highly modular and flexible manner.
5  *
6  * The library is free for all purposes without any express
7  * guarantee it works.
8  */
9 #include "tomcrypt.h"
10
11 /**
12    @file lrw_getiv.c
13    LRW_MODE implementation, Retrieve the current IV, Tom St Denis
14 */
15
16 #ifdef LTC_LRW_MODE
17
18 /**
19   Get the IV for LRW
20   @param IV      [out] The IV, must be 16 octets
21   @param len     Length ... must be at least 16 :-)
22   @param lrw     The LRW state to read
23   @return CRYPT_OK if successful
24 */
25 int lrw_getiv(unsigned char *IV, unsigned long *len, symmetric_LRW *lrw)
26 {
27    LTC_ARGCHK(IV != NULL);
28    LTC_ARGCHK(len != NULL);
29    LTC_ARGCHK(lrw != NULL);
30    if (*len < 16) {
31        *len = 16;
32        return CRYPT_BUFFER_OVERFLOW;
33    }
34
35    XMEMCPY(IV, lrw->IV, 16);
36    *len = 16;
37    return CRYPT_OK;
38 }
39
40 #endif
41 /* ref:         $Format:%D$ */
42 /* git commit:  $Format:%H$ */
43 /* commit time: $Format:%ai$ */