summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/modes
diff options
context:
space:
mode:
authorjsing <>2026-01-17 14:30:37 +0000
committerjsing <>2026-01-17 14:30:37 +0000
commitdb12bd9b580e2fc1c5c7d3224d2d9d0f534d1b8d (patch)
treed8886890844b745822e02557ecb2251ea4786398 /src/lib/libcrypto/modes
parent1dd1aaafcbe820792a0f2e002a85a22055696509 (diff)
downloadopenbsd-db12bd9b580e2fc1c5c7d3224d2d9d0f534d1b8d.tar.gz
openbsd-db12bd9b580e2fc1c5c7d3224d2d9d0f534d1b8d.tar.bz2
openbsd-db12bd9b580e2fc1c5c7d3224d2d9d0f534d1b8d.zip
Replace GHASH_ASM with function specific defines.
Use the same pattern that is now used for most other code - provide HAVE_* defines for functions and use these to selectively enable source code.
Diffstat (limited to 'src/lib/libcrypto/modes')
-rw-r--r--src/lib/libcrypto/modes/gcm128.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/lib/libcrypto/modes/gcm128.c b/src/lib/libcrypto/modes/gcm128.c
index b6874296e0..a88f589b00 100644
--- a/src/lib/libcrypto/modes/gcm128.c
+++ b/src/lib/libcrypto/modes/gcm128.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gcm128.c,v 1.54 2025/06/28 12:39:10 jsing Exp $ */ 1/* $OpenBSD: gcm128.c,v 1.55 2026/01/17 14:30:37 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -52,6 +52,7 @@
52 52
53#include <openssl/crypto.h> 53#include <openssl/crypto.h>
54 54
55#include "crypto_arch.h"
55#include "crypto_internal.h" 56#include "crypto_internal.h"
56#include "modes_local.h" 57#include "modes_local.h"
57 58
@@ -84,17 +85,17 @@ gcm_init_4bit(u128 Htable[16], uint64_t H[2])
84 } 85 }
85} 86}
86 87
87#ifdef GHASH_ASM 88#if !defined(HAVE_GCM_GHASH_4BIT) && !defined(HAVE_GCM_GMULT_4BIT)
88void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]);
89void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
90 size_t len);
91
92#else
93static const uint16_t rem_4bit[16] = { 89static const uint16_t rem_4bit[16] = {
94 0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0, 90 0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0,
95 0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0, 91 0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0,
96}; 92};
93#endif
94
95#ifdef HAVE_GCM_GMULT_4BIT
96void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]);
97 97
98#else
98static void 99static void
99gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]) 100gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16])
100{ 101{
@@ -135,7 +136,13 @@ gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16])
135 Xi[0] = htobe64(Z.hi); 136 Xi[0] = htobe64(Z.hi);
136 Xi[1] = htobe64(Z.lo); 137 Xi[1] = htobe64(Z.lo);
137} 138}
139#endif
138 140
141#ifdef HAVE_GCM_GHASH_4BIT
142void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
143 size_t len);
144
145#else
139static void 146static void
140gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], 147gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16],
141 const uint8_t *inp, size_t len) 148 const uint8_t *inp, size_t len)