18 years agoTo figure out if we're going outside the buffer, use the size of the buffer,
Richard Levitte [Thu, 11 Dec 2003 18:01:03 +0000 (18:01 +0000)]
To figure out if we're going outside the buffer, use the size of the buffer,
not the size of the integer used to index in said buffer.

PR: 794
Notified by: Rhett Garber <>

18 years agoDocument that you need to include x509.h (to get [i2d|d2i]_RSA_PUBKEY()).
Richard Levitte [Wed, 10 Dec 2003 14:31:55 +0000 (14:31 +0000)]
Document that you need to include x509.h (to get [i2d|d2i]_RSA_PUBKEY()).
Correct the typo PUKEY...

18 years agoDocument that you need to include x509.h (to get [i2d|d2i]_DSA_PUBKEY()).
Richard Levitte [Wed, 10 Dec 2003 13:57:51 +0000 (13:57 +0000)]
Document that you need to include x509.h (to get [i2d|d2i]_DSA_PUBKEY()).
Correct the typo PUKEY...

18 years agoAdd "dif" variable to clean up the loop implementations.
Ulf Möller [Sat, 6 Dec 2003 11:55:46 +0000 (11:55 +0000)]
Add "dif" variable to clean up the loop implementations.

Submitted by: Nils Larsch

18 years agoSkip a curve with generator of non-prime order.
Ulf Möller [Sat, 6 Dec 2003 11:41:22 +0000 (11:41 +0000)]
Skip a curve with generator of non-prime order.

Submitted by: Nils Larsch

18 years agoAvoid segfault if ret==0.
Ulf Möller [Sat, 6 Dec 2003 11:39:37 +0000 (11:39 +0000)]
Avoid segfault if ret==0.

Submitted by: Nils Larsch

18 years agoRestructure make targets to allow parallel make.
Lutz Jänicke [Wed, 3 Dec 2003 16:29:41 +0000 (16:29 +0000)]
Restructure make targets to allow parallel make.
Submitted by: Witold Filipczyk <>

PR: #513

19 years agoIncremental cleanups to bn_lib.c.
Geoff Thorpe [Tue, 2 Dec 2003 20:01:30 +0000 (20:01 +0000)]
Incremental cleanups to bn_lib.c.
- Add missing bn_check_top() calls and relocate some others
- Use BN_is_zero() where appropriate
- Remove assert()s that bn_check_top() is already covering
- Simplify the code in places (esp. bn_expand2())
- Only keep ambiguous zero handling if BN_STRICT isn't defined
- Remove some white-space and make some other aesthetic tweaks

19 years agoUse the BN_is_odd() macro in place of code that (inconsistently) does much
Geoff Thorpe [Tue, 2 Dec 2003 03:28:24 +0000 (03:28 +0000)]
Use the BN_is_odd() macro in place of code that (inconsistently) does much
the same thing.

Also, I have some stuff on the back-burner related to some BN_CTX notes
from Peter Gutmann about his cryptlib hacks to the bignum code. The BN_CTX
comments are there to remind me of some relevant points in the code.

19 years agoBN_FLG_FREE is of extremely dubious usefulness, and is only referred to
Geoff Thorpe [Tue, 2 Dec 2003 03:16:56 +0000 (03:16 +0000)]
BN_FLG_FREE is of extremely dubious usefulness, and is only referred to
once in the source (where it is set for the benefit of no other code
whatsoever). I've deprecated the declaration in the header and likewise
made the use of the flag conditional in bn_lib.c. Note, this change also
NULLs the 'd' pointer in a BIGNUM when it is reset but not deallocated.

19 years agoDeclare the static BIGNUM "BN_value_one()" more carefully.
Geoff Thorpe [Mon, 1 Dec 2003 23:13:17 +0000 (23:13 +0000)]
Declare the static BIGNUM "BN_value_one()" more carefully.

19 years agoAdd missing bn_check_top()s to bn_kron.c, remove some miscellaneous
Geoff Thorpe [Mon, 1 Dec 2003 23:11:45 +0000 (23:11 +0000)]
Add missing bn_check_top()s to bn_kron.c, remove some miscellaneous
white-space, and include extra headers to satisfy debugging builds.

19 years agoAdd missing bn_check_top()s to bn_gf2m.c and remove some miscellaneous
Geoff Thorpe [Mon, 1 Dec 2003 23:10:21 +0000 (23:10 +0000)]
Add missing bn_check_top()s to bn_gf2m.c and remove some miscellaneous

