Mercurial > dropbear
comparison libtomcrypt/src/ciphers/rc6.c @ 1439:8d24733026c5 coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 23:33:16 +0800 |
parents | f849a5ca2efc |
children | 6dba84798cd5 |
comparison
equal
deleted
inserted
replaced
1400:238a439670f5 | 1439:8d24733026c5 |
---|---|
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 * | 8 * |
9 * Tom St Denis, [email protected], http://libtomcrypt.com | 9 * Tom St Denis, [email protected], http://libtom.org |
10 */ | 10 */ |
11 | 11 |
12 /** | 12 /** |
13 @file rc6.c | 13 @file rc6.c |
14 RC6 code by Tom St Denis | 14 LTC_RC6 code by Tom St Denis |
15 */ | 15 */ |
16 #include "tomcrypt.h" | 16 #include "tomcrypt.h" |
17 | 17 |
18 #ifdef RC6 | 18 #ifdef LTC_RC6 |
19 | 19 |
20 const struct ltc_cipher_descriptor rc6_desc = | 20 const struct ltc_cipher_descriptor rc6_desc = |
21 { | 21 { |
22 "rc6", | 22 "rc6", |
23 3, | 23 3, |
38 0x8d14babbUL, 0x2b4c3474UL, 0xc983ae2dUL, 0x67bb27e6UL, 0x05f2a19fUL, 0xa42a1b58UL, 0x42619511UL, 0xe0990ecaUL, | 38 0x8d14babbUL, 0x2b4c3474UL, 0xc983ae2dUL, 0x67bb27e6UL, 0x05f2a19fUL, 0xa42a1b58UL, 0x42619511UL, 0xe0990ecaUL, |
39 0x7ed08883UL, 0x1d08023cUL, 0xbb3f7bf5UL, 0x5976f5aeUL, 0xf7ae6f67UL, 0x95e5e920UL, 0x341d62d9UL, 0xd254dc92UL, | 39 0x7ed08883UL, 0x1d08023cUL, 0xbb3f7bf5UL, 0x5976f5aeUL, 0xf7ae6f67UL, 0x95e5e920UL, 0x341d62d9UL, 0xd254dc92UL, |
40 0x708c564bUL, 0x0ec3d004UL, 0xacfb49bdUL, 0x4b32c376UL }; | 40 0x708c564bUL, 0x0ec3d004UL, 0xacfb49bdUL, 0x4b32c376UL }; |
41 | 41 |
42 /** | 42 /** |
43 Initialize the RC6 block cipher | 43 Initialize the LTC_RC6 block cipher |
44 @param key The symmetric key you wish to pass | 44 @param key The symmetric key you wish to pass |
45 @param keylen The key length in bytes | 45 @param keylen The key length in bytes |
46 @param num_rounds The number of rounds desired (0 for default) | 46 @param num_rounds The number of rounds desired (0 for default) |
47 @param skey The key in as scheduled by this function. | 47 @param skey The key in as scheduled by this function. |
48 @return CRYPT_OK if successful | 48 @return CRYPT_OK if successful |
112 return x; | 112 return x; |
113 } | 113 } |
114 #endif | 114 #endif |
115 | 115 |
116 /** | 116 /** |
117 Encrypts a block of text with RC6 | 117 Encrypts a block of text with LTC_RC6 |
118 @param pt The input plaintext (16 bytes) | 118 @param pt The input plaintext (16 bytes) |
119 @param ct The output ciphertext (16 bytes) | 119 @param ct The output ciphertext (16 bytes) |
120 @param skey The key as scheduled | 120 @param skey The key as scheduled |
121 */ | 121 */ |
122 #ifdef LTC_CLEAN_STACK | 122 #ifdef LTC_CLEAN_STACK |
166 return err; | 166 return err; |
167 } | 167 } |
168 #endif | 168 #endif |
169 | 169 |
170 /** | 170 /** |
171 Decrypts a block of text with RC6 | 171 Decrypts a block of text with LTC_RC6 |
172 @param ct The input ciphertext (16 bytes) | 172 @param ct The input ciphertext (16 bytes) |
173 @param pt The output plaintext (16 bytes) | 173 @param pt The output plaintext (16 bytes) |
174 @param skey The key as scheduled | 174 @param skey The key as scheduled |
175 */ | 175 */ |
176 #ifdef LTC_CLEAN_STACK | 176 #ifdef LTC_CLEAN_STACK |
222 return err; | 222 return err; |
223 } | 223 } |
224 #endif | 224 #endif |
225 | 225 |
226 /** | 226 /** |
227 Performs a self-test of the RC6 block cipher | 227 Performs a self-test of the LTC_RC6 block cipher |
228 @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled | 228 @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled |
229 */ | 229 */ |
230 int rc6_test(void) | 230 int rc6_test(void) |
231 { | 231 { |
232 #ifndef LTC_TEST | 232 #ifndef LTC_TEST |
337 *keysize = 128; | 337 *keysize = 128; |
338 } | 338 } |
339 return CRYPT_OK; | 339 return CRYPT_OK; |
340 } | 340 } |
341 | 341 |
342 #endif /*RC6*/ | 342 #endif /*LTC_RC6*/ |
343 | 343 |
344 | 344 |
345 | 345 |
346 /* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc6.c,v $ */ | 346 /* $Source$ */ |
347 /* $Revision: 1.12 $ */ | 347 /* $Revision$ */ |
348 /* $Date: 2006/11/08 23:01:06 $ */ | 348 /* $Date$ */ |