Mercurial > dropbear
comparison libtomcrypt/src/ciphers/rc2.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 * To commemorate the 1996 RSA Data Security Conference, the following * | 12 * To commemorate the 1996 RSA Data Security Conference, the following * |
13 * code is released into the public domain by its author. Prost! * | 13 * code is released into the public domain by its author. Prost! * |
14 * * | 14 * * |
20 \**********************************************************************/ | 20 \**********************************************************************/ |
21 #include <tomcrypt.h> | 21 #include <tomcrypt.h> |
22 | 22 |
23 /** | 23 /** |
24 @file rc2.c | 24 @file rc2.c |
25 Implementation of RC2 | 25 Implementation of LTC_RC2 |
26 */ | 26 */ |
27 | 27 |
28 #ifdef RC2 | 28 #ifdef LTC_RC2 |
29 | 29 |
30 const struct ltc_cipher_descriptor rc2_desc = { | 30 const struct ltc_cipher_descriptor rc2_desc = { |
31 "rc2", | 31 "rc2", |
32 12, 8, 128, 8, 16, | 32 12, 8, 128, 8, 16, |
33 &rc2_setup, | 33 &rc2_setup, |
58 13, 56, 52, 27,171, 51,255,176,187, 72, 12, 95,185,177,205, 46, | 58 13, 56, 52, 27,171, 51,255,176,187, 72, 12, 95,185,177,205, 46, |
59 197,243,219, 71,229,165,156,119, 10,166, 32,104,254,127,193,173 | 59 197,243,219, 71,229,165,156,119, 10,166, 32,104,254,127,193,173 |
60 }; | 60 }; |
61 | 61 |
62 /** | 62 /** |
63 Initialize the RC2 block cipher | 63 Initialize the LTC_RC2 block cipher |
64 @param key The symmetric key you wish to pass | 64 @param key The symmetric key you wish to pass |
65 @param keylen The key length in bytes | 65 @param keylen The key length in bytes |
66 @param num_rounds The number of rounds desired (0 for default) | 66 @param num_rounds The number of rounds desired (0 for default) |
67 @param skey The key in as scheduled by this function. | 67 @param skey The key in as scheduled by this function. |
68 @return CRYPT_OK if successful | 68 @return CRYPT_OK if successful |
119 | 119 |
120 /**********************************************************************\ | 120 /**********************************************************************\ |
121 * Encrypt an 8-byte block of plaintext using the given key. * | 121 * Encrypt an 8-byte block of plaintext using the given key. * |
122 \**********************************************************************/ | 122 \**********************************************************************/ |
123 /** | 123 /** |
124 Encrypts a block of text with RC2 | 124 Encrypts a block of text with LTC_RC2 |
125 @param pt The input plaintext (8 bytes) | 125 @param pt The input plaintext (8 bytes) |
126 @param ct The output ciphertext (8 bytes) | 126 @param ct The output ciphertext (8 bytes) |
127 @param skey The key as scheduled | 127 @param skey The key as scheduled |
128 @return CRYPT_OK if successful | 128 @return CRYPT_OK if successful |
129 */ | 129 */ |
197 | 197 |
198 /**********************************************************************\ | 198 /**********************************************************************\ |
199 * Decrypt an 8-byte block of ciphertext using the given key. * | 199 * Decrypt an 8-byte block of ciphertext using the given key. * |
200 \**********************************************************************/ | 200 \**********************************************************************/ |
201 /** | 201 /** |
202 Decrypts a block of text with RC2 | 202 Decrypts a block of text with LTC_RC2 |
203 @param ct The input ciphertext (8 bytes) | 203 @param ct The input ciphertext (8 bytes) |
204 @param pt The output plaintext (8 bytes) | 204 @param pt The output plaintext (8 bytes) |
205 @param skey The key as scheduled | 205 @param skey The key as scheduled |
206 @return CRYPT_OK if successful | 206 @return CRYPT_OK if successful |
207 */ | 207 */ |
273 return err; | 273 return err; |
274 } | 274 } |
275 #endif | 275 #endif |
276 | 276 |
277 /** | 277 /** |
278 Performs a self-test of the RC2 block cipher | 278 Performs a self-test of the LTC_RC2 block cipher |
279 @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled | 279 @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled |
280 */ | 280 */ |
281 int rc2_test(void) | 281 int rc2_test(void) |
282 { | 282 { |
283 #ifndef LTC_TEST | 283 #ifndef LTC_TEST |
355 #endif | 355 #endif |
356 | 356 |
357 | 357 |
358 | 358 |
359 | 359 |
360 /* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc2.c,v $ */ | 360 /* $Source$ */ |
361 /* $Revision: 1.12 $ */ | 361 /* $Revision$ */ |
362 /* $Date: 2006/11/08 23:01:06 $ */ | 362 /* $Date$ */ |