Fix test failures when using enable-ubsan
[openssl.git] / 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;