Commit graph

262 commits

Author SHA1 Message Date
Ben Laurie
c9b51693dc max -> dmax in bn_check_top. 2000-08-22 21:23:09 +00:00
Dr. Stephen Henson
2d978cbd30 Changes needed for Tandem NSK, supplied by Scott Uroff (scott@xypro.com).
Fix warnings with BIO_dump_indent().
2000-08-04 00:01:39 +00:00
Richard Levitte
8083e1bd9e There's a slight possibility that a is 0 in BN_sub_word(), and might
therefore have unallocated parts.  Therefore, a check for the 0 case
is needed, resulting with the same thing as when a is negative.
2000-07-27 21:32:23 +00:00
Richard Levitte
8b4e27e26e In the case where a < 0 and |a| < w, the result (assigned to a) from
BN_add_word becomes wrongly negative...
This was discovered by Darrel Hankerson <dhankers@cacr.math.uwaterloo.ca>
2000-07-27 21:17:14 +00:00
Richard Levitte
47ff5de8c2 Darrel Hankerson <dhankers@cacr.math.uwaterloo.ca> correctly discovered
that of the result pointer to bn_mul was the same as one of the two arguments,
That argument might have it's sign destroyed.  He provided this fix.
2000-07-26 01:14:16 +00:00
Bodo Möller
904cb691f3 Return bignum '0' when BN_rand is asked for a 0 bit random number. 2000-07-02 19:42:19 +00:00
Ben Laurie
69b5d3c51f Don't let top go below zero! 2000-07-01 16:30:27 +00:00
Bodo Möller
fc57ebc057 Actually comment out the parts of BN_MOD_MUL_WORD that I inteded to
comment out in the previous commit
2000-06-23 08:10:28 +00:00
Bodo Möller
e958c5afe7 In BN_mod_exp_mont_word, avoid one application of BN_MOD_MUL_WORD,
and for small 'a' also a couple of calls to
BN_mod_mul_montgomery(r, r, r, ...).
2000-06-23 05:51:37 +00:00
Ulf Möller
8415060e1e use faster version 2000-06-21 21:20:46 +00:00
Bodo Möller
24bec03beb This probably fixes a BN_rshift bug. 2000-06-13 15:07:39 +00:00
Bodo Möller
c3b1424cc0 Use BN_CTX_end when exiting early from BN_mod_exp_mont_word because
BN_mod_exp_atalla could be used.
2000-06-13 13:50:42 +00:00
Geoff Thorpe
8ba6d1b0cc The atalla functionality doesn't work with the "word" version of
BN_mod_exp. Call the regular atalla mod_exp operation instead.
2000-06-13 13:18:51 +00:00
Geoff Thorpe
1c4f90a05d Enable DSO support on alpha (OSF1), cc and gcc.
Also, "make update" has added some missing functions to libeay.num,
updated the TABLE for the alpha changes, and updated thousands of
dependancies that have changed from recent commits.
2000-06-13 12:59:38 +00:00
Bodo Möller
814ed26cfa Comment for increased code clarity. 2000-06-09 09:11:30 +00:00
Bodo Möller
dc434bbcb0 Slightly faster DSA verification (BN_mod_exp2_mont),
marginally faster BN_mod_exp for 1024 bit exponents.
2000-06-08 20:26:03 +00:00
Bodo Möller
f8989a2155 Use the equivalent of a sliding window (without precomputation
because we're only handling words anyway) in BN_mod_exp_mont_word
making it a little faster for very small exponents,
and adjust the performance gain estimate in CHANGES according
to slightly more thorough measurements.
(15% faster than BN_mod_exp_mont for "large" base,
20% faster than BN_mod_exp_mont for small base.)
2000-06-08 09:39:28 +00:00
Bodo Möller
6dad7bd69c Speed up DH with small generator. 2000-06-07 21:29:25 +00:00
Richard Levitte
26a3a48d65 There have been a number of complaints from a number of sources that names
like Malloc, Realloc and especially Free conflict with already existing names
on some operating systems or other packages.  That is reason enough to change
the names of the OpenSSL memory allocation macros to something that has a
better chance of being unique, like prepending them with OPENSSL_.

This change includes all the name changes needed throughout all C files.
2000-06-01 22:19:21 +00:00
Ulf Möller
de42b6a7a8 Use NO_FP_API. 2000-06-01 20:25:44 +00:00
Ulf Möller
623bb80b77 In some of the Makefiles CPP was not defined. 2000-03-20 18:16:52 +00:00
Bodo Möller
88f17a5e98 Remove Win32 assembler files. They are always rebuilt (with some
choice of parameters) when they are needed.
2000-03-13 08:04:20 +00:00
Ulf Möller
3a6a39c373 asm workaround for SuSE Linux
proposed by Holger Reif
2000-03-12 12:52:36 +00:00
Bodo Möller
59fc2b0fc2 Preserve reason strings in automatically build tables. 2000-03-05 00:19:36 +00:00
Bodo Möller
df83eeb710 Update comment. 2000-03-02 22:08:30 +00:00
Bodo Möller
743e7be913 Add missing dependencies. 2000-03-02 19:30:41 +00:00
Bodo Möller
2d092edf5e Change comment. 2000-03-02 14:34:08 +00:00
Ulf Möller
8782a42627 add comment. 2000-03-01 19:08:47 +00:00
Ulf Möller
0b8fa44ef0 Bug fix. 2000-03-01 19:08:27 +00:00
Ulf Möller
f1a617edc9 check for WIN32 (needed by Mingw32) 2000-03-01 01:46:34 +00:00
Richard Levitte
4ba48ec4d0 Include rand.h so RAND_pseudo_bytes may be declared.
Remove one ampersand so the compiler may complain less.
Make rand() static so it will not conflict with the C RTL.
Make bug() static too, for good measure.
2000-02-27 22:57:53 +00:00
Dr. Stephen Henson
587bb0e02e Don't call BN_rand with zero bits in bntest.c 2000-02-27 17:34:30 +00:00
Ben Laurie
707ef52e21 Typo. 2000-02-27 16:56:48 +00:00
Bodo Möller
981cdfab86 Add a comment. 2000-02-27 11:48:32 +00:00
Ulf Möller
688938fbb4 Bug fix! 2000-02-27 02:05:39 +00:00
Ulf Möller
1070e0e2ee *** empty log message *** 2000-02-27 00:00:56 +00:00
Ulf Möller
1b199605c4 workaround no longer needed 2000-02-26 22:37:43 +00:00
Ulf Möller
f27e41349f remove 2000-02-26 22:37:34 +00:00
Ulf Möller
775c63fc02 Reorganize bn_mul.c (no bugfix yet), remove obsolete files in BN library. 2000-02-26 22:16:47 +00:00
Andy Polyakov
63933136ab BN_div_recp fix. I've ran divtest for 10 mins and it didn't exhibit a
single fault:-) Needless to mention that bnbug.c posted couple of days
ago passes as well...
2000-02-26 16:20:05 +00:00
Ulf Möller
582afb4bd7 flush output.
Looks like it fails when b is a power of 2, but I never get incorrect
results.
2000-02-25 22:08:37 +00:00
Richard Levitte
f36e02b2ef Enhance consistency by using BIO_flush() instead of fflush(). 2000-02-25 20:40:12 +00:00
Ulf Möller
17dddc0596 Test the division functions.
Apparently BN_div_recp reports an error for small divisors
(1,2,4,8,40).