19 years agoThe bn_set_max() macro is only "used" by the bn_set_[low|high]() macros
Geoff Thorpe [Mon, 1 Dec 2003 22:11:08 +0000 (22:11 +0000)]
The bn_set_max() macro is only "used" by the bn_set_[low|high]() macros
which, in turn, are used nowhere at all. This is a good thing because
bn_set_max() would currently generate code that wouldn't compile (BIGNUM
has no 'max' element).

The only apparent use for bn_set_[low|high] would be for implementing
windowing algorithms, and all of openssl's seem to use bn_***_words()
helpers instead (including the BN_div() that Nils fixed recently, which had
been using independently-coded versions of what these unused macros are
intended for). I'm therefore consigning these macros to cvs oblivion in the
name of readability.

19 years agobn_fix_top() exists for compatibility's sake and is mapped to
Geoff Thorpe [Mon, 1 Dec 2003 21:59:40 +0000 (21:59 +0000)]
bn_fix_top() exists for compatibility's sake and is mapped to
bn_correct_top() or bn_check_top() depending on debug settings. For
internal source, all bn_fix_top()s should be converted one way or the other
depending on whether the use of bn_correct_top() is justified.

For BN_div_recp(), these cases should not require correction if the other
bignum functions are doing their jobs properly, so convert to

19 years agoIt was pointed out to me that if the requested size is 0, we shouldn't
Richard Levitte [Mon, 1 Dec 2003 13:25:37 +0000 (13:25 +0000)]
It was pointed out to me that if the requested size is 0, we shouldn't
ty to allocate anything at all.  This will allow eNULL to still work.

PR: 751
Notified by: Lutz Jaenicke

19 years agoCheck that OPENSSL_malloc() really returned some memory.
Richard Levitte [Mon, 1 Dec 2003 12:11:55 +0000 (12:11 +0000)]
Check that OPENSSL_malloc() really returned some memory.

PR: 751
Notified by:
Reviewed by: Lutz Jaenicke, Richard Levitte

19 years agoCRYPTO_malloc(), CRYPTO_realloc() and variants of them should return NULL
Richard Levitte [Mon, 1 Dec 2003 12:06:15 +0000 (12:06 +0000)]
CRYPTO_malloc(), CRYPTO_realloc() and variants of them should return NULL
if the give size is 0.

This is a thought that came up in PR 751.

19 years agoSome more ASFLAGS settings required
Lutz Jänicke [Mon, 1 Dec 2003 08:12:47 +0000 (08:12 +0000)]
Some more ASFLAGS settings required
PR: #735
Submitted by: Tim Rice <>

19 years agoAdd more debugging to my Configure target, and "make update" to incorporate
Geoff Thorpe [Sun, 30 Nov 2003 23:29:27 +0000 (23:29 +0000)]
Add more debugging to my Configure target, and "make update" to incorporate
this and a few other changes.

19 years agoIf BN_STRICT is defined, don't accept an ambiguous representation of zero
Geoff Thorpe [Sun, 30 Nov 2003 22:23:12 +0000 (22:23 +0000)]
If BN_STRICT is defined, don't accept an ambiguous representation of zero
(ie. where top may be zero, or it may be one if the corresponding word is
set to zero). Note, this only affects the macros in bn.h, there are probably
similar corrections required in some c files.

Also, clarify the audit-related macros at the top of the header. Mental
note: I must not forget to clean all this out before 0.9.8 is released ...

19 years agoImprove a couple of the bignum macros. Note, this doesn't eliminate
Geoff Thorpe [Sun, 30 Nov 2003 22:02:10 +0000 (22:02 +0000)]
Improve a couple of the bignum macros. Note, this doesn't eliminate
tolerance of ambiguous zero-representation, it just improves
BN_abs_is_word() and simplifies other macros that depend on it.

19 years agoMake BN_DEBUG_RAND less painfully slow by only consuming one byte of
Geoff Thorpe [Sun, 30 Nov 2003 21:21:30 +0000 (21:21 +0000)]
Make BN_DEBUG_RAND less painfully slow by only consuming one byte of
pseudo-random data for each bn_pollute().

19 years agoThis improves the placement of check_top() macros in a couple of bn_lib
Geoff Thorpe [Sat, 29 Nov 2003 20:34:07 +0000 (20:34 +0000)]
This improves the placement of check_top() macros in a couple of bn_lib

19 years agoMake sure the documentation matches reality.
Richard Levitte [Sat, 29 Nov 2003 10:33:25 +0000 (10:33 +0000)]
Make sure the documentation matches reality.

PR: 755
Notified by: Jakub Bogusz <>

