diff options
author | Kelly McLaughlin <[email protected]> | 2017-03-29 08:49:17 -0600 |
---|---|---|
committer | Kelly McLaughlin <[email protected]> | 2017-03-29 08:49:17 -0600 |
commit | 25b8f8119f5b64b5c07cb5ed4978f7df64d4799f (patch) | |
tree | 38a3fa43fb79421aa3fd5d175184f8c84235329d | |
parent | 59099922f53a478903da304cc591c4baae549dc5 (diff) | |
download | otp-25b8f8119f5b64b5c07cb5ed4978f7df64d4799f.tar.gz otp-25b8f8119f5b64b5c07cb5ed4978f7df64d4799f.tar.bz2 otp-25b8f8119f5b64b5c07cb5ed4978f7df64d4799f.zip |
Fix bug with AES CFB 128
Fix a bug with the use of the aes_cfb128 cipher by calling the correct
underlying openssl interface function when the cipher is specified.
-rw-r--r-- | lib/crypto/c_src/crypto.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c index cd375e6d50..d4264335b6 100644 --- a/lib/crypto/c_src/crypto.c +++ b/lib/crypto/c_src/crypto.c @@ -1405,13 +1405,20 @@ static ERL_NIF_TERM block_crypt_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM return enif_raise_exception(env, atom_notsup); } - if ((argv[0] == atom_aes_cfb8 || argv[0] == atom_aes_cfb128) + if (argv[0] == atom_aes_cfb8 && (key.size == 24 || key.size == 32)) { /* Why do EVP_CIPHER_CTX_set_key_length() fail on these key sizes? * Fall back on low level API */ return aes_cfb_8_crypt(env, argc-1, argv+1); } + else if (argv[0] == atom_aes_cfb128 + && (key.size == 24 || key.size == 32)) { + /* Why do EVP_CIPHER_CTX_set_key_length() fail on these key sizes? + * Fall back on low level API + */ + return aes_cfb_128_crypt_nif(env, argc-1, argv+1); + } ivec_size = EVP_CIPHER_iv_length(cipher); |