diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2022-11-01 22:43:36 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2023-03-01 03:28:39 +0000 |
commit | aba33b3659256dde6e895b52bcff90550f77d49f (patch) | |
tree | ab50b420cdc80f1ba42f9a7f7453a8eb464c2f0c /crypto/bn | |
parent | f874e59ffcd8b5ecd018ad8311d78e866340f3e9 (diff) | |
download | src-aba33b3659256dde6e895b52bcff90550f77d49f.tar.gz src-aba33b3659256dde6e895b52bcff90550f77d49f.zip |
Import OpenSSL 1.1.1s
Diffstat (limited to 'crypto/bn')
-rw-r--r-- | crypto/bn/bn_nist.c | 35 | ||||
-rw-r--r-- | crypto/bn/bn_prime.pl | 9 |
2 files changed, 29 insertions, 15 deletions
diff --git a/crypto/bn/bn_nist.c b/crypto/bn/bn_nist.c index 325dc228490a..c29e62ed3fef 100644 --- a/crypto/bn/bn_nist.c +++ b/crypto/bn/bn_nist.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -249,17 +249,28 @@ const BIGNUM *BN_get0_nist_prime_521(void) return &_bignum_nist_p_521; } -static void nist_cp_bn_0(BN_ULONG *dst, const BN_ULONG *src, int top, int max) -{ - int i; - -#ifdef BN_DEBUG - (void)ossl_assert(top <= max); -#endif - for (i = 0; i < top; i++) - dst[i] = src[i]; - for (; i < max; i++) - dst[i] = 0; +/* + * To avoid more recent compilers (specifically clang-14) from treating this + * code as a violation of the strict aliasing conditions and omiting it, this + * cannot be declared as a function. Moreover, the dst parameter cannot be + * cached in a local since this no longer references the union and again falls + * foul of the strict aliasing criteria. Refer to #18225 for the initial + * diagnostics and llvm/llvm-project#55255 for the later discussions with the + * LLVM developers. The problem boils down to if an array in the union is + * converted to a pointer or if it is used directly. + * + * This function was inlined regardless, so there is no space cost to be + * paid for making it a macro. + */ +#define nist_cp_bn_0(dst, src_in, top, max) \ +{ \ + int ii; \ + const BN_ULONG *src = src_in; \ + \ + for (ii = 0; ii < top; ii++) \ + (dst)[ii] = src[ii]; \ + for (; ii < max; ii++) \ + (dst)[ii] = 0; \ } static void nist_cp_bn(BN_ULONG *dst, const BN_ULONG *src, int top) diff --git a/crypto/bn/bn_prime.pl b/crypto/bn/bn_prime.pl index b0b16087429b..d2eaac6564f8 100644 --- a/crypto/bn/bn_prime.pl +++ b/crypto/bn/bn_prime.pl @@ -1,13 +1,16 @@ #! /usr/bin/env perl -# Copyright 1998-2019 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 1998-2022 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy # in the file LICENSE in the source distribution or at # https://www.openssl.org/source/license.html +use FindBin; +use lib "$FindBin::Bin/../../util/perl"; +use OpenSSL::copyright; -# Output year depends on the year of the script. -my $YEAR = [localtime([stat($0)]->[9])]->[5] + 1900; +# The year the output file is generated. +my $YEAR = OpenSSL::copyright::year_of($0); print <<"EOF"; /* * WARNING: do not edit! |