summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2023-04-15 19:15:53 +0000
committerjsing <>2023-04-15 19:15:53 +0000
commit1360c085f918d4a9562d6313272200fa3181fc54 (patch)
tree32df40158aef1bfc11d0e4baab896367f1798b4b /src
parent90bc52ec284ed000ba952cc4d8d31facd618af58 (diff)
downloadopenbsd-1360c085f918d4a9562d6313272200fa3181fc54.tar.gz
openbsd-1360c085f918d4a9562d6313272200fa3181fc54.tar.bz2
openbsd-1360c085f918d4a9562d6313272200fa3181fc54.zip
Use the same byte order tests as we do elsewhere in libcrypto.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/sha/sha3.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libcrypto/sha/sha3.c b/src/lib/libcrypto/sha/sha3.c
index 23019fb4d4..7b70d90c87 100644
--- a/src/lib/libcrypto/sha/sha3.c
+++ b/src/lib/libcrypto/sha/sha3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha3.c,v 1.9 2023/04/15 18:32:55 jsing Exp $ */ 1/* $OpenBSD: sha3.c,v 1.10 2023/04/15 19:15:53 jsing Exp $ */
2/* 2/*
3 * The MIT License (MIT) 3 * The MIT License (MIT)
4 * 4 *
@@ -23,6 +23,8 @@
23 * SOFTWARE. 23 * SOFTWARE.
24 */ 24 */
25 25
26#include <endian.h>
27
26#include "sha3_internal.h" 28#include "sha3_internal.h"
27 29
28#define KECCAKF_ROUNDS 24 30#define KECCAKF_ROUNDS 24
@@ -54,7 +56,7 @@ sha3_keccakf(uint64_t st[25])
54 uint64_t t, bc[5]; 56 uint64_t t, bc[5];
55 int i, j, r; 57 int i, j, r;
56 58
57#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ 59#if BYTE_ORDER != LITTLE_ENDIAN
58 uint8_t *v; 60 uint8_t *v;
59 61
60 for (i = 0; i < 25; i++) { 62 for (i = 0; i < 25; i++) {
@@ -99,7 +101,7 @@ sha3_keccakf(uint64_t st[25])
99 st[0] ^= sha3_keccakf_rndc[r]; 101 st[0] ^= sha3_keccakf_rndc[r];
100 } 102 }
101 103
102#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ 104#if BYTE_ORDER != LITTLE_ENDIAN
103 for (i = 0; i < 25; i++) { 105 for (i = 0; i < 25; i++) {
104 v = (uint8_t *) &st[i]; 106 v = (uint8_t *) &st[i];
105 t = st[i]; 107 t = st[i];