[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Thu Jan 28 00:10:23 UTC 2016


The branch master has been updated
       via  b4f35e5e07afa2df7125b814b45242648b33e39e (commit)
      from  3e9e810f2e047effb1056211794d2d12ec2b04e7 (commit)


- Log -----------------------------------------------------------------
commit b4f35e5e07afa2df7125b814b45242648b33e39e
Author: Rich Salz <rsalz at akamai.com>
Date:   Sat Jan 23 13:23:25 2016 -0500

    Remove EIGHT_BIT and SIXTEEN_BIT
    
    Also cleaned up bn_prime.pl to current coding style.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 Configure             |  4 +---
 crypto/bn/bn_prime.c  |  8 ++-----
 crypto/bn/bn_prime.h  | 13 ++---------
 crypto/bn/bn_prime.pl | 65 +++++++++++++++++----------------------------------
 makevms.com           |  4 ----
 5 files changed, 27 insertions(+), 67 deletions(-)

diff --git a/Configure b/Configure
index 3d2e3cd..f34444c 100755
--- a/Configure
+++ b/Configure
@@ -1131,7 +1131,7 @@ $config{export_var_as_fn}	=0;
 my $def_int="unsigned int";
 $config{rc4_int}		=$def_int;
 $config{rc2_int}		=$def_int;
-($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8})=(0,0,1,0,0);
+($config{b64l},$config{b64},$config{b32})=(0,0,1);
 
 foreach (sort split(/\s+/,$target{bn_ops})) {
     $config{bn_ll}=1				if /BN_LLONG/;
@@ -1295,8 +1295,6 @@ print "\n";
 print "SIXTY_FOUR_BIT_LONG mode\n" if $config{b64l};
 print "SIXTY_FOUR_BIT mode\n" if $config{b64};
 print "THIRTY_TWO_BIT mode\n" if $config{b32};
-print "SIXTEEN_BIT mode\n" if $config{b16};
-print "EIGHT_BIT mode\n" if $config{b8};
 print "BN_LLONG mode\n" if $config{bn_ll};
 print "RC4 uses $config{rc4_int}\n" if $config{rc4_int} != $def_int;
 print "RC2 uses $config{rc2_int}\n" if $config{rc2_int} != $def_int;
diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c
index 7d210d3..8d1294f 100644
--- a/crypto/bn/bn_prime.c
+++ b/crypto/bn/bn_prime.c
@@ -115,18 +115,14 @@
 #include <openssl/rand.h>
 
 /*
- * NB: these functions have been "upgraded", the deprecated versions (which
- * are compatibility wrappers using these functions) are in bn_depr.c. -
- * Geoff
- */
-
-/*
  * The quick sieve algorithm approach to weeding out primes is Philip
  * Zimmermann's, as implemented in PGP.  I have had a read of his comments
  * and implemented my own version.
  */
 #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);
diff --git a/crypto/bn/bn_prime.h b/crypto/bn/bn_prime.h
index c2824a8..d1fbcd1 100644
--- a/crypto/bn/bn_prime.h
+++ b/crypto/bn/bn_prime.h
@@ -56,23 +56,15 @@
  * [including the GNU Public Licence.]
  */
 
-#ifndef EIGHT_BIT
-# define NUMPRIMES 2048
 typedef unsigned short prime_t;
-#else
-# define NUMPRIMES 54
-typedef unsigned char prime_t;
-#endif
-static const prime_t primes[NUMPRIMES]= {
+static const prime_t primes[] = {
        2,    3,    5,    7,   11,   13,   17,   19, 
       23,   29,   31,   37,   41,   43,   47,   53, 
       59,   61,   67,   71,   73,   79,   83,   89, 
       97,  101,  103,  107,  109,  113,  127,  131, 
      137,  139,  149,  151,  157,  163,  167,  173, 
      179,  181,  191,  193,  197,  199,  211,  223, 
-     227,  229,  233,  239,  241,  251, 
-#ifndef EIGHT_BIT
-     257,  263, 
+     227,  229,  233,  239,  241,  251,  257,  263, 
      269,  271,  277,  281,  283,  293,  307,  311, 
      313,  317,  331,  337,  347,  349,  353,  359, 
      367,  373,  379,  383,  389,  397,  401,  409, 
@@ -322,5 +314,4 @@ static const prime_t primes[NUMPRIMES]= {
     17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683, 
     17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783, 
     17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863, 
-#endif
 };
diff --git a/crypto/bn/bn_prime.pl b/crypto/bn/bn_prime.pl
index 4e4426a..add6ffb 100644
--- a/crypto/bn/bn_prime.pl
+++ b/crypto/bn/bn_prime.pl
@@ -1,22 +1,4 @@
-#!/usr/local/bin/perl
-# bn_prime.pl
-
-$num=2048;
-$num=$ARGV[0] if ($#ARGV >= 0);
-
-push(@primes,2);
-$p=1;
-loop: while ($#primes < $num-1)
-	{
-	$p+=2;
-	$s=int(sqrt($p));
-
-	for ($i=0; defined($primes[$i]) && $primes[$i]<=$s; $i++)
-		{
-		next loop if (($p%$primes[$i]) == 0);
-		}
-	push(@primes,$p);
-	}
+#! /usr/bin/env perl
 
 print <<\EOF;
 /* Auto generated by bn_prime.pl */
@@ -79,28 +61,25 @@ print <<\EOF;
 
 EOF
 
-for ($i=0; $i <= $#primes; $i++)
-	{
-	if ($primes[$i] > 256)
-		{
-		$eight=$i;
-		last;
-		}
-	}
 
-printf "#ifndef EIGHT_BIT\n";
-printf "# define NUMPRIMES %d\n",$num;
-printf "typedef unsigned short prime_t;\n";
-printf "#else\n";
-printf "# define NUMPRIMES %d\n",$eight;
-printf "typedef unsigned char prime_t;\n";
-printf "#endif\n";
-print "static const prime_t primes[NUMPRIMES]= {\n    ";
-$init=0;
-for ($i=0; $i <= $#primes; $i++)
-	{
-	printf "\n#ifndef EIGHT_BIT\n    " if ($primes[$i] > 256) && !($init++);
-	printf "\n    " if (($i%8) == 0) && ($i != 0);
-	printf "%4d, ", $primes[$i];
-	}
-print "\n#endif\n};\n";
+my $num = shift || 2048;
+my @primes = ( 2 );
+my $p = 1;
+loop: while ($#primes < $num-1) {
+    $p += 2;
+    my $s = int(sqrt($p));
+
+    for (my $i = 0; defined($primes[$i]) && $primes[$i] <= $s; $i++) {
+        next loop if ($p % $primes[$i]) == 0;
+    }
+    push(@primes, $p);
+}
+
+print "typedef unsigned short prime_t;\n";
+
+print "static const prime_t primes[] = {";
+for (my $i = 0; $i <= $#primes; $i++) {
+    printf "\n    " if ($i % 8) == 0;
+    printf "%4d, ", $primes[$i];
+}
+print "\n};\n";
diff --git a/makevms.com b/makevms.com
index 02e0cf2..bfaf261 100755
--- a/makevms.com
+++ b/makevms.com
@@ -592,8 +592,6 @@ $   WRITE H_FILE "#undef SIXTY_FOUR_BIT_LONG"
 $   WRITE H_FILE "#undef SIXTY_FOUR_BIT"
 $   WRITE H_FILE "#define SIXTY_FOUR_BIT"
 $   WRITE H_FILE "#undef THIRTY_TWO_BIT"
-$   WRITE H_FILE "#undef SIXTEEN_BIT"
-$   WRITE H_FILE "#undef EIGHT_BIT"
 $   WRITE H_FILE "#endif"
 $
 $   WRITE H_FILE "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION"
@@ -619,8 +617,6 @@ $   WRITE H_FILE "#undef SIXTY_FOUR_BIT_LONG"
 $   WRITE H_FILE "#undef SIXTY_FOUR_BIT"
 $   WRITE H_FILE "#undef THIRTY_TWO_BIT"
 $   WRITE H_FILE "#define THIRTY_TWO_BIT"
-$   WRITE H_FILE "#undef SIXTEEN_BIT"
-$   WRITE H_FILE "#undef EIGHT_BIT"
 $   WRITE H_FILE "#endif"
 $!
 $   WRITE H_FILE "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION"


More information about the openssl-commits mailing list