modes/ocb128.c: improve the calculation of double mask
authorDesWurstes <DesWurstes@users.noreply.github.com>
Sat, 7 Jul 2018 09:10:53 +0000 (12:10 +0300)
committerAndy Polyakov <appro@openssl.org>
Mon, 9 Jul 2018 10:35:02 +0000 (12:35 +0200)
CLA: trivial

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6667)

crypto/modes/ocb128.c

index 76591e69921f260a898fa23713135b728a9ab66d..72e6ea9b583bbf89f9b6d6c1734a9fc51364fbc9 100644 (file)
@@ -74,7 +74,7 @@ static void ocb_double(OCB_BLOCK *in, OCB_BLOCK *out)
      */
     mask = in->c[0] & 0x80;
     mask >>= 7;
-    mask *= 135;
+    mask = (0 - mask) & 0x87;
 
     ocb_block_lshift(in->c, 1, out->c);