Commit e3b2632ffa for openssl.org
commit e3b2632ffafc57010c11d04695e8f397d9d0bbce
Author: Bob Beck <beck@openssl.org>
Date: Mon Apr 27 19:23:48 2026 -0600
Generate guarded bn_prime.h
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May 6 11:36:00 2026
(Merged from https://github.com/openssl/openssl/pull/31001)
diff --git a/crypto/bn/bn_prime.h b/crypto/bn/bn_prime.h
index 8a859ac02e..4038d99b6a 100644
--- a/crypto/bn/bn_prime.h
+++ b/crypto/bn/bn_prime.h
@@ -2,7 +2,7 @@
* WARNING: do not edit!
* Generated by crypto/bn/bn_prime.pl
*
- * Copyright 1998-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1998-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -10,6 +10,10 @@
* https://www.openssl.org/source/license.html
*/
+#if !defined(OSSL_LIBCRYPTO_BN_BN_PRIME_H)
+#define OSSL_LIBCRYPTO_BN_BN_PRIME_H
+
+/* clang-format off */
typedef unsigned short prime_t;
# define NUMPRIMES 2048
@@ -271,3 +275,6 @@ static const prime_t primes[2048] = {
17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783,
17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863,
};
+/* clang-format on */
+
+#endif /* !defined(OSSL_LIBCRYPTO_BN_BN_PRIME_H) */
diff --git a/crypto/bn/bn_prime.pl b/crypto/bn/bn_prime.pl
index a7a764627b..3d9722d008 100644
--- a/crypto/bn/bn_prime.pl
+++ b/crypto/bn/bn_prime.pl
@@ -25,6 +25,10 @@ print <<"EOF";
* https://www.openssl.org/source/license.html
*/
+#if !defined(OSSL_LIBCRYPTO_BN_BN_PRIME_H)
+#define OSSL_LIBCRYPTO_BN_BN_PRIME_H
+
+/* clang-format off */
EOF
@@ -50,3 +54,5 @@ for (my $i = 0; $i <= $#primes; $i++) {
printf " %5d,", $primes[$i];
}
print "\n};\n";
+print "/* clang-format on */\n";
+print "\n#endif /* !defined(OSSL_LIBCRYPTO_BN_BN_PRIME_H) */\n"