Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 1 | /** |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 2 | * \file cipher_wrap.c |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 3 | * |
Paul Bakker | 2028156 | 2011-11-11 10:34:04 +0000 | [diff] [blame] | 4 | * \brief Generic cipher wrapper for PolarSSL |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 5 | * |
| 6 | * \author Adriaan de Jong <dejong@fox-it.com> |
| 7 | * |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 8 | * Copyright (C) 2006-2013, Brainspark B.V. |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 9 | * |
| 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 Bakker | f654371 | 2012-03-05 14:01:29 +0000 | [diff] [blame] | 35 | |
| 36 | #if defined(POLARSSL_AES_C) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 37 | #include "polarssl/aes.h" |
Paul Bakker | f654371 | 2012-03-05 14:01:29 +0000 | [diff] [blame] | 38 | #endif |
| 39 | |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 40 | #if defined(POLARSSL_ARC4_C) |
| 41 | #include "polarssl/arc4.h" |
| 42 | #endif |
| 43 | |
Paul Bakker | f654371 | 2012-03-05 14:01:29 +0000 | [diff] [blame] | 44 | #if defined(POLARSSL_CAMELLIA_C) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 45 | #include "polarssl/camellia.h" |
Paul Bakker | f654371 | 2012-03-05 14:01:29 +0000 | [diff] [blame] | 46 | #endif |
| 47 | |
| 48 | #if defined(POLARSSL_DES_C) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 49 | #include "polarssl/des.h" |
Paul Bakker | 02f6169 | 2012-03-15 10:54:25 +0000 | [diff] [blame] | 50 | #endif |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 51 | |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 52 | #if defined(POLARSSL_BLOWFISH_C) |
| 53 | #include "polarssl/blowfish.h" |
| 54 | #endif |
| 55 | |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 56 | #if defined(POLARSSL_GCM_C) |
| 57 | #include "polarssl/gcm.h" |
| 58 | #endif |
| 59 | |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 60 | #if defined(POLARSSL_MEMORY_C) |
| 61 | #include "polarssl/memory.h" |
| 62 | #else |
| 63 | #define polarssl_malloc malloc |
| 64 | #define polarssl_free free |
| 65 | #endif |
| 66 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 67 | #include <stdlib.h> |
| 68 | |
| 69 | #if defined(POLARSSL_AES_C) |
| 70 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 71 | static int aes_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 72 | const unsigned char *input, unsigned char *output ) |
| 73 | { |
| 74 | return aes_crypt_ecb( (aes_context *) ctx, operation, input, output ); |
| 75 | } |
| 76 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 77 | static int aes_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 78 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 79 | { |
| 80 | return aes_crypt_cbc( (aes_context *) ctx, operation, length, iv, input, output ); |
| 81 | } |
| 82 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 83 | static int aes_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 84 | size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 85 | { |
| 86 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 87 | return aes_crypt_cfb128( (aes_context *) ctx, operation, length, iv_off, iv, input, output ); |
| 88 | #else |
| 89 | ((void) ctx); |
| 90 | ((void) operation); |
| 91 | ((void) length); |
| 92 | ((void) iv_off); |
| 93 | ((void) iv); |
| 94 | ((void) input); |
| 95 | ((void) output); |
| 96 | |
| 97 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 98 | #endif |
| 99 | } |
| 100 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 101 | static int aes_crypt_ctr_wrap( void *ctx, size_t length, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 102 | size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, |
| 103 | const unsigned char *input, unsigned char *output ) |
| 104 | { |
| 105 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 106 | return aes_crypt_ctr( (aes_context *) ctx, length, nc_off, nonce_counter, |
| 107 | stream_block, input, output ); |
| 108 | #else |
| 109 | ((void) ctx); |
| 110 | ((void) length); |
| 111 | ((void) nc_off); |
| 112 | ((void) nonce_counter); |
| 113 | ((void) stream_block); |
| 114 | ((void) input); |
| 115 | ((void) output); |
| 116 | |
| 117 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 118 | #endif |
| 119 | } |
| 120 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 121 | static int aes_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 122 | { |
| 123 | return aes_setkey_dec( (aes_context *) ctx, key, key_length ); |
| 124 | } |
| 125 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 126 | static int aes_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 127 | { |
| 128 | return aes_setkey_enc( (aes_context *) ctx, key, key_length ); |
| 129 | } |
| 130 | |
| 131 | static void * aes_ctx_alloc( void ) |
| 132 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 133 | return polarssl_malloc( sizeof( aes_context ) ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | static void aes_ctx_free( void *ctx ) |
| 137 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 138 | polarssl_free( ctx ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 139 | } |
| 140 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 141 | const cipher_base_t aes_info = { |
| 142 | POLARSSL_CIPHER_ID_AES, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 143 | aes_crypt_ecb_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 144 | aes_crypt_cbc_wrap, |
| 145 | aes_crypt_cfb128_wrap, |
| 146 | aes_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 147 | NULL, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 148 | aes_setkey_enc_wrap, |
| 149 | aes_setkey_dec_wrap, |
| 150 | aes_ctx_alloc, |
| 151 | aes_ctx_free |
| 152 | }; |
| 153 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 154 | const cipher_info_t aes_128_ecb_info = { |
| 155 | POLARSSL_CIPHER_AES_128_ECB, |
| 156 | POLARSSL_MODE_ECB, |
| 157 | 128, |
| 158 | "AES-128-ECB", |
| 159 | 16, |
| 160 | 0, |
| 161 | 16, |
| 162 | &aes_info |
| 163 | }; |
| 164 | |
| 165 | const cipher_info_t aes_192_ecb_info = { |
| 166 | POLARSSL_CIPHER_AES_192_ECB, |
| 167 | POLARSSL_MODE_ECB, |
| 168 | 192, |
| 169 | "AES-192-ECB", |
| 170 | 16, |
| 171 | 0, |
| 172 | 16, |
| 173 | &aes_info |
| 174 | }; |
| 175 | |
| 176 | const cipher_info_t aes_256_ecb_info = { |
| 177 | POLARSSL_CIPHER_AES_256_ECB, |
| 178 | POLARSSL_MODE_ECB, |
| 179 | 256, |
| 180 | "AES-256-ECB", |
| 181 | 16, |
| 182 | 0, |
| 183 | 16, |
| 184 | &aes_info |
| 185 | }; |
| 186 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 187 | const cipher_info_t aes_128_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 188 | POLARSSL_CIPHER_AES_128_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 189 | POLARSSL_MODE_CBC, |
| 190 | 128, |
| 191 | "AES-128-CBC", |
| 192 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 193 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 194 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 195 | &aes_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 196 | }; |
| 197 | |
| 198 | const cipher_info_t aes_192_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 199 | POLARSSL_CIPHER_AES_192_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 200 | POLARSSL_MODE_CBC, |
| 201 | 192, |
| 202 | "AES-192-CBC", |
| 203 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 204 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 205 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 206 | &aes_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 207 | }; |
| 208 | |
| 209 | const cipher_info_t aes_256_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 210 | POLARSSL_CIPHER_AES_256_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 211 | POLARSSL_MODE_CBC, |
| 212 | 256, |
| 213 | "AES-256-CBC", |
| 214 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 215 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 216 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 217 | &aes_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 218 | }; |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 219 | |
| 220 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 221 | const cipher_info_t aes_128_cfb128_info = { |
| 222 | POLARSSL_CIPHER_AES_128_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 223 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 224 | 128, |
| 225 | "AES-128-CFB128", |
| 226 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 227 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 228 | 16, |
| 229 | &aes_info |
| 230 | }; |
| 231 | |
| 232 | const cipher_info_t aes_192_cfb128_info = { |
| 233 | POLARSSL_CIPHER_AES_192_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 234 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 235 | 192, |
| 236 | "AES-192-CFB128", |
| 237 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 238 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 239 | 16, |
| 240 | &aes_info |
| 241 | }; |
| 242 | |
| 243 | const cipher_info_t aes_256_cfb128_info = { |
| 244 | POLARSSL_CIPHER_AES_256_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 245 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 246 | 256, |
| 247 | "AES-256-CFB128", |
| 248 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 249 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 250 | 16, |
| 251 | &aes_info |
| 252 | }; |
| 253 | #endif /* POLARSSL_CIPHER_MODE_CFB */ |
| 254 | |
| 255 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 256 | const cipher_info_t aes_128_ctr_info = { |
| 257 | POLARSSL_CIPHER_AES_128_CTR, |
| 258 | POLARSSL_MODE_CTR, |
| 259 | 128, |
| 260 | "AES-128-CTR", |
| 261 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 262 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 263 | 16, |
| 264 | &aes_info |
| 265 | }; |
| 266 | |
| 267 | const cipher_info_t aes_192_ctr_info = { |
| 268 | POLARSSL_CIPHER_AES_192_CTR, |
| 269 | POLARSSL_MODE_CTR, |
| 270 | 192, |
| 271 | "AES-192-CTR", |
| 272 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 273 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 274 | 16, |
| 275 | &aes_info |
| 276 | }; |
| 277 | |
| 278 | const cipher_info_t aes_256_ctr_info = { |
| 279 | POLARSSL_CIPHER_AES_256_CTR, |
| 280 | POLARSSL_MODE_CTR, |
| 281 | 256, |
| 282 | "AES-256-CTR", |
| 283 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 284 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 285 | 16, |
| 286 | &aes_info |
| 287 | }; |
| 288 | #endif /* POLARSSL_CIPHER_MODE_CTR */ |
| 289 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 290 | #if defined(POLARSSL_GCM_C) |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 291 | static void *gcm_ctx_alloc( void ) |
| 292 | { |
| 293 | return polarssl_malloc( sizeof( gcm_context ) ); |
| 294 | } |
| 295 | |
| 296 | static void gcm_ctx_free( void *ctx ) |
| 297 | { |
| 298 | polarssl_free( ctx ); |
| 299 | } |
| 300 | |
Paul Bakker | 43aff2a | 2013-09-09 00:10:27 +0200 | [diff] [blame] | 301 | static int gcm_aes_setkey_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 302 | { |
Paul Bakker | 43aff2a | 2013-09-09 00:10:27 +0200 | [diff] [blame] | 303 | return gcm_init( (gcm_context *) ctx, POLARSSL_CIPHER_ID_AES, |
| 304 | key, key_length ); |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | const cipher_base_t gcm_aes_info = { |
| 308 | POLARSSL_CIPHER_ID_AES, |
| 309 | NULL, |
| 310 | NULL, |
| 311 | NULL, |
| 312 | NULL, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 313 | NULL, |
Paul Bakker | 43aff2a | 2013-09-09 00:10:27 +0200 | [diff] [blame] | 314 | gcm_aes_setkey_wrap, |
| 315 | gcm_aes_setkey_wrap, |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 316 | gcm_ctx_alloc, |
| 317 | gcm_ctx_free, |
| 318 | }; |
| 319 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 320 | const cipher_info_t aes_128_gcm_info = { |
| 321 | POLARSSL_CIPHER_AES_128_GCM, |
| 322 | POLARSSL_MODE_GCM, |
| 323 | 128, |
| 324 | "AES-128-GCM", |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 325 | 12, |
| 326 | 1, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 327 | 16, |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 328 | &gcm_aes_info |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 329 | }; |
| 330 | |
Manuel Pégourié-Gonnard | 83f3fc0 | 2013-09-04 12:07:24 +0200 | [diff] [blame] | 331 | const cipher_info_t aes_192_gcm_info = { |
| 332 | POLARSSL_CIPHER_AES_192_GCM, |
| 333 | POLARSSL_MODE_GCM, |
| 334 | 192, |
| 335 | "AES-192-GCM", |
| 336 | 12, |
| 337 | 1, |
| 338 | 16, |
| 339 | &gcm_aes_info |
| 340 | }; |
| 341 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 342 | const cipher_info_t aes_256_gcm_info = { |
| 343 | POLARSSL_CIPHER_AES_256_GCM, |
| 344 | POLARSSL_MODE_GCM, |
| 345 | 256, |
| 346 | "AES-256-GCM", |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 347 | 12, |
| 348 | 1, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 349 | 16, |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 350 | &gcm_aes_info |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 351 | }; |
| 352 | #endif /* POLARSSL_GCM_C */ |
| 353 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 354 | #endif |
| 355 | |
| 356 | #if defined(POLARSSL_CAMELLIA_C) |
| 357 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 358 | static int camellia_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 359 | const unsigned char *input, unsigned char *output ) |
| 360 | { |
| 361 | return camellia_crypt_ecb( (camellia_context *) ctx, operation, input, output ); |
| 362 | } |
| 363 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 364 | static int camellia_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 365 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 366 | { |
| 367 | return camellia_crypt_cbc( (camellia_context *) ctx, operation, length, iv, input, output ); |
| 368 | } |
| 369 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 370 | static int camellia_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 371 | size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 372 | { |
| 373 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 374 | return camellia_crypt_cfb128( (camellia_context *) ctx, operation, length, iv_off, iv, input, output ); |
| 375 | #else |
| 376 | ((void) ctx); |
| 377 | ((void) operation); |
| 378 | ((void) length); |
| 379 | ((void) iv_off); |
| 380 | ((void) iv); |
| 381 | ((void) input); |
| 382 | ((void) output); |
| 383 | |
| 384 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 385 | #endif |
| 386 | } |
| 387 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 388 | static int camellia_crypt_ctr_wrap( void *ctx, size_t length, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 389 | size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, |
| 390 | const unsigned char *input, unsigned char *output ) |
| 391 | { |
| 392 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 393 | return camellia_crypt_ctr( (camellia_context *) ctx, length, nc_off, nonce_counter, |
| 394 | stream_block, input, output ); |
| 395 | #else |
| 396 | ((void) ctx); |
| 397 | ((void) length); |
| 398 | ((void) nc_off); |
| 399 | ((void) nonce_counter); |
| 400 | ((void) stream_block); |
| 401 | ((void) input); |
| 402 | ((void) output); |
| 403 | |
| 404 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 405 | #endif |
| 406 | } |
| 407 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 408 | static int camellia_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 409 | { |
| 410 | return camellia_setkey_dec( (camellia_context *) ctx, key, key_length ); |
| 411 | } |
| 412 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 413 | static int camellia_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 414 | { |
| 415 | return camellia_setkey_enc( (camellia_context *) ctx, key, key_length ); |
| 416 | } |
| 417 | |
| 418 | static void * camellia_ctx_alloc( void ) |
| 419 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 420 | return polarssl_malloc( sizeof( camellia_context ) ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | static void camellia_ctx_free( void *ctx ) |
| 424 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 425 | polarssl_free( ctx ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 426 | } |
| 427 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 428 | const cipher_base_t camellia_info = { |
| 429 | POLARSSL_CIPHER_ID_CAMELLIA, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 430 | camellia_crypt_ecb_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 431 | camellia_crypt_cbc_wrap, |
| 432 | camellia_crypt_cfb128_wrap, |
| 433 | camellia_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 434 | NULL, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 435 | camellia_setkey_enc_wrap, |
| 436 | camellia_setkey_dec_wrap, |
| 437 | camellia_ctx_alloc, |
| 438 | camellia_ctx_free |
| 439 | }; |
| 440 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 441 | const cipher_info_t camellia_128_ecb_info = { |
| 442 | POLARSSL_CIPHER_CAMELLIA_128_ECB, |
| 443 | POLARSSL_MODE_ECB, |
| 444 | 128, |
| 445 | "CAMELLIA-128-ECB", |
| 446 | 16, |
| 447 | 0, |
| 448 | 16, |
| 449 | &camellia_info |
| 450 | }; |
| 451 | |
| 452 | const cipher_info_t camellia_192_ecb_info = { |
| 453 | POLARSSL_CIPHER_CAMELLIA_192_ECB, |
| 454 | POLARSSL_MODE_ECB, |
| 455 | 192, |
| 456 | "CAMELLIA-192-ECB", |
| 457 | 16, |
| 458 | 0, |
| 459 | 16, |
| 460 | &camellia_info |
| 461 | }; |
| 462 | |
| 463 | const cipher_info_t camellia_256_ecb_info = { |
| 464 | POLARSSL_CIPHER_CAMELLIA_256_ECB, |
| 465 | POLARSSL_MODE_ECB, |
| 466 | 256, |
| 467 | "CAMELLIA-256-ECB", |
| 468 | 16, |
| 469 | 0, |
| 470 | 16, |
| 471 | &camellia_info |
| 472 | }; |
| 473 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 474 | const cipher_info_t camellia_128_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 475 | POLARSSL_CIPHER_CAMELLIA_128_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 476 | POLARSSL_MODE_CBC, |
| 477 | 128, |
| 478 | "CAMELLIA-128-CBC", |
| 479 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 480 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 481 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 482 | &camellia_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 483 | }; |
| 484 | |
| 485 | const cipher_info_t camellia_192_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 486 | POLARSSL_CIPHER_CAMELLIA_192_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 487 | POLARSSL_MODE_CBC, |
| 488 | 192, |
| 489 | "CAMELLIA-192-CBC", |
| 490 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 491 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 492 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 493 | &camellia_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 494 | }; |
| 495 | |
| 496 | const cipher_info_t camellia_256_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 497 | POLARSSL_CIPHER_CAMELLIA_256_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 498 | POLARSSL_MODE_CBC, |
| 499 | 256, |
| 500 | "CAMELLIA-256-CBC", |
| 501 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 502 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 503 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 504 | &camellia_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 505 | }; |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 506 | |
| 507 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 508 | const cipher_info_t camellia_128_cfb128_info = { |
| 509 | POLARSSL_CIPHER_CAMELLIA_128_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 510 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 511 | 128, |
| 512 | "CAMELLIA-128-CFB128", |
| 513 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 514 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 515 | 16, |
| 516 | &camellia_info |
| 517 | }; |
| 518 | |
| 519 | const cipher_info_t camellia_192_cfb128_info = { |
| 520 | POLARSSL_CIPHER_CAMELLIA_192_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 521 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 522 | 192, |
| 523 | "CAMELLIA-192-CFB128", |
| 524 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 525 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 526 | 16, |
| 527 | &camellia_info |
| 528 | }; |
| 529 | |
| 530 | const cipher_info_t camellia_256_cfb128_info = { |
| 531 | POLARSSL_CIPHER_CAMELLIA_256_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 532 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 533 | 256, |
| 534 | "CAMELLIA-256-CFB128", |
| 535 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 536 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 537 | 16, |
| 538 | &camellia_info |
| 539 | }; |
| 540 | #endif /* POLARSSL_CIPHER_MODE_CFB */ |
| 541 | |
| 542 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 543 | const cipher_info_t camellia_128_ctr_info = { |
| 544 | POLARSSL_CIPHER_CAMELLIA_128_CTR, |
| 545 | POLARSSL_MODE_CTR, |
| 546 | 128, |
| 547 | "CAMELLIA-128-CTR", |
| 548 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 549 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 550 | 16, |
| 551 | &camellia_info |
| 552 | }; |
| 553 | |
| 554 | const cipher_info_t camellia_192_ctr_info = { |
| 555 | POLARSSL_CIPHER_CAMELLIA_192_CTR, |
| 556 | POLARSSL_MODE_CTR, |
| 557 | 192, |
| 558 | "CAMELLIA-192-CTR", |
| 559 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 560 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 561 | 16, |
| 562 | &camellia_info |
| 563 | }; |
| 564 | |
| 565 | const cipher_info_t camellia_256_ctr_info = { |
| 566 | POLARSSL_CIPHER_CAMELLIA_256_CTR, |
| 567 | POLARSSL_MODE_CTR, |
| 568 | 256, |
| 569 | "CAMELLIA-256-CTR", |
| 570 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 571 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 572 | 16, |
| 573 | &camellia_info |
| 574 | }; |
| 575 | #endif /* POLARSSL_CIPHER_MODE_CTR */ |
| 576 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 577 | #endif |
| 578 | |
| 579 | #if defined(POLARSSL_DES_C) |
| 580 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 581 | static int des_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 582 | const unsigned char *input, unsigned char *output ) |
| 583 | { |
| 584 | ((void) operation); |
| 585 | return des_crypt_ecb( (des_context *) ctx, input, output ); |
| 586 | } |
| 587 | |
| 588 | static int des3_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 589 | const unsigned char *input, unsigned char *output ) |
| 590 | { |
| 591 | ((void) operation); |
| 592 | return des3_crypt_ecb( (des3_context *) ctx, input, output ); |
| 593 | } |
| 594 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 595 | static int des_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 596 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 597 | { |
| 598 | return des_crypt_cbc( (des_context *) ctx, operation, length, iv, input, output ); |
| 599 | } |
| 600 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 601 | static int des3_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 602 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 603 | { |
| 604 | return des3_crypt_cbc( (des3_context *) ctx, operation, length, iv, input, output ); |
| 605 | } |
| 606 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 607 | static int des_crypt_cfb128_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 608 | size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 609 | { |
| 610 | ((void) ctx); |
| 611 | ((void) operation); |
| 612 | ((void) length); |
| 613 | ((void) iv_off); |
| 614 | ((void) iv); |
| 615 | ((void) input); |
| 616 | ((void) output); |
| 617 | |
| 618 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 619 | } |
| 620 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 621 | static int des_crypt_ctr_wrap( void *ctx, size_t length, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 622 | size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, |
| 623 | const unsigned char *input, unsigned char *output ) |
| 624 | { |
| 625 | ((void) ctx); |
| 626 | ((void) length); |
| 627 | ((void) nc_off); |
| 628 | ((void) nonce_counter); |
| 629 | ((void) stream_block); |
| 630 | ((void) input); |
| 631 | ((void) output); |
| 632 | |
| 633 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 634 | } |
| 635 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 636 | static int des_setkey_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 637 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 638 | ((void) key_length); |
| 639 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 640 | return des_setkey_dec( (des_context *) ctx, key ); |
| 641 | } |
| 642 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 643 | static int des_setkey_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 644 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 645 | ((void) key_length); |
| 646 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 647 | return des_setkey_enc( (des_context *) ctx, key ); |
| 648 | } |
| 649 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 650 | static int des3_set2key_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 651 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 652 | ((void) key_length); |
| 653 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 654 | return des3_set2key_dec( (des3_context *) ctx, key ); |
| 655 | } |
| 656 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 657 | static int des3_set2key_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 658 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 659 | ((void) key_length); |
| 660 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 661 | return des3_set2key_enc( (des3_context *) ctx, key ); |
| 662 | } |
| 663 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 664 | static int des3_set3key_dec_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 665 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 666 | ((void) key_length); |
| 667 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 668 | return des3_set3key_dec( (des3_context *) ctx, key ); |
| 669 | } |
| 670 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 671 | static int des3_set3key_enc_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 672 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 673 | ((void) key_length); |
| 674 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 675 | return des3_set3key_enc( (des3_context *) ctx, key ); |
| 676 | } |
| 677 | |
| 678 | static void * des_ctx_alloc( void ) |
| 679 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 680 | return polarssl_malloc( sizeof( des_context ) ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | static void * des3_ctx_alloc( void ) |
| 684 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 685 | return polarssl_malloc( sizeof( des3_context ) ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 686 | } |
| 687 | |
| 688 | static void des_ctx_free( void *ctx ) |
| 689 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 690 | polarssl_free( ctx ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 691 | } |
| 692 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 693 | const cipher_base_t des_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 694 | POLARSSL_CIPHER_ID_DES, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 695 | des_crypt_ecb_wrap, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 696 | des_crypt_cbc_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 697 | des_crypt_cfb128_wrap, |
| 698 | des_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 699 | NULL, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 700 | des_setkey_enc_wrap, |
| 701 | des_setkey_dec_wrap, |
| 702 | des_ctx_alloc, |
| 703 | des_ctx_free |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 704 | }; |
| 705 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 706 | const cipher_info_t des_ecb_info = { |
| 707 | POLARSSL_CIPHER_DES_ECB, |
| 708 | POLARSSL_MODE_ECB, |
| 709 | POLARSSL_KEY_LENGTH_DES, |
| 710 | "DES-ECB", |
| 711 | 8, |
| 712 | 0, |
| 713 | 8, |
| 714 | &des_info |
| 715 | }; |
| 716 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 717 | const cipher_info_t des_cbc_info = { |
| 718 | POLARSSL_CIPHER_DES_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 719 | POLARSSL_MODE_CBC, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 720 | POLARSSL_KEY_LENGTH_DES, |
| 721 | "DES-CBC", |
| 722 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 723 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 724 | 8, |
| 725 | &des_info |
| 726 | }; |
| 727 | |
| 728 | const cipher_base_t des_ede_info = { |
| 729 | POLARSSL_CIPHER_ID_DES, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 730 | des3_crypt_ecb_wrap, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 731 | des3_crypt_cbc_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 732 | des_crypt_cfb128_wrap, |
| 733 | des_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 734 | NULL, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 735 | des3_set2key_enc_wrap, |
| 736 | des3_set2key_dec_wrap, |
| 737 | des3_ctx_alloc, |
| 738 | des_ctx_free |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 739 | }; |
| 740 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 741 | const cipher_info_t des_ede_ecb_info = { |
| 742 | POLARSSL_CIPHER_DES_EDE_ECB, |
| 743 | POLARSSL_MODE_ECB, |
| 744 | POLARSSL_KEY_LENGTH_DES_EDE, |
| 745 | "DES-EDE-ECB", |
| 746 | 8, |
| 747 | 0, |
| 748 | 8, |
| 749 | &des_ede_info |
| 750 | }; |
| 751 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 752 | const cipher_info_t des_ede_cbc_info = { |
| 753 | POLARSSL_CIPHER_DES_EDE_CBC, |
| 754 | POLARSSL_MODE_CBC, |
| 755 | POLARSSL_KEY_LENGTH_DES_EDE, |
| 756 | "DES-EDE-CBC", |
Paul Bakker | 0e34235 | 2013-06-24 19:33:02 +0200 | [diff] [blame] | 757 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 758 | 0, |
Paul Bakker | 0e34235 | 2013-06-24 19:33:02 +0200 | [diff] [blame] | 759 | 8, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 760 | &des_ede_info |
| 761 | }; |
| 762 | |
| 763 | const cipher_base_t des_ede3_info = { |
| 764 | POLARSSL_CIPHER_ID_DES, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 765 | des3_crypt_ecb_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 766 | des3_crypt_cbc_wrap, |
| 767 | des_crypt_cfb128_wrap, |
| 768 | des_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 769 | NULL, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 770 | des3_set3key_enc_wrap, |
| 771 | des3_set3key_dec_wrap, |
| 772 | des3_ctx_alloc, |
| 773 | des_ctx_free |
| 774 | }; |
| 775 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 776 | const cipher_info_t des_ede3_ecb_info = { |
| 777 | POLARSSL_CIPHER_DES_EDE3_ECB, |
| 778 | POLARSSL_MODE_ECB, |
| 779 | POLARSSL_KEY_LENGTH_DES_EDE3, |
| 780 | "DES-EDE3-ECB", |
| 781 | 8, |
| 782 | 0, |
| 783 | 8, |
| 784 | &des_ede3_info |
| 785 | }; |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 786 | const cipher_info_t des_ede3_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 787 | POLARSSL_CIPHER_DES_EDE3_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 788 | POLARSSL_MODE_CBC, |
| 789 | POLARSSL_KEY_LENGTH_DES_EDE3, |
| 790 | "DES-EDE3-CBC", |
| 791 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 792 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 793 | 8, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 794 | &des_ede3_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 795 | }; |
| 796 | #endif |
| 797 | |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 798 | #if defined(POLARSSL_BLOWFISH_C) |
| 799 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 800 | static int blowfish_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 801 | const unsigned char *input, unsigned char *output ) |
| 802 | { |
| 803 | return blowfish_crypt_ecb( (blowfish_context *) ctx, operation, input, output ); |
| 804 | } |
| 805 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 806 | static int blowfish_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 807 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 808 | { |
| 809 | return blowfish_crypt_cbc( (blowfish_context *) ctx, operation, length, iv, input, output ); |
| 810 | } |
| 811 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 812 | static int blowfish_crypt_cfb64_wrap( void *ctx, operation_t operation, size_t length, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 813 | size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 814 | { |
| 815 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 816 | return blowfish_crypt_cfb64( (blowfish_context *) ctx, operation, length, iv_off, iv, input, output ); |
| 817 | #else |
| 818 | ((void) ctx); |
| 819 | ((void) operation); |
| 820 | ((void) length); |
| 821 | ((void) iv_off); |
| 822 | ((void) iv); |
| 823 | ((void) input); |
| 824 | ((void) output); |
| 825 | |
| 826 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 827 | #endif |
| 828 | } |
| 829 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 830 | static int blowfish_crypt_ctr_wrap( void *ctx, size_t length, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 831 | size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, |
| 832 | const unsigned char *input, unsigned char *output ) |
| 833 | { |
| 834 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 835 | return blowfish_crypt_ctr( (blowfish_context *) ctx, length, nc_off, nonce_counter, |
| 836 | stream_block, input, output ); |
| 837 | #else |
| 838 | ((void) ctx); |
| 839 | ((void) length); |
| 840 | ((void) nc_off); |
| 841 | ((void) nonce_counter); |
| 842 | ((void) stream_block); |
| 843 | ((void) input); |
| 844 | ((void) output); |
| 845 | |
| 846 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 847 | #endif |
| 848 | } |
| 849 | |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 850 | static int blowfish_setkey_wrap( void *ctx, const unsigned char *key, unsigned int key_length ) |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 851 | { |
| 852 | return blowfish_setkey( (blowfish_context *) ctx, key, key_length ); |
| 853 | } |
| 854 | |
| 855 | static void * blowfish_ctx_alloc( void ) |
| 856 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 857 | return polarssl_malloc( sizeof( blowfish_context ) ); |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 858 | } |
| 859 | |
| 860 | static void blowfish_ctx_free( void *ctx ) |
| 861 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 862 | polarssl_free( ctx ); |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 863 | } |
| 864 | |
| 865 | const cipher_base_t blowfish_info = { |
| 866 | POLARSSL_CIPHER_ID_BLOWFISH, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 867 | blowfish_crypt_ecb_wrap, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 868 | blowfish_crypt_cbc_wrap, |
| 869 | blowfish_crypt_cfb64_wrap, |
| 870 | blowfish_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 871 | NULL, |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 872 | blowfish_setkey_wrap, |
| 873 | blowfish_setkey_wrap, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 874 | blowfish_ctx_alloc, |
| 875 | blowfish_ctx_free |
| 876 | }; |
| 877 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 878 | const cipher_info_t blowfish_ecb_info = { |
| 879 | POLARSSL_CIPHER_BLOWFISH_ECB, |
| 880 | POLARSSL_MODE_ECB, |
| 881 | 128, |
| 882 | "BLOWFISH-ECB", |
| 883 | 8, |
| 884 | 0, |
| 885 | 8, |
| 886 | &blowfish_info |
| 887 | }; |
| 888 | |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 889 | const cipher_info_t blowfish_cbc_info = { |
| 890 | POLARSSL_CIPHER_BLOWFISH_CBC, |
| 891 | POLARSSL_MODE_CBC, |
Paul Bakker | bfe671f | 2013-04-07 22:35:44 +0200 | [diff] [blame] | 892 | 128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 893 | "BLOWFISH-CBC", |
| 894 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 895 | 0, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 896 | 8, |
| 897 | &blowfish_info |
| 898 | }; |
| 899 | |
| 900 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 901 | const cipher_info_t blowfish_cfb64_info = { |
| 902 | POLARSSL_CIPHER_BLOWFISH_CFB64, |
| 903 | POLARSSL_MODE_CFB, |
Paul Bakker | bfe671f | 2013-04-07 22:35:44 +0200 | [diff] [blame] | 904 | 128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 905 | "BLOWFISH-CFB64", |
| 906 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 907 | 0, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 908 | 8, |
| 909 | &blowfish_info |
| 910 | }; |
| 911 | #endif /* POLARSSL_CIPHER_MODE_CFB */ |
| 912 | |
| 913 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 914 | const cipher_info_t blowfish_ctr_info = { |
| 915 | POLARSSL_CIPHER_BLOWFISH_CTR, |
| 916 | POLARSSL_MODE_CTR, |
Paul Bakker | bfe671f | 2013-04-07 22:35:44 +0200 | [diff] [blame] | 917 | 128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 918 | "BLOWFISH-CTR", |
| 919 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 920 | 0, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 921 | 8, |
| 922 | &blowfish_info |
| 923 | }; |
| 924 | #endif /* POLARSSL_CIPHER_MODE_CTR */ |
| 925 | #endif /* POLARSSL_BLOWFISH_C */ |
| 926 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 927 | #if defined(POLARSSL_ARC4_C) |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 928 | static int arc4_crypt_stream_wrap( void *ctx, size_t length, |
| 929 | const unsigned char *input, |
| 930 | unsigned char *output ) |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 931 | { |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 932 | return( arc4_crypt( (arc4_context *) ctx, length, input, output ) ); |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 933 | } |
| 934 | |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 935 | static int arc4_setkey_wrap( void *ctx, const unsigned char *key, |
| 936 | unsigned int key_length ) |
| 937 | { |
Manuel Pégourié-Gonnard | ce41125 | 2013-09-04 12:28:37 +0200 | [diff] [blame] | 938 | /* we get key_length in bits, arc4 expects it in bytes */ |
| 939 | if( key_length % 8 != 0) |
| 940 | return( POLARSSL_ERR_CIPHER_BAD_INPUT_DATA ); |
| 941 | |
| 942 | arc4_setup( (arc4_context *) ctx, key, key_length / 8 ); |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 943 | return( 0 ); |
| 944 | } |
| 945 | |
| 946 | static void * arc4_ctx_alloc( void ) |
| 947 | { |
| 948 | return polarssl_malloc( sizeof( arc4_context ) ); |
| 949 | } |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 950 | |
| 951 | static void arc4_ctx_free( void *ctx ) |
| 952 | { |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 953 | polarssl_free( ctx ); |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 954 | } |
| 955 | |
| 956 | const cipher_base_t arc4_base_info = { |
| 957 | POLARSSL_CIPHER_ID_ARC4, |
| 958 | NULL, |
| 959 | NULL, |
| 960 | NULL, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 961 | NULL, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 962 | arc4_crypt_stream_wrap, |
| 963 | arc4_setkey_wrap, |
| 964 | arc4_setkey_wrap, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 965 | arc4_ctx_alloc, |
| 966 | arc4_ctx_free |
| 967 | }; |
| 968 | |
| 969 | const cipher_info_t arc4_128_info = { |
| 970 | POLARSSL_CIPHER_ARC4_128, |
| 971 | POLARSSL_MODE_STREAM, |
| 972 | 128, |
| 973 | "ARC4-128", |
| 974 | 0, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 975 | 0, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 976 | 1, |
| 977 | &arc4_base_info |
| 978 | }; |
| 979 | #endif /* POLARSSL_ARC4_C */ |
| 980 | |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 981 | #if defined(POLARSSL_CIPHER_NULL_CIPHER) |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 982 | static int null_crypt_stream( void *ctx, size_t length, |
| 983 | const unsigned char *input, |
| 984 | unsigned char *output ) |
| 985 | { |
| 986 | ((void) ctx); |
| 987 | memmove( output, input, length ); |
| 988 | return( 0 ); |
| 989 | } |
| 990 | |
| 991 | static int null_setkey( void *ctx, const unsigned char *key, |
| 992 | unsigned int key_length ) |
| 993 | { |
| 994 | ((void) ctx); |
| 995 | ((void) key); |
| 996 | ((void) key_length); |
| 997 | |
| 998 | return( 0 ); |
| 999 | } |
| 1000 | |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1001 | static void * null_ctx_alloc( void ) |
| 1002 | { |
| 1003 | return (void *) 1; |
| 1004 | } |
| 1005 | |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1006 | static void null_ctx_free( void *ctx ) |
| 1007 | { |
| 1008 | ((void) ctx); |
| 1009 | } |
| 1010 | |
| 1011 | const cipher_base_t null_base_info = { |
| 1012 | POLARSSL_CIPHER_ID_NULL, |
| 1013 | NULL, |
| 1014 | NULL, |
| 1015 | NULL, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 1016 | NULL, |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 1017 | null_crypt_stream, |
| 1018 | null_setkey, |
| 1019 | null_setkey, |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1020 | null_ctx_alloc, |
| 1021 | null_ctx_free |
| 1022 | }; |
| 1023 | |
| 1024 | const cipher_info_t null_cipher_info = { |
| 1025 | POLARSSL_CIPHER_NULL, |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 1026 | POLARSSL_MODE_STREAM, |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1027 | 0, |
| 1028 | "NULL", |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 1029 | 0, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 1030 | 0, |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1031 | 1, |
| 1032 | &null_base_info |
| 1033 | }; |
| 1034 | #endif /* defined(POLARSSL_CIPHER_NULL_CIPHER) */ |
| 1035 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 1036 | #endif |