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, start chain, Tom St Denis
20 Initialize a OFB context
21 @param cipher The index of the cipher desired
22 @param IV The initialization vector
23 @param key The secret key
24 @param keylen The length of the secret key (octets)
25 @param num_rounds Number of rounds in the cipher desired (0 for default)
26 @param ofb The OFB state to initialize
27 @return CRYPT_OK if successful
29 int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key,
30 int keylen, int num_rounds, symmetric_OFB *ofb)
34 LTC_ARGCHK(IV != NULL);
35 LTC_ARGCHK(key != NULL);
36 LTC_ARGCHK(ofb != NULL);
38 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
44 ofb->blocklen = cipher_descriptor[cipher].block_length;
45 for (x = 0; x < ofb->blocklen; x++) {
50 ofb->padlen = ofb->blocklen;
51 return cipher_descriptor[cipher].setup(key, keylen, num_rounds, &ofb->key);
56 /* ref: $Format:%D$ */
57 /* git commit: $Format:%H$ */
58 /* commit time: $Format:%ai$ */