diff options
author | Erlang/OTP <[email protected]> | 2017-03-31 12:58:35 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2017-03-31 12:58:35 +0200 |
commit | b209cea8bd69aa71aef919e794988d3367f36891 (patch) | |
tree | f0be11376b8e97e4552a1d46790e9aa58ded24d3 /lib/crypto/test | |
parent | e29f48616d61b9ef53d79280d5a5f46bd9765d9a (diff) | |
parent | 25b8f8119f5b64b5c07cb5ed4978f7df64d4799f (diff) | |
download | otp-b209cea8bd69aa71aef919e794988d3367f36891.tar.gz otp-b209cea8bd69aa71aef919e794988d3367f36891.tar.bz2 otp-b209cea8bd69aa71aef919e794988d3367f36891.zip |
Merge branch 'kellymclaughlin/crypto/aes_cfb_128/PR-1393/OTP-14313' into maint-19
* kellymclaughlin/crypto/aes_cfb_128/PR-1393/OTP-14313:
Fix bug with AES CFB 128
Demonstrate the bug with AES CFB 128 encryption
Diffstat (limited to 'lib/crypto/test')
-rw-r--r-- | lib/crypto/test/crypto_SUITE.erl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index 7b07cef33f..dbd335c693 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -358,6 +358,16 @@ block_cipher({Type, Key, PlainText}) -> ct:fail({{crypto, block_decrypt, [Type, Key, CipherText]}, {expected, Plain}, {got, Other}}) end; +block_cipher({aes_cfb128, Key, IV, PlainText}) -> + Plain = iolist_to_binary(PlainText), + CipherText = crypto:aes_cfb_128_encrypt(Key, IV, PlainText), + case crypto:block_decrypt(aes_cfb128, Key, IV, CipherText) of + Plain -> + ok; + Other -> + ct:fail({{crypto, block_decrypt, [aes_cfb128, Key, IV, CipherText]}, {expected, Plain}, {got, Other}}) + end; + block_cipher({Type, Key, IV, PlainText}) -> Plain = iolist_to_binary(PlainText), CipherText = crypto:block_encrypt(Type, Key, IV, PlainText), |