I haven't got mismatches so far. If you can, please run the test
program for a few days (nohup divtest >out& or something), and if it
reports a mismatch, post the output.
2000-02-25 20:28:54 +00:00
Ulf Möller
766d78c8f5 divide the correct number... 2000-02-25 00:14:50 +00:00
Ulf Möller
c04949e978 work around a bug in BN_div_recp or BN_reciprocal 2000-02-24 23:37:15 +00:00
Bodo Möller
0dd0cbf554 Do fflush(stdout) when there was an error. 2000-02-24 20:13:27 +00:00
Ulf Möller
4a26329b4c correct macro. 2000-02-23 22:11:07 +00:00
Ben Laurie
bd03b99b9b Add support for Compaq Atalla crypto accelerator. 2000-02-16 22:15:39 +00:00
Andy Polyakov
8691ff97a1 Move primes to read-only segment. 2000-02-16 13:24:06 +00:00
Andy Polyakov
89cee61b45 New NO_INLINE_ASM macro. Primary target for the moment is Solaris x86
which can't stand GNU C assembler templates.
2000-02-15 17:20:52 +00:00
Andy Polyakov
ea96c4bc7f test_mont was exercising 100-bit multiplication modulus X*I-bit, where
X is 5120 on 32-bit and 151552 on 64-bit architectures and I varies
from 0 to 4. As result the test was *unreasonably* slow and virtually
impossible to complete on 64-bit architectures (e.g. IRIX bc couldn't
even swallow such long lines).
2000-02-15 13:50:02 +00:00
Ralf S. Engelschall
667ac4ec6a Make gcc 2.95.2 happy again, even under ``-Wall -Wshadow -Wpointer-arith -Wcast-align
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline''.
2000-02-11 09:47:18 +00:00
Dr. Stephen Henson
f07fb9b24b Add command line password options to the reamining utilities,
amend docs.
2000-02-08 01:34:59 +00:00
Ulf Möller
4e539aaa1e "print" is GNU bc specific. 2000-02-06 23:33:06 +00:00
Ulf Möller
fcb20be846 put missing line back in. 2000-02-06 16:35:28 +00:00
Ulf Möller
cae55bfc68 Improve bntest slightly, and fix another bug in the BN library. 2000-02-06 15:56:59 +00:00
Ulf Möller
4a6222d71b BN_div bugfix. The q-- loop should not be entered in the n0==d0 case. 2000-02-06 00:25:39 +00:00
Bodo Möller
29a28ee503 Cosmetic changes. 2000-02-05 21:28:09 +00:00
Bodo Möller
eb5a6a55c5 Commit patch to bn.h that CVS decided to throw away during 'cvs update',
and initialize too_many because memset(..., 0, ...) is not used here.
2000-02-05 20:39:26 +00:00
Bodo Möller
37e48b88ad Generate just one error code if iterated SSL_CTX_get() fails.
Avoid enabled 'assert()' in production library.
2000-02-05 19:29:00 +00:00
Ulf Möller
6535eb1728 Use MONT_WORD macro to control if the word-based or the bignum
algorithm is used.
2000-02-05 18:23:05 +00:00
Ulf Möller
9b141126d4 New functions BN_CTX_start(), BN_CTX_get(), BN_CTX_end() to access
temporary BIGNUMs. BN_CTX still uses a fixed number of BIGNUMs, but
the BN_CTX implementation could now easily be changed.
2000-02-05 14:17:32 +00:00
Ulf Möller
ce76ce43ae *** empty log message *** 2000-02-03 23:38:55 +00:00
Ulf Möller
657e60fa00 ispell (and minor modifications) 2000-02-03 23:23:24 +00:00
Bodo Möller
7999c65c9b Some 'const's for BNs. 2000-02-03 01:26:07 +00:00
Bodo Möller
bfe30e4d1b Include OpenSSL license. 2000-02-02 23:30:32 +00:00
Bodo Möller
aff0825c61 Tolerate negative numbers in BN_is_prime. 2000-02-02 22:18:01 +00:00
Bodo Möller
e74231ed9e rndsort{Miller, Rabin} primality test. 2000-02-02 21:20:44 +00:00
Andy Polyakov
fb81ac5e6b Support for "multiply high" instruction, see BN_UMULT_HIGH comment in
crypto/bn/bn_lcl.h for further details. It should be noted that for
the moment of this writing the code was tested only on Alpha. If
compiled with DEC C the C implementation exhibits 12% performance
improvement over the crypto/bn/asm/alpha.s (on EV56 box running
AlphaLinux). GNU C is (unfortunately) 8% behind the assembler
implementation. But it's OpenVMS Alpha users who *may* benefit most
as 'apps/openssl speed rsa' exhibits 6 (six) times performance
improvement over the original VMS bignum implementation. Where "*may*"
means "as soon as code is enabled though #define SIXTY_FOUR_BIT and
crypto/bn/asm/vms.mar is skipped."
2000-02-02 16:18:12 +00:00
Ulf Möller
1399f17a07 Bug fix: BN_is_prime() would fail with a high probability for small
primes (negligible for larger ones).
2000-02-01 23:48:55 +00:00
Ulf Möller
0bde1089f8 match the prototype 2000-02-01 23:47:24 +00:00
Bodo Möller
cb5b7850ac If n0 == d0, we must alway compute 'rem' "by hand" 2000-02-01 11:10:54 +00:00
Bodo Möller
fe7cd1647d Typo in preprocessor symbol. 2000-02-01 08:48:30 +00:00
Ulf Möller
f40c02d908 undo. I keep confusing my directories. :( 2000-02-01 02:24:10 +00:00
Ulf Möller
8efb60144d EBCDIC support.
Submitted by: Martin Kraemer <martin.kraemer@mch.sni.de>
2000-02-01 02:21:16 +00:00
Ulf Möller
51ca375e7e Seek out and destroy another evil cast. 2000-01-30 23:33:40 +00:00
Bodo Möller
1baa94907c Make output of "openssl dsaparam 1024" more interesting :-) 2000-01-30 03:32:28 +00:00
Bodo Möller
a87030a1ed Make DSA_generate_parameters, and fix a couple of bug
(including another problem in the s3_srvr.c state machine).
2000-01-30 02:23:03 +00:00
Richard Levitte
f95a9f678a Declare BN_pseudo_rand(). 2000-01-27 22:07:42 +00:00
Bodo Möller
953aa79040 A couple of things were reversed for BN_pseudo_rand ... 2000-01-27 21:09:25 +00:00
Ulf Möller
157be2b67d comment was wrong. 2000-01-27 19:52:58 +00:00
Ulf Möller
38e33cef15 Document DSA and SHA.
New function BN_pseudo_rand().
Use BN_prime_checks_size(BN_num_bits(w)) rounds of Miller-Rabin when
generating DSA primes (why not use BN_is_prime()?)
2000-01-27 19:31:26 +00:00
Bodo Möller
2233bed1cb typo in a comment 2000-01-27 14:31:31 +00:00
Bodo Möller
ec1258dd44 Update comments to provide a better approximation of reality. 2000-01-27 13:00:10 +00:00
Bodo Möller
b99b110766 Add a pointer to a paper (is the algorithm in section 4.2 the
word-based algorithm we are using?)
2000-01-27 12:52:41 +00:00
Bodo Möller
6e0cad8d34 enable Montgomery test 2000-01-27 11:26:28 +00:00
Bodo Möller
5f5e96d92b Update references. 2000-01-27 09:15:49 +00:00
Ulf Möller
e93f9a3284 Run ispell.
Clean up bn_mont.c.
2000-01-27 01:50:42 +00:00
Dr. Stephen Henson
dd9d233e2a Tidy up CRYPTO_EX_DATA structures. 2000-01-23 23:41:49 +00:00
Ulf Möller
dd8dec69b8 Document the BN library. 2000-01-23 22:06:24 +00:00
Ulf Möller
4486d0cd7a Document the DH library, and make some minor changes along the way. 2000-01-22 20:05:23 +00:00
Ulf Möller
b25c8db872 AFAICS lst1 stands for "lshift test" not "list". 2000-01-21 00:00:12 +00:00
Bodo Möller
4146aa6b42 Rename lst1 to list1 to avoid name conflict on some platforms. 2000-01-20 23:15:50 +00:00
Bodo Möller
0c50e02b30 - Pseudo-seed the PRNG in programs used for "make test"
because otherwise BN_rand will fail unless DEVRANDOM works,
  which causes the programs to dump core because they
  don't check the return value of BN_rand (and if they
  did, we still couldn't test anything).

