mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-03-20 16:08:43 +00:00
Added POLARSSL_MODE_ECB to the cipher layer
This commit is contained in:
@@ -70,6 +70,9 @@ typedef enum {
|
||||
typedef enum {
|
||||
POLARSSL_CIPHER_NONE = 0,
|
||||
POLARSSL_CIPHER_NULL,
|
||||
POLARSSL_CIPHER_AES_128_ECB,
|
||||
POLARSSL_CIPHER_AES_192_ECB,
|
||||
POLARSSL_CIPHER_AES_256_ECB,
|
||||
POLARSSL_CIPHER_AES_128_CBC,
|
||||
POLARSSL_CIPHER_AES_192_CBC,
|
||||
POLARSSL_CIPHER_AES_256_CBC,
|
||||
@@ -82,6 +85,9 @@ typedef enum {
|
||||
POLARSSL_CIPHER_AES_128_GCM,
|
||||
POLARSSL_CIPHER_AES_192_GCM,
|
||||
POLARSSL_CIPHER_AES_256_GCM,
|
||||
POLARSSL_CIPHER_CAMELLIA_128_ECB,
|
||||
POLARSSL_CIPHER_CAMELLIA_192_ECB,
|
||||
POLARSSL_CIPHER_CAMELLIA_256_ECB,
|
||||
POLARSSL_CIPHER_CAMELLIA_128_CBC,
|
||||
POLARSSL_CIPHER_CAMELLIA_192_CBC,
|
||||
POLARSSL_CIPHER_CAMELLIA_256_CBC,
|
||||
@@ -91,9 +97,13 @@ typedef enum {
|
||||
POLARSSL_CIPHER_CAMELLIA_128_CTR,
|
||||
POLARSSL_CIPHER_CAMELLIA_192_CTR,
|
||||
POLARSSL_CIPHER_CAMELLIA_256_CTR,
|
||||
POLARSSL_CIPHER_DES_ECB,
|
||||
POLARSSL_CIPHER_DES_CBC,
|
||||
POLARSSL_CIPHER_DES_EDE_ECB,
|
||||
POLARSSL_CIPHER_DES_EDE_CBC,
|
||||
POLARSSL_CIPHER_DES_EDE3_ECB,
|
||||
POLARSSL_CIPHER_DES_EDE3_CBC,
|
||||
POLARSSL_CIPHER_BLOWFISH_ECB,
|
||||
POLARSSL_CIPHER_BLOWFISH_CBC,
|
||||
POLARSSL_CIPHER_BLOWFISH_CFB64,
|
||||
POLARSSL_CIPHER_BLOWFISH_CTR,
|
||||
@@ -102,6 +112,7 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
POLARSSL_MODE_NONE = 0,
|
||||
POLARSSL_MODE_ECB,
|
||||
POLARSSL_MODE_CBC,
|
||||
POLARSSL_MODE_CFB,
|
||||
POLARSSL_MODE_OFB,
|
||||
@@ -145,6 +156,10 @@ typedef struct {
|
||||
/** Base Cipher type (e.g. POLARSSL_CIPHER_ID_AES) */
|
||||
cipher_id_t cipher;
|
||||
|
||||
/** Encrypt using ECB */
|
||||
int (*ecb_func)( void *ctx, operation_t mode,
|
||||
const unsigned char *input, unsigned char *output );
|
||||
|
||||
/** Encrypt using CBC */
|
||||
int (*cbc_func)( void *ctx, operation_t mode, size_t length, unsigned char *iv,
|
||||
const unsigned char *input, unsigned char *output );
|
||||
@@ -497,6 +512,8 @@ int cipher_update_ad( cipher_context_t *ctx,
|
||||
* that cannot be written immediately will either be added
|
||||
* to the next block, or flushed when cipher_final is
|
||||
* called.
|
||||
* Exception: for POLARSSL_MODE_ECB, expects single block
|
||||
* in size (e.g. 16 bytes for AES)
|
||||
*
|
||||
* \param ctx generic cipher context
|
||||
* \param input buffer holding the input data
|
||||
|
||||
@@ -38,6 +38,10 @@ extern "C" {
|
||||
|
||||
#if defined(POLARSSL_AES_C)
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
@@ -64,6 +68,10 @@ extern const cipher_info_t aes_256_gcm_info;
|
||||
|
||||
#if defined(POLARSSL_CAMELLIA_C)
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
@@ -84,6 +92,10 @@ extern const cipher_info_t camellia_256_ctr_info;
|
||||
|
||||
#if defined(POLARSSL_DES_C)
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
@@ -91,6 +103,7 @@ extern const cipher_info_t des_ede3_cbc_info;
|
||||
#endif /* defined(POLARSSL_DES_C) */
|
||||
|
||||
#if defined(POLARSSL_BLOWFISH_C)
|
||||
extern const cipher_info_t blowfish_ecb_info;
|
||||
extern const cipher_info_t blowfish_cbc_info;
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CFB)
|
||||
|
||||
Reference in New Issue
Block a user