Revert "Fix an occasional CI failure due to unaligned access"
authorTomas Mraz <tomas@openssl.org>
Thu, 3 Nov 2022 12:26:22 +0000 (13:26 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 9 Jan 2023 07:29:19 +0000 (08:29 +0100)
This reverts commit 8511520842b744d1794ea794c032ce5f78cd874b.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19597)

crypto/bn/rsaz_exp_x2.c

index e6d6e43f93b93cd2a75d0675d823b670437db4e4..f979cebd6fb783474f6c66598fda23d36cfc73f7 100644 (file)
@@ -25,11 +25,11 @@ NON_EMPTY_TRANSLATION_UNIT
 # include <string.h>
 
 # if defined(__GNUC__)
-#  define ALIGN1  __attribute__((aligned(1)))
+#  define ALIGN64 __attribute__((aligned(64)))
 # elif defined(_MSC_VER)
-#  define ALIGN1  __declspec(align(1))
+#  define ALIGN64 __declspec(align(64))
 # else
-#  define ALIGN1
+#  define ALIGN64
 # endif
 
 # define ALIGN_OF(ptr, boundary) \
@@ -47,8 +47,6 @@ NON_EMPTY_TRANSLATION_UNIT
 # define NUMBER_OF_REGISTERS(digits_num, register_size)            \
     (((digits_num) * 64 + (register_size) - 1) / (register_size))
 
-typedef uint64_t ALIGN1 uint64_t_align1;
-
 static ossl_inline uint64_t get_digit(const uint8_t *in, int in_len);
 static ossl_inline void put_digit(uint8_t *out, int out_len, uint64_t digit);
 static void to_words52(BN_ULONG *out, int out_len, const BN_ULONG *in,
@@ -559,9 +557,9 @@ static void to_words52(BN_ULONG *out, int out_len,
     in_str = (uint8_t *)in;
 
     for (; in_bitsize >= (2 * DIGIT_SIZE); in_bitsize -= (2 * DIGIT_SIZE), out += 2) {
-        out[0] = (*(uint64_t_align1 *)in_str) & DIGIT_MASK;
+        out[0] = (*(uint64_t *)in_str) & DIGIT_MASK;
         in_str += 6;
-        out[1] = ((*(uint64_t_align1 *)in_str) >> 4) & DIGIT_MASK;
+        out[1] = ((*(uint64_t *)in_str) >> 4) & DIGIT_MASK;
         in_str += 7;
         out_len -= 2;
     }
@@ -620,9 +618,9 @@ static void from_words52(BN_ULONG *out, int out_bitsize, const BN_ULONG *in)
 
         for (; out_bitsize >= (2 * DIGIT_SIZE);
                out_bitsize -= (2 * DIGIT_SIZE), in += 2) {
-            (*(uint64_t_align1 *)out_str) = in[0];
+            (*(uint64_t *)out_str) = in[0];
             out_str += 6;
-            (*(uint64_t_align1 *)out_str) ^= in[1] << 4;
+            (*(uint64_t *)out_str) ^= in[1] << 4;
             out_str += 7;
         }