mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Make CBC an option, step 2: cipher layer
This commit is contained in:
@ -36,6 +36,10 @@
|
||||
#define POLARSSL_CIPHER_MODE_AEAD
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CBC)
|
||||
#define POLARSSL_CIPHER_MODE_WITH_PADDING
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER) && !defined(inline)
|
||||
@ -462,6 +466,7 @@ static inline operation_t cipher_get_operation( const cipher_context_t *ctx )
|
||||
int cipher_setkey( cipher_context_t *ctx, const unsigned char *key, int key_length,
|
||||
const operation_t operation );
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_WITH_PADDING)
|
||||
/**
|
||||
* \brief Set padding mode, for cipher modes that use padding.
|
||||
* (Default: PKCS7 padding.)
|
||||
@ -475,6 +480,7 @@ int cipher_setkey( cipher_context_t *ctx, const unsigned char *key, int key_leng
|
||||
* does not support padding.
|
||||
*/
|
||||
int cipher_set_padding_mode( cipher_context_t *ctx, cipher_padding_t mode );
|
||||
#endif /* POLARSSL_CIPHER_MODE_WITH_PADDING */
|
||||
|
||||
/**
|
||||
* \brief Set the initialization vector (IV) or nonce
|
||||
|
@ -42,9 +42,11 @@ extern const cipher_info_t aes_128_ecb_info;
|
||||
extern const cipher_info_t aes_192_ecb_info;
|
||||
extern const cipher_info_t aes_256_ecb_info;
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CBC)
|
||||
extern const cipher_info_t aes_128_cbc_info;
|
||||
extern const cipher_info_t aes_192_cbc_info;
|
||||
extern const cipher_info_t aes_256_cbc_info;
|
||||
#endif /* POLARSSL_CIPHER_MODE_CBC */
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CFB)
|
||||
extern const cipher_info_t aes_128_cfb128_info;
|
||||
@ -72,9 +74,11 @@ extern const cipher_info_t camellia_128_ecb_info;
|
||||
extern const cipher_info_t camellia_192_ecb_info;
|
||||
extern const cipher_info_t camellia_256_ecb_info;
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CBC)
|
||||
extern const cipher_info_t camellia_128_cbc_info;
|
||||
extern const cipher_info_t camellia_192_cbc_info;
|
||||
extern const cipher_info_t camellia_256_cbc_info;
|
||||
#endif /* POLARSSL_CIPHER_MODE_CBC */
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CFB)
|
||||
extern const cipher_info_t camellia_128_cfb128_info;
|
||||
@ -96,15 +100,19 @@ extern const cipher_info_t des_ecb_info;
|
||||
extern const cipher_info_t des_ede_ecb_info;
|
||||
extern const cipher_info_t des_ede3_ecb_info;
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CBC)
|
||||
extern const cipher_info_t des_cbc_info;
|
||||
extern const cipher_info_t des_ede_cbc_info;
|
||||
extern const cipher_info_t des_ede3_cbc_info;
|
||||
#endif /* POLARSSL_CIPHER_MODE_CBC */
|
||||
|
||||
#endif /* defined(POLARSSL_DES_C) */
|
||||
|
||||
#if defined(POLARSSL_BLOWFISH_C)
|
||||
extern const cipher_info_t blowfish_ecb_info;
|
||||
#if defined(POLARSSL_CIPHER_MODE_CBC)
|
||||
extern const cipher_info_t blowfish_cbc_info;
|
||||
#endif /* POLARSSL_CIPHER_MODE_CBC */
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CFB)
|
||||
extern const cipher_info_t blowfish_cfb64_info;
|
||||
|
Reference in New Issue
Block a user