19 years agoWe're getting a clash with C++ because it has a type called 'list'.
Richard Levitte [Sat, 29 Nov 2003 10:25:37 +0000 (10:25 +0000)]
We're getting a clash with C++ because it has a type called 'list'.
Therefore, change all instances of the symbol 'list' to something else.

PR: 758
Submitted by: Frédéric Giudicelli <>

19 years agoAdd IPSec/IKE/Oakley curves.
Richard Levitte [Sat, 29 Nov 2003 09:25:59 +0000 (09:25 +0000)]
Add IPSec/IKE/Oakley curves.

PR: 768
Submitted by: Vadim Fedukovich <>

19 years agoDamnit, I'm sick of having to do something special every time a module
Richard Levitte [Sat, 29 Nov 2003 09:19:12 +0000 (09:19 +0000)]
Damnit, I'm sick of having to do something special every time a module
that gets built before objects barfs all over the place because it
uses a new NID that hasn't had a chance of getting defined yet (in
this case, it was about a couple of new EC curves, and therefore a
couple of new corresponding NIDs).

I'm placing objects first in SDIRS!  There.

19 years agoRSA_size() and DH_size() return the amount of bytes in a key, and we
Richard Levitte [Fri, 28 Nov 2003 23:03:14 +0000 (23:03 +0000)]
RSA_size() and DH_size() return the amount of bytes in a key, and we
compared it to the amount of bits required...
PR: 770
Submitted by: c zhang <>

19 years ago1024 is the export key bits limit according to current regulations, not 512.
Richard Levitte [Fri, 28 Nov 2003 22:39:19 +0000 (22:39 +0000)]
1024 is the export key bits limit according to current regulations, not 512.
PR: 771
Submitted by: c zhang <>

19 years agoGet rid of some signed/unsigned comparison warnings.
Geoff Thorpe [Fri, 28 Nov 2003 16:39:16 +0000 (16:39 +0000)]
Get rid of some signed/unsigned comparison warnings.

19 years agoMake a number of changes to the OS/2 build. Submitter's comment below.
Richard Levitte [Fri, 28 Nov 2003 14:51:30 +0000 (14:51 +0000)]
Make a number of changes to the OS/2 build.  Submitter's comment below.

PR: 732
Submitted by: Ilya Zakharevich <>

Submitter's comment:

This patch:

a) Introduces a new file os2/

b) Introduces a new variable $preamble.  As you can see, it may
   be used also to move some OS-specific code to VC-CE too (the the
   first chunk of the patch);

c) The DESCRIPTION specifier of the .def file is made more informative:
   now it contains the version number too.  On OS/2 it is made conformant
   to OS/2 conventions; in particular, when one runs the standard command
   one can see:

   Revision:    0.9.7c
   Description: OpenSSL: implementation of Secure Socket Layer; DLL for library crypto.  Build for EMX -Zmtd

   [I did not make Win32 descriptions as informative as this - I'm afraid to
    break something.  Be welcome to fix this.]

d) On OS/2 the generated DLL was hardly usable (it had a shared initialized
   data segment).

e) On OS/2 the generated DLLs had names like ssl.dll.  However, DLL names on
   OS/2 are "global data".  It is hard to have several DLLs with the same
   name on the system.  Thus this precluded coexistence of OpenSSL with DLLs
   for other SLL implementations - or other name clashes.  I transparently
   changed the names of the DLLs to open_ssl.dll and cryptssl.dll.

f) The file added in (a) is used to create "forwarder" DLLs, so the
   applications expecting the "old" DLL names may use the new DLLs
   transparently.  (A presence of these DLLs on the system nullifies (e),
   but makes old applications work.  This is a stopgap measure until the
   old applications are relinked.  Systems with no old applications do not
   need these DLLs, so may enjoy all the benefits of (e).)

   The new DLLs are placed in os2/ and os2/noname subdirectories.

g) The makefiles created with os2/OS2-EMX.cmd did not work (some mysterious
   meaningless failures).  The change to util/pl/ uses the
   variable introduced in (b) to switch the Makefiles to SHELL=sh syntax.
   All these backslashes are removed, and the generated Makefiles started to

h) Running os2/OS2-EMX.cmd now prints out what to do next.

19 years agoMove another common functionality (reproduced so far with cut'n'paste)
Richard Levitte [Fri, 28 Nov 2003 14:45:09 +0000 (14:45 +0000)]
Move another common functionality (reproduced so far with cut'n'paste)
to apps.c, and give it the hopefully descriptive name parse_yesno().

