Mercurial > dropbear
comparison libtomcrypt/src/mac/f9/f9_init.c @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | f849a5ca2efc |
children |
comparison
equal
deleted
inserted
replaced
1470:8bba51a55704 | 1471:6dba84798cd5 |
---|---|
3 * LibTomCrypt is a library that provides various cryptographic | 3 * LibTomCrypt is a library that provides various cryptographic |
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | |
9 * Tom St Denis, [email protected], http://libtom.org | |
10 */ | 8 */ |
11 #include "tomcrypt.h" | 9 #include "tomcrypt.h" |
12 | 10 |
13 /** | 11 /** |
14 @file f9_init.c | 12 @file f9_init.c |
43 #endif | 41 #endif |
44 | 42 |
45 if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &f9->key)) != CRYPT_OK) { | 43 if ((err = cipher_descriptor[cipher].setup(key, keylen, 0, &f9->key)) != CRYPT_OK) { |
46 goto done; | 44 goto done; |
47 } | 45 } |
48 | 46 |
49 /* make the second key */ | 47 /* make the second key */ |
50 for (x = 0; (unsigned)x < keylen; x++) { | 48 for (x = 0; (unsigned)x < keylen; x++) { |
51 f9->akey[x] = key[x] ^ 0xAA; | 49 f9->akey[x] = key[x] ^ 0xAA; |
52 } | 50 } |
53 | 51 |
54 /* setup struct */ | 52 /* setup struct */ |
55 zeromem(f9->IV, cipher_descriptor[cipher].block_length); | 53 zeromem(f9->IV, cipher_descriptor[cipher].block_length); |
56 zeromem(f9->ACC, cipher_descriptor[cipher].block_length); | 54 zeromem(f9->ACC, cipher_descriptor[cipher].block_length); |
57 f9->blocksize = cipher_descriptor[cipher].block_length; | 55 f9->blocksize = cipher_descriptor[cipher].block_length; |
58 f9->cipher = cipher; | 56 f9->cipher = cipher; |
62 return err; | 60 return err; |
63 } | 61 } |
64 | 62 |
65 #endif | 63 #endif |
66 | 64 |
67 /* $Source$ */ | 65 /* ref: $Format:%D$ */ |
68 /* $Revision$ */ | 66 /* git commit: $Format:%H$ */ |
69 /* $Date$ */ | 67 /* commit time: $Format:%ai$ */ |
70 | 68 |