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 | { |
Manuel Pégourié-Gonnard | 4fe9200 | 2013-09-13 13:45:58 +0200 | [diff] [blame^] | 298 | gcm_free( ctx ); |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 299 | polarssl_free( ctx ); |
| 300 | } |
| 301 | |
Paul Bakker | 43aff2a | 2013-09-09 00:10:27 +0200 | [diff] [blame] | 302 | 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] | 303 | { |
Paul Bakker | 43aff2a | 2013-09-09 00:10:27 +0200 | [diff] [blame] | 304 | return gcm_init( (gcm_context *) ctx, POLARSSL_CIPHER_ID_AES, |
| 305 | key, key_length ); |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | const cipher_base_t gcm_aes_info = { |
| 309 | POLARSSL_CIPHER_ID_AES, |
| 310 | NULL, |
| 311 | NULL, |
| 312 | NULL, |
| 313 | NULL, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 314 | NULL, |
Paul Bakker | 43aff2a | 2013-09-09 00:10:27 +0200 | [diff] [blame] | 315 | gcm_aes_setkey_wrap, |
| 316 | gcm_aes_setkey_wrap, |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 317 | gcm_ctx_alloc, |
| 318 | gcm_ctx_free, |
| 319 | }; |
| 320 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 321 | const cipher_info_t aes_128_gcm_info = { |
| 322 | POLARSSL_CIPHER_AES_128_GCM, |
| 323 | POLARSSL_MODE_GCM, |
| 324 | 128, |
| 325 | "AES-128-GCM", |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 326 | 12, |
| 327 | 1, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 328 | 16, |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 329 | &gcm_aes_info |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 330 | }; |
| 331 | |
Manuel Pégourié-Gonnard | 83f3fc0 | 2013-09-04 12:07:24 +0200 | [diff] [blame] | 332 | const cipher_info_t aes_192_gcm_info = { |
| 333 | POLARSSL_CIPHER_AES_192_GCM, |
| 334 | POLARSSL_MODE_GCM, |
| 335 | 192, |
| 336 | "AES-192-GCM", |
| 337 | 12, |
| 338 | 1, |
| 339 | 16, |
| 340 | &gcm_aes_info |
| 341 | }; |
| 342 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 343 | const cipher_info_t aes_256_gcm_info = { |
| 344 | POLARSSL_CIPHER_AES_256_GCM, |
| 345 | POLARSSL_MODE_GCM, |
| 346 | 256, |
| 347 | "AES-256-GCM", |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 348 | 12, |
| 349 | 1, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 350 | 16, |
Manuel Pégourié-Gonnard | 07f8fa5 | 2013-08-30 18:34:08 +0200 | [diff] [blame] | 351 | &gcm_aes_info |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 352 | }; |
| 353 | #endif /* POLARSSL_GCM_C */ |
| 354 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 355 | #endif |
| 356 | |
| 357 | #if defined(POLARSSL_CAMELLIA_C) |
| 358 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 359 | static int camellia_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 360 | const unsigned char *input, unsigned char *output ) |
| 361 | { |
| 362 | return camellia_crypt_ecb( (camellia_context *) ctx, operation, input, output ); |
| 363 | } |
| 364 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 365 | 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] | 366 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 367 | { |
| 368 | return camellia_crypt_cbc( (camellia_context *) ctx, operation, length, iv, input, output ); |
| 369 | } |
| 370 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 371 | 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] | 372 | size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 373 | { |
| 374 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 375 | return camellia_crypt_cfb128( (camellia_context *) ctx, operation, length, iv_off, iv, input, output ); |
| 376 | #else |
| 377 | ((void) ctx); |
| 378 | ((void) operation); |
| 379 | ((void) length); |
| 380 | ((void) iv_off); |
| 381 | ((void) iv); |
| 382 | ((void) input); |
| 383 | ((void) output); |
| 384 | |
| 385 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 386 | #endif |
| 387 | } |
| 388 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 389 | static int camellia_crypt_ctr_wrap( void *ctx, size_t length, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 390 | size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, |
| 391 | const unsigned char *input, unsigned char *output ) |
| 392 | { |
| 393 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 394 | return camellia_crypt_ctr( (camellia_context *) ctx, length, nc_off, nonce_counter, |
| 395 | stream_block, input, output ); |
| 396 | #else |
| 397 | ((void) ctx); |
| 398 | ((void) length); |
| 399 | ((void) nc_off); |
| 400 | ((void) nonce_counter); |
| 401 | ((void) stream_block); |
| 402 | ((void) input); |
| 403 | ((void) output); |
| 404 | |
| 405 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 406 | #endif |
| 407 | } |
| 408 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 409 | 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] | 410 | { |
| 411 | return camellia_setkey_dec( (camellia_context *) ctx, key, key_length ); |
| 412 | } |
| 413 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 414 | 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] | 415 | { |
| 416 | return camellia_setkey_enc( (camellia_context *) ctx, key, key_length ); |
| 417 | } |
| 418 | |
| 419 | static void * camellia_ctx_alloc( void ) |
| 420 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 421 | return polarssl_malloc( sizeof( camellia_context ) ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | static void camellia_ctx_free( void *ctx ) |
| 425 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 426 | polarssl_free( ctx ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 427 | } |
| 428 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 429 | const cipher_base_t camellia_info = { |
| 430 | POLARSSL_CIPHER_ID_CAMELLIA, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 431 | camellia_crypt_ecb_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 432 | camellia_crypt_cbc_wrap, |
| 433 | camellia_crypt_cfb128_wrap, |
| 434 | camellia_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 435 | NULL, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 436 | camellia_setkey_enc_wrap, |
| 437 | camellia_setkey_dec_wrap, |
| 438 | camellia_ctx_alloc, |
| 439 | camellia_ctx_free |
| 440 | }; |
| 441 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 442 | const cipher_info_t camellia_128_ecb_info = { |
| 443 | POLARSSL_CIPHER_CAMELLIA_128_ECB, |
| 444 | POLARSSL_MODE_ECB, |
| 445 | 128, |
| 446 | "CAMELLIA-128-ECB", |
| 447 | 16, |
| 448 | 0, |
| 449 | 16, |
| 450 | &camellia_info |
| 451 | }; |
| 452 | |
| 453 | const cipher_info_t camellia_192_ecb_info = { |
| 454 | POLARSSL_CIPHER_CAMELLIA_192_ECB, |
| 455 | POLARSSL_MODE_ECB, |
| 456 | 192, |
| 457 | "CAMELLIA-192-ECB", |
| 458 | 16, |
| 459 | 0, |
| 460 | 16, |
| 461 | &camellia_info |
| 462 | }; |
| 463 | |
| 464 | const cipher_info_t camellia_256_ecb_info = { |
| 465 | POLARSSL_CIPHER_CAMELLIA_256_ECB, |
| 466 | POLARSSL_MODE_ECB, |
| 467 | 256, |
| 468 | "CAMELLIA-256-ECB", |
| 469 | 16, |
| 470 | 0, |
| 471 | 16, |
| 472 | &camellia_info |
| 473 | }; |
| 474 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 475 | const cipher_info_t camellia_128_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 476 | POLARSSL_CIPHER_CAMELLIA_128_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 477 | POLARSSL_MODE_CBC, |
| 478 | 128, |
| 479 | "CAMELLIA-128-CBC", |
| 480 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 481 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 482 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 483 | &camellia_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 484 | }; |
| 485 | |
| 486 | const cipher_info_t camellia_192_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 487 | POLARSSL_CIPHER_CAMELLIA_192_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 488 | POLARSSL_MODE_CBC, |
| 489 | 192, |
| 490 | "CAMELLIA-192-CBC", |
| 491 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 492 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 493 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 494 | &camellia_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 495 | }; |
| 496 | |
| 497 | const cipher_info_t camellia_256_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 498 | POLARSSL_CIPHER_CAMELLIA_256_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 499 | POLARSSL_MODE_CBC, |
| 500 | 256, |
| 501 | "CAMELLIA-256-CBC", |
| 502 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 503 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 504 | 16, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 505 | &camellia_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 506 | }; |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 507 | |
| 508 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 509 | const cipher_info_t camellia_128_cfb128_info = { |
| 510 | POLARSSL_CIPHER_CAMELLIA_128_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 511 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 512 | 128, |
| 513 | "CAMELLIA-128-CFB128", |
| 514 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 515 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 516 | 16, |
| 517 | &camellia_info |
| 518 | }; |
| 519 | |
| 520 | const cipher_info_t camellia_192_cfb128_info = { |
| 521 | POLARSSL_CIPHER_CAMELLIA_192_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 522 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 523 | 192, |
| 524 | "CAMELLIA-192-CFB128", |
| 525 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 526 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 527 | 16, |
| 528 | &camellia_info |
| 529 | }; |
| 530 | |
| 531 | const cipher_info_t camellia_256_cfb128_info = { |
| 532 | POLARSSL_CIPHER_CAMELLIA_256_CFB128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 533 | POLARSSL_MODE_CFB, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 534 | 256, |
| 535 | "CAMELLIA-256-CFB128", |
| 536 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 537 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 538 | 16, |
| 539 | &camellia_info |
| 540 | }; |
| 541 | #endif /* POLARSSL_CIPHER_MODE_CFB */ |
| 542 | |
| 543 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 544 | const cipher_info_t camellia_128_ctr_info = { |
| 545 | POLARSSL_CIPHER_CAMELLIA_128_CTR, |
| 546 | POLARSSL_MODE_CTR, |
| 547 | 128, |
| 548 | "CAMELLIA-128-CTR", |
| 549 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 550 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 551 | 16, |
| 552 | &camellia_info |
| 553 | }; |
| 554 | |
| 555 | const cipher_info_t camellia_192_ctr_info = { |
| 556 | POLARSSL_CIPHER_CAMELLIA_192_CTR, |
| 557 | POLARSSL_MODE_CTR, |
| 558 | 192, |
| 559 | "CAMELLIA-192-CTR", |
| 560 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 561 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 562 | 16, |
| 563 | &camellia_info |
| 564 | }; |
| 565 | |
| 566 | const cipher_info_t camellia_256_ctr_info = { |
| 567 | POLARSSL_CIPHER_CAMELLIA_256_CTR, |
| 568 | POLARSSL_MODE_CTR, |
| 569 | 256, |
| 570 | "CAMELLIA-256-CTR", |
| 571 | 16, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 572 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 573 | 16, |
| 574 | &camellia_info |
| 575 | }; |
| 576 | #endif /* POLARSSL_CIPHER_MODE_CTR */ |
| 577 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 578 | #endif |
| 579 | |
| 580 | #if defined(POLARSSL_DES_C) |
| 581 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 582 | static int des_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 583 | const unsigned char *input, unsigned char *output ) |
| 584 | { |
| 585 | ((void) operation); |
| 586 | return des_crypt_ecb( (des_context *) ctx, input, output ); |
| 587 | } |
| 588 | |
| 589 | static int des3_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 590 | const unsigned char *input, unsigned char *output ) |
| 591 | { |
| 592 | ((void) operation); |
| 593 | return des3_crypt_ecb( (des3_context *) ctx, input, output ); |
| 594 | } |
| 595 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 596 | 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] | 597 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 598 | { |
| 599 | return des_crypt_cbc( (des_context *) ctx, operation, length, iv, input, output ); |
| 600 | } |
| 601 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 602 | 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] | 603 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 604 | { |
| 605 | return des3_crypt_cbc( (des3_context *) ctx, operation, length, iv, input, output ); |
| 606 | } |
| 607 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 608 | 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] | 609 | size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 610 | { |
| 611 | ((void) ctx); |
| 612 | ((void) operation); |
| 613 | ((void) length); |
| 614 | ((void) iv_off); |
| 615 | ((void) iv); |
| 616 | ((void) input); |
| 617 | ((void) output); |
| 618 | |
| 619 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 620 | } |
| 621 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 622 | static int des_crypt_ctr_wrap( void *ctx, size_t length, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 623 | size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, |
| 624 | const unsigned char *input, unsigned char *output ) |
| 625 | { |
| 626 | ((void) ctx); |
| 627 | ((void) length); |
| 628 | ((void) nc_off); |
| 629 | ((void) nonce_counter); |
| 630 | ((void) stream_block); |
| 631 | ((void) input); |
| 632 | ((void) output); |
| 633 | |
| 634 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 635 | } |
| 636 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 637 | 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] | 638 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 639 | ((void) key_length); |
| 640 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 641 | return des_setkey_dec( (des_context *) ctx, key ); |
| 642 | } |
| 643 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 644 | 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] | 645 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 646 | ((void) key_length); |
| 647 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 648 | return des_setkey_enc( (des_context *) ctx, key ); |
| 649 | } |
| 650 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 651 | 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] | 652 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 653 | ((void) key_length); |
| 654 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 655 | return des3_set2key_dec( (des3_context *) ctx, key ); |
| 656 | } |
| 657 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 658 | 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] | 659 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 660 | ((void) key_length); |
| 661 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 662 | return des3_set2key_enc( (des3_context *) ctx, key ); |
| 663 | } |
| 664 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 665 | 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] | 666 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 667 | ((void) key_length); |
| 668 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 669 | return des3_set3key_dec( (des3_context *) ctx, key ); |
| 670 | } |
| 671 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 672 | 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] | 673 | { |
Paul Bakker | d61e7d9 | 2011-01-18 16:17:47 +0000 | [diff] [blame] | 674 | ((void) key_length); |
| 675 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 676 | return des3_set3key_enc( (des3_context *) ctx, key ); |
| 677 | } |
| 678 | |
| 679 | static void * des_ctx_alloc( void ) |
| 680 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 681 | return polarssl_malloc( sizeof( des_context ) ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 682 | } |
| 683 | |
| 684 | static void * des3_ctx_alloc( void ) |
| 685 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 686 | return polarssl_malloc( sizeof( des3_context ) ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 687 | } |
| 688 | |
| 689 | static void des_ctx_free( void *ctx ) |
| 690 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 691 | polarssl_free( ctx ); |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 692 | } |
| 693 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 694 | const cipher_base_t des_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 695 | POLARSSL_CIPHER_ID_DES, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 696 | des_crypt_ecb_wrap, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 697 | des_crypt_cbc_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 698 | des_crypt_cfb128_wrap, |
| 699 | des_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 700 | NULL, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 701 | des_setkey_enc_wrap, |
| 702 | des_setkey_dec_wrap, |
| 703 | des_ctx_alloc, |
| 704 | des_ctx_free |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 705 | }; |
| 706 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 707 | const cipher_info_t des_ecb_info = { |
| 708 | POLARSSL_CIPHER_DES_ECB, |
| 709 | POLARSSL_MODE_ECB, |
| 710 | POLARSSL_KEY_LENGTH_DES, |
| 711 | "DES-ECB", |
| 712 | 8, |
| 713 | 0, |
| 714 | 8, |
| 715 | &des_info |
| 716 | }; |
| 717 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 718 | const cipher_info_t des_cbc_info = { |
| 719 | POLARSSL_CIPHER_DES_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 720 | POLARSSL_MODE_CBC, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 721 | POLARSSL_KEY_LENGTH_DES, |
| 722 | "DES-CBC", |
| 723 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 724 | 0, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 725 | 8, |
| 726 | &des_info |
| 727 | }; |
| 728 | |
| 729 | const cipher_base_t des_ede_info = { |
| 730 | POLARSSL_CIPHER_ID_DES, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 731 | des3_crypt_ecb_wrap, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 732 | des3_crypt_cbc_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 733 | des_crypt_cfb128_wrap, |
| 734 | des_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 735 | NULL, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 736 | des3_set2key_enc_wrap, |
| 737 | des3_set2key_dec_wrap, |
| 738 | des3_ctx_alloc, |
| 739 | des_ctx_free |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 740 | }; |
| 741 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 742 | const cipher_info_t des_ede_ecb_info = { |
| 743 | POLARSSL_CIPHER_DES_EDE_ECB, |
| 744 | POLARSSL_MODE_ECB, |
| 745 | POLARSSL_KEY_LENGTH_DES_EDE, |
| 746 | "DES-EDE-ECB", |
| 747 | 8, |
| 748 | 0, |
| 749 | 8, |
| 750 | &des_ede_info |
| 751 | }; |
| 752 | |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 753 | const cipher_info_t des_ede_cbc_info = { |
| 754 | POLARSSL_CIPHER_DES_EDE_CBC, |
| 755 | POLARSSL_MODE_CBC, |
| 756 | POLARSSL_KEY_LENGTH_DES_EDE, |
| 757 | "DES-EDE-CBC", |
Paul Bakker | 0e34235 | 2013-06-24 19:33:02 +0200 | [diff] [blame] | 758 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 759 | 0, |
Paul Bakker | 0e34235 | 2013-06-24 19:33:02 +0200 | [diff] [blame] | 760 | 8, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 761 | &des_ede_info |
| 762 | }; |
| 763 | |
| 764 | const cipher_base_t des_ede3_info = { |
| 765 | POLARSSL_CIPHER_ID_DES, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 766 | des3_crypt_ecb_wrap, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 767 | des3_crypt_cbc_wrap, |
| 768 | des_crypt_cfb128_wrap, |
| 769 | des_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 770 | NULL, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 771 | des3_set3key_enc_wrap, |
| 772 | des3_set3key_dec_wrap, |
| 773 | des3_ctx_alloc, |
| 774 | des_ctx_free |
| 775 | }; |
| 776 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 777 | const cipher_info_t des_ede3_ecb_info = { |
| 778 | POLARSSL_CIPHER_DES_EDE3_ECB, |
| 779 | POLARSSL_MODE_ECB, |
| 780 | POLARSSL_KEY_LENGTH_DES_EDE3, |
| 781 | "DES-EDE3-ECB", |
| 782 | 8, |
| 783 | 0, |
| 784 | 8, |
| 785 | &des_ede3_info |
| 786 | }; |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 787 | const cipher_info_t des_ede3_cbc_info = { |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 788 | POLARSSL_CIPHER_DES_EDE3_CBC, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 789 | POLARSSL_MODE_CBC, |
| 790 | POLARSSL_KEY_LENGTH_DES_EDE3, |
| 791 | "DES-EDE3-CBC", |
| 792 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 793 | 0, |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 794 | 8, |
Paul Bakker | 343a870 | 2011-06-09 14:27:58 +0000 | [diff] [blame] | 795 | &des_ede3_info |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 796 | }; |
| 797 | #endif |
| 798 | |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 799 | #if defined(POLARSSL_BLOWFISH_C) |
| 800 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 801 | static int blowfish_crypt_ecb_wrap( void *ctx, operation_t operation, |
| 802 | const unsigned char *input, unsigned char *output ) |
| 803 | { |
| 804 | return blowfish_crypt_ecb( (blowfish_context *) ctx, operation, input, output ); |
| 805 | } |
| 806 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 807 | 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] | 808 | unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 809 | { |
| 810 | return blowfish_crypt_cbc( (blowfish_context *) ctx, operation, length, iv, input, output ); |
| 811 | } |
| 812 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 813 | 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] | 814 | size_t *iv_off, unsigned char *iv, const unsigned char *input, unsigned char *output ) |
| 815 | { |
| 816 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 817 | return blowfish_crypt_cfb64( (blowfish_context *) ctx, operation, length, iv_off, iv, input, output ); |
| 818 | #else |
| 819 | ((void) ctx); |
| 820 | ((void) operation); |
| 821 | ((void) length); |
| 822 | ((void) iv_off); |
| 823 | ((void) iv); |
| 824 | ((void) input); |
| 825 | ((void) output); |
| 826 | |
| 827 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 828 | #endif |
| 829 | } |
| 830 | |
Paul Bakker | fae35f0 | 2013-03-13 10:33:51 +0100 | [diff] [blame] | 831 | static int blowfish_crypt_ctr_wrap( void *ctx, size_t length, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 832 | size_t *nc_off, unsigned char *nonce_counter, unsigned char *stream_block, |
| 833 | const unsigned char *input, unsigned char *output ) |
| 834 | { |
| 835 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 836 | return blowfish_crypt_ctr( (blowfish_context *) ctx, length, nc_off, nonce_counter, |
| 837 | stream_block, input, output ); |
| 838 | #else |
| 839 | ((void) ctx); |
| 840 | ((void) length); |
| 841 | ((void) nc_off); |
| 842 | ((void) nonce_counter); |
| 843 | ((void) stream_block); |
| 844 | ((void) input); |
| 845 | ((void) output); |
| 846 | |
| 847 | return POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE; |
| 848 | #endif |
| 849 | } |
| 850 | |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 851 | 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] | 852 | { |
| 853 | return blowfish_setkey( (blowfish_context *) ctx, key, key_length ); |
| 854 | } |
| 855 | |
| 856 | static void * blowfish_ctx_alloc( void ) |
| 857 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 858 | return polarssl_malloc( sizeof( blowfish_context ) ); |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 859 | } |
| 860 | |
| 861 | static void blowfish_ctx_free( void *ctx ) |
| 862 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 863 | polarssl_free( ctx ); |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 864 | } |
| 865 | |
| 866 | const cipher_base_t blowfish_info = { |
| 867 | POLARSSL_CIPHER_ID_BLOWFISH, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 868 | blowfish_crypt_ecb_wrap, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 869 | blowfish_crypt_cbc_wrap, |
| 870 | blowfish_crypt_cfb64_wrap, |
| 871 | blowfish_crypt_ctr_wrap, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 872 | NULL, |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 873 | blowfish_setkey_wrap, |
| 874 | blowfish_setkey_wrap, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 875 | blowfish_ctx_alloc, |
| 876 | blowfish_ctx_free |
| 877 | }; |
| 878 | |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 879 | const cipher_info_t blowfish_ecb_info = { |
| 880 | POLARSSL_CIPHER_BLOWFISH_ECB, |
| 881 | POLARSSL_MODE_ECB, |
| 882 | 128, |
| 883 | "BLOWFISH-ECB", |
| 884 | 8, |
| 885 | 0, |
| 886 | 8, |
| 887 | &blowfish_info |
| 888 | }; |
| 889 | |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 890 | const cipher_info_t blowfish_cbc_info = { |
| 891 | POLARSSL_CIPHER_BLOWFISH_CBC, |
| 892 | POLARSSL_MODE_CBC, |
Paul Bakker | bfe671f | 2013-04-07 22:35:44 +0200 | [diff] [blame] | 893 | 128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 894 | "BLOWFISH-CBC", |
| 895 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 896 | 0, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 897 | 8, |
| 898 | &blowfish_info |
| 899 | }; |
| 900 | |
| 901 | #if defined(POLARSSL_CIPHER_MODE_CFB) |
| 902 | const cipher_info_t blowfish_cfb64_info = { |
| 903 | POLARSSL_CIPHER_BLOWFISH_CFB64, |
| 904 | POLARSSL_MODE_CFB, |
Paul Bakker | bfe671f | 2013-04-07 22:35:44 +0200 | [diff] [blame] | 905 | 128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 906 | "BLOWFISH-CFB64", |
| 907 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 908 | 0, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 909 | 8, |
| 910 | &blowfish_info |
| 911 | }; |
| 912 | #endif /* POLARSSL_CIPHER_MODE_CFB */ |
| 913 | |
| 914 | #if defined(POLARSSL_CIPHER_MODE_CTR) |
| 915 | const cipher_info_t blowfish_ctr_info = { |
| 916 | POLARSSL_CIPHER_BLOWFISH_CTR, |
| 917 | POLARSSL_MODE_CTR, |
Paul Bakker | bfe671f | 2013-04-07 22:35:44 +0200 | [diff] [blame] | 918 | 128, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 919 | "BLOWFISH-CTR", |
| 920 | 8, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 921 | 0, |
Paul Bakker | 6132d0a | 2012-07-04 17:10:40 +0000 | [diff] [blame] | 922 | 8, |
| 923 | &blowfish_info |
| 924 | }; |
| 925 | #endif /* POLARSSL_CIPHER_MODE_CTR */ |
| 926 | #endif /* POLARSSL_BLOWFISH_C */ |
| 927 | |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 928 | #if defined(POLARSSL_ARC4_C) |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 929 | static int arc4_crypt_stream_wrap( void *ctx, size_t length, |
| 930 | const unsigned char *input, |
| 931 | unsigned char *output ) |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 932 | { |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 933 | return( arc4_crypt( (arc4_context *) ctx, length, input, output ) ); |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 934 | } |
| 935 | |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 936 | static int arc4_setkey_wrap( void *ctx, const unsigned char *key, |
| 937 | unsigned int key_length ) |
| 938 | { |
Manuel Pégourié-Gonnard | ce41125 | 2013-09-04 12:28:37 +0200 | [diff] [blame] | 939 | /* we get key_length in bits, arc4 expects it in bytes */ |
| 940 | if( key_length % 8 != 0) |
| 941 | return( POLARSSL_ERR_CIPHER_BAD_INPUT_DATA ); |
| 942 | |
| 943 | arc4_setup( (arc4_context *) ctx, key, key_length / 8 ); |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 944 | return( 0 ); |
| 945 | } |
| 946 | |
| 947 | static void * arc4_ctx_alloc( void ) |
| 948 | { |
| 949 | return polarssl_malloc( sizeof( arc4_context ) ); |
| 950 | } |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 951 | |
| 952 | static void arc4_ctx_free( void *ctx ) |
| 953 | { |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 954 | polarssl_free( ctx ); |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 955 | } |
| 956 | |
| 957 | const cipher_base_t arc4_base_info = { |
| 958 | POLARSSL_CIPHER_ID_ARC4, |
| 959 | NULL, |
| 960 | NULL, |
| 961 | NULL, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 962 | NULL, |
Manuel Pégourié-Gonnard | 37e230c | 2013-08-28 13:50:42 +0200 | [diff] [blame] | 963 | arc4_crypt_stream_wrap, |
| 964 | arc4_setkey_wrap, |
| 965 | arc4_setkey_wrap, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 966 | arc4_ctx_alloc, |
| 967 | arc4_ctx_free |
| 968 | }; |
| 969 | |
| 970 | const cipher_info_t arc4_128_info = { |
| 971 | POLARSSL_CIPHER_ARC4_128, |
| 972 | POLARSSL_MODE_STREAM, |
| 973 | 128, |
| 974 | "ARC4-128", |
| 975 | 0, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 976 | 0, |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 977 | 1, |
| 978 | &arc4_base_info |
| 979 | }; |
| 980 | #endif /* POLARSSL_ARC4_C */ |
| 981 | |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 982 | #if defined(POLARSSL_CIPHER_NULL_CIPHER) |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 983 | static int null_crypt_stream( void *ctx, size_t length, |
| 984 | const unsigned char *input, |
| 985 | unsigned char *output ) |
| 986 | { |
| 987 | ((void) ctx); |
| 988 | memmove( output, input, length ); |
| 989 | return( 0 ); |
| 990 | } |
| 991 | |
| 992 | static int null_setkey( void *ctx, const unsigned char *key, |
| 993 | unsigned int key_length ) |
| 994 | { |
| 995 | ((void) ctx); |
| 996 | ((void) key); |
| 997 | ((void) key_length); |
| 998 | |
| 999 | return( 0 ); |
| 1000 | } |
| 1001 | |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1002 | static void * null_ctx_alloc( void ) |
| 1003 | { |
| 1004 | return (void *) 1; |
| 1005 | } |
| 1006 | |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1007 | static void null_ctx_free( void *ctx ) |
| 1008 | { |
| 1009 | ((void) ctx); |
| 1010 | } |
| 1011 | |
| 1012 | const cipher_base_t null_base_info = { |
| 1013 | POLARSSL_CIPHER_ID_NULL, |
| 1014 | NULL, |
| 1015 | NULL, |
| 1016 | NULL, |
Paul Bakker | 5e0efa7 | 2013-09-08 23:04:04 +0200 | [diff] [blame] | 1017 | NULL, |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 1018 | null_crypt_stream, |
| 1019 | null_setkey, |
| 1020 | null_setkey, |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1021 | null_ctx_alloc, |
| 1022 | null_ctx_free |
| 1023 | }; |
| 1024 | |
| 1025 | const cipher_info_t null_cipher_info = { |
| 1026 | POLARSSL_CIPHER_NULL, |
Manuel Pégourié-Gonnard | b5e8588 | 2013-08-28 16:36:14 +0200 | [diff] [blame] | 1027 | POLARSSL_MODE_STREAM, |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1028 | 0, |
| 1029 | "NULL", |
Paul Bakker | 68884e3 | 2013-01-07 18:20:04 +0100 | [diff] [blame] | 1030 | 0, |
Manuel Pégourié-Gonnard | a235b5b | 2013-09-03 13:25:52 +0200 | [diff] [blame] | 1031 | 0, |
Paul Bakker | fab5c82 | 2012-02-06 16:45:10 +0000 | [diff] [blame] | 1032 | 1, |
| 1033 | &null_base_info |
| 1034 | }; |
| 1035 | #endif /* defined(POLARSSL_CIPHER_NULL_CIPHER) */ |
| 1036 | |
Paul Bakker | 8123e9d | 2011-01-06 15:37:30 +0000 | [diff] [blame] | 1037 | #endif |