19 years agoLet's use text/plain in the example instead of crapy HTML.
Richard Levitte [Fri, 28 Nov 2003 14:32:31 +0000 (14:32 +0000)]
Let's use text/plain in the example instead of crapy HTML.
PR: 777
Submitted by: Michael Shields <>

19 years agoForgot to change the declaration of do_subject() to one of parse_name()...
Richard Levitte [Fri, 28 Nov 2003 14:18:05 +0000 (14:18 +0000)]
Forgot to change the declaration of do_subject() to one of parse_name()...

19 years agoMove do_subject() to apps.c and rename it to parse_name(). The
Richard Levitte [Fri, 28 Nov 2003 14:07:14 +0000 (14:07 +0000)]
Move do_subject() to apps.c and rename it to parse_name().  The
rationale behind the move is that it's use by several applications.
The rationale behind the name change is that it describes what the
function does a bit better.

19 years agoAllow multi-valued rdns in subjects. This adds the -multivalue-rdn option
Richard Levitte [Fri, 28 Nov 2003 14:04:09 +0000 (14:04 +0000)]
Allow multi-valued rdns in subjects.  This adds the -multivalue-rdn option
to 'openssl req' and 'openssl ca'.

PR: 779
Submitted by: Michael Bell <>
Reviewed by: Richard Levitte

(there will be some follow-up changes)

19 years agoNetware-specific changes,
Richard Levitte [Fri, 28 Nov 2003 13:10:58 +0000 (13:10 +0000)]
Netware-specific changes,

PR: 780
Submitted by: Verdon Walker <>
Reviewed by: Richard Levitte

19 years agoChange my debugging entries to do fierce BIGNUM debugging.
Richard Levitte [Fri, 28 Nov 2003 12:54:11 +0000 (12:54 +0000)]
Change my debugging entries to do fierce BIGNUM debugging.

19 years agoDue to recent debugging bursts, openssl should be more or less solid
Geoff Thorpe [Tue, 25 Nov 2003 21:07:59 +0000 (21:07 +0000)]
Due to recent debugging bursts, openssl should be more or less solid
against inconsistent BIGNUMs coming out of any of its API functions. So
this change no longer "fixes" the bn_print.c functions, but it makes for
cleaner code. This patch was a part of ticket 697.

PR: 697
Submitted by: Otto Moerbeek
Reviewed by: Geoff Thorpe

19 years agoFix some handling in bn_word. This also resolves the issues observed in
Geoff Thorpe [Tue, 25 Nov 2003 20:39:19 +0000 (20:39 +0000)]
Fix some handling in bn_word. This also resolves the issues observed in
ticket 697 (though uses a different solution than the proposed one). This
problem was initially raised by Otto Moerbeek.

PR: 697
Submitted by: Nils Larsch
Reviewed by: Geoff Thorpe

19 years agoSome changes for bn_gf2m.c: better error checking plus some minor
Geoff Thorpe [Tue, 25 Nov 2003 03:41:20 +0000 (03:41 +0000)]
Some changes for bn_gf2m.c: better error checking plus some minor

Submitted by: Nils Larsch

19 years agoFree "engine" resource in case of failure to prevent memory leak
Lutz Jänicke [Mon, 24 Nov 2003 16:48:52 +0000 (16:48 +0000)]
Free "engine" resource in case of failure to prevent memory leak
PR: #778
Submitted by: George Mitchell <>

19 years agoBN_div() cleanup: replace the use of BN_sub and BN_add with bn_sub_words
Geoff Thorpe [Sat, 22 Nov 2003 20:23:41 +0000 (20:23 +0000)]
BN_div() cleanup: replace the use of BN_sub and BN_add with bn_sub_words
and bn_add_words to avoid using fake bignums to window other bignums that
can lead to corruption. This change allows all bignum tests to pass with
BN_DEBUG and BN_DEBUG_RAND debugging and valgrind. NB: This should be
tested on a few different architectures and configuration targets, as the
bignum code this deals with is quite preprocessor (and assembly) sensitive.

Submitted by: Nils Narsch
Reviewed by: Geoff Thorpe, Ulf Moeller

19 years agoFix a small bug in str_copy: if more than one variable is replaced, make
Geoff Thorpe [Fri, 21 Nov 2003 21:42:35 +0000 (21:42 +0000)]
Fix a small bug in str_copy: if more than one variable is replaced, make
sure the current length is used to calculate the new buffer length instead
of using the old length (prior to any variable substitution).

Submitted by: Nils Larsch

