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

Side by Side Diff: srtp/crypto/cipher/aes_gcm_ossl.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/cipher/aes_cbc.c ('k') | srtp/crypto/cipher/aes_icm.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * aes_gcm_ossl.c
3 *
4 * AES Galois Counter Mode
5 *
6 * John A. Foley
7 * Cisco Systems, Inc.
8 *
9 */
10
11 /*
12 *
13 * Copyright (c) 2013, Cisco Systems, Inc.
14 * All rights reserved.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 *
20 * Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 *
23 * Redistributions in binary form must reproduce the above
24 * copyright notice, this list of conditions and the following
25 * disclaimer in the documentation and/or other materials provided
26 * with the distribution.
27 *
28 * Neither the name of the Cisco Systems, Inc. nor the names of its
29 * contributors may be used to endorse or promote products derived
30 * from this software without specific prior written permission.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
35 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
36 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
37 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
39 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
43 * OF THE POSSIBILITY OF SUCH DAMAGE.
44 *
45 */
46
47 #ifdef HAVE_CONFIG_H
48 #include <config.h>
49 #endif
50
51 #include <openssl/evp.h>
52 #include "aes_icm_ossl.h"
53 #include "aes_gcm_ossl.h"
54 #include "alloc.h"
55 #include "crypto_types.h"
56
57
58 debug_module_t mod_aes_gcm = {
59 0, /* debugging is off by default */
60 "aes gcm" /* printable module name */
61 };
62
63 /*
64 * The following are the global singleton instances for the
65 * 128-bit and 256-bit GCM ciphers.
66 */
67 extern cipher_type_t aes_gcm_128_openssl;
68 extern cipher_type_t aes_gcm_256_openssl;
69
70 /*
71 * For now we only support 8 and 16 octet tags. The spec allows for
72 * optional 12 byte tag, which may be supported in the future.
73 */
74 #define GCM_AUTH_TAG_LEN 16
75 #define GCM_AUTH_TAG_LEN_8 8
76
77
78 /*
79 * This function allocates a new instance of this crypto engine.
80 * The key_len parameter should be one of 28 or 44 for
81 * AES-128-GCM or AES-256-GCM respectively. Note that the
82 * key length includes the 14 byte salt value that is used when
83 * initializing the KDF.
84 */
85 err_status_t aes_gcm_openssl_alloc (cipher_t **c, int key_len, int tlen)
86 {
87 aes_gcm_ctx_t *gcm;
88 int tmp;
89 uint8_t *allptr;
90
91 debug_print(mod_aes_gcm, "allocating cipher with key length %d", key_len);
92 debug_print(mod_aes_gcm, "allocating cipher with tag length %d", tlen);
93
94 /*
95 * Verify the key_len is valid for one of: AES-128/256
96 */
97 if (key_len != AES_128_GCM_KEYSIZE_WSALT &&
98 key_len != AES_256_GCM_KEYSIZE_WSALT) {
99 return (err_status_bad_param);
100 }
101
102 if (tlen != GCM_AUTH_TAG_LEN &&
103 tlen != GCM_AUTH_TAG_LEN_8) {
104 return (err_status_bad_param);
105 }
106
107 /* allocate memory a cipher of type aes_gcm */
108 tmp = sizeof(cipher_t) + sizeof(aes_gcm_ctx_t);
109 allptr = crypto_alloc(tmp);
110 if (allptr == NULL) {
111 return (err_status_alloc_fail);
112 }
113
114 /* set pointers */
115 *c = (cipher_t*)allptr;
116 (*c)->state = allptr + sizeof(cipher_t);
117 gcm = (aes_gcm_ctx_t *)(*c)->state;
118
119 /* increment ref_count */
120 switch (key_len) {
121 case AES_128_GCM_KEYSIZE_WSALT:
122 (*c)->type = &aes_gcm_128_openssl;
123 (*c)->algorithm = AES_128_GCM;
124 aes_gcm_128_openssl.ref_count++;
125 ((aes_gcm_ctx_t*)(*c)->state)->key_size = AES_128_KEYSIZE;
126 ((aes_gcm_ctx_t*)(*c)->state)->tag_len = tlen;
127 break;
128 case AES_256_GCM_KEYSIZE_WSALT:
129 (*c)->type = &aes_gcm_256_openssl;
130 (*c)->algorithm = AES_256_GCM;
131 aes_gcm_256_openssl.ref_count++;
132 ((aes_gcm_ctx_t*)(*c)->state)->key_size = AES_256_KEYSIZE;
133 ((aes_gcm_ctx_t*)(*c)->state)->tag_len = tlen;
134 break;
135 }
136
137 /* set key size */
138 (*c)->key_len = key_len;
139 EVP_CIPHER_CTX_init(&gcm->ctx);
140
141 return (err_status_ok);
142 }
143
144
145 /*
146 * This function deallocates a GCM session
147 */
148 err_status_t aes_gcm_openssl_dealloc (cipher_t *c)
149 {
150 aes_gcm_ctx_t *ctx;
151
152 ctx = (aes_gcm_ctx_t*)c->state;
153 if (ctx) {
154 EVP_CIPHER_CTX_cleanup(&ctx->ctx);
155 /* decrement ref_count for the appropriate engine */
156 switch (ctx->key_size) {
157 case AES_256_KEYSIZE:
158 aes_gcm_256_openssl.ref_count--;
159 break;
160 case AES_128_KEYSIZE:
161 aes_gcm_128_openssl.ref_count--;
162 break;
163 default:
164 return (err_status_dealloc_fail);
165 break;
166 }
167 }
168
169 /* zeroize entire state*/
170 octet_string_set_to_zero((uint8_t*)c, sizeof(cipher_t) + sizeof(aes_gcm_ctx_ t));
171
172 /* free memory */
173 crypto_free(c);
174
175 return (err_status_ok);
176 }
177
178 /*
179 * aes_gcm_openssl_context_init(...) initializes the aes_gcm_context
180 * using the value in key[].
181 *
182 * the key is the secret key
183 */
184 err_status_t aes_gcm_openssl_context_init (aes_gcm_ctx_t *c, const uint8_t *key)
185 {
186 c->dir = direction_any;
187
188 /* copy key to be used later when CiscoSSL crypto context is created */
189 v128_copy_octet_string((v128_t*)&c->key, key);
190
191 if (c->key_size == AES_256_KEYSIZE) {
192 debug_print(mod_aes_gcm, "Copying last 16 bytes of key: %s",
193 v128_hex_string((v128_t*)(key + AES_128_KEYSIZE)));
194 v128_copy_octet_string(((v128_t*)(&c->key.v8)) + 1,
195 key + AES_128_KEYSIZE);
196 }
197
198 debug_print(mod_aes_gcm, "key: %s", v128_hex_string((v128_t*)&c->key));
199
200 EVP_CIPHER_CTX_cleanup(&c->ctx);
201
202 return (err_status_ok);
203 }
204
205
206 /*
207 * aes_gcm_openssl_set_iv(c, iv) sets the counter value to the exor of iv with
208 * the offset
209 */
210 err_status_t aes_gcm_openssl_set_iv (aes_gcm_ctx_t *c, void *iv,
211 int direction)
212 {
213 const EVP_CIPHER *evp;
214
215 if (direction != direction_encrypt && direction != direction_decrypt) {
216 return (err_status_bad_param);
217 }
218 c->dir = direction;
219
220 debug_print(mod_aes_gcm, "setting iv: %s", v128_hex_string(iv));
221
222 switch (c->key_size) {
223 case AES_256_KEYSIZE:
224 evp = EVP_aes_256_gcm();
225 break;
226 case AES_128_KEYSIZE:
227 evp = EVP_aes_128_gcm();
228 break;
229 default:
230 return (err_status_bad_param);
231 break;
232 }
233
234 if (!EVP_CipherInit_ex(&c->ctx, evp, NULL, (const unsigned char*)&c->key.v8,
235 NULL, (c->dir == direction_encrypt ? 1 : 0))) {
236 return (err_status_init_fail);
237 }
238
239 /* set IV len and the IV value, the followiong 3 calls are required */
240 if (!EVP_CIPHER_CTX_ctrl(&c->ctx, EVP_CTRL_GCM_SET_IVLEN, 12, 0)) {
241 return (err_status_init_fail);
242 }
243 if (!EVP_CIPHER_CTX_ctrl(&c->ctx, EVP_CTRL_GCM_SET_IV_FIXED, -1, iv)) {
244 return (err_status_init_fail);
245 }
246 if (!EVP_CIPHER_CTX_ctrl(&c->ctx, EVP_CTRL_GCM_IV_GEN, 0, iv)) {
247 return (err_status_init_fail);
248 }
249
250 return (err_status_ok);
251 }
252
253 /*
254 * This function processes the AAD
255 *
256 * Parameters:
257 * c Crypto context
258 * aad Additional data to process for AEAD cipher suites
259 * aad_len length of aad buffer
260 */
261 err_status_t aes_gcm_openssl_set_aad (aes_gcm_ctx_t *c, unsigned char *aad,
262 unsigned int aad_len)
263 {
264 int rv;
265
266 /*
267 * Set dummy tag, OpenSSL requires the Tag to be set before
268 * processing AAD
269 */
270 EVP_CIPHER_CTX_ctrl(&c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, aad);
271
272 rv = EVP_Cipher(&c->ctx, NULL, aad, aad_len);
273 if (rv != aad_len) {
274 return (err_status_algo_fail);
275 } else {
276 return (err_status_ok);
277 }
278 }
279
280 /*
281 * This function encrypts a buffer using AES GCM mode
282 *
283 * Parameters:
284 * c Crypto context
285 * buf data to encrypt
286 * enc_len length of encrypt buffer
287 */
288 err_status_t aes_gcm_openssl_encrypt (aes_gcm_ctx_t *c, unsigned char *buf,
289 unsigned int *enc_len)
290 {
291 if (c->dir != direction_encrypt && c->dir != direction_decrypt) {
292 return (err_status_bad_param);
293 }
294
295 /*
296 * Encrypt the data
297 */
298 EVP_Cipher(&c->ctx, buf, buf, *enc_len);
299
300 return (err_status_ok);
301 }
302
303 /*
304 * This function calculates and returns the GCM tag for a given context.
305 * This should be called after encrypting the data. The *len value
306 * is increased by the tag size. The caller must ensure that *buf has
307 * enough room to accept the appended tag.
308 *
309 * Parameters:
310 * c Crypto context
311 * buf data to encrypt
312 * len length of encrypt buffer
313 */
314 err_status_t aes_gcm_openssl_get_tag (aes_gcm_ctx_t *c, unsigned char *buf,
315 int *len)
316 {
317 /*
318 * Calculate the tag
319 */
320 EVP_Cipher(&c->ctx, NULL, NULL, 0);
321
322 /*
323 * Retreive the tag
324 */
325 EVP_CIPHER_CTX_ctrl(&c->ctx, EVP_CTRL_GCM_GET_TAG, c->tag_len, buf);
326
327 /*
328 * Increase encryption length by desired tag size
329 */
330 *len = c->tag_len;
331
332 return (err_status_ok);
333 }
334
335
336 /*
337 * This function decrypts a buffer using AES GCM mode
338 *
339 * Parameters:
340 * c Crypto context
341 * buf data to encrypt
342 * enc_len length of encrypt buffer
343 */
344 err_status_t aes_gcm_openssl_decrypt (aes_gcm_ctx_t *c, unsigned char *buf,
345 unsigned int *enc_len)
346 {
347 if (c->dir != direction_encrypt && c->dir != direction_decrypt) {
348 return (err_status_bad_param);
349 }
350
351 /*
352 * Set the tag before decrypting
353 */
354 EVP_CIPHER_CTX_ctrl(&c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len,
355 buf + (*enc_len - c->tag_len));
356 EVP_Cipher(&c->ctx, buf, buf, *enc_len - c->tag_len);
357
358 /*
359 * Check the tag
360 */
361 if (EVP_Cipher(&c->ctx, NULL, NULL, 0)) {
362 return (err_status_auth_fail);
363 }
364
365 /*
366 * Reduce the buffer size by the tag length since the tag
367 * is not part of the original payload
368 */
369 *enc_len -= c->tag_len;
370
371 return (err_status_ok);
372 }
373
374
375
376 /*
377 * Name of this crypto engine
378 */
379 char aes_gcm_128_openssl_description[] = "AES-128 GCM using openssl";
380 char aes_gcm_256_openssl_description[] = "AES-256 GCM using openssl";
381
382
383 /*
384 * KAT values for AES self-test. These
385 * values we're derived from independent test code
386 * using OpenSSL.
387 */
388 uint8_t aes_gcm_test_case_0_key[AES_128_GCM_KEYSIZE_WSALT] = {
389 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
390 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
391 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
392 0x09, 0x0a, 0x0b, 0x0c,
393 };
394
395 uint8_t aes_gcm_test_case_0_iv[12] = {
396 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
397 0xde, 0xca, 0xf8, 0x88
398 };
399
400 uint8_t aes_gcm_test_case_0_plaintext[60] = {
401 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
402 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
403 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
404 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
405 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
406 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
407 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
408 0xba, 0x63, 0x7b, 0x39
409 };
410
411 uint8_t aes_gcm_test_case_0_aad[20] = {
412 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
413 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
414 0xab, 0xad, 0xda, 0xd2
415 };
416
417 uint8_t aes_gcm_test_case_0_ciphertext[76] = {
418 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24,
419 0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c,
420 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0,
421 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e,
422 0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c,
423 0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05,
424 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97,
425 0x3d, 0x58, 0xe0, 0x91,
426 /* the last 16 bytes are the tag */
427 0x5b, 0xc9, 0x4f, 0xbc, 0x32, 0x21, 0xa5, 0xdb,
428 0x94, 0xfa, 0xe9, 0x5a, 0xe7, 0x12, 0x1a, 0x47,
429 };
430
431 cipher_test_case_t aes_gcm_test_case_0a = {
432 AES_128_GCM_KEYSIZE_WSALT, /* octets in key */
433 aes_gcm_test_case_0_key, /* key */
434 aes_gcm_test_case_0_iv, /* packet index */
435 60, /* octets in plaintext */
436 aes_gcm_test_case_0_plaintext, /* plaintext */
437 68, /* octets in ciphertext */
438 aes_gcm_test_case_0_ciphertext, /* ciphertext + tag */
439 20, /* octets in AAD */
440 aes_gcm_test_case_0_aad, /* AAD */
441 GCM_AUTH_TAG_LEN_8,
442 NULL /* pointer to next testcase */
443 };
444
445 cipher_test_case_t aes_gcm_test_case_0 = {
446 AES_128_GCM_KEYSIZE_WSALT, /* octets in key */
447 aes_gcm_test_case_0_key, /* key */
448 aes_gcm_test_case_0_iv, /* packet index */
449 60, /* octets in plaintext */
450 aes_gcm_test_case_0_plaintext, /* plaintext */
451 76, /* octets in ciphertext */
452 aes_gcm_test_case_0_ciphertext, /* ciphertext + tag */
453 20, /* octets in AAD */
454 aes_gcm_test_case_0_aad, /* AAD */
455 GCM_AUTH_TAG_LEN,
456 &aes_gcm_test_case_0a /* pointer to next testcase */
457 };
458
459 uint8_t aes_gcm_test_case_1_key[AES_256_GCM_KEYSIZE_WSALT] = {
460 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
461 0xa5, 0x59, 0x09, 0xc5, 0x54, 0x66, 0x93, 0x1c,
462 0xaf, 0xf5, 0x26, 0x9a, 0x21, 0xd5, 0x14, 0xb2,
463 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
464 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
465 0x09, 0x0a, 0x0b, 0x0c,
466
467 };
468
469 uint8_t aes_gcm_test_case_1_iv[12] = {
470 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
471 0xde, 0xca, 0xf8, 0x88
472 };
473
474 uint8_t aes_gcm_test_case_1_plaintext[60] = {
475 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
476 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
477 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
478 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
479 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
480 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
481 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
482 0xba, 0x63, 0x7b, 0x39
483 };
484
485 uint8_t aes_gcm_test_case_1_aad[20] = {
486 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
487 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
488 0xab, 0xad, 0xda, 0xd2
489 };
490
491 uint8_t aes_gcm_test_case_1_ciphertext[76] = {
492 0x0b, 0x11, 0xcf, 0xaf, 0x68, 0x4d, 0xae, 0x46,
493 0xc7, 0x90, 0xb8, 0x8e, 0xb7, 0x6a, 0x76, 0x2a,
494 0x94, 0x82, 0xca, 0xab, 0x3e, 0x39, 0xd7, 0x86,
495 0x1b, 0xc7, 0x93, 0xed, 0x75, 0x7f, 0x23, 0x5a,
496 0xda, 0xfd, 0xd3, 0xe2, 0x0e, 0x80, 0x87, 0xa9,
497 0x6d, 0xd7, 0xe2, 0x6a, 0x7d, 0x5f, 0xb4, 0x80,
498 0xef, 0xef, 0xc5, 0x29, 0x12, 0xd1, 0xaa, 0x10,
499 0x09, 0xc9, 0x86, 0xc1,
500 /* the last 16 bytes are the tag */
501 0x45, 0xbc, 0x03, 0xe6, 0xe1, 0xac, 0x0a, 0x9f,
502 0x81, 0xcb, 0x8e, 0x5b, 0x46, 0x65, 0x63, 0x1d,
503 };
504
505 cipher_test_case_t aes_gcm_test_case_1a = {
506 AES_256_GCM_KEYSIZE_WSALT, /* octets in key */
507 aes_gcm_test_case_1_key, /* key */
508 aes_gcm_test_case_1_iv, /* packet index */
509 60, /* octets in plaintext */
510 aes_gcm_test_case_1_plaintext, /* plaintext */
511 68, /* octets in ciphertext */
512 aes_gcm_test_case_1_ciphertext, /* ciphertext + tag */
513 20, /* octets in AAD */
514 aes_gcm_test_case_1_aad, /* AAD */
515 GCM_AUTH_TAG_LEN_8,
516 NULL /* pointer to next testcase */
517 };
518
519 cipher_test_case_t aes_gcm_test_case_1 = {
520 AES_256_GCM_KEYSIZE_WSALT, /* octets in key */
521 aes_gcm_test_case_1_key, /* key */
522 aes_gcm_test_case_1_iv, /* packet index */
523 60, /* octets in plaintext */
524 aes_gcm_test_case_1_plaintext, /* plaintext */
525 76, /* octets in ciphertext */
526 aes_gcm_test_case_1_ciphertext, /* ciphertext + tag */
527 20, /* octets in AAD */
528 aes_gcm_test_case_1_aad, /* AAD */
529 GCM_AUTH_TAG_LEN,
530 &aes_gcm_test_case_1a /* pointer to next testcase */
531 };
532
533 /*
534 * This is the vector function table for this crypto engine.
535 */
536 cipher_type_t aes_gcm_128_openssl = {
537 (cipher_alloc_func_t) aes_gcm_openssl_alloc,
538 (cipher_dealloc_func_t) aes_gcm_openssl_dealloc,
539 (cipher_init_func_t) aes_gcm_openssl_context_init,
540 (cipher_set_aad_func_t) aes_gcm_openssl_set_aad,
541 (cipher_encrypt_func_t) aes_gcm_openssl_encrypt,
542 (cipher_decrypt_func_t) aes_gcm_openssl_decrypt,
543 (cipher_set_iv_func_t) aes_gcm_openssl_set_iv,
544 (cipher_get_tag_func_t) aes_gcm_openssl_get_tag,
545 (char*) aes_gcm_128_openssl_description,
546 (int) 0, /* instance count */
547 (cipher_test_case_t*) &aes_gcm_test_case_0,
548 (debug_module_t*) &mod_aes_gcm,
549 (cipher_type_id_t) AES_128_GCM
550 };
551
552 /*
553 * This is the vector function table for this crypto engine.
554 */
555 cipher_type_t aes_gcm_256_openssl = {
556 (cipher_alloc_func_t) aes_gcm_openssl_alloc,
557 (cipher_dealloc_func_t) aes_gcm_openssl_dealloc,
558 (cipher_init_func_t) aes_gcm_openssl_context_init,
559 (cipher_set_aad_func_t) aes_gcm_openssl_set_aad,
560 (cipher_encrypt_func_t) aes_gcm_openssl_encrypt,
561 (cipher_decrypt_func_t) aes_gcm_openssl_decrypt,
562 (cipher_set_iv_func_t) aes_gcm_openssl_set_iv,
563 (cipher_get_tag_func_t) aes_gcm_openssl_get_tag,
564 (char*) aes_gcm_256_openssl_description,
565 (int) 0, /* instance count */
566 (cipher_test_case_t*) &aes_gcm_test_case_1,
567 (debug_module_t*) &mod_aes_gcm,
568 (cipher_type_id_t) AES_256_GCM
569 };
570
OLDNEW
« no previous file with comments | « srtp/crypto/cipher/aes_cbc.c ('k') | srtp/crypto/cipher/aes_icm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698