summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2002-05-31 13:11:44 +0000
committerRichard Levitte <levitte@openssl.org>2002-05-31 13:11:44 +0000
commit94f1b50c0fde7b60a7bf31c6eb8c93e84b9e3f24 (patch)
treec128989c4f51105fc14a2f170b02350a0fbc4ef7 /crypto
parentbd54d55c1da428e7d3e5bb6bdff7bfc0f10d7586 (diff)
For CFB and OFB modes, always create the encryption key.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/e_aes.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c
index 9d03a9602f..c323fa2892 100644
--- a/crypto/evp/e_aes.c
+++ b/crypto/evp/e_aes.c
@@ -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);