For CFB and OFB modes, always create the encryption key.
This commit is contained in:
parent
bd54d55c1d
commit
94f1b50c0f
1 changed files with 3 additions and 1 deletions
|
@ -88,7 +88,9 @@ IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY,
|
|||
static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
const unsigned char *iv, int enc) {
|
||||
|
||||
if (enc)
|
||||
if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE
|
||||
|| (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE
|
||||
|| enc)
|
||||
AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
|
||||
else
|
||||
AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
|
||||
|
|
Loading…
Reference in a new issue