23 #ifndef MBEDTLS_BLOWFISH_H
24 #define MBEDTLS_BLOWFISH_H
26 #if !defined(MBEDTLS_CONFIG_FILE)
29 #include MBEDTLS_CONFIG_FILE
35 #define MBEDTLS_BLOWFISH_ENCRYPT 1
36 #define MBEDTLS_BLOWFISH_DECRYPT 0
37 #define MBEDTLS_BLOWFISH_MAX_KEY_BITS 448
38 #define MBEDTLS_BLOWFISH_MIN_KEY_BITS 32
39 #define MBEDTLS_BLOWFISH_ROUNDS 16
40 #define MBEDTLS_BLOWFISH_BLOCKSIZE 8
42 #define MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH -0x0016
43 #define MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH -0x0018
45 #if !defined(MBEDTLS_BLOWFISH_ALT)
61 mbedtls_blowfish_context;
68 void mbedtls_blowfish_init( mbedtls_blowfish_context *ctx );
75 void mbedtls_blowfish_free( mbedtls_blowfish_context *ctx );
86 int mbedtls_blowfish_setkey( mbedtls_blowfish_context *ctx,
const unsigned char *key,
87 unsigned int keybits );
99 int mbedtls_blowfish_crypt_ecb( mbedtls_blowfish_context *ctx,
102 unsigned char output[MBEDTLS_BLOWFISH_BLOCKSIZE] );
104 #if defined(MBEDTLS_CIPHER_MODE_CBC)
128 int mbedtls_blowfish_crypt_cbc( mbedtls_blowfish_context *ctx,
131 unsigned char iv[MBEDTLS_BLOWFISH_BLOCKSIZE],
132 const unsigned char *input,
133 unsigned char *output );
136 #if defined(MBEDTLS_CIPHER_MODE_CFB)
158 int mbedtls_blowfish_crypt_cfb64( mbedtls_blowfish_context *ctx,
162 unsigned char iv[MBEDTLS_BLOWFISH_BLOCKSIZE],
163 const unsigned char *input,
164 unsigned char *output );
167 #if defined(MBEDTLS_CIPHER_MODE_CTR)
186 int mbedtls_blowfish_crypt_ctr( mbedtls_blowfish_context *ctx,
189 unsigned char nonce_counter[MBEDTLS_BLOWFISH_BLOCKSIZE],
190 unsigned char stream_block[MBEDTLS_BLOWFISH_BLOCKSIZE],
191 const unsigned char *input,
192 unsigned char *output );
200 #include "blowfish_alt.h"
#define MBEDTLS_BLOWFISH_BLOCKSIZE
Configuration options (set of defines)
#define MBEDTLS_BLOWFISH_ROUNDS
Rounds to use.