aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-12-17 16:05:57 +0100
committerSverker Eriksson <[email protected]>2015-12-17 16:05:57 +0100
commita47b233a0cc0548ac14e1b3eb170d8291e836052 (patch)
treeec107c9ceecf21c121e9ae1d4725f2faff894cc6
parent82be6a3e5589781551ca9170cb212983463f1446 (diff)
parent41e0a3fcbcc39ed1b7d503fc6d648c00f858bd42 (diff)
downloadotp-a47b233a0cc0548ac14e1b3eb170d8291e836052.tar.gz
otp-a47b233a0cc0548ac14e1b3eb170d8291e836052.tar.bz2
otp-a47b233a0cc0548ac14e1b3eb170d8291e836052.zip
Merge branch 'sverk/crypto/aes-ecb-192-bit'
OTP-13207 * sverk/crypto/aes-ecb-192-bit: crypto: Support 192-bit keys for AES ECB
-rw-r--r--lib/crypto/c_src/crypto.c1
-rw-r--r--lib/crypto/test/crypto_SUITE.erl26
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index 406dde91ba..c0ab7ba7cd 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -455,6 +455,7 @@ struct cipher_type_t cipher_types[] =
{"aes_cfb8", &EVP_aes_128_cfb8},
{"aes_cfb128", &EVP_aes_128_cfb128},
{"aes_ecb", &EVP_aes_128_ecb, 16},
+ {"aes_ecb", &EVP_aes_192_ecb, 24},
{"aes_ecb", &EVP_aes_256_ecb, 32},
{NULL}
};
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 70cf801516..6ec98a4ece 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -1371,7 +1371,31 @@ aes_ecb() ->
<<"0000000000000000">>},
{aes_ecb,
<<"FEDCBA9876543210">>,
- <<"FFFFFFFFFFFFFFFF">>}
+ <<"FFFFFFFFFFFFFFFF">>},
+ %% AES ECB test vectors from http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
+ %% F.1.1 ECB-AES128.Encrypt, F.1.2 ECB-AES128.Decrypt
+ {aes_ecb,
+ hexstr2bin("2b7e151628aed2a6abf7158809cf4f3c"),
+ hexstr2bin("6bc1bee22e409f96e93d7e117393172a"
+ "ae2d8a571e03ac9c9eb76fac45af8e51"
+ "30c81c46a35ce411e5fbc1191a0a52ef"
+ "f69f2445df4f9b17ad2b417be66c3710")},
+ %% F.1.3 ECB-AES192.Encrypt, F.1.4 ECB-AES192.Decrypt
+ {aes_ecb,
+ hexstr2bin("8e73b0f7da0e6452c810f32b809079e5"
+ "62f8ead2522c6b7b"),
+ hexstr2bin("6bc1bee22e409f96e93d7e117393172a"
+ "ae2d8a571e03ac9c9eb76fac45af8e51"
+ "30c81c46a35ce411e5fbc1191a0a52ef"
+ "f69f2445df4f9b17ad2b417be66c3710")},
+ %% F.1.5 ECB-AES256.Encrypt, F.1.6 ECB-AES256.Decrypt
+ {aes_ecb,
+ hexstr2bin("603deb1015ca71be2b73aef0857d7781"
+ "1f352c073b6108d72d9810a30914dff4"),
+ hexstr2bin("6bc1bee22e409f96e93d7e117393172a"
+ "ae2d8a571e03ac9c9eb76fac45af8e51"
+ "30c81c46a35ce411e5fbc1191a0a52ef"
+ "f69f2445df4f9b17ad2b417be66c3710")}
].
aes_ige256() ->