From c2dba342cdef443c017f914c12b7b6c6c39082ef Mon Sep 17 00:00:00 2001 From: Bryce Shang <65570357+bryce-shang@users.noreply.github.com> Date: Tue, 30 Aug 2022 08:48:39 -0700 Subject: [PATCH] Import |EVP_aes_128/192/256_cfb1/8| APIs. (#595) * Import |EVP_aes_128/192/256_cfb1/8| APIs. * Add EVP_CIPH_FLAG_LENGTH_BITS. * Add explicit cast. --- crypto/decrepit/cfb/cfb.c | 107 ++++++++++++++++++++++++- crypto/decrepit/cfb/cfb_test.cc | 108 +++++++++++++++++++------- crypto/fipsmodule/aes/mode_wrappers.c | 17 ++++ crypto/fipsmodule/cipher/internal.h | 10 +++ include/openssl/cipher.h | 21 +++++ 5 files changed, 231 insertions(+), 32 deletions(-) diff --git a/crypto/decrepit/cfb/cfb.c b/crypto/decrepit/cfb/cfb.c index 380d706368..17723ce868 100644 --- a/crypto/decrepit/cfb/cfb.c +++ b/crypto/decrepit/cfb/cfb.c @@ -22,6 +22,10 @@ #include "../../internal.h" #include "../../fipsmodule/cipher/internal.h" +// MAXBITCHUNK is used in |aes_cfb1_cipher| to avoid overflow because +// |AES_cfb1_encrypt| operates data on bit level. +#define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4)) + typedef struct { AES_KEY ks; } EVP_CFB_CTX; @@ -29,20 +33,69 @@ typedef struct { static int aes_cfb_init_key(EVP_CIPHER_CTX *ctx, const uint8_t *key, const uint8_t *iv, int enc) { if (key) { - EVP_CFB_CTX *cfb_ctx = ctx->cipher_data; + EVP_CFB_CTX *cfb_ctx = (EVP_CFB_CTX *)ctx->cipher_data; AES_set_encrypt_key(key, ctx->key_len * 8, &cfb_ctx->ks); } return 1; } +static int aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, + const uint8_t *in, size_t len) { + if (!out || !in) { + return 0; + } + + EVP_CFB_CTX *cfb_ctx = (EVP_CFB_CTX *)ctx->cipher_data; + if (ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) { + int num = ctx->num; + AES_cfb1_encrypt(in, out, len, &cfb_ctx->ks, ctx->iv, &num, + ctx->encrypt ? AES_ENCRYPT : AES_DECRYPT); + ctx->num = num; + return 1; + } + + while (len >= MAXBITCHUNK) { + int num = ctx->num; + AES_cfb1_encrypt(in, out, MAXBITCHUNK * 8, &cfb_ctx->ks, ctx->iv, &num, + ctx->encrypt ? AES_ENCRYPT : AES_DECRYPT); + ctx->num = num; + len -= MAXBITCHUNK; + out += MAXBITCHUNK; + in += MAXBITCHUNK; + } + if (len) { + int num = ctx->num; + AES_cfb1_encrypt(in, out, len * 8, &cfb_ctx->ks, ctx->iv, &num, + ctx->encrypt ? AES_ENCRYPT : AES_DECRYPT); + ctx->num = num; + } + + return 1; +} + +static int aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, + const uint8_t *in, size_t len) { + if (!out || !in) { + return 0; + } + + EVP_CFB_CTX *cfb_ctx = (EVP_CFB_CTX *)ctx->cipher_data; + int num = ctx->num; + AES_cfb8_encrypt(in, out, len, &cfb_ctx->ks, ctx->iv, &num, + ctx->encrypt ? AES_ENCRYPT : AES_DECRYPT); + ctx->num = num; + + return 1; +} + static int aes_cfb128_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, const uint8_t *in, size_t len) { if (!out || !in) { return 0; } - EVP_CFB_CTX *cfb_ctx = ctx->cipher_data; + EVP_CFB_CTX *cfb_ctx = (EVP_CFB_CTX *)ctx->cipher_data; int num = ctx->num; AES_cfb128_encrypt(in, out, len, &cfb_ctx->ks, ctx->iv, &num, ctx->encrypt ? AES_ENCRYPT : AES_DECRYPT); @@ -51,6 +104,20 @@ static int aes_cfb128_cipher(EVP_CIPHER_CTX *ctx, uint8_t *out, return 1; } +static const EVP_CIPHER aes_128_cfb1 = { + NID_aes_128_cfb1, 1 /* block_size */, 16 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher, + NULL /* cleanup */, NULL /* ctrl */, +}; + +static const EVP_CIPHER aes_128_cfb8 = { + NID_aes_128_cfb8, 1 /* block_size */, 16 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher, + NULL /* cleanup */, NULL /* ctrl */, +}; + static const EVP_CIPHER aes_128_cfb128 = { NID_aes_128_cfb128, 1 /* block_size */, 16 /* key_size */, 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, @@ -58,6 +125,20 @@ static const EVP_CIPHER aes_128_cfb128 = { NULL /* cleanup */, NULL /* ctrl */, }; +static const EVP_CIPHER aes_192_cfb1 = { + NID_aes_192_cfb1, 1 /* block_size */, 24 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher, + NULL /* cleanup */, NULL /* ctrl */, +}; + +static const EVP_CIPHER aes_192_cfb8 = { + NID_aes_192_cfb8, 1 /* block_size */, 24 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher, + NULL /* cleanup */, NULL /* ctrl */, +}; + static const EVP_CIPHER aes_192_cfb128 = { NID_aes_192_cfb128, 1 /* block_size */, 24 /* key_size */, 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, @@ -65,6 +146,20 @@ static const EVP_CIPHER aes_192_cfb128 = { NULL /* cleanup */, NULL /* ctrl */, }; +static const EVP_CIPHER aes_256_cfb1 = { + NID_aes_256_cfb1, 1 /* block_size */, 32 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + NULL /* app_data */, aes_cfb_init_key, aes_cfb1_cipher, + NULL /* cleanup */, NULL /* ctrl */, +}; + +static const EVP_CIPHER aes_256_cfb8 = { + NID_aes_256_cfb8, 1 /* block_size */, 32 /* key_size */, + 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, + NULL /* app_data */, aes_cfb_init_key, aes_cfb8_cipher, + NULL /* cleanup */, NULL /* ctrl */, +}; + static const EVP_CIPHER aes_256_cfb128 = { NID_aes_256_cfb128, 1 /* block_size */, 32 /* key_size */, 16 /* iv_len */, sizeof(EVP_CFB_CTX), EVP_CIPH_CFB_MODE, @@ -72,9 +167,17 @@ static const EVP_CIPHER aes_256_cfb128 = { NULL /* cleanup */, NULL /* ctrl */, }; +const EVP_CIPHER *EVP_aes_128_cfb1(void) { return &aes_128_cfb1; } +const EVP_CIPHER *EVP_aes_128_cfb8(void) { return &aes_128_cfb8; } const EVP_CIPHER *EVP_aes_128_cfb128(void) { return &aes_128_cfb128; } const EVP_CIPHER *EVP_aes_128_cfb(void) { return &aes_128_cfb128; } + +const EVP_CIPHER *EVP_aes_192_cfb1(void) { return &aes_192_cfb1; } +const EVP_CIPHER *EVP_aes_192_cfb8(void) { return &aes_192_cfb8; } const EVP_CIPHER *EVP_aes_192_cfb128(void) { return &aes_192_cfb128; } const EVP_CIPHER *EVP_aes_192_cfb(void) { return &aes_192_cfb128; } + +const EVP_CIPHER *EVP_aes_256_cfb1(void) { return &aes_256_cfb1; } +const EVP_CIPHER *EVP_aes_256_cfb8(void) { return &aes_256_cfb8; } const EVP_CIPHER *EVP_aes_256_cfb128(void) { return &aes_256_cfb128; } const EVP_CIPHER *EVP_aes_256_cfb(void) { return &aes_256_cfb128; } diff --git a/crypto/decrepit/cfb/cfb_test.cc b/crypto/decrepit/cfb/cfb_test.cc index aff0ed9714..8da9f61377 100644 --- a/crypto/decrepit/cfb/cfb_test.cc +++ b/crypto/decrepit/cfb/cfb_test.cc @@ -20,19 +20,86 @@ #include "../../test/test_util.h" struct CFBTestCase { - size_t key_len; + const EVP_CIPHER *evp_cipher; uint8_t key[32]; uint8_t iv[16]; - uint8_t plaintext[16*4]; - uint8_t ciphertext[16*4]; + std::vector plaintext; + std::vector ciphertext; }; static const CFBTestCase kCFBTestCases[] = { + // CFB1 + { + // This is the test case from + // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, + // section F.3.1, for CFB1-AES128 + EVP_aes_128_cfb1(), + {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, + {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x6b, 0xc1}, + {0x68, 0xb3}, + }, + { + // This is the test case from + // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, + // section F.3.3, CFB1-AES192 + EVP_aes_192_cfb1(), + {0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b}, + {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x6b, 0xc1}, + {0x93, 0x59}, + }, + { + // This is the test case from + // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, + // section F.3.5, CFB1-AES256 + EVP_aes_256_cfb1(), + {0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4}, + {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x6b, 0xc1}, + {0x90, 0x29}, + }, + // CFB8 + { + // This is the test case from + // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, + // section F.3.7, for CFB8-AES128 + EVP_aes_128_cfb8(), + {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, + {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d}, + {0x3b, 0x79, 0x42, 0x4c, 0x9c, 0x0d, 0xd4, 0x36, 0xba, 0xce, 0x9e, 0x0e, 0xd4, 0x58, 0x6a, 0x4f, 0x32, 0xb9}, + }, + { + // This is the test case from + // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, + // section F.3.9, CFB8-AES192 + EVP_aes_192_cfb8(), + {0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b}, + {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d}, + {0xcd, 0xa2, 0x52, 0x1e, 0xf0, 0xa9, 0x05, 0xca, 0x44, 0xcd, 0x05, 0x7c, 0xbf, 0x0d, 0x47, 0xa0, 0x67, 0x8a}, + }, + { + // This is the test case from + // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, + // section F.3.11, CFB8-AES256 + EVP_aes_256_cfb8(), + {0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4}, + {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d}, + {0xdc, 0x1f, 0x1a, 0x85, 0x20, 0xa6, 0x4d, 0xb5, 0x5f, 0xcc, 0x8a, 0xc5, 0x54, 0x84, 0x4e, 0x88, 0x97, 0x00}, + }, + // CFB/CFB128 { // This is the test case from // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, // section F.3.13, for CFB128-AES128 - 16, + EVP_aes_128_cfb128(), {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, @@ -48,7 +115,7 @@ static const CFBTestCase kCFBTestCases[] = { // This is the test case from // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, // section F.3.15, CFB128-AES192 - 24, + EVP_aes_192_cfb128(), {0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b}, {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, @@ -65,7 +132,7 @@ static const CFBTestCase kCFBTestCases[] = { // This is the test case from // http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf, // section F.3.17, CFB128-AES256 - 32, + EVP_aes_256_cfb128(), {0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4}, {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, @@ -86,22 +153,13 @@ TEST(CFBTest, TestVectors) { test_num++; SCOPED_TRACE(test_num); - const size_t input_len = sizeof(test.plaintext); + const size_t input_len = test.plaintext.size(); + const EVP_CIPHER *evp_cipher = test.evp_cipher; std::unique_ptr out(new uint8_t[input_len]); for (size_t stride = 1; stride <= input_len; stride++) { bssl::ScopedEVP_CIPHER_CTX ctx; - if (test.key_len == 16) { - ASSERT_TRUE(EVP_EncryptInit_ex(ctx.get(), EVP_aes_128_cfb128(), nullptr, - test.key, test.iv)); - } else if (test.key_len == 24) { - ASSERT_TRUE(EVP_EncryptInit_ex(ctx.get(), EVP_aes_192_cfb128(), nullptr, - test.key, test.iv)); - } else { - assert(test.key_len == 32); - ASSERT_TRUE(EVP_EncryptInit_ex(ctx.get(), EVP_aes_256_cfb128(), nullptr, - test.key, test.iv)); - } + ASSERT_TRUE(EVP_EncryptInit_ex(ctx.get(), evp_cipher, nullptr, test.key, test.iv)); size_t done = 0; while (done < input_len) { @@ -112,7 +170,7 @@ TEST(CFBTest, TestVectors) { int out_bytes; ASSERT_TRUE(EVP_EncryptUpdate(ctx.get(), out.get() + done, &out_bytes, - test.plaintext + done, todo)); + test.plaintext.data() + done, todo)); ASSERT_EQ(static_cast(out_bytes), todo); done += todo; @@ -122,17 +180,7 @@ TEST(CFBTest, TestVectors) { } bssl::ScopedEVP_CIPHER_CTX decrypt_ctx; - if (test.key_len == 16) { - ASSERT_TRUE(EVP_DecryptInit_ex(decrypt_ctx.get(), EVP_aes_128_cfb128(), - nullptr, test.key, test.iv)); - } else if (test.key_len == 24) { - ASSERT_TRUE(EVP_DecryptInit_ex(decrypt_ctx.get(), EVP_aes_192_cfb128(), - nullptr, test.key, test.iv)); - } else { - assert(test.key_len == 32); - ASSERT_TRUE(EVP_DecryptInit_ex(decrypt_ctx.get(), EVP_aes_256_cfb128(), - nullptr, test.key, test.iv)); - } + ASSERT_TRUE(EVP_DecryptInit_ex(decrypt_ctx.get(), evp_cipher, nullptr, test.key, test.iv)); std::unique_ptr plaintext(new uint8_t[input_len]); int num_bytes; diff --git a/crypto/fipsmodule/aes/mode_wrappers.c b/crypto/fipsmodule/aes/mode_wrappers.c index 03a28ec609..5723f33d0e 100644 --- a/crypto/fipsmodule/aes/mode_wrappers.c +++ b/crypto/fipsmodule/aes/mode_wrappers.c @@ -52,6 +52,7 @@ #include "../aes/internal.h" #include "../modes/internal.h" +#include "../cipher/internal.h" void AES_ctr128_encrypt(const uint8_t *in, uint8_t *out, size_t len, const AES_KEY *key, uint8_t ivec[AES_BLOCK_SIZE], @@ -113,6 +114,22 @@ void AES_ofb128_encrypt(const uint8_t *in, uint8_t *out, size_t length, *num = (int)num_u; } +void AES_cfb1_encrypt(const uint8_t *in, uint8_t *out, size_t bits, + const AES_KEY *key, uint8_t *ivec, int *num, + int enc) { + unsigned num_u = (unsigned)(*num); + CRYPTO_cfb128_1_encrypt(in, out, bits, key, ivec, &num_u, enc, AES_encrypt); + *num = (int)num_u; +} + +void AES_cfb8_encrypt(const uint8_t *in, uint8_t *out, size_t length, + const AES_KEY *key, uint8_t *ivec, int *num, + int enc) { + unsigned num_u = (unsigned)(*num); + CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, &num_u, enc, AES_encrypt); + *num = (int)num_u; +} + void AES_cfb128_encrypt(const uint8_t *in, uint8_t *out, size_t length, const AES_KEY *key, uint8_t *ivec, int *num, int enc) { diff --git a/crypto/fipsmodule/cipher/internal.h b/crypto/fipsmodule/cipher/internal.h index 6ec9a3b3c8..30292975e2 100644 --- a/crypto/fipsmodule/cipher/internal.h +++ b/crypto/fipsmodule/cipher/internal.h @@ -160,6 +160,16 @@ ctr128_f aes_ctr_set_key(AES_KEY *aes_key, GCM128_KEY *gcm_key, block128_f *out_block, const uint8_t *key, size_t key_bytes); +// AES_cfb1_encrypt calls |CRYPTO_cfb128_1_encrypt| using the block |AES_encrypt|. +void AES_cfb1_encrypt(const uint8_t *in, uint8_t *out, + size_t bits, const AES_KEY *key, + uint8_t *ivec, int *num, int enc); + +// AES_cfb8_encrypt calls |CRYPTO_cfb128_8_encrypt| using the block |AES_encrypt|. +void AES_cfb8_encrypt(const uint8_t *in, uint8_t *out, + size_t len, const AES_KEY *key, + uint8_t *ivec, int *num, int enc); + #if defined(__cplusplus) } // extern C #endif diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h index 8323c87f24..217d96cdd9 100644 --- a/include/openssl/cipher.h +++ b/include/openssl/cipher.h @@ -361,6 +361,9 @@ OPENSSL_EXPORT int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, #define EVP_CIPH_GCM_MODE 0x6 #define EVP_CIPH_XTS_MODE 0x7 +// Buffer length in bits not bytes: CFB1 mode only. +# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 + // Cipher flags (for |EVP_CIPHER_flags|). @@ -475,18 +478,36 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb128(void); // EVP_aes_128_cfb is an alias for |EVP_aes_128_cfb128| and is deprecated. OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb(void); +// EVP_aes_128_cfb1 is deprecated. +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb1(void); + +// EVP_aes_128_cfb8 is deprecated. +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb8(void); + // EVP_aes_192_cfb128 is deprecated. OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_cfb128(void); // EVP_aes_192_cfb is an alias for |EVP_aes_192_cfb128| and is deprecated. OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_cfb(void); +// EVP_aes_192_cfb1 is deprecated. +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_cfb1(void); + +// EVP_aes_192_cfb8 is deprecated. +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_cfb8(void); + // EVP_aes_256_cfb128 is deprecated. OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cfb128(void); // EVP_aes_256_cfb is an alias for |EVP_aes_256_cfb128| and is deprecated. OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cfb(void); +// EVP_aes_256_cfb1 is deprecated. +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cfb1(void); + +// EVP_aes_256_cfb8 is deprecated. +OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cfb8(void); + // EVP_bf_ecb is Blowfish in ECB mode and is deprecated. OPENSSL_EXPORT const EVP_CIPHER *EVP_bf_ecb(void);