Add and use internal header that implements endianness check
[openssl.git] / crypto / modes / ctr128.c
index ad25eb38ddc31e7aaae11a9884513b4b121e3070..b902ee9b0b7f1aa53fe80345421a91e5e1c4a626 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <string.h>
 #include <openssl/crypto.h>
+#include "internal/endian.h"
 #include "crypto/modes.h"
 
 #if defined(__GNUC__) && !defined(STRICT_ALIGNMENT)
@@ -39,14 +40,9 @@ static void ctr128_inc(unsigned char *counter)
 static void ctr128_inc_aligned(unsigned char *counter)
 {
     size_t *data, c, d, n;
-    const union {
-        long one;
-        char little;
-    } is_endian = {
-        1
-    };
-
-    if (is_endian.little || ((size_t)counter % sizeof(size_t)) != 0) {
+    DECLARE_IS_ENDIAN;
+
+    if (IS_LITTLE_ENDIAN || ((size_t)counter % sizeof(size_t)) != 0) {
         ctr128_inc(counter);
         return;
     }