Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: openssl/crypto/rc4/rc4test.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/crypto/rc4/rc4_skey.c ('k') | openssl/crypto/rc5/Makefile » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* crypto/rc4/rc4test.c */ 1 /* crypto/rc4/rc4test.c */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 {0x66,0xa0,0x94,0x9f,0x8a,0xf7,0xd6,0x89, 107 {0x66,0xa0,0x94,0x9f,0x8a,0xf7,0xd6,0x89,
108 0x1f,0x7f,0x83,0x2b,0xa8,0x33,0xc0,0x0c, 108 0x1f,0x7f,0x83,0x2b,0xa8,0x33,0xc0,0x0c,
109 0x89,0x2e,0xbe,0x30,0x14,0x3c,0xe2,0x87, 109 0x89,0x2e,0xbe,0x30,0x14,0x3c,0xe2,0x87,
110 0x40,0x01,0x1e,0xcf,0x00}, 110 0x40,0x01,0x1e,0xcf,0x00},
111 {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,0xbd,0x61,0x00}, 111 {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,0xbd,0x61,0x00},
112 {0}, 112 {0},
113 }; 113 };
114 114
115 int main(int argc, char *argv[]) 115 int main(int argc, char *argv[])
116 { 116 {
117 » int err=0; 117 » int i,err=0;
118 » unsigned int i, j; 118 » int j;
119 unsigned char *p; 119 unsigned char *p;
120 RC4_KEY key; 120 RC4_KEY key;
121 unsigned char obuf[512]; 121 unsigned char obuf[512];
122 122
123 for (i=0; i<6; i++) 123 for (i=0; i<6; i++)
124 { 124 {
125 RC4_set_key(&key,keys[i][0],&(keys[i][1])); 125 RC4_set_key(&key,keys[i][0],&(keys[i][1]));
126 memset(obuf,0x00,sizeof(obuf)); 126 memset(obuf,0x00,sizeof(obuf));
127 RC4(&key,data_len[i],&(data[i][0]),obuf); 127 RC4(&key,data_len[i],&(data[i][0]),obuf);
128 if (memcmp(obuf,output[i],data_len[i]+1) != 0) 128 if (memcmp(obuf,output[i],data_len[i]+1) != 0)
129 { 129 {
130 printf("error calculating RC4\n"); 130 printf("error calculating RC4\n");
131 printf("output:"); 131 printf("output:");
132 » » » for (j=0; j<data_len[i]+1U; j++) 132 » » » for (j=0; j<data_len[i]+1; j++)
133 printf(" %02x",obuf[j]); 133 printf(" %02x",obuf[j]);
134 printf("\n"); 134 printf("\n");
135 printf("expect:"); 135 printf("expect:");
136 p= &(output[i][0]); 136 p= &(output[i][0]);
137 » » » for (j=0; j<data_len[i]+1U; j++) 137 » » » for (j=0; j<data_len[i]+1; j++)
138 printf(" %02x",*(p++)); 138 printf(" %02x",*(p++));
139 printf("\n"); 139 printf("\n");
140 err++; 140 err++;
141 } 141 }
142 else 142 else
143 printf("test %d ok\n",i); 143 printf("test %d ok\n",i);
144 } 144 }
145 printf("test end processing "); 145 printf("test end processing ");
146 for (i=0; i<data_len[3]; i++) 146 for (i=0; i<data_len[3]; i++)
147 { 147 {
(...skipping 25 matching lines...) Expand all
173 for (i=0; i<data_len[3]; i++) 173 for (i=0; i<data_len[3]; i++)
174 { 174 {
175 RC4_set_key(&key,keys[3][0],&(keys[3][1])); 175 RC4_set_key(&key,keys[3][0],&(keys[3][1]));
176 memset(obuf,0x00,sizeof(obuf)); 176 memset(obuf,0x00,sizeof(obuf));
177 RC4(&key,i,&(data[3][0]),obuf); 177 RC4(&key,i,&(data[3][0]),obuf);
178 RC4(&key,data_len[3]-i,&(data[3][i]),&(obuf[i])); 178 RC4(&key,data_len[3]-i,&(data[3][i]),&(obuf[i]));
179 if (memcmp(obuf,output[3],data_len[3]+1) != 0) 179 if (memcmp(obuf,output[3],data_len[3]+1) != 0)
180 { 180 {
181 printf("error in RC4 multi-call processing\n"); 181 printf("error in RC4 multi-call processing\n");
182 printf("output:"); 182 printf("output:");
183 » » » for (j=0; j<data_len[3]+1U; j++) 183 » » » for (j=0; j<data_len[3]+1; j++)
184 printf(" %02x",obuf[j]); 184 printf(" %02x",obuf[j]);
185 printf("\n"); 185 printf("\n");
186 printf("expect:"); 186 printf("expect:");
187 p= &(output[3][0]); 187 p= &(output[3][0]);
188 » » » for (j=0; j<data_len[3]+1U; j++) 188 » » » for (j=0; j<data_len[3]+1; j++)
189 printf(" %02x",*(p++)); 189 printf(" %02x",*(p++));
190 err++; 190 err++;
191 } 191 }
192 else 192 else
193 { 193 {
194 printf("."); 194 printf(".");
195 fflush(stdout); 195 fflush(stdout);
196 } 196 }
197 } 197 }
198 printf("done\n"); 198 printf("done\n");
(...skipping 10 matching lines...) Expand all
209 SHA1_Init(&c); 209 SHA1_Init(&c);
210 for (i=0;i<2571;i++) { 210 for (i=0;i<2571;i++) {
211 RC4(&key,sizeof(buf),buf,buf); 211 RC4(&key,sizeof(buf),buf,buf);
212 SHA1_Update(&c,buf,sizeof(buf)); 212 SHA1_Update(&c,buf,sizeof(buf));
213 } 213 }
214 SHA1_Final(md,&c); 214 SHA1_Final(md,&c);
215 215
216 if (memcmp(md,expected,sizeof(md))) { 216 if (memcmp(md,expected,sizeof(md))) {
217 printf("error in RC4 bulk test\n"); 217 printf("error in RC4 bulk test\n");
218 printf("output:"); 218 printf("output:");
219 » » » for (j=0; j<sizeof(md); j++) 219 » » » for (j=0; j<(int)sizeof(md); j++)
220 printf(" %02x",md[j]); 220 printf(" %02x",md[j]);
221 printf("\n"); 221 printf("\n");
222 printf("expect:"); 222 printf("expect:");
223 » » » for (j=0; j<sizeof(md); j++) 223 » » » for (j=0; j<(int)sizeof(md); j++)
224 printf(" %02x",expected[j]); 224 printf(" %02x",expected[j]);
225 printf("\n"); 225 printf("\n");
226 err++; 226 err++;
227 } 227 }
228 else printf("ok\n"); 228 else printf("ok\n");
229 } 229 }
230 #ifdef OPENSSL_SYS_NETWARE 230 #ifdef OPENSSL_SYS_NETWARE
231 if (err) printf("ERROR: %d\n", err); 231 if (err) printf("ERROR: %d\n", err);
232 #endif 232 #endif
233 EXIT(err); 233 EXIT(err);
234 return(0); 234 return(0);
235 } 235 }
236 #endif 236 #endif
OLDNEW
« no previous file with comments | « openssl/crypto/rc4/rc4_skey.c ('k') | openssl/crypto/rc5/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698