comparison libtomcrypt/src/prngs/rc4.c @ 1435:f849a5ca2efc

update to libtomcrypt 1.17 (with Dropbear changes)
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Jun 2017 17:50:50 +0800
parents 0cbe8f6dbf9e
children 6dba84798cd5
comparison
equal deleted inserted replaced
1434:27b9ddb06b09 1435:f849a5ca2efc
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 #include "tomcrypt.h" 11 #include "tomcrypt.h"
12 12
13 /** 13 /**
14 @file rc4.c 14 @file rc4.c
15 RC4 PRNG, Tom St Denis 15 LTC_RC4 PRNG, Tom St Denis
16 */ 16 */
17 17
18 #ifdef RC4 18 #ifdef LTC_RC4
19 19
20 const struct ltc_prng_descriptor rc4_desc = 20 const struct ltc_prng_descriptor rc4_desc =
21 { 21 {
22 "rc4", 32, 22 "rc4", 32,
23 &rc4_start, 23 &rc4_start,
91 /* extract the key */ 91 /* extract the key */
92 s = prng->rc4.buf; 92 s = prng->rc4.buf;
93 XMEMCPY(key, s, 256); 93 XMEMCPY(key, s, 256);
94 keylen = prng->rc4.x; 94 keylen = prng->rc4.x;
95 95
96 /* make RC4 perm and shuffle */ 96 /* make LTC_RC4 perm and shuffle */
97 for (x = 0; x < 256; x++) { 97 for (x = 0; x < 256; x++) {
98 s[x] = x; 98 s[x] = x;
99 } 99 }
100 100
101 for (j = x = y = 0; x < 256; x++) { 101 for (j = x = y = 0; x < 256; x++) {
248 } 248 }
249 rc4_done(&prng); 249 rc4_done(&prng);
250 if (XMEMCMP(dst, tests[x].ct, 8)) { 250 if (XMEMCMP(dst, tests[x].ct, 8)) {
251 #if 0 251 #if 0
252 int y; 252 int y;
253 printf("\n\nRC4 failed, I got:\n"); 253 printf("\n\nLTC_RC4 failed, I got:\n");
254 for (y = 0; y < 8; y++) printf("%02x ", dst[y]); 254 for (y = 0; y < 8; y++) printf("%02x ", dst[y]);
255 printf("\n"); 255 printf("\n");
256 #endif 256 #endif
257 return CRYPT_FAIL_TESTVECTOR; 257 return CRYPT_FAIL_TESTVECTOR;
258 } 258 }
262 } 262 }
263 263
264 #endif 264 #endif
265 265
266 266
267 /* $Source: /cvs/libtom/libtomcrypt/src/prngs/rc4.c,v $ */ 267 /* $Source$ */
268 /* $Revision: 1.9 $ */ 268 /* $Revision$ */
269 /* $Date: 2006/11/16 00:32:18 $ */ 269 /* $Date$ */