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/src/crypto.erl | |
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/src/crypto.erl')
-rw-r--r-- | lib/crypto/src/crypto.erl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 696929ba4e..60e0affda0 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -822,6 +822,8 @@ sha_mac_96(Key, Data) -> hmac(sha, Key, Data, 12). block_crypt_nif(_Type, _Key, _Ivec, _Text, _IsEncrypt) -> ?nif_stub. block_crypt_nif(_Type, _Key, _Text, _IsEncrypt) -> ?nif_stub. +aes_cfb_128_crypt_nif(_Key, _Ivec, _Text, _IsEncrypt) -> ?nif_stub. + check_des3_key(Key) -> case lists:map(fun erlang:iolist_to_binary/1, Key) of ValidKey = [B1, B2, B3] when byte_size(B1) =:= 8, @@ -915,7 +917,9 @@ blowfish_ofb64_encrypt(Key, IVec, Data) -> -spec aes_cfb_128_decrypt(iodata(), binary(), iodata()) -> binary(). aes_cfb_128_encrypt(Key, IVec, Data) -> - block_encrypt(aes_cfb128, Key, IVec, Data). + %% block_encrypt(aes_cfb128, Key, IVec, Data). + aes_cfb_128_crypt_nif(Key, IVec, Data, true). + aes_cfb_128_decrypt(Key, IVec, Data) -> block_decrypt(aes_cfb128, Key, IVec, Data). |