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

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

Issue 889083003: Update libsrtp to upstream 1.5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libsrtp@master
Patch Set: Updated to libsrtp 1.5.1 Created 5 years, 10 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/rng/rand_source_ossl.c ('k') | srtp/crypto/test/cipher_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 * aes_calc.c 2 * aes_calc.c
3 * 3 *
4 * A simple AES calculator for generating AES encryption values 4 * A simple AES calculator for generating AES encryption values
5 * 5 *
6 * David A. McGrew 6 * David A. McGrew
7 * Cisco Systems, Inc. 7 * Cisco Systems, Inc.
8 */ 8 */
9
9 /* 10 /*
10 * 11 *
11 * Copyright (c) 2001-2006, Cisco Systems, Inc. 12 * Copyright (c) 2001-2006, Cisco Systems, Inc.
12 * All rights reserved. 13 * All rights reserved.
13 * 14 *
14 * Redistribution and use in source and binary forms, with or without 15 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions 16 * modification, are permitted provided that the following conditions
16 * are met: 17 * are met:
17 * 18 *
18 * Redistributions of source code must retain the above copyright 19 * Redistributions of source code must retain the above copyright
(...skipping 27 matching lines...) Expand all
46 47
47 Example usage (with first NIST FIPS 197 test case): 48 Example usage (with first NIST FIPS 197 test case):
48 49
49 [sh]$ test/aes_calc 000102030405060708090a0b0c0d0e0f 00112233445566778899aabbccd deeff -v 50 [sh]$ test/aes_calc 000102030405060708090a0b0c0d0e0f 00112233445566778899aabbccd deeff -v
50 plaintext: 00112233445566778899aabbccddeeff 51 plaintext: 00112233445566778899aabbccddeeff
51 key: 000102030405060708090a0b0c0d0e0f 52 key: 000102030405060708090a0b0c0d0e0f
52 ciphertext: 69c4e0d86a7b0430d8cdb78070b4c55a 53 ciphertext: 69c4e0d86a7b0430d8cdb78070b4c55a
53 54
54 */ 55 */
55 56
57 #ifdef HAVE_CONFIG_H
58 #include <config.h>
59 #endif
60
56 #include "aes.h" 61 #include "aes.h"
57 #include <stdio.h> 62 #include <stdio.h>
58 #include <string.h> 63 #include <string.h>
59 64
60 void 65 void
61 usage(char *prog_name) { 66 usage(char *prog_name) {
62 printf("usage: %s <key> <plaintext> [-v]\n", prog_name); 67 printf("usage: %s <key> <plaintext> [-v]\n", prog_name);
63 exit(255); 68 exit(255);
64 } 69 }
65 70
66 #define AES_MAX_KEY_LEN 32 71 #define AES_MAX_KEY_LEN 32
67 72
68 int 73 int
69 main (int argc, char *argv[]) { 74 main (int argc, char *argv[]) {
70 v128_t data; 75 v128_t data;
71 uint8_t key[AES_MAX_KEY_LEN]; 76 uint8_t key[AES_MAX_KEY_LEN];
72 aes_expanded_key_t exp_key; 77 aes_expanded_key_t exp_key;
73 int key_len, len; 78 int key_len, len;
74 int verbose; 79 int verbose = 0;
75 err_status_t status; 80 err_status_t status;
76 81
77 if (argc == 3) { 82 if (argc == 3) {
78 /* we're not in verbose mode */ 83 /* we're not in verbose mode */
79 verbose = 0; 84 verbose = 0;
80 } else if (argc == 4) { 85 } else if (argc == 4) {
81 if (strncmp(argv[3], "-v", 2) == 0) { 86 if (strncmp(argv[3], "-v", 2) == 0) {
82 /* we're in verbose mode */ 87 /* we're in verbose mode */
83 verbose = 1; 88 verbose = 1;
84 } else { 89 } else {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 /* write ciphertext to output */ 150 /* write ciphertext to output */
146 if (verbose) { 151 if (verbose) {
147 printf("key:\t\t%s\n", octet_string_hex_string(key, key_len)); 152 printf("key:\t\t%s\n", octet_string_hex_string(key, key_len));
148 printf("ciphertext:\t"); 153 printf("ciphertext:\t");
149 } 154 }
150 printf("%s\n", v128_hex_string(&data)); 155 printf("%s\n", v128_hex_string(&data));
151 156
152 return 0; 157 return 0;
153 } 158 }
154 159
OLDNEW
« no previous file with comments | « srtp/crypto/rng/rand_source_ossl.c ('k') | srtp/crypto/test/cipher_driver.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698