Loading CHANGES +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ RC2_SHORT, RC2_LONG, RC4_LONG, RC4_CHUNK, RC4_INDEX [Rich Salz, with advice from Andy Polyakov] *) Many BN internals have been moved to an internal header file. [Rich Salz with help from Andy Polyakov] *) Configuration and writing out the results from it has changed. Files such as Makefile include/openssl/opensslconf.h and are now produced through general templates, such as Makefile.in and Loading Configure +13 −9 Original line number Diff line number Diff line Loading @@ -1116,17 +1116,21 @@ my $def_int="unsigned int"; $config{rc4_int} =$def_int; ($config{b64l},$config{b64},$config{b32})=(0,0,1); my $count = 0; foreach (sort split(/\s+/,$target{bn_ops})) { $config{bn_ll}=1 if /BN_LLONG/; $config{rc4_int}="unsigned char" if /RC4_CHAR/; ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8}) =(0,1,0,0,0) if /SIXTY_FOUR_BIT/; ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8}) =(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/; ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8}) =(0,0,1,0,0) if /THIRTY_TWO_BIT/; $config{export_var_as_fn}=1 if /EXPORT_VAR_AS_FN/; } $count++ if /SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT/; $config{export_var_as_fn}=1 if $_ eq 'EXPORT_VAR_AS_FN'; $config{bn_ll}=1 if $_ eq 'BN_LLONG'; $config{rc4_int}="unsigned char" if $_ eq 'RC4_CHAR'; ($config{b64l},$config{b64},$config{b32}) =(0,1,0) if $_ eq 'SIXTY_FOUR_BIT'; ($config{b64l},$config{b64},$config{b32}) =(1,0,0) if $_ eq 'SIXTY_FOUR_BIT_LONG'; ($config{b64l},$config{b64},$config{b32}) =(0,0,1) if $_ eq 'THIRTY_TWO_BIT'; } die "Exactly one of SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT can be set in bn_ops\n" if $count > 1; # Hack cflags for better warnings (dev option) ####################### Loading crypto/bn/bn_div.c +0 −8 Original line number Diff line number Diff line Loading @@ -360,10 +360,6 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, q = (BN_ULONG)(((((BN_ULLONG) n0) << BN_BITS2) | n1) / d0); # else q = bn_div_words(n0, n1, d0); # ifdef BN_DEBUG_LEVITTE fprintf(stderr, "DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\ X) -> 0x%08X\n", n0, n1, d0, q); # endif # endif # ifndef REMAINDER_IS_ALREADY_CALCULATED Loading @@ -388,10 +384,6 @@ X) -> 0x%08X\n", n0, n1, d0, q); BN_ULONG t2l, t2h; q = bn_div_words(n0, n1, d0); # ifdef BN_DEBUG_LEVITTE fprintf(stderr, "DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\ X) -> 0x%08X\n", n0, n1, d0, q); # endif # ifndef REMAINDER_IS_ALREADY_CALCULATED rem = (n1 - q * d0) & BN_MASK2; # endif Loading crypto/bn/bn_gcd.c +1 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,7 @@ BIGNUM *int_bn_mod_inverse(BIGNUM *in, * sign*Y*a == A (mod |n|). */ if (BN_is_odd(n) && (BN_num_bits(n) <= (BN_BITS <= 32 ? 450 : 2048))) { if (BN_is_odd(n) && (BN_num_bits(n) <= 2048)) { /* * Binary inversion algorithm; requires odd modulus. This is faster * than the general algorithm if the modulus is sufficiently small Loading crypto/bn/bn_lcl.h +88 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,94 @@ extern "C" { #endif /* * These preprocessor symbols control various aspects of the bignum headers * and library code. They're not defined by any "normal" configuration, as * they are intended for development and testing purposes. NB: defining all * three can be useful for debugging application code as well as openssl * itself. BN_DEBUG - turn on various debugging alterations to the bignum * code BN_DEBUG_RAND - uses random poisoning of unused words to trip up * mismanagement of bignum internals. You must also define BN_DEBUG. */ /* #define BN_DEBUG */ /* #define BN_DEBUG_RAND */ # ifndef OPENSSL_SMALL_FOOTPRINT # define BN_MUL_COMBA # define BN_SQR_COMBA # define BN_RECURSION # endif /* * This next option uses the C libraries (2 word)/(1 word) function. If it is * not defined, I use my C version (which is slower). The reason for this * flag is that when the particular C compiler library routine is used, and * the library is linked with a different compiler, the library is missing. * This mostly happens when the library is built with gcc and then linked * using normal cc. This would be a common occurrence because gcc normally * produces code that is 2 times faster than system compilers for the big * number stuff. For machines with only one compiler (or shared libraries), * this should be on. Again this in only really a problem on machines using * "long long's", are 32bit, and are not using my assembler code. */ # if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \ defined(OPENSSL_SYS_WIN32) || defined(linux) # define BN_DIV2W # endif /* * 64-bit processor with LP64 ABI */ # ifdef SIXTY_FOUR_BIT_LONG # define BN_ULLONG unsigned long long # define BN_BITS4 32 # define BN_MASK2 (0xffffffffffffffffL) # define BN_MASK2l (0xffffffffL) # define BN_MASK2h (0xffffffff00000000L) # define BN_MASK2h1 (0xffffffff80000000L) # define BN_DEC_CONV (10000000000000000000UL) # define BN_DEC_NUM 19 # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # endif /* * 64-bit processor other than LP64 ABI */ # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_BITS4 32 # define BN_MASK2 (0xffffffffffffffffLL) # define BN_MASK2l (0xffffffffL) # define BN_MASK2h (0xffffffff00000000LL) # define BN_MASK2h1 (0xffffffff80000000LL) # define BN_DEC_CONV (10000000000000000000ULL) # define BN_DEC_NUM 19 # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined(_WIN32) && !defined(__GNUC__) # define BN_ULLONG unsigned __int64 # else # define BN_ULLONG unsigned long long # endif # endif # define BN_BITS4 16 # define BN_MASK2 (0xffffffffL) # define BN_MASK2l (0xffff) # define BN_MASK2h1 (0xffff8000L) # define BN_MASK2h (0xffff0000L) # define BN_DEC_CONV (1000000000L) # define BN_DEC_NUM 9 # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # endif /*- * Bignum consistency macros * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from Loading Loading
CHANGES +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ RC2_SHORT, RC2_LONG, RC4_LONG, RC4_CHUNK, RC4_INDEX [Rich Salz, with advice from Andy Polyakov] *) Many BN internals have been moved to an internal header file. [Rich Salz with help from Andy Polyakov] *) Configuration and writing out the results from it has changed. Files such as Makefile include/openssl/opensslconf.h and are now produced through general templates, such as Makefile.in and Loading
Configure +13 −9 Original line number Diff line number Diff line Loading @@ -1116,17 +1116,21 @@ my $def_int="unsigned int"; $config{rc4_int} =$def_int; ($config{b64l},$config{b64},$config{b32})=(0,0,1); my $count = 0; foreach (sort split(/\s+/,$target{bn_ops})) { $config{bn_ll}=1 if /BN_LLONG/; $config{rc4_int}="unsigned char" if /RC4_CHAR/; ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8}) =(0,1,0,0,0) if /SIXTY_FOUR_BIT/; ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8}) =(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/; ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8}) =(0,0,1,0,0) if /THIRTY_TWO_BIT/; $config{export_var_as_fn}=1 if /EXPORT_VAR_AS_FN/; } $count++ if /SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT/; $config{export_var_as_fn}=1 if $_ eq 'EXPORT_VAR_AS_FN'; $config{bn_ll}=1 if $_ eq 'BN_LLONG'; $config{rc4_int}="unsigned char" if $_ eq 'RC4_CHAR'; ($config{b64l},$config{b64},$config{b32}) =(0,1,0) if $_ eq 'SIXTY_FOUR_BIT'; ($config{b64l},$config{b64},$config{b32}) =(1,0,0) if $_ eq 'SIXTY_FOUR_BIT_LONG'; ($config{b64l},$config{b64},$config{b32}) =(0,0,1) if $_ eq 'THIRTY_TWO_BIT'; } die "Exactly one of SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT can be set in bn_ops\n" if $count > 1; # Hack cflags for better warnings (dev option) ####################### Loading
crypto/bn/bn_div.c +0 −8 Original line number Diff line number Diff line Loading @@ -360,10 +360,6 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, q = (BN_ULONG)(((((BN_ULLONG) n0) << BN_BITS2) | n1) / d0); # else q = bn_div_words(n0, n1, d0); # ifdef BN_DEBUG_LEVITTE fprintf(stderr, "DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\ X) -> 0x%08X\n", n0, n1, d0, q); # endif # endif # ifndef REMAINDER_IS_ALREADY_CALCULATED Loading @@ -388,10 +384,6 @@ X) -> 0x%08X\n", n0, n1, d0, q); BN_ULONG t2l, t2h; q = bn_div_words(n0, n1, d0); # ifdef BN_DEBUG_LEVITTE fprintf(stderr, "DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\ X) -> 0x%08X\n", n0, n1, d0, q); # endif # ifndef REMAINDER_IS_ALREADY_CALCULATED rem = (n1 - q * d0) & BN_MASK2; # endif Loading
crypto/bn/bn_gcd.c +1 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,7 @@ BIGNUM *int_bn_mod_inverse(BIGNUM *in, * sign*Y*a == A (mod |n|). */ if (BN_is_odd(n) && (BN_num_bits(n) <= (BN_BITS <= 32 ? 450 : 2048))) { if (BN_is_odd(n) && (BN_num_bits(n) <= 2048)) { /* * Binary inversion algorithm; requires odd modulus. This is faster * than the general algorithm if the modulus is sufficiently small Loading
crypto/bn/bn_lcl.h +88 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,94 @@ extern "C" { #endif /* * These preprocessor symbols control various aspects of the bignum headers * and library code. They're not defined by any "normal" configuration, as * they are intended for development and testing purposes. NB: defining all * three can be useful for debugging application code as well as openssl * itself. BN_DEBUG - turn on various debugging alterations to the bignum * code BN_DEBUG_RAND - uses random poisoning of unused words to trip up * mismanagement of bignum internals. You must also define BN_DEBUG. */ /* #define BN_DEBUG */ /* #define BN_DEBUG_RAND */ # ifndef OPENSSL_SMALL_FOOTPRINT # define BN_MUL_COMBA # define BN_SQR_COMBA # define BN_RECURSION # endif /* * This next option uses the C libraries (2 word)/(1 word) function. If it is * not defined, I use my C version (which is slower). The reason for this * flag is that when the particular C compiler library routine is used, and * the library is linked with a different compiler, the library is missing. * This mostly happens when the library is built with gcc and then linked * using normal cc. This would be a common occurrence because gcc normally * produces code that is 2 times faster than system compilers for the big * number stuff. For machines with only one compiler (or shared libraries), * this should be on. Again this in only really a problem on machines using * "long long's", are 32bit, and are not using my assembler code. */ # if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \ defined(OPENSSL_SYS_WIN32) || defined(linux) # define BN_DIV2W # endif /* * 64-bit processor with LP64 ABI */ # ifdef SIXTY_FOUR_BIT_LONG # define BN_ULLONG unsigned long long # define BN_BITS4 32 # define BN_MASK2 (0xffffffffffffffffL) # define BN_MASK2l (0xffffffffL) # define BN_MASK2h (0xffffffff00000000L) # define BN_MASK2h1 (0xffffffff80000000L) # define BN_DEC_CONV (10000000000000000000UL) # define BN_DEC_NUM 19 # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # endif /* * 64-bit processor other than LP64 ABI */ # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_BITS4 32 # define BN_MASK2 (0xffffffffffffffffLL) # define BN_MASK2l (0xffffffffL) # define BN_MASK2h (0xffffffff00000000LL) # define BN_MASK2h1 (0xffffffff80000000LL) # define BN_DEC_CONV (10000000000000000000ULL) # define BN_DEC_NUM 19 # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined(_WIN32) && !defined(__GNUC__) # define BN_ULLONG unsigned __int64 # else # define BN_ULLONG unsigned long long # endif # endif # define BN_BITS4 16 # define BN_MASK2 (0xffffffffL) # define BN_MASK2l (0xffff) # define BN_MASK2h1 (0xffff8000L) # define BN_MASK2h (0xffff0000L) # define BN_DEC_CONV (1000000000L) # define BN_DEC_NUM 9 # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # endif /*- * Bignum consistency macros * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from Loading