19 years agoGive CRLDP its standard name.
Dr. Stephen Henson [Thu, 20 Nov 2003 22:45:06 +0000 (22:45 +0000)]
Give CRLDP its standard name.

Max req -x509 use V1 if extensions section absent.

19 years agohpux64-parisc2-gcc target added. Once it is verified, ./config should
Andy Polyakov [Thu, 20 Nov 2003 19:10:36 +0000 (19:10 +0000)]
hpux64-parisc2-gcc target added. Once it is verified, ./config should
be modified to choose it instead of hpux64-parisc-gcc, which should
then be removed. hpux64-parisc-cc is removed already now as redundant
[in case you wonder, 64-bit HP-UX ABI *implies* PA-RISC2.0].

19 years ago./config failed to correctly detect if gcc uses 64-bit ABI on HP-UX.
Andy Polyakov [Thu, 20 Nov 2003 18:33:20 +0000 (18:33 +0000)]
./config failed to correctly detect if gcc uses 64-bit ABI on HP-UX.
PR: 772

19 years agoMake sure to initialize AES counters to obtain proper results.
Lutz Jänicke [Tue, 18 Nov 2003 18:27:12 +0000 (18:27 +0000)]
Make sure to initialize AES counters to obtain proper results.
Submitted by: Kirill Kochetkov <>

PR: #748

19 years agore-enable the test, keeping the original method for RAND_pseudo_bytes
Ulf Möller [Sun, 16 Nov 2003 19:33:31 +0000 (19:33 +0000)]
re-enable the test, keeping the original method for RAND_pseudo_bytes
which is used by BN_DEBUG_RAND
Submitted by: Nils Larsch

19 years agoCatch error condition to prevent NULL pointer dereference.
Lutz Jänicke [Sun, 16 Nov 2003 16:30:39 +0000 (16:30 +0000)]
Catch error condition to prevent NULL pointer dereference.
Submitted by: Goetz Babin-Ebell <>

PR: #766

19 years agoProvide ASFLAGS in the subdirectories handling assembler code.
Lutz Jänicke [Sun, 16 Nov 2003 14:38:34 +0000 (14:38 +0000)]
Provide ASFLAGS in the subdirectories handling assembler code.

Submitted by: Tim Rice <>

PR: #735, #765

19 years agoThe x9.62 tests replace the PRNG with specific numbers,
Ulf Möller [Sun, 16 Nov 2003 12:24:45 +0000 (12:24 +0000)]
The x9.62 tests replace the PRNG with specific numbers,
so don't run them if BN_DEBUG_RAND is defined.

Also, fix another small bug.

Submitted by: Nils Larsch

19 years agoBN_set_bit() etc should use "unsigned int".
Ulf Möller [Sat, 15 Nov 2003 08:37:50 +0000 (08:37 +0000)]
BN_set_bit() etc should use "unsigned int".
Keep it as is to avoid an API change, but check for negativ values.

Submitted by: Nils Larsch

19 years agoLess restrictive debugging build.
Richard Levitte [Fri, 14 Nov 2003 14:06:40 +0000 (14:06 +0000)]
Less restrictive debugging build.

19 years agoThis rewrites two "for" loops in BN_rshift() - equality with zero is
Geoff Thorpe [Thu, 13 Nov 2003 15:03:14 +0000 (15:03 +0000)]
This rewrites two "for" loops in BN_rshift() - equality with zero is
generally a more efficient comparison than comparing two integers, and the
first of these two loops was off-by-one (copying one too many values). This
change also removes a superfluous assignment that would set an unused word
to zero (and potentially allow an overrun in some cases).

Submitted by: Nils Larsch
Reviewed by: Geoff Thorpe

19 years agoGeneral improvements to the ec_asn1.c code. This squashes at least one bug
Geoff Thorpe [Mon, 10 Nov 2003 18:09:18 +0000 (18:09 +0000)]
General improvements to the ec_asn1.c code. This squashes at least one bug
(where it was impossible to create an EC certificate with a compressed
public key), and has some style improvements based on some comments from
Steve Henson about use of the ASN1 macros.

Submitted by: Nils Larsch
Reviewed by: Geoff Thorpe

19 years agoAvoid possible memory leaks in error-handling.
Geoff Thorpe [Mon, 10 Nov 2003 18:05:22 +0000 (18:05 +0000)]
Avoid possible memory leaks in error-handling.

Submitted by: Nils Larsch
Reviewed by: Geoff Thorpe

