Restore NUMPRIMES as a numeric literal
authorViktor Dukhovni <openssl-users@dukhovni.org>
Thu, 28 Jan 2016 05:10:11 +0000 (00:10 -0500)
committerViktor Dukhovni <openssl-users@dukhovni.org>
Thu, 28 Jan 2016 11:36:55 +0000 (06:36 -0500)
This fixes clang compilation problem with size_t NUMPRIMES and int
loop counters.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Makefile.in
crypto/bn/bn_prime.c
crypto/bn/bn_prime.h
crypto/bn/bn_prime.pl

index 629141de97553397fb58aa5e964a8d5f68cc732a..80d5f175d0cb82d35d13c7d39b6be70e5c262845 100644 (file)
@@ -442,9 +442,9 @@ depend:
 update: generate errors ordinals depend
 
 generate:
-       (cd apps && $(MAKE) generate)
-       (cd crypto/bn && $(MAKE) generate)
-       (cd crypto/objects && $(MAKE) generate)
+       (cd apps && PERL='${PERL}' $(MAKE) generate)
+       (cd crypto/bn && PERL='${PERL}' $(MAKE) generate)
+       (cd crypto/objects && PERL='${PERL}' $(MAKE) generate)
 
 errors:
        $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
index 8d1294fcfcc0a44468555e226f405e0ac3acdda0..a5887d96a8532b859796d1cf7723ebac1e6c949e 100644 (file)
  */
 #include "bn_prime.h"
 
-#define NUMPRIMES OSSL_NELEM(primes)
-
 static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
                    const BIGNUM *a1_odd, int k, BN_CTX *ctx,
                    BN_MONT_CTX *mont);
index d1fbcd1021b98ea6c774d40c1ec4e85e1849650e..6f6949cd7a86f633a17905b2866b46b9e3514bb8 100644 (file)
  */
 
 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, 
       23,   29,   31,   37,   41,   43,   47,   53, 
       59,   61,   67,   71,   73,   79,   83,   89, 
index add6ffb9d0d724eec2e3fe60bd90e31b02303713..3a5f064faa61b55628fe7dd3e395483ac9dd6464 100644 (file)
@@ -76,8 +76,9 @@ loop: while ($#primes < $num-1) {
 }
 
 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++) {
     printf "\n    " if ($i % 8) == 0;
     printf "%4d, ", $primes[$i];