Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/tomcrypt/src/modes/cfb/cfb_getiv.c
5972 views
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 cfb_getiv.c
13
CFB implementation, get IV, Tom St Denis
14
*/
15
16
#ifdef LTC_CFB_MODE
17
18
/**
19
Get the current initialization vector
20
@param IV [out] The destination of the initialization vector
21
@param len [in/out] The max size and resulting size of the initialization vector
22
@param cfb The CFB state
23
@return CRYPT_OK if successful
24
*/
25
int cfb_getiv(unsigned char *IV, unsigned long *len, symmetric_CFB *cfb)
26
{
27
LTC_ARGCHK(IV != NULL);
28
LTC_ARGCHK(len != NULL);
29
LTC_ARGCHK(cfb != NULL);
30
if ((unsigned long)cfb->blocklen > *len) {
31
*len = cfb->blocklen;
32
return CRYPT_BUFFER_OVERFLOW;
33
}
34
XMEMCPY(IV, cfb->IV, cfb->blocklen);
35
*len = cfb->blocklen;
36
37
return CRYPT_OK;
38
}
39
40
#endif
41
42