aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2024-05-16 11:00:42 -0400
committerBoringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-05-16 15:22:44 +0000
commitc70190368c7040c37c1d655f0690bcde2b109a0d (patch)
treec2af04e90ade911a962e9fb362da44ace1eb0e54 /crypto
parent7662e58e3e0f6b6bcfd6e93ef8c83062096f22e2 (diff)
downloadboringssl-c70190368c7040c37c1d655f0690bcde2b109a0d.zip
boringssl-c70190368c7040c37c1d655f0690bcde2b109a0d.tar.gz
boringssl-c70190368c7040c37c1d655f0690bcde2b109a0d.tar.bz2
Don't define CRYPTO_addc_* and CRYPTO_subc_* in C++
GCC does not support C11 _Generic in C++ mode. Change-Id: I974a0b04bbe4900419736044d0d8050f2b856d56 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68507 Auto-Submit: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/internal.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
index a77102d..a45f97b 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -1174,6 +1174,11 @@ static inline uint64_t CRYPTO_rotr_u64(uint64_t value, int shift) {
// Arithmetic functions.
+// The most efficient versions of these functions on GCC and Clang depend on C11
+// |_Generic|. If we ever need to call these from C++, we'll need to add a
+// variant that uses C++ overloads instead.
+#if !defined(__cplusplus)
+
// CRYPTO_addc_* returns |x + y + carry|, and sets |*out_carry| to the carry
// bit. |carry| must be zero or one.
#if OPENSSL_HAS_BUILTIN(__builtin_addc)
@@ -1275,6 +1280,8 @@ static inline uint64_t CRYPTO_subc_u64(uint64_t x, uint64_t y, uint64_t borrow,
#define CRYPTO_subc_w CRYPTO_subc_u32
#endif
+#endif // !__cplusplus
+
// FIPS functions.