Support several flavours of AES-192.
Change-Id: I28d302fad0d3d00fa69d3224a96366207729d8d5
This commit is contained in:
parent
087930f5b5
commit
1049e26f6b
@ -313,6 +313,8 @@ static int test_cipher(const char *cipher, const uint8_t *key, int kn,
|
||||
c = EVP_aes_128_gcm();
|
||||
} else if (strcmp(cipher, "AES-128-OFB") == 0) {
|
||||
c = EVP_aes_128_ofb();
|
||||
} else if (strcmp(cipher, "AES-192-CBC") == 0) {
|
||||
c = EVP_aes_192_cbc();
|
||||
} else if (strcmp(cipher, "AES-256-CBC") == 0) {
|
||||
c = EVP_aes_256_cbc();
|
||||
} else if (strcmp(cipher, "AES-128-CTR") == 0) {
|
||||
|
@ -757,6 +757,28 @@ static const EVP_CIPHER aes_128_gcm = {
|
||||
aes_gcm_ctrl};
|
||||
|
||||
|
||||
static const EVP_CIPHER aes_192_cbc = {
|
||||
NID_aes_192_cbc, 16 /* block_size */, 24 /* key_size */,
|
||||
16 /* iv_len */, sizeof(EVP_AES_KEY), EVP_CIPH_CBC_MODE,
|
||||
NULL /* app_data */, aes_init_key, aes_cbc_cipher,
|
||||
NULL /* cleanup */, NULL /* ctrl */};
|
||||
|
||||
static const EVP_CIPHER aes_192_ctr = {
|
||||
NID_aes_192_ctr, 1 /* block_size */, 24 /* key_size */,
|
||||
16 /* iv_len */, sizeof(EVP_AES_KEY), EVP_CIPH_CTR_MODE,
|
||||
NULL /* app_data */, aes_init_key, aes_ctr_cipher,
|
||||
NULL /* cleanup */, NULL /* ctrl */};
|
||||
|
||||
static const EVP_CIPHER aes_192_gcm = {
|
||||
NID_aes_192_gcm, 1 /* block_size */, 24 /* key_size */, 12 /* iv_len */,
|
||||
sizeof(EVP_AES_GCM_CTX),
|
||||
EVP_CIPH_GCM_MODE | EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER |
|
||||
EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT |
|
||||
EVP_CIPH_FLAG_AEAD_CIPHER,
|
||||
NULL /* app_data */, aes_gcm_init_key, aes_gcm_cipher, aes_gcm_cleanup,
|
||||
aes_gcm_ctrl};
|
||||
|
||||
|
||||
static const EVP_CIPHER aes_256_cbc = {
|
||||
NID_aes_256_cbc, 16 /* block_size */, 32 /* key_size */,
|
||||
16 /* iv_len */, sizeof(EVP_AES_KEY), EVP_CIPH_CBC_MODE,
|
||||
@ -917,6 +939,28 @@ static const EVP_CIPHER aesni_128_gcm = {
|
||||
aes_gcm_ctrl};
|
||||
|
||||
|
||||
static const EVP_CIPHER aesni_192_cbc = {
|
||||
NID_aes_192_cbc, 16 /* block_size */, 24 /* key_size */,
|
||||
16 /* iv_len */, sizeof(EVP_AES_KEY), EVP_CIPH_CBC_MODE,
|
||||
NULL /* app_data */, aesni_init_key, aesni_cbc_cipher,
|
||||
NULL /* cleanup */, NULL /* ctrl */};
|
||||
|
||||
static const EVP_CIPHER aesni_192_ctr = {
|
||||
NID_aes_192_ctr, 1 /* block_size */, 24 /* key_size */,
|
||||
16 /* iv_len */, sizeof(EVP_AES_KEY), EVP_CIPH_CTR_MODE,
|
||||
NULL /* app_data */, aesni_init_key, aes_ctr_cipher,
|
||||
NULL /* cleanup */, NULL /* ctrl */};
|
||||
|
||||
static const EVP_CIPHER aesni_192_gcm = {
|
||||
NID_aes_192_gcm, 1 /* block_size */, 24 /* key_size */, 12 /* iv_len */,
|
||||
sizeof(EVP_AES_GCM_CTX),
|
||||
EVP_CIPH_GCM_MODE | EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER |
|
||||
EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT |
|
||||
EVP_CIPH_FLAG_AEAD_CIPHER,
|
||||
NULL /* app_data */, aesni_gcm_init_key, aes_gcm_cipher, aes_gcm_cleanup,
|
||||
aes_gcm_ctrl};
|
||||
|
||||
|
||||
static const EVP_CIPHER aesni_256_cbc = {
|
||||
NID_aes_256_cbc, 16 /* block_size */, 32 /* key_size */,
|
||||
16 /* iv_len */, sizeof(EVP_AES_KEY), EVP_CIPH_CBC_MODE,
|
||||
@ -978,6 +1022,10 @@ EVP_CIPHER_FUNCTION(128, ecb)
|
||||
EVP_CIPHER_FUNCTION(128, ofb)
|
||||
EVP_CIPHER_FUNCTION(128, gcm)
|
||||
|
||||
EVP_CIPHER_FUNCTION(192, cbc)
|
||||
EVP_CIPHER_FUNCTION(192, ctr)
|
||||
EVP_CIPHER_FUNCTION(192, gcm)
|
||||
|
||||
EVP_CIPHER_FUNCTION(256, cbc)
|
||||
EVP_CIPHER_FUNCTION(256, ctr)
|
||||
EVP_CIPHER_FUNCTION(256, ecb)
|
||||
|
@ -101,3 +101,9 @@ AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000
|
||||
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:0
|
||||
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:0
|
||||
AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:0
|
||||
|
||||
# AES-192 CBC-mode test from upstream OpenSSL.
|
||||
AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:4F021DB243BC633D7178183A9FA071E8
|
||||
AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:4F021DB243BC633D7178183A9FA071E8:AE2D8A571E03AC9C9EB76FAC45AF8E51:B4D9ADA9AD7DEDF4E5E738763F69145A
|
||||
AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:B4D9ADA9AD7DEDF4E5E738763F69145A:30C81C46A35CE411E5FBC1191A0A52EF:571B242012FB7AE07FA9BAAC3DF102E0
|
||||
AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:571B242012FB7AE07FA9BAAC3DF102E0:F69F2445DF4F9B17AD2B417BE66C3710:08B0E27988598881D920A9E64F5615CD
|
||||
|
@ -92,6 +92,11 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_ofb(void);
|
||||
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_gcm(void);
|
||||
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_gcm(void);
|
||||
|
||||
/* Deprecated 192-bit version of AES. */
|
||||
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_cbc(void);
|
||||
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_ctr(void);
|
||||
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_gcm(void);
|
||||
|
||||
/* EVP_enc_null returns a 'cipher' that passes plaintext through as
|
||||
* ciphertext. */
|
||||
OPENSSL_EXPORT const EVP_CIPHER *EVP_enc_null(void);
|
||||
@ -494,7 +499,6 @@ typedef struct evp_cipher_info_st {
|
||||
* Android they'll have no definition. */
|
||||
|
||||
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_ecb(void);
|
||||
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_cbc(void);
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
Loading…
Reference in New Issue
Block a user