[PATCH 2/9] Fix CBC-CTS+CBC-MAC flag check

Jussi Kivilinna jussi.kivilinna at iki.fi
Tue Jun 19 17:51:14 CEST 2018


* cipher/cipher.c (_gcry_cipher_open_internal): Check flags separately
instead of AND masking two flags to zero.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/cipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cipher/cipher.c b/cipher/cipher.c
index d6cd0b42e..1b547a4b7 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -503,7 +503,7 @@ _gcry_cipher_open_internal (gcry_cipher_hd_t *handle,
 		     | GCRY_CIPHER_ENABLE_SYNC
 		     | GCRY_CIPHER_CBC_CTS
 		     | GCRY_CIPHER_CBC_MAC))
-	  || (flags & GCRY_CIPHER_CBC_CTS & GCRY_CIPHER_CBC_MAC)))
+	  || ((flags & GCRY_CIPHER_CBC_CTS) && (flags & GCRY_CIPHER_CBC_MAC))))
     err = GPG_ERR_CIPHER_ALGO;
 
   /* check that a valid mode has been requested */
-- 
2.17.1




More information about the Gcrypt-devel mailing list