blob: 99e509287398f091e04e03d5dea66ca7a81fc581 [file] [log] [blame]
Paul Bakker8123e9d2011-01-06 15:37:30 +00001/**
2 * \file md_wrap.c
3 *
Paul Bakker20281562011-11-11 10:34:04 +00004 * \brief Generic cipher wrapper for PolarSSL
Paul Bakker8123e9d2011-01-06 15:37:30 +00005 *
6 * \author Adriaan de Jong <dejong@fox-it.com>
7 *
Paul Bakkerfab5c822012-02-06 16:45:10 +00008 * Copyright (C) 2006-2012, Brainspark B.V.
Paul Bakker8123e9d2011-01-06 15:37:30 +00009 *
10 * This file is part of PolarSSL (http://www.polarssl.org)
11 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
12 *
13 * All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 */
29
30#include "polarssl/config.h"
31
32#if defined(POLARSSL_CIPHER_C)
33
34#include "polarssl/cipher_wrap.h"
Paul Bakkerf6543712012-03-05 14:01:29 +000035
36#if defined(POLARSSL_AES_C)
Paul Bakker8123e9d2011-01-06 15:37:30 +000037#include "polarssl/aes.h"
Paul Bakkerf6543712012-03-05 14:01:29 +000038#endif
39
40#if defined(POLARSSL_CAMELLIA_C)
Paul Bakker8123e9d2011-01-06 15:37:30 +000041#include "polarssl/camellia.h"
Paul Bakkerf6543712012-03-05 14:01:29 +000042#endif
43
44#if defined(POLARSSL_DES_C)
Paul Bakker8123e9d2011-01-06 15:37:30 +000045#include "polarssl/des.h"
Paul Bakker02f61692012-03-15 10:54:25 +000046#endif
Paul Bakker8123e9d2011-01-06 15:37:30 +000047
Paul Bakker8123e9d2011-01-06 15:37:30 +000048#include <stdlib.h>
49
50#if defined(POLARSSL_AES_C)
51
Paul Bakker23986e52011-04-24 08:57:21 +000052int aes_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length,
Paul Bakker8123e9d2011-01-06 15:37:30 +000053 unsigned char *iv, const unsigned char *input, unsigned char *output )
54{
55 return aes_crypt_cbc( (aes_context *) ctx, operation, length, iv, input, output );
56}
57
Paul Bakker343a8702011-06-09 14:27:58 +000058int aes_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length,
59 size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output )
60{
61#if defined(POLARSSL_CIPHER_MODE_CFB)
62 return aes_crypt_cfb128( (aes_context *) ctx, operation, length, iv_off, iv, input, output );
63#else
64 ((void) ctx);
65 ((void) operation);
66 ((void) length);
67 ((void) iv_off);
68 ((void) iv);
69 ((void) input);
70 ((void) output);
71
72 return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
73#endif
74}
75
76int aes_crypt_ctr_wrap( void *ctx, size_t length,
77 size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block,
78 const unsigned char *input, unsigned char *output )
79{
80#if defined(POLARSSL_CIPHER_MODE_CTR)
81 return aes_crypt_ctr( (aes_context *) ctx, length, nc_off, nonce_counter,
82 stream_block, input, output );
83#else
84 ((void) ctx);
85 ((void) length);
86 ((void) nc_off);
87 ((void) nonce_counter);
88 ((void) stream_block);
89 ((void) input);
90 ((void) output);
91
92 return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
93#endif
94}
95
Paul Bakker23986e52011-04-24 08:57:21 +000096int aes_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +000097{
98 return aes_setkey_dec( (aes_context *) ctx, key, key_length );
99}
100
Paul Bakker23986e52011-04-24 08:57:21 +0000101int aes_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000102{
103 return aes_setkey_enc( (aes_context *) ctx, key, key_length );
104}
105
106static void * aes_ctx_alloc( void )
107{
108 return malloc( sizeof( aes_context ) );
109}
110
111static void aes_ctx_free( void *ctx )
112{
113 free( ctx );
114}
115
Paul Bakker343a8702011-06-09 14:27:58 +0000116const cipher_base_t aes_info = {
117 POLARSSL_CIPHER_ID_AES,
118 aes_crypt_cbc_wrap,
119 aes_crypt_cfb128_wrap,
120 aes_crypt_ctr_wrap,
121 aes_setkey_enc_wrap,
122 aes_setkey_dec_wrap,
123 aes_ctx_alloc,
124 aes_ctx_free
125};
126
Paul Bakker8123e9d2011-01-06 15:37:30 +0000127const cipher_info_t aes_128_cbc_info = {
Paul Bakker23986e52011-04-24 08:57:21 +0000128 POLARSSL_CIPHER_AES_128_CBC,
Paul Bakker23986e52011-04-24 08:57:21 +0000129 POLARSSL_MODE_CBC,
130 128,
131 "AES-128-CBC",
132 16,
133 16,
Paul Bakker343a8702011-06-09 14:27:58 +0000134 &aes_info
Paul Bakker8123e9d2011-01-06 15:37:30 +0000135};
136
137const cipher_info_t aes_192_cbc_info = {
Paul Bakker23986e52011-04-24 08:57:21 +0000138 POLARSSL_CIPHER_AES_192_CBC,
Paul Bakker23986e52011-04-24 08:57:21 +0000139 POLARSSL_MODE_CBC,
140 192,
141 "AES-192-CBC",
142 16,
143 16,
Paul Bakker343a8702011-06-09 14:27:58 +0000144 &aes_info
Paul Bakker8123e9d2011-01-06 15:37:30 +0000145};
146
147const cipher_info_t aes_256_cbc_info = {
Paul Bakker23986e52011-04-24 08:57:21 +0000148 POLARSSL_CIPHER_AES_256_CBC,
Paul Bakker23986e52011-04-24 08:57:21 +0000149 POLARSSL_MODE_CBC,
150 256,
151 "AES-256-CBC",
152 16,
153 16,
Paul Bakker343a8702011-06-09 14:27:58 +0000154 &aes_info
Paul Bakker8123e9d2011-01-06 15:37:30 +0000155};
Paul Bakker343a8702011-06-09 14:27:58 +0000156
157#if defined(POLARSSL_CIPHER_MODE_CFB)
158const cipher_info_t aes_128_cfb128_info = {
159 POLARSSL_CIPHER_AES_128_CFB128,
160 POLARSSL_MODE_CFB128,
161 128,
162 "AES-128-CFB128",
163 16,
164 16,
165 &aes_info
166};
167
168const cipher_info_t aes_192_cfb128_info = {
169 POLARSSL_CIPHER_AES_192_CFB128,
170 POLARSSL_MODE_CFB128,
171 192,
172 "AES-192-CFB128",
173 16,
174 16,
175 &aes_info
176};
177
178const cipher_info_t aes_256_cfb128_info = {
179 POLARSSL_CIPHER_AES_256_CFB128,
180 POLARSSL_MODE_CFB128,
181 256,
182 "AES-256-CFB128",
183 16,
184 16,
185 &aes_info
186};
187#endif /* POLARSSL_CIPHER_MODE_CFB */
188
189#if defined(POLARSSL_CIPHER_MODE_CTR)
190const cipher_info_t aes_128_ctr_info = {
191 POLARSSL_CIPHER_AES_128_CTR,
192 POLARSSL_MODE_CTR,
193 128,
194 "AES-128-CTR",
195 16,
196 16,
197 &aes_info
198};
199
200const cipher_info_t aes_192_ctr_info = {
201 POLARSSL_CIPHER_AES_192_CTR,
202 POLARSSL_MODE_CTR,
203 192,
204 "AES-192-CTR",
205 16,
206 16,
207 &aes_info
208};
209
210const cipher_info_t aes_256_ctr_info = {
211 POLARSSL_CIPHER_AES_256_CTR,
212 POLARSSL_MODE_CTR,
213 256,
214 "AES-256-CTR",
215 16,
216 16,
217 &aes_info
218};
219#endif /* POLARSSL_CIPHER_MODE_CTR */
220
Paul Bakker8123e9d2011-01-06 15:37:30 +0000221#endif
222
223#if defined(POLARSSL_CAMELLIA_C)
224
Paul Bakker23986e52011-04-24 08:57:21 +0000225int camellia_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length,
Paul Bakker8123e9d2011-01-06 15:37:30 +0000226 unsigned char *iv, const unsigned char *input, unsigned char *output )
227{
228 return camellia_crypt_cbc( (camellia_context *) ctx, operation, length, iv, input, output );
229}
230
Paul Bakker343a8702011-06-09 14:27:58 +0000231int camellia_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length,
232 size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output )
233{
234#if defined(POLARSSL_CIPHER_MODE_CFB)
235 return camellia_crypt_cfb128( (camellia_context *) ctx, operation, length, iv_off, iv, input, output );
236#else
237 ((void) ctx);
238 ((void) operation);
239 ((void) length);
240 ((void) iv_off);
241 ((void) iv);
242 ((void) input);
243 ((void) output);
244
245 return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
246#endif
247}
248
249int camellia_crypt_ctr_wrap( void *ctx, size_t length,
250 size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block,
251 const unsigned char *input, unsigned char *output )
252{
253#if defined(POLARSSL_CIPHER_MODE_CTR)
254 return camellia_crypt_ctr( (camellia_context *) ctx, length, nc_off, nonce_counter,
255 stream_block, input, output );
256#else
257 ((void) ctx);
258 ((void) length);
259 ((void) nc_off);
260 ((void) nonce_counter);
261 ((void) stream_block);
262 ((void) input);
263 ((void) output);
264
265 return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
266#endif
267}
268
Paul Bakker23986e52011-04-24 08:57:21 +0000269int camellia_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000270{
271 return camellia_setkey_dec( (camellia_context *) ctx, key, key_length );
272}
273
Paul Bakker23986e52011-04-24 08:57:21 +0000274int camellia_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000275{
276 return camellia_setkey_enc( (camellia_context *) ctx, key, key_length );
277}
278
279static void * camellia_ctx_alloc( void )
280{
281 return malloc( sizeof( camellia_context ) );
282}
283
284static void camellia_ctx_free( void *ctx )
285{
286 free( ctx );
287}
288
Paul Bakker343a8702011-06-09 14:27:58 +0000289const cipher_base_t camellia_info = {
290 POLARSSL_CIPHER_ID_CAMELLIA,
291 camellia_crypt_cbc_wrap,
292 camellia_crypt_cfb128_wrap,
293 camellia_crypt_ctr_wrap,
294 camellia_setkey_enc_wrap,
295 camellia_setkey_dec_wrap,
296 camellia_ctx_alloc,
297 camellia_ctx_free
298};
299
Paul Bakker8123e9d2011-01-06 15:37:30 +0000300const cipher_info_t camellia_128_cbc_info = {
Paul Bakker23986e52011-04-24 08:57:21 +0000301 POLARSSL_CIPHER_CAMELLIA_128_CBC,
Paul Bakker23986e52011-04-24 08:57:21 +0000302 POLARSSL_MODE_CBC,
303 128,
304 "CAMELLIA-128-CBC",
305 16,
306 16,
Paul Bakker343a8702011-06-09 14:27:58 +0000307 &camellia_info
Paul Bakker8123e9d2011-01-06 15:37:30 +0000308};
309
310const cipher_info_t camellia_192_cbc_info = {
Paul Bakker23986e52011-04-24 08:57:21 +0000311 POLARSSL_CIPHER_CAMELLIA_192_CBC,
Paul Bakker23986e52011-04-24 08:57:21 +0000312 POLARSSL_MODE_CBC,
313 192,
314 "CAMELLIA-192-CBC",
315 16,
316 16,
Paul Bakker343a8702011-06-09 14:27:58 +0000317 &camellia_info
Paul Bakker8123e9d2011-01-06 15:37:30 +0000318};
319
320const cipher_info_t camellia_256_cbc_info = {
Paul Bakker23986e52011-04-24 08:57:21 +0000321 POLARSSL_CIPHER_CAMELLIA_256_CBC,
Paul Bakker23986e52011-04-24 08:57:21 +0000322 POLARSSL_MODE_CBC,
323 256,
324 "CAMELLIA-256-CBC",
325 16,
326 16,
Paul Bakker343a8702011-06-09 14:27:58 +0000327 &camellia_info
Paul Bakker8123e9d2011-01-06 15:37:30 +0000328};
Paul Bakker343a8702011-06-09 14:27:58 +0000329
330#if defined(POLARSSL_CIPHER_MODE_CFB)
331const cipher_info_t camellia_128_cfb128_info = {
332 POLARSSL_CIPHER_CAMELLIA_128_CFB128,
333 POLARSSL_MODE_CFB128,
334 128,
335 "CAMELLIA-128-CFB128",
336 16,
337 16,
338 &camellia_info
339};
340
341const cipher_info_t camellia_192_cfb128_info = {
342 POLARSSL_CIPHER_CAMELLIA_192_CFB128,
343 POLARSSL_MODE_CFB128,
344 192,
345 "CAMELLIA-192-CFB128",
346 16,
347 16,
348 &camellia_info
349};
350
351const cipher_info_t camellia_256_cfb128_info = {
352 POLARSSL_CIPHER_CAMELLIA_256_CFB128,
353 POLARSSL_MODE_CFB128,
354 256,
355 "CAMELLIA-256-CFB128",
356 16,
357 16,
358 &camellia_info
359};
360#endif /* POLARSSL_CIPHER_MODE_CFB */
361
362#if defined(POLARSSL_CIPHER_MODE_CTR)
363const cipher_info_t camellia_128_ctr_info = {
364 POLARSSL_CIPHER_CAMELLIA_128_CTR,
365 POLARSSL_MODE_CTR,
366 128,
367 "CAMELLIA-128-CTR",
368 16,
369 16,
370 &camellia_info
371};
372
373const cipher_info_t camellia_192_ctr_info = {
374 POLARSSL_CIPHER_CAMELLIA_192_CTR,
375 POLARSSL_MODE_CTR,
376 192,
377 "CAMELLIA-192-CTR",
378 16,
379 16,
380 &camellia_info
381};
382
383const cipher_info_t camellia_256_ctr_info = {
384 POLARSSL_CIPHER_CAMELLIA_256_CTR,
385 POLARSSL_MODE_CTR,
386 256,
387 "CAMELLIA-256-CTR",
388 16,
389 16,
390 &camellia_info
391};
392#endif /* POLARSSL_CIPHER_MODE_CTR */
393
Paul Bakker8123e9d2011-01-06 15:37:30 +0000394#endif
395
396#if defined(POLARSSL_DES_C)
397
Paul Bakker23986e52011-04-24 08:57:21 +0000398int des_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length,
Paul Bakker8123e9d2011-01-06 15:37:30 +0000399 unsigned char *iv, const unsigned char *input, unsigned char *output )
400{
401 return des_crypt_cbc( (des_context *) ctx, operation, length, iv, input, output );
402}
403
Paul Bakker23986e52011-04-24 08:57:21 +0000404int des3_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length,
Paul Bakker8123e9d2011-01-06 15:37:30 +0000405 unsigned char *iv, const unsigned char *input, unsigned char *output )
406{
407 return des3_crypt_cbc( (des3_context *) ctx, operation, length, iv, input, output );
408}
409
Paul Bakker343a8702011-06-09 14:27:58 +0000410int des_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length,
411 size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output )
412{
413 ((void) ctx);
414 ((void) operation);
415 ((void) length);
416 ((void) iv_off);
417 ((void) iv);
418 ((void) input);
419 ((void) output);
420
421 return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
422}
423
424int des_crypt_ctr_wrap( void *ctx, size_t length,
425 size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block,
426 const unsigned char *input, unsigned char *output )
427{
428 ((void) ctx);
429 ((void) length);
430 ((void) nc_off);
431 ((void) nonce_counter);
432 ((void) stream_block);
433 ((void) input);
434 ((void) output);
435
436 return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE;
437}
438
439
Paul Bakker23986e52011-04-24 08:57:21 +0000440int des_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000441{
Paul Bakkerd61e7d92011-01-18 16:17:47 +0000442 ((void) key_length);
443
Paul Bakker8123e9d2011-01-06 15:37:30 +0000444 return des_setkey_dec( (des_context *) ctx, key );
445}
446
Paul Bakker23986e52011-04-24 08:57:21 +0000447int des_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000448{
Paul Bakkerd61e7d92011-01-18 16:17:47 +0000449 ((void) key_length);
450
Paul Bakker8123e9d2011-01-06 15:37:30 +0000451 return des_setkey_enc( (des_context *) ctx, key );
452}
453
Paul Bakker23986e52011-04-24 08:57:21 +0000454int des3_set2key_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000455{
Paul Bakkerd61e7d92011-01-18 16:17:47 +0000456 ((void) key_length);
457
Paul Bakker8123e9d2011-01-06 15:37:30 +0000458 return des3_set2key_dec( (des3_context *) ctx, key );
459}
460
Paul Bakker23986e52011-04-24 08:57:21 +0000461int des3_set2key_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000462{
Paul Bakkerd61e7d92011-01-18 16:17:47 +0000463 ((void) key_length);
464
Paul Bakker8123e9d2011-01-06 15:37:30 +0000465 return des3_set2key_enc( (des3_context *) ctx, key );
466}
467
Paul Bakker23986e52011-04-24 08:57:21 +0000468int des3_set3key_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000469{
Paul Bakkerd61e7d92011-01-18 16:17:47 +0000470 ((void) key_length);
471
Paul Bakker8123e9d2011-01-06 15:37:30 +0000472 return des3_set3key_dec( (des3_context *) ctx, key );
473}
474
Paul Bakker23986e52011-04-24 08:57:21 +0000475int des3_set3key_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length )
Paul Bakker8123e9d2011-01-06 15:37:30 +0000476{
Paul Bakkerd61e7d92011-01-18 16:17:47 +0000477 ((void) key_length);
478
Paul Bakker8123e9d2011-01-06 15:37:30 +0000479 return des3_set3key_enc( (des3_context *) ctx, key );
480}
481
482static void * des_ctx_alloc( void )
483{
484 return malloc( sizeof( des_context ) );
485}
486
487static void * des3_ctx_alloc( void )
488{
489 return malloc( sizeof( des3_context ) );
490}
491
492static void des_ctx_free( void *ctx )
493{
494 free( ctx );
495}
496
Paul Bakker343a8702011-06-09 14:27:58 +0000497const cipher_base_t des_info = {
Paul Bakker23986e52011-04-24 08:57:21 +0000498 POLARSSL_CIPHER_ID_DES,
Paul Bakker23986e52011-04-24 08:57:21 +0000499 des_crypt_cbc_wrap,
Paul Bakker343a8702011-06-09 14:27:58 +0000500 des_crypt_cfb128_wrap,
501 des_crypt_ctr_wrap,
Paul Bakker23986e52011-04-24 08:57:21 +0000502 des_setkey_enc_wrap,
503 des_setkey_dec_wrap,
504 des_ctx_alloc,
505 des_ctx_free
Paul Bakker8123e9d2011-01-06 15:37:30 +0000506};
507
Paul Bakker343a8702011-06-09 14:27:58 +0000508const cipher_info_t des_cbc_info = {
509 POLARSSL_CIPHER_DES_CBC,
Paul Bakker23986e52011-04-24 08:57:21 +0000510 POLARSSL_MODE_CBC,
Paul Bakker343a8702011-06-09 14:27:58 +0000511 POLARSSL_KEY_LENGTH_DES,
512 "DES-CBC",
513 8,
514 8,
515 &des_info
516};
517
518const cipher_base_t des_ede_info = {
519 POLARSSL_CIPHER_ID_DES,
Paul Bakker23986e52011-04-24 08:57:21 +0000520 des3_crypt_cbc_wrap,
Paul Bakker343a8702011-06-09 14:27:58 +0000521 des_crypt_cfb128_wrap,
522 des_crypt_ctr_wrap,
Paul Bakker23986e52011-04-24 08:57:21 +0000523 des3_set2key_enc_wrap,
524 des3_set2key_dec_wrap,
525 des3_ctx_alloc,
526 des_ctx_free
Paul Bakker8123e9d2011-01-06 15:37:30 +0000527};
528
Paul Bakker343a8702011-06-09 14:27:58 +0000529const cipher_info_t des_ede_cbc_info = {
530 POLARSSL_CIPHER_DES_EDE_CBC,
531 POLARSSL_MODE_CBC,
532 POLARSSL_KEY_LENGTH_DES_EDE,
533 "DES-EDE-CBC",
534 16,
535 16,
536 &des_ede_info
537};
538
539const cipher_base_t des_ede3_info = {
540 POLARSSL_CIPHER_ID_DES,
541 des3_crypt_cbc_wrap,
542 des_crypt_cfb128_wrap,
543 des_crypt_ctr_wrap,
544 des3_set3key_enc_wrap,
545 des3_set3key_dec_wrap,
546 des3_ctx_alloc,
547 des_ctx_free
548};
549
Paul Bakker8123e9d2011-01-06 15:37:30 +0000550const cipher_info_t des_ede3_cbc_info = {
Paul Bakker23986e52011-04-24 08:57:21 +0000551 POLARSSL_CIPHER_DES_EDE3_CBC,
Paul Bakker23986e52011-04-24 08:57:21 +0000552 POLARSSL_MODE_CBC,
553 POLARSSL_KEY_LENGTH_DES_EDE3,
554 "DES-EDE3-CBC",
555 8,
556 8,
Paul Bakker343a8702011-06-09 14:27:58 +0000557 &des_ede3_info
Paul Bakker8123e9d2011-01-06 15:37:30 +0000558};
559#endif
560
Paul Bakkerfab5c822012-02-06 16:45:10 +0000561#if defined(POLARSSL_CIPHER_NULL_CIPHER)
562static void * null_ctx_alloc( void )
563{
564 return (void *) 1;
565}
566
567
568static void null_ctx_free( void *ctx )
569{
570 ((void) ctx);
571}
572
573const cipher_base_t null_base_info = {
574 POLARSSL_CIPHER_ID_NULL,
575 NULL,
576 NULL,
577 NULL,
578 NULL,
579 NULL,
580 null_ctx_alloc,
581 null_ctx_free
582};
583
584const cipher_info_t null_cipher_info = {
585 POLARSSL_CIPHER_NULL,
586 POLARSSL_MODE_NULL,
587 0,
588 "NULL",
589 1,
590 1,
591 &null_base_info
592};
593#endif /* defined(POLARSSL_CIPHER_NULL_CIPHER) */
594
Paul Bakker8123e9d2011-01-06 15:37:30 +0000595#endif