19 years agoPrint out GeneralizedTime and UTCTime in ASN1_STRING_print_ex().
Dr. Stephen Henson [Mon, 10 Nov 2003 01:37:23 +0000 (01:37 +0000)]
Print out GeneralizedTime and UTCTime in ASN1_STRING_print_ex().

19 years agoGeoff suggested a more succinct description for "top".
Ulf Möller [Fri, 7 Nov 2003 01:33:00 +0000 (01:33 +0000)]
Geoff suggested a more succinct description for "top".

19 years agooops... the description of ->top was inaccurate (the example is correct though)
Ulf Möller [Fri, 7 Nov 2003 00:07:28 +0000 (00:07 +0000)]
oops... the description of ->top was inaccurate (the example is correct though)

19 years agoThis extends the debugging macros to use "pollution" during
Geoff Thorpe [Thu, 6 Nov 2003 23:24:44 +0000 (23:24 +0000)]
This extends the debugging macros to use "pollution" during
bn_correct_top(), previously only bn_check_top() did this.

19 years agoAdd debug-screening of input parameters to some functions I'd missed
Geoff Thorpe [Thu, 6 Nov 2003 23:13:04 +0000 (23:13 +0000)]
Add debug-screening of input parameters to some functions I'd missed

19 years agoPut more debug screening in BN_div() and correct a comment.
Geoff Thorpe [Thu, 6 Nov 2003 23:11:07 +0000 (23:11 +0000)]
Put more debug screening in BN_div() and correct a comment.

19 years agoThis is a revert of my previous commit to "improve" the declaration of
Geoff Thorpe [Wed, 5 Nov 2003 19:30:29 +0000 (19:30 +0000)]
This is a revert of my previous commit to "improve" the declaration of
constant BIGNUMs. It turns out that this trips up different but equally
useful compiler warnings to -Wcast-qual, and so wasn't worth the ugliness
it created. (Thanks to Ulf for the forehead-slap.)

19 years agotypo in comment
Ulf Möller [Wed, 5 Nov 2003 17:28:59 +0000 (17:28 +0000)]
typo in comment

19 years agocleanup as discussed with Geoff
Ulf Möller [Wed, 5 Nov 2003 17:28:25 +0000 (17:28 +0000)]
cleanup as discussed with Geoff

19 years agoCygwin debugging
Ulf Möller [Wed, 5 Nov 2003 17:27:13 +0000 (17:27 +0000)]
Cygwin debugging

19 years agoPut the first stage of my bignum debugging adventures into CVS. This code
Geoff Thorpe [Tue, 4 Nov 2003 22:54:49 +0000 (22:54 +0000)]
Put the first stage of my bignum debugging adventures into CVS. This code
is itself experimental, and in addition may cause execution to break on
existing openssl "bugs" that previously were harmless or at least

19 years agoAvoid some shadowed variable names.
Geoff Thorpe [Tue, 4 Nov 2003 00:51:32 +0000 (00:51 +0000)]
Avoid some shadowed variable names.
Submitted by: Nils Larsch

19 years agoThis is the least unacceptable way I've found for declaring the bignum data
Geoff Thorpe [Tue, 4 Nov 2003 00:29:09 +0000 (00:29 +0000)]
This is the least unacceptable way I've found for declaring the bignum data
and structures as constant without having to cast away const at any point.
There is still plenty of other code that makes gcc's "-Wcast-qual" unhappy,
but crypto/bn/ is now ok. Purists are welcome to suggest alternatives.

19 years agoEngines are usually binary, and should therefore be in INSTALLTOP
Richard Levitte [Fri, 31 Oct 2003 10:48:48 +0000 (10:48 +0000)]
Engines are usually binary, and should therefore be in INSTALLTOP
rather than OPENSSLDIR.

19 years agoLet exit codes propagate from within for loops.
Richard Levitte [Fri, 31 Oct 2003 06:58:24 +0000 (06:58 +0000)]
Let exit codes propagate from within for loops.

19 years agobn_div() does some pretty nasty things with temporary variables,
Geoff Thorpe [Fri, 31 Oct 2003 01:35:16 +0000 (01:35 +0000)]
bn_div() does some pretty nasty things with temporary variables,
constructing BIGNUM structures with pointers offset into other bignums
(among other things). This corrects some of it that is too plainly insane,
and tries to ensure that bignums are normalised when passed to other

19 years agoWhen a BN_CTX is used for temporary workspace, the variables are sometimes
Geoff Thorpe [Thu, 30 Oct 2003 01:07:56 +0000 (01:07 +0000)]
When a BN_CTX is used for temporary workspace, the variables are sometimes
left in an inconsistent state when they are released for later reuse. This
change resets the BIGNUMs when they are released back to the context.

