comparison ofb_start.c @ 3:7faae8f46238 libtomcrypt-orig

Branch renaming
author Matt Johnston <matt@ucc.asn.au>
date Mon, 31 May 2004 18:25:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 3:7faae8f46238
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 * Tom St Denis, [email protected], http://libtomcrypt.org
10 */
11 #include "mycrypt.h"
12
13 #ifdef OFB
14
15 int ofb_start(int cipher, const unsigned char *IV, const unsigned char *key,
16 int keylen, int num_rounds, symmetric_OFB *ofb)
17 {
18 int x, err;
19
20 _ARGCHK(IV != NULL);
21 _ARGCHK(key != NULL);
22 _ARGCHK(ofb != NULL);
23
24 if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
25 return err;
26 }
27
28 /* copy details */
29 ofb->cipher = cipher;
30 ofb->blocklen = cipher_descriptor[cipher].block_length;
31 for (x = 0; x < ofb->blocklen; x++) {
32 ofb->IV[x] = IV[x];
33 }
34
35 /* init the cipher */
36 ofb->padlen = ofb->blocklen;
37 return cipher_descriptor[cipher].setup(key, keylen, num_rounds, &ofb->key);
38 }
39
40 #endif