- add comment to some files that appear not to be used at all.
2000-01-14 17:55:37 +00:00
Ulf Möller
eb952088f0 Precautions against using the PRNG uninitialized: RAND_bytes() now
returns int (1 = ok, 0 = not seeded). New function RAND_add() is the
same as RAND_seed() but takes an estimate of the entropy as an additional
argument.
2000-01-13 20:59:17 +00:00
Bodo Möller
76aa0ddc86 Turn BN_prime_checks into a macro.
Primes p where (p-1)/2 is prime too are called "safe", not "strong".
2000-01-12 11:57:30 +00:00
Bodo Möller
e4b7645631 add dependency and auto-generation rule for bn_prime.h
(created by bn_prime.pl, which now prints the copyright/license
note as found in bn_prime.h)
2000-01-12 09:16:22 +00:00
Andy Polyakov
b96eb06f79 Makefile clean-ups, crypto/bn/asm/alpha.s compiles on Alpha Linux. 1999-12-25 16:08:31 +00:00
Ulf Möller
3b14cb717d Solaris x86 assembler problem is already addressed in ./config
(bug reports keep coming in because that was still missing in 0.9.4)
1999-12-14 15:28:10 +00:00
Ulf Möller
a4af39ac44 Don't use inline assembler on x86 Solaris (would need a different syntax). 1999-12-08 22:55:06 +00:00