From: tb Date: Sun, 4 Jun 2023 17:28:35 +0000 (+0000) Subject: Reinstate bn_isqrt.c r1.8 and crypto_lock.c r1.3 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a29d9d67340b8f3fa5d47bc026fa8826622c56ea;p=openbsd Reinstate bn_isqrt.c r1.8 and crypto_lock.c r1.3 This traded local copies of CTASSERT() to the one in crypto_internal.h. This change was backed out due to SHA-512 breakage on STRICT_ALIGNMENT architectures still using Fred Flintstone's gcc without asm sha512. Original commit message: Use crypto_internal.h's CTASSERT() Now that this macro is available in a header, let's use that version rather than copies in several .c files. discussed with jsing --- diff --git a/lib/libcrypto/bn/bn_isqrt.c b/lib/libcrypto/bn/bn_isqrt.c index d24a4a43baa..018d5f34bd8 100644 --- a/lib/libcrypto/bn/bn_isqrt.c +++ b/lib/libcrypto/bn/bn_isqrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_isqrt.c,v 1.9 2023/05/19 00:54:28 deraadt Exp $ */ +/* $OpenBSD: bn_isqrt.c,v 1.10 2023/06/04 17:28:35 tb Exp $ */ /* * Copyright (c) 2022 Theo Buehler * @@ -22,9 +22,7 @@ #include #include "bn_local.h" - -#define CTASSERT(x) extern char _ctassert[(x) ? 1 : -1 ] \ - __attribute__((__unused__)) +#include "crypto_internal.h" /* * Calculate integer square root of |n| using a variant of Newton's method. diff --git a/lib/libcrypto/crypto_lock.c b/lib/libcrypto/crypto_lock.c index bd8315c264e..6d9dbab22bd 100644 --- a/lib/libcrypto/crypto_lock.c +++ b/lib/libcrypto/crypto_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_lock.c,v 1.4 2023/05/19 00:54:27 deraadt Exp $ */ +/* $OpenBSD: crypto_lock.c,v 1.5 2023/06/04 17:28:35 tb Exp $ */ /* * Copyright (c) 2018 Brent Cook * @@ -19,6 +19,8 @@ #include +#include "crypto_internal.h" + static pthread_mutex_t locks[] = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, @@ -63,9 +65,6 @@ static pthread_mutex_t locks[] = { PTHREAD_MUTEX_INITIALIZER, }; -#define CTASSERT(x) extern char _ctassert[(x) ? 1 : -1 ] \ - __attribute__((__unused__)) - CTASSERT((sizeof(locks) / sizeof(*locks)) == CRYPTO_NUM_LOCKS); void