From 78dcaa06094b68a21bf390abac91958a8522a220 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Fri, 9 Jul 2010 17:24:29 +0000 Subject: [PATCH] PR: 2297 Submitted by: Antony, Benoy Approved by: steve@openssl.org Fix bug in AES wrap code when t > 0xff. --- crypto/aes/aes_wrap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/aes/aes_wrap.c b/crypto/aes/aes_wrap.c index 9feacd65d8..a9aebfe9b0 100644 --- a/crypto/aes/aes_wrap.c +++ b/crypto/aes/aes_wrap.c @@ -85,9 +85,9 @@ int AES_wrap_key(AES_KEY *key, const unsigned char *iv, A[7] ^= (unsigned char)(t & 0xff); if (t > 0xff) { - A[6] ^= (unsigned char)((t & 0xff) >> 8); - A[5] ^= (unsigned char)((t & 0xff) >> 16); - A[4] ^= (unsigned char)((t & 0xff) >> 24); + A[6] ^= (unsigned char)((t >> 8) & 0xff); + A[5] ^= (unsigned char)((t >> 16) & 0xff); + A[4] ^= (unsigned char)((t >> 24) & 0xff); } memcpy(R, B + 8, 8); } -- 2.25.1