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

Side by Side Diff: srtp/crypto/test/datatypes_driver.c

Issue 1098043003: Update libsrtp to 1.5.2 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libsrtp@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « srtp/crypto/test/cipher_driver.c ('k') | srtp/crypto/test/kernel_driver.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * datatypes_driver.c 2 * datatypes_driver.c
3 * 3 *
4 * a test driver for crypto/math datatypes 4 * a test driver for crypto/math datatypes
5 * 5 *
6 * David A. McGrew 6 * David A. McGrew
7 * Cisco Systems, Inc. 7 * Cisco Systems, Inc.
8 */ 8 */
9 9
10 /* 10 /*
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 len = hex_string_to_octet_string(raw, hex2, strlen(hex2)); 203 len = hex_string_to_octet_string(raw, hex2, strlen(hex2));
204 printf("computed length: %d\tstring: %s\n", len, 204 printf("computed length: %d\tstring: %s\n", len,
205 octet_string_hex_string(raw, len/2)); 205 octet_string_hex_string(raw, len/2));
206 printf("expected length: %d\tstring: %s\n", 16, "0123456789abcdef"); 206 printf("expected length: %d\tstring: %s\n", 16, "0123456789abcdef");
207 207
208 } 208 }
209 209
210 void 210 void
211 print_string(char *s) { 211 print_string(char *s) {
212 int i; 212 size_t i;
213 printf("%s\n", s); 213 printf("%s\n", s);
214 printf("strlen(s) = %u\n", (unsigned)strlen(s)); 214 printf("strlen(s) = %u\n", (unsigned)strlen(s));
215 printf("{ "); 215 printf("{ ");
216 for (i=0; i < strlen(s); i++) { 216 for (i=0; i < strlen(s); i++) {
217 printf("0x%x, ", s[i]); 217 printf("0x%x, ", s[i]);
218 if (((i+1) % 8) == 0) 218 if (((i+1) % 8) == 0)
219 printf("\n "); 219 printf("\n ");
220 } 220 }
221 printf("}\n"); 221 printf("}\n");
222 } 222 }
223 223
224 void 224 void
225 test_bswap(void) { 225 test_bswap(void) {
226 uint32_t x = 0x11223344; 226 uint32_t x = 0x11223344;
227 uint64_t y = 0x1122334455667788LL; 227 uint64_t y = 0x1122334455667788LL;
228 228
229 printf("before: %0x\nafter: %0x\n", x, be32_to_cpu(x)); 229 printf("before: %0x\nafter: %0x\n", x, be32_to_cpu(x));
230 printf("before: %0llx\nafter: %0llx\n", (unsigned long long)y, 230 printf("before: %0llx\nafter: %0llx\n", (unsigned long long)y,
231 (unsigned long long)be64_to_cpu(y)); 231 (unsigned long long)be64_to_cpu(y));
232 232
233 y = 1234; 233 y = 1234;
234 234
235 printf("1234: %0llx\n", (unsigned long long)y); 235 printf("1234: %0llx\n", (unsigned long long)y);
236 printf("as octet string: %s\n", 236 printf("as octet string: %s\n",
237 octet_string_hex_string((uint8_t *) &y, 8)); 237 octet_string_hex_string((uint8_t *) &y, 8));
238 y = be64_to_cpu(y); 238 y = be64_to_cpu(y);
239 printf("bswapped octet string: %s\n", 239 printf("bswapped octet string: %s\n",
240 octet_string_hex_string((uint8_t *) &y, 8)); 240 octet_string_hex_string((uint8_t *) &y, 8));
241 } 241 }
OLDNEW
« no previous file with comments | « srtp/crypto/test/cipher_driver.c ('k') | srtp/crypto/test/kernel_driver.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698