19 years agoThis fixes a couple of cases where an inconsistent BIGNUM could be passed as
Geoff Thorpe [Thu, 30 Oct 2003 01:03:31 +0000 (01:03 +0000)]
This fixes a couple of cases where an inconsistent BIGNUM could be passed as
input to a function.

19 years agomake update
Geoff Thorpe [Wed, 29 Oct 2003 23:25:52 +0000 (23:25 +0000)]
make update

19 years agoTighten up my compiler settings.
Geoff Thorpe [Wed, 29 Oct 2003 23:25:34 +0000 (23:25 +0000)]
Tighten up my compiler settings.

19 years agoRemove a line that was causing redundant declarations.
Geoff Thorpe [Wed, 29 Oct 2003 22:55:19 +0000 (22:55 +0000)]
Remove a line that was causing redundant declarations.
Obtained from: Stephen Henson <>

19 years agoCopy-n-paste bug (don't mix variable declarations and code). This sets the
Geoff Thorpe [Wed, 29 Oct 2003 22:30:45 +0000 (22:30 +0000)]
Copy-n-paste bug (don't mix variable declarations and code). This sets the
callback structure just before it is needed.

19 years agoOops, this file already had the "empty source file" workaround but it
Geoff Thorpe [Wed, 29 Oct 2003 22:25:04 +0000 (22:25 +0000)]
Oops, this file already had the "empty source file" workaround but it
requires -DPEDANTIC and was hidden at the bottom of the file. This moves it
to the top and removes the redundant declaration.

19 years agoMake md32_common.h friendlier to compiler warnings.
Geoff Thorpe [Wed, 29 Oct 2003 20:55:03 +0000 (20:55 +0000)]
Make md32_common.h friendlier to compiler warnings.
Obtained from: Andy Polyakov <>

19 years agoSome provisional bignum debugging has begun to detect inconsistent BIGNUM
Geoff Thorpe [Wed, 29 Oct 2003 20:47:49 +0000 (20:47 +0000)]
Some provisional bignum debugging has begun to detect inconsistent BIGNUM
structures being passed in to or out of API functions, and this corrects a
couple of cases found so far.

Also, lop off a couple of bytes of white-space.

19 years agoA general spring-cleaning (in autumn) to fix up signed/unsigned warnings.
Geoff Thorpe [Wed, 29 Oct 2003 20:24:15 +0000 (20:24 +0000)]
A general spring-cleaning (in autumn) to fix up signed/unsigned warnings.
I have tried to convert 'len' type variable declarations to unsigned as a
means to address these warnings when appropriate, but when in doubt I have
used casts in the comparisons instead. The better solution (that would get
us all lynched by API users) would be to go through and convert all the
function prototypes and structure definitions to use unsigned variables
except when signed is necessary. The proliferation of (signed) "int" for
strictly non-negative uses is unfortunate.

19 years agoBN_CTX is opaque and the static initialiser BN_CTX_init() is not used
Geoff Thorpe [Wed, 29 Oct 2003 18:04:37 +0000 (18:04 +0000)]
BN_CTX is opaque and the static initialiser BN_CTX_init() is not used
except internally to the allocator BN_CTX_new(), as such this deprecates
the use of BN_CTX_init() in the API. Moreover, the structure definition of
BN_CTX is taken out of bn_lcl.h and moved into bn_ctx.c itself.

NDEBUG should probably only be "forced" in the top-level configuration, but
until it is I will avoid removing it from bn_ctx.c which might surprise
people with massive slow-downs in their keygens. So I've left it in
bn_ctx.c but tidied up the preprocessor logic a touch and made it more
tolerant of debugging efforts.

19 years agoRemoving those memcpy()s also took away the possibility for in and out to
Richard Levitte [Wed, 29 Oct 2003 06:21:22 +0000 (06:21 +0000)]
Removing those memcpy()s also took away the possibility for in and out to
be the same.  Therefore, the removed memcpy()s need to be restored.

19 years agoremove accidentally committed debugging cruft.
Geoff Thorpe [Wed, 29 Oct 2003 05:35:31 +0000 (05:35 +0000)]
remove accidentally committed debugging cruft.

19 years agoRemove an unnecessary cast that causes certain compilers (eg. mine) some
Geoff Thorpe [Wed, 29 Oct 2003 05:00:57 +0000 (05:00 +0000)]
Remove an unnecessary cast that causes certain compilers (eg. mine) some
confusion. Also silence a couple of signed/unsigned warnings.

19 years agoRemove redundant declaration.
Geoff Thorpe [Wed, 29 Oct 2003 04:58:23 +0000 (04:58 +0000)]
Remove redundant declaration.

19 years agoRelax some over-zealous constification that gave some lhash-based code no
Geoff Thorpe [Wed, 29 Oct 2003 04:57:05 +0000 (04:57 +0000)]
Relax some over-zealous constification that gave some lhash-based code no
choice but to have to cast away "const" qualifiers from their prototypes.
This does not remove constification restrictions from hash/compare
callbacks, but allows destructor commands to be run over a tables' elements
without bad casts.

19 years agoComments out some unimplemented functions instead of redeclaring them.
Geoff Thorpe [Wed, 29 Oct 2003 04:42:29 +0000 (04:42 +0000)]
Comments out some unimplemented functions instead of redeclaring them.

19 years agoAvoid "empty source file" warnings.
Geoff Thorpe [Wed, 29 Oct 2003 04:41:19 +0000 (04:41 +0000)]
Avoid "empty source file" warnings.

19 years agoFor whatever reason (compiler or header bugs), at least one commonly-used
Geoff Thorpe [Wed, 29 Oct 2003 04:40:13 +0000 (04:40 +0000)]
For whatever reason (compiler or header bugs), at least one commonly-used
linux system (namely mine) chokes on our definitions and uses of the "HZ"
symbol in crypto/tmdiff.[ch] and apps/speed.c as a "bad function cast"
(when in fact there is no function casting involved at all). In both cases,
it is easily worked around by not defining a cast into the macro and
jiggling the expressions slightly.

In addition - this highlights some cruft in openssl that needs sorting out.
The tmdiff.h header is exported as part of the openssl API despite the fact
that it is ugly as the driven sludge and not used anywhere in the library,
applications, or utilities. More weird still, almost identical code exists
in apps/speed.c though it looks to be slightly tweaked - so either tmdiff
should be updated and used by speed.c, or it should be dumped because it's
obviously not useful enough.

Rather than removing it for now, I've changed the API for tmdiff to at
least make sense. This involves taking the object type (MS_TM) from the
implementation and using it in the header rather than using "char *" in the
API and casting mercilessly in the code (ugh). If someone doesn't like
"MS_TM" and the "ms_time_***" naming, by all means change it. This should
be a harmless improvement, because the existing API is clearly not very
useful (eg. we reimplement it rather than using it in our own utils).

However, someone still needs to take a hack at consolidating speed.c and
tmdiff.[ch] somehow.

19 years agoUpdate any code that was using deprecated functions so that everything builds
Geoff Thorpe [Wed, 29 Oct 2003 04:14:08 +0000 (04:14 +0000)]
Update any code that was using deprecated functions so that everything builds
and links with OPENSSL_NO_DEPRECATED defined.

19 years agoWhen OPENSSL_NO_DEPRECATED is defined, deprecated functions are (or should
Geoff Thorpe [Wed, 29 Oct 2003 04:06:50 +0000 (04:06 +0000)]
When OPENSSL_NO_DEPRECATED is defined, deprecated functions are (or should
be) precompiled out in the API headers. This change is to ensure that if
it is defined when compiling openssl, the deprecated functions aren't
implemented either.

19 years agoThe "cryptodev" engine preprocessor logic used undefined symbols in
Geoff Thorpe [Wed, 29 Oct 2003 04:00:14 +0000 (04:00 +0000)]
The "cryptodev" engine preprocessor logic used undefined symbols in
comparisons. It's better not to allow this, because it gives false
positives when using compiler warnings that detect mistyped symbols.

19 years agoAdd my own debug config target.
Geoff Thorpe [Tue, 28 Oct 2003 22:57:18 +0000 (22:57 +0000)]
Add my own debug config target.

19 years agomake update
Geoff Thorpe [Tue, 28 Oct 2003 22:10:47 +0000 (22:10 +0000)]
make update

19 years agoIgnore derived file.
Geoff Thorpe [Tue, 28 Oct 2003 17:26:46 +0000 (17:26 +0000)]
Ignore derived file.

19 years agocrypto/evp/evptests.txt is copied to tests/ rather than symlinked because
Geoff Thorpe [Tue, 28 Oct 2003 17:24:29 +0000 (17:24 +0000)]
crypto/evp/evptests.txt is copied to tests/ rather than symlinked because
of windows (see checkin 1.75 of crypto/evp/Makefile.ssl), so quiet cvs
noise for the copied version.