2 # Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
11 * WARNING: do not edit!
12 * Generated by crypto/bn/bn_prime.pl
14 * Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
16 * Licensed under the OpenSSL license (the "License"). You may not use
17 * this file except in compliance with the License. You can obtain a copy
18 * in the file LICENSE in the source distribution or at
19 * https://www.openssl.org/source/license.html
25 my $num = shift || 2048;
28 loop: while ($#primes < $num-1) {
30 my $s = int(sqrt($p));
32 for (my $i = 0; defined($primes[$i]) && $primes[$i] <= $s; $i++) {
33 next loop if ($p % $primes[$i]) == 0;
38 print "typedef unsigned short prime_t;\n";
39 printf "# define NUMPRIMES %d\n\n", $num;
41 printf "static const prime_t primes[%d] = {\n", $num;
42 for (my $i = 0; $i <= $#primes; $i++) {
43 printf "\n " if ($i % 8) == 0;
44 printf "%4d, ", $primes[$i];