32 #if defined(POLARSSL_CIPHER_C)
36 #if defined(POLARSSL_AES_C)
40 #if defined(POLARSSL_CAMELLIA_C)
44 #if defined(POLARSSL_DES_C)
48 #if defined(POLARSSL_BLOWFISH_C)
55 static void polarssl_zeroize(
void *v,
size_t n ) {
56 volatile unsigned char *p = v;
while( n-- ) *p++ = 0;
59 #if defined(POLARSSL_AES_C)
61 static int aes_crypt_cbc_wrap(
void *ctx,
operation_t operation,
size_t length,
62 unsigned char *iv,
const unsigned char *input,
unsigned char *output )
67 static int aes_crypt_cfb128_wrap(
void *ctx,
operation_t operation,
size_t length,
68 size_t *iv_off,
unsigned char *iv,
const unsigned char *input,
unsigned char *output )
70 #if defined(POLARSSL_CIPHER_MODE_CFB)
85 static int aes_crypt_ctr_wrap(
void *ctx,
size_t length,
86 size_t *nc_off,
unsigned char *nonce_counter,
unsigned char *stream_block,
87 const unsigned char *input,
unsigned char *output )
89 #if defined(POLARSSL_CIPHER_MODE_CTR)
91 stream_block, input, output );
96 ((void) nonce_counter);
97 ((void) stream_block);
105 static int aes_setkey_dec_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
110 static int aes_setkey_enc_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
115 static void * aes_ctx_alloc(
void )
120 static void aes_ctx_free(
void *ctx )
129 aes_crypt_cfb128_wrap,
167 #if defined(POLARSSL_CIPHER_MODE_CFB)
199 #if defined(POLARSSL_CIPHER_MODE_CTR)
233 #if defined(POLARSSL_CAMELLIA_C)
235 static int camellia_crypt_cbc_wrap(
void *ctx,
operation_t operation,
size_t length,
236 unsigned char *iv,
const unsigned char *input,
unsigned char *output )
241 static int camellia_crypt_cfb128_wrap(
void *ctx,
operation_t operation,
size_t length,
242 size_t *iv_off,
unsigned char *iv,
const unsigned char *input,
unsigned char *output )
244 #if defined(POLARSSL_CIPHER_MODE_CFB)
259 static int camellia_crypt_ctr_wrap(
void *ctx,
size_t length,
260 size_t *nc_off,
unsigned char *nonce_counter,
unsigned char *stream_block,
261 const unsigned char *input,
unsigned char *output )
263 #if defined(POLARSSL_CIPHER_MODE_CTR)
265 stream_block, input, output );
270 ((void) nonce_counter);
271 ((void) stream_block);
279 static int camellia_setkey_dec_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
284 static int camellia_setkey_enc_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
289 static void * camellia_ctx_alloc(
void )
294 static void camellia_ctx_free(
void *ctx )
302 camellia_crypt_cbc_wrap,
303 camellia_crypt_cfb128_wrap,
304 camellia_crypt_ctr_wrap,
305 camellia_setkey_enc_wrap,
306 camellia_setkey_dec_wrap,
341 #if defined(POLARSSL_CIPHER_MODE_CFB)
346 "CAMELLIA-128-CFB128",
356 "CAMELLIA-192-CFB128",
366 "CAMELLIA-256-CFB128",
373 #if defined(POLARSSL_CIPHER_MODE_CTR)
407 #if defined(POLARSSL_DES_C)
409 static int des_crypt_cbc_wrap(
void *ctx,
operation_t operation,
size_t length,
410 unsigned char *iv,
const unsigned char *input,
unsigned char *output )
415 static int des3_crypt_cbc_wrap(
void *ctx,
operation_t operation,
size_t length,
416 unsigned char *iv,
const unsigned char *input,
unsigned char *output )
421 static int des_crypt_cfb128_wrap(
void *ctx,
operation_t operation,
size_t length,
422 size_t *iv_off,
unsigned char *iv,
const unsigned char *input,
unsigned char *output )
435 static int des_crypt_ctr_wrap(
void *ctx,
size_t length,
436 size_t *nc_off,
unsigned char *nonce_counter,
unsigned char *stream_block,
437 const unsigned char *input,
unsigned char *output )
442 ((void) nonce_counter);
443 ((void) stream_block);
451 static int des_setkey_dec_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
458 static int des_setkey_enc_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
465 static int des3_set2key_dec_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
472 static int des3_set2key_enc_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
479 static int des3_set3key_dec_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
486 static int des3_set3key_enc_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
493 static void * des_ctx_alloc(
void )
498 static void * des3_ctx_alloc(
void )
503 static void des_ctx_free(
void *ctx )
509 static void des3_ctx_free(
void *ctx )
518 des_crypt_cfb128_wrap,
539 des_crypt_cfb128_wrap,
541 des3_set2key_enc_wrap,
542 des3_set2key_dec_wrap,
560 des_crypt_cfb128_wrap,
562 des3_set3key_enc_wrap,
563 des3_set3key_dec_wrap,
579 #if defined(POLARSSL_BLOWFISH_C)
581 static int blowfish_crypt_cbc_wrap(
void *ctx,
operation_t operation,
size_t length,
582 unsigned char *iv,
const unsigned char *input,
unsigned char *output )
587 static int blowfish_crypt_cfb64_wrap(
void *ctx,
operation_t operation,
size_t length,
588 size_t *iv_off,
unsigned char *iv,
const unsigned char *input,
unsigned char *output )
590 #if defined(POLARSSL_CIPHER_MODE_CFB)
605 static int blowfish_crypt_ctr_wrap(
void *ctx,
size_t length,
606 size_t *nc_off,
unsigned char *nonce_counter,
unsigned char *stream_block,
607 const unsigned char *input,
unsigned char *output )
609 #if defined(POLARSSL_CIPHER_MODE_CTR)
611 stream_block, input, output );
616 ((void) nonce_counter);
617 ((void) stream_block);
625 static int blowfish_setkey_dec_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
630 static int blowfish_setkey_enc_wrap(
void *ctx,
const unsigned char *key,
unsigned int key_length )
635 static void * blowfish_ctx_alloc(
void )
640 static void blowfish_ctx_free(
void *ctx )
648 blowfish_crypt_cbc_wrap,
649 blowfish_crypt_cfb64_wrap,
650 blowfish_crypt_ctr_wrap,
651 blowfish_setkey_enc_wrap,
652 blowfish_setkey_dec_wrap,
667 #if defined(POLARSSL_CIPHER_MODE_CFB)
679 #if defined(POLARSSL_CIPHER_MODE_CTR)
692 #if defined(POLARSSL_CIPHER_NULL_CIPHER)
693 static void * null_ctx_alloc(
void )
699 static void null_ctx_free(
void *ctx )