Fix test failures when using enable-ubsan
authorMatt Caswell <matt@openssl.org>
Thu, 2 Jun 2016 12:53:49 +0000 (13:53 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 2 Jun 2016 14:36:22 +0000 (15:36 +0100)
Numerous test failures were occuring when Configured with enable-ubsan
although they could all be traced back to one issue.

Reviewed-by: Andy Polyakov <appro@openssl.org>
crypto/bn/rsaz_exp.c

index 3398cce9ab450f2a7663161367c3acce1d60af3f..1a70f6caded2eab20b0a0b4026556c23bf3b93a0 100644 (file)
@@ -253,7 +253,7 @@ void RSAZ_1024_mod_exp_avx2(BN_ULONG result_norm[16],
 
         rsaz_1024_sqr_avx2(result, result, m, k0, 5);
 
-        wvalue = *((unsigned short *)&p_str[index / 8]);
+        wvalue = (p_str[(index / 8) + 1] << 8) | p_str[index / 8];
         wvalue = (wvalue >> (index % 8)) & 31;
         index -= 5;