1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
6 * The library is free for all purposes without any express
13 OFB implementation, set IV, Tom St Denis
19 Set an initialization vector
20 @param IV The initialization vector
21 @param len The length of the vector (in octets)
22 @param ofb The OFB state
23 @return CRYPT_OK if successful
25 int ofb_setiv(const unsigned char *IV, unsigned long len, symmetric_OFB *ofb)
29 LTC_ARGCHK(IV != NULL);
30 LTC_ARGCHK(ofb != NULL);
32 if ((err = cipher_is_valid(ofb->cipher)) != CRYPT_OK) {
36 if (len != (unsigned long)ofb->blocklen) {
37 return CRYPT_INVALID_ARG;
40 /* force next block */
42 return cipher_descriptor[ofb->cipher].ecb_encrypt(IV, ofb->IV, &ofb->key);
48 /* ref: $Format:%D$ */
49 /* git commit: $Format:%H$ */
50 /* commit time: $Format:%ai$ */