RT2867: des_ede3_cfb1 ignored "size in bits" flag
authorRich Salz <rsalz@openssl.org>
Thu, 23 Jun 2016 14:03:50 +0000 (10:03 -0400)
committerMatt Caswell <matt@openssl.org>
Tue, 2 May 2017 16:04:27 +0000 (17:04 +0100)
Code by Steve Henson. Backport to 1.0.2 from commit fe2d149119

Fixes #2346

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3364)

crypto/evp/e_des3.c

index 0e910d6d8085b902ac9dac181c5d94585ded51bf..ab8126e5c9cf689877b2c9d66a6aab2030146392 100644 (file)
@@ -212,6 +212,8 @@ static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
     size_t n;
     unsigned char c[1], d[1];
 
+    if (!EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
+            inl *= 8;
     for (n = 0; n < inl; ++n) {
         c[0] = (in[n / 8] & (1 << (7 - n % 8))) ? 0x80 : 0;
         DES_ede3_cfb_encrypt(c, d, 1, 1,