From: tb Date: Wed, 17 May 2023 07:42:38 +0000 (+0000) Subject: Use crypto_internal.h's CTASSERT() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c42a47753f95ef5853cf0a04c40c8ce1aaea48d0;p=openbsd 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 4a757b02ceb..1dff1b05622 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.7 2023/03/27 10:25:02 tb Exp $ */ +/* $OpenBSD: bn_isqrt.c,v 1.8 2023/05/17 07:42:38 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 5d317a81c00..5b1d1b090ba 100644 --- a/lib/libcrypto/crypto_lock.c +++ b/lib/libcrypto/crypto_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_lock.c,v 1.2 2018/11/28 15:51:32 jsing Exp $ */ +/* $OpenBSD: crypto_lock.c,v 1.3 2023/05/17 07:42:38 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