2
0
mirror of https://github.com/openssl/openssl.git synced 2025-02-23 14:42:15 +08:00

Restore NUMPRIMES as a numeric literal

This fixes clang compilation problem with size_t NUMPRIMES and int
loop counters.

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Viktor Dukhovni 2016-01-28 00:10:11 -05:00
parent 3538c7da3d
commit 7eba4e6207
4 changed files with 9 additions and 7 deletions

View File

@ -442,9 +442,9 @@ depend:
update: generate errors ordinals depend update: generate errors ordinals depend
generate: generate:
(cd apps && $(MAKE) generate) (cd apps && PERL='${PERL}' $(MAKE) generate)
(cd crypto/bn && $(MAKE) generate) (cd crypto/bn && PERL='${PERL}' $(MAKE) generate)
(cd crypto/objects && $(MAKE) generate) (cd crypto/objects && PERL='${PERL}' $(MAKE) generate)
errors: errors:
$(PERL) util/ck_errf.pl -strict */*.c */*/*.c $(PERL) util/ck_errf.pl -strict */*.c */*/*.c

View File

@ -121,8 +121,6 @@
*/ */
#include "bn_prime.h" #include "bn_prime.h"
#define NUMPRIMES OSSL_NELEM(primes)
static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
const BIGNUM *a1_odd, int k, BN_CTX *ctx, const BIGNUM *a1_odd, int k, BN_CTX *ctx,
BN_MONT_CTX *mont); BN_MONT_CTX *mont);

View File

@ -57,7 +57,10 @@
*/ */
typedef unsigned short prime_t; typedef unsigned short prime_t;
static const prime_t primes[] = { # define NUMPRIMES 2048
static const prime_t primes[2048] = {
2, 3, 5, 7, 11, 13, 17, 19, 2, 3, 5, 7, 11, 13, 17, 19,
23, 29, 31, 37, 41, 43, 47, 53, 23, 29, 31, 37, 41, 43, 47, 53,
59, 61, 67, 71, 73, 79, 83, 89, 59, 61, 67, 71, 73, 79, 83, 89,

View File

@ -76,8 +76,9 @@ loop: while ($#primes < $num-1) {
} }
print "typedef unsigned short prime_t;\n"; print "typedef unsigned short prime_t;\n";
printf "# define NUMPRIMES %d\n\n", $num;
print "static const prime_t primes[] = {"; printf "static const prime_t primes[%d] = {\n", $num;
for (my $i = 0; $i <= $#primes; $i++) { for (my $i = 0; $i <= $#primes; $i++) {
printf "\n " if ($i % 8) == 0; printf "\n " if ($i % 8) == 0;
printf "%4d, ", $primes[$i]; printf "%4d, ", $primes[$i];