22 years agoFixes to OCSP print code.
Dr. Stephen Henson [Wed, 20 Dec 2000 00:46:44 +0000 (00:46 +0000)]
Fixes to OCSP print code.

Don't try to print request certificates if signature is not present.

Remove unnecessary test for certificates being NULL.

Fix typos in printed output.

Tidy up output.

Fix for typo in OCSP_SERVICELOC ASN1 template.

Also give a bit more info in CHANGES about the ASN1 revision.

22 years agofix indentation
Bodo Möller [Tue, 19 Dec 2000 12:39:45 +0000 (12:39 +0000)]
fix indentation

22 years agoDon't hold CRYPTO_LOCK_RSA during time-consuming operations.
Bodo Möller [Tue, 19 Dec 2000 12:31:41 +0000 (12:31 +0000)]
Don't hold CRYPTO_LOCK_RSA during time-consuming operations.

22 years agoAdd a comment (intended change)
Bodo Möller [Mon, 18 Dec 2000 16:39:00 +0000 (16:39 +0000)]
Add a comment (intended change)

22 years agoImport s2_pkt.c wbuf fixes from OpenSSL_0_9_6-stable branch.
Bodo Möller [Mon, 18 Dec 2000 11:35:32 +0000 (11:35 +0000)]
Import s2_pkt.c wbuf fixes from OpenSSL_0_9_6-stable branch.

22 years agoComment correction.
Bodo Möller [Mon, 18 Dec 2000 09:18:22 +0000 (09:18 +0000)]
Comment correction.

22 years agoObtain lock CRYPTO_LOCK_RSA before creating BN_MONT_CTX
Bodo Möller [Mon, 18 Dec 2000 09:00:48 +0000 (09:00 +0000)]
Obtain lock CRYPTO_LOCK_RSA before creating BN_MONT_CTX
structures and setting rsa->_method_mod_{n,p,q}.

Submitted by: "Reddie, Steven" <>

22 years agoundo previous change: '-prexit' is already available in current versions of s_client
Bodo Möller [Mon, 18 Dec 2000 08:18:07 +0000 (08:18 +0000)]
undo previous change: '-prexit' is already available in current versions of s_client

22 years agoRedo OCSP response printing. Remove duplicate or
Dr. Stephen Henson [Sun, 17 Dec 2000 14:09:43 +0000 (14:09 +0000)]
Redo OCSP response printing. Remove duplicate or
obsolete code. Delete some redundant files.

22 years agoWhen mentioning features that don't exist in current releases of
Bodo Möller [Sun, 17 Dec 2000 00:32:49 +0000 (00:32 +0000)]
When mentioning features that don't exist in current releases of
OpenSSL (such as the new undocumented '-prexit' option to s_client),
the FAQ should point out that they don't: The FAQ is not just part
of the release, it's current version is also published on the web.

22 years agoSimplify preprocessor statements.
Bodo Möller [Sun, 17 Dec 2000 00:30:03 +0000 (00:30 +0000)]
Simplify preprocessor statements.

22 years agoAdd OCSP service locator extension.
Dr. Stephen Henson [Sat, 16 Dec 2000 12:51:58 +0000 (12:51 +0000)]
Add OCSP service locator extension.

22 years agoDo not poll DEVRANDOM if weäre building without an file pointer API.
Richard Levitte [Sat, 16 Dec 2000 11:19:19 +0000 (11:19 +0000)]
Do not poll DEVRANDOM if weäre building without an file pointer API.
Spotted by "David Schwartz" <>.

22 years agoMake sure each FAQ item has an index entry.
Richard Levitte [Sat, 16 Dec 2000 11:14:41 +0000 (11:14 +0000)]
Make sure each FAQ item has an index entry.

22 years agoAdd support for the noCheck OCSP extension. This is
Dr. Stephen Henson [Sat, 16 Dec 2000 01:58:58 +0000 (01:58 +0000)]
Add support for the noCheck OCSP extension. This is
just a NULL and appears in a certificate.

22 years agoMake parse some ASN1 IMPLEMENT macros.
Dr. Stephen Henson [Sat, 16 Dec 2000 01:19:24 +0000 (01:19 +0000)]
Make parse some ASN1 IMPLEMENT macros.

Initial support for variables in DEF files.

22 years agoAdd a couple of FAQs.
Dr. Stephen Henson [Sat, 16 Dec 2000 01:07:16 +0000 (01:07 +0000)]
Add a couple of FAQs.

22 years ago"Andrew W. Gray" <> says /GD is no longer a valid
Ulf Möller [Fri, 15 Dec 2000 20:59:37 +0000 (20:59 +0000)]
"Andrew W. Gray" <> says /GD is no longer a valid
compiler switch.

22 years agoIf CONF_get_string returns NULL and we want to tolerate this
Bodo Möller [Fri, 15 Dec 2000 16:59:49 +0000 (16:59 +0000)]
If CONF_get_string returns NULL and we want to tolerate this
(e.g., use a default), we have to call ERR_clear_error().

22 years agoLocking issues.
Bodo Möller [Fri, 15 Dec 2000 16:40:35 +0000 (16:40 +0000)]
Locking issues.

22 years agoImplement some standard OCSP extensions in the v3 code. These
Dr. Stephen Henson [Fri, 15 Dec 2000 13:42:00 +0000 (13:42 +0000)]
Implement some standard OCSP extensions in the v3 code. These
are all raw print only extensions at present.

22 years agoThe C version of bn_sub_part_words is needed not only
Bodo Möller [Fri, 15 Dec 2000 10:54:03 +0000 (10:54 +0000)]
The C version of bn_sub_part_words is needed not only
in NO_ASM configurations

22 years agoVery few in the "README" is up-to-date
Bodo Möller [Fri, 15 Dec 2000 10:42:11 +0000 (10:42 +0000)]
Very few in the "README" is up-to-date

22 years agoAdd OCSP nonce extension to supported extensions.
Dr. Stephen Henson [Thu, 14 Dec 2000 23:27:20 +0000 (23:27 +0000)]
Add OCSP nonce extension to supported extensions.

This is a little unusual because it can contain no
structure i.e. the extension OCTET STRING content
octets do not contain a DER encoded structure.

22 years agoMake a note of the new engine.
Geoff Thorpe [Thu, 14 Dec 2000 21:49:48 +0000 (21:49 +0000)]
Make a note of the new engine.

22 years agoThis is an engine contributed by Broadcom - it is meant to support the
Geoff Thorpe [Thu, 14 Dec 2000 21:41:55 +0000 (21:41 +0000)]
This is an engine contributed by Broadcom - it is meant to support the
BCM5805 and BCM5820 units. So far I've merely taken a skim over the code
and changed a few things from their original contributed source
(de-shadowing variables, removing variables from the header, and
re-constifying some functions to remove warnings). If this gives
compilation problems on any system, please let me know. We will hopefully
know for sure whether this actually functions on a system with the relevant
hardware in a day or two.  :-)

22 years agoNew function X509V3_extensions_print() this removes extension duplication
Dr. Stephen Henson [Thu, 14 Dec 2000 18:42:28 +0000 (18:42 +0000)]
New function X509V3_extensions_print() this removes extension duplication
from the print routines.

Reorganisation of OCSP code: initial print routines in ocsp_prn.c. Doesn't
work fully because OCSP extensions aren't reimplemented yet.

Implement some ASN1 functions needed to compile OCSP code.

22 years agotypo
Bodo Möller [Thu, 14 Dec 2000 17:47:29 +0000 (17:47 +0000)]

22 years agoThe BN_mul bug test apparently is no longer needed
Bodo Möller [Thu, 14 Dec 2000 17:46:36 +0000 (17:46 +0000)]
The BN_mul bug test apparently is no longer needed

22 years agoFirst step towards SSL_peek fix.
Bodo Möller [Thu, 14 Dec 2000 17:36:59 +0000 (17:36 +0000)]
First step towards SSL_peek fix.

22 years agoUpdate.
Bodo Möller [Thu, 14 Dec 2000 17:29:33 +0000 (17:29 +0000)]

22 years agoNew function X509_signature_print() to remove some duplicate
Dr. Stephen Henson [Thu, 14 Dec 2000 00:53:10 +0000 (00:53 +0000)]
New function X509_signature_print() to remove some duplicate
code from certificate, CRL and request printing routines.

22 years agoChange the PKCS7 structure to use SEQUENCE OF for the
Dr. Stephen Henson [Wed, 13 Dec 2000 23:54:30 +0000 (23:54 +0000)]
Change the PKCS7 structure to use SEQUENCE OF for the
authenticated attributes: this is used to retain the
original encoding and not break signatures.

Support for a SET OF which reorders the STACK when
encoding a structure. This will be used with the
PKCS7 code.

22 years agoc&p error spotted by Martin Forssen
Ulf Möller [Wed, 13 Dec 2000 23:00:33 +0000 (23:00 +0000)]
c&p error spotted by Martin Forssen

23 years agoReplace the old style OCSP ASN1 module.
Dr. Stephen Henson [Wed, 13 Dec 2000 18:21:51 +0000 (18:21 +0000)]
Replace the old style OCSP ASN1 module.

23 years agoConstification of the data of a hash table. This means the callback
Richard Levitte [Wed, 13 Dec 2000 17:15:03 +0000 (17:15 +0000)]
Constification of the data of a hash table.  This means the callback
functions need to be constified, and therefore meant a number of easy
changes a little everywhere.

Now, if someone could explain to me why OBJ_dup() cheats...

23 years agoProblem: bn_mul_normal() misbehaves if the size of b is 0.
Richard Levitte [Wed, 13 Dec 2000 15:29:29 +0000 (15:29 +0000)]
Problem: bn_mul_normal() misbehaves if the size of b is 0.
Solution: multiply a with 0, putting the result in r, and return.

23 years agoIn bn_mul_recursive(), make sure the comba routines are only called
Richard Levitte [Wed, 13 Dec 2000 14:47:06 +0000 (14:47 +0000)]
In bn_mul_recursive(), make sure the comba routines are only called
when both a and b are of the exact right size.  This may change to
something better later.

23 years agoWhen using -pedantic, it's a good thing to define PEDANTIC as well.
Richard Levitte [Wed, 13 Dec 2000 14:04:08 +0000 (14:04 +0000)]
When using -pedantic, it's a good thing to define PEDANTIC as well.
Also, define a second debugging configuration without assembler.

23 years agoStop extension creation code core dumping.
Dr. Stephen Henson [Wed, 13 Dec 2000 13:55:03 +0000 (13:55 +0000)]
Stop extension creation code core dumping.

This was caused by no initialising the buffer
to NULL when using the auto allocating version
if i2d.

23 years agoRewrite the extension code to use an ASN1_ITEM structure
Dr. Stephen Henson [Wed, 13 Dec 2000 13:47:33 +0000 (13:47 +0000)]
Rewrite the extension code to use an ASN1_ITEM structure
for its ASN1 operations as well as the old style function
pointers (i2d, d2i, new, free). Change standard extensions
to support this.

Fix a warning in BN_mul(), bn_mul.c about uninitialised 'j'.

23 years agoAdd description of SSL_[CTX_]_check_private_key().
Lutz Jänicke [Tue, 12 Dec 2000 21:06:29 +0000 (21:06 +0000)]
Add description of SSL_[CTX_]_check_private_key().

23 years agoSSL_new() may potentially add a certfificate. Therefore, wen
Richard Levitte [Tue, 12 Dec 2000 08:08:53 +0000 (08:08 +0000)]
SSL_new() may potentially add a certfificate.  Therefore, wen
duplicating the certificate that is in the original SSL, remove the
one that SSL_new() provided, if any.
Spotted by: Mike Zeoli <>

23 years agoChange/add comments
Bodo Möller [Mon, 11 Dec 2000 17:28:07 +0000 (17:28 +0000)]
Change/add comments

23 years agoStop on bntest error.
Ulf Möller [Sun, 10 Dec 2000 04:25:57 +0000 (04:25 +0000)]
Stop on bntest error.

23 years ago*** empty log message ***
Ulf Möller [Sun, 10 Dec 2000 04:22:45 +0000 (04:22 +0000)]
*** empty log message ***

23 years agoMake TYPE_RSA the default type instead of just setting it when -new is
Richard Levitte [Sat, 9 Dec 2000 11:11:35 +0000 (11:11 +0000)]
Make TYPE_RSA the default type instead of just setting it when -new is
given.  That also allows the arguments to come in any order (-new
last, for example).

23 years agoUse continuation lines in test/bctest as far as it is possible
Bodo Möller [Sat, 9 Dec 2000 10:07:47 +0000 (10:07 +0000)]
Use continuation lines in test/bctest as far as it is possible
to dermine what the expression should look like.
Apparently CVS does not like lines longer than about 2^10 characters.

23 years agoDon't throw away bctest's error messages.
Bodo Möller [Sat, 9 Dec 2000 10:05:03 +0000 (10:05 +0000)]
Don't throw away bctest's error messages.

23 years agoTest for SCO bc bug
Ulf Möller [Sat, 9 Dec 2000 02:45:59 +0000 (02:45 +0000)]
Test for SCO bc bug

23 years agoNext step in tidying up the LHASH code.
Geoff Thorpe [Fri, 8 Dec 2000 20:02:01 +0000 (20:02 +0000)]
Next step in tidying up the LHASH code.

DECLARE/IMPLEMENT macros now exist to create type (and prototype) safe
wrapper functions that avoid the use of function pointer casting yet retain
type-safety for type-specific callbacks. However, most of the usage within
OpenSSL itself doesn't really require the extra function because the hash
and compare callbacks are internal functions declared only for use by the
hash table. So this change catches all those cases and reimplements the
functions using the base-level LHASH prototypes and does per-variable
casting inside those functions to convert to the appropriate item type.

The exception so far is in ssl_lib.c where the hash and compare callbacks
are not static - they're exposed in ssl.h so their prototypes should not be
changed. In this last case, the IMPLEMENT_LHASH_*** macros have been left

23 years agobn_part_sub_word prototype.
Ulf Möller [Fri, 8 Dec 2000 19:10:33 +0000 (19:10 +0000)]
bn_part_sub_word prototype.

23 years agoMerge from the ASN1 branch of new ASN1 code
Dr. Stephen Henson [Fri, 8 Dec 2000 19:09:35 +0000 (19:09 +0000)]
Merge from the ASN1 branch of new ASN1 code
to main trunk.

Lets see if the makes it to openssl-cvs :-)

23 years agoAdd manual pages for certficate/key loading and friends.
Lutz Jänicke [Fri, 8 Dec 2000 14:29:13 +0000 (14:29 +0000)]
Add manual pages for certficate/key loading and friends.

23 years agoPlaceholder for SCO bc bug detection
Bodo Möller [Fri, 8 Dec 2000 08:30:38 +0000 (08:30 +0000)]
Placeholder for SCO bc bug detection

23 years agoFix some things that look like bugs.
Bodo Möller [Thu, 7 Dec 2000 22:06:09 +0000 (22:06 +0000)]
Fix some things that look like bugs.

One problem that looked like a problem in bn_recp.c at first turned
out to be a BN_mul bug.  An example is given in bn_recp.c; finding
the bug responsible for this is left as an exercise.

23 years agoTEST_MUL and TEST_SQR added.
Bodo Möller [Thu, 7 Dec 2000 11:11:10 +0000 (11:11 +0000)]
TEST_MUL and TEST_SQR added.

23 years agoSign-related fixes (and tests).
Bodo Möller [Thu, 7 Dec 2000 08:48:58 +0000 (08:48 +0000)]
Sign-related fixes (and tests).

BN_mod_exp_mont does not work properly yet if modulus m
is negative (we want computations to be carried out
modulo |m|).

23 years agoMove 'q->neg = 0' to those places where it is needed
Bodo Möller [Thu, 7 Dec 2000 07:55:26 +0000 (07:55 +0000)]
Move 'q->neg = 0' to those places where it is needed
(just in cases someone uses a negative modulus)

23 years agoBN_mod_sqrt documentation/comment
Bodo Möller [Wed, 6 Dec 2000 21:33:58 +0000 (21:33 +0000)]
BN_mod_sqrt documentation/comment

23 years agoDon't check for bc at all. We can now run a meaningful test even if
Ulf Möller [Wed, 6 Dec 2000 16:39:09 +0000 (16:39 +0000)]
Don't check for bc at all. We can now run a meaningful test even if
it is missing.

23 years agoremove a comment that shouldn't have been there any more
Ulf Möller [Wed, 6 Dec 2000 16:30:23 +0000 (16:30 +0000)]
remove a comment that shouldn't have been there any more

23 years agoFaster BN_mod_sqrt algorithm for p == 5 (8).
Bodo Möller [Wed, 6 Dec 2000 12:25:33 +0000 (12:25 +0000)]
Faster BN_mod_sqrt algorithm for p == 5 (8).

23 years agoPrinting "verify ..." should not be counted as a test for the
Bodo Möller [Wed, 6 Dec 2000 12:24:27 +0000 (12:24 +0000)]
Printing "verify ..." should not be counted as a test for the
"xxx tests passed" message.

23 years agoDuring the self test, we only want to know what bctest says on
Richard Levitte [Wed, 6 Dec 2000 10:58:13 +0000 (10:58 +0000)]
During the self test, we only want to know what bctest says on

23 years agoHave the self test use bctest to check that bc is sane.
Richard Levitte [Wed, 6 Dec 2000 10:54:31 +0000 (10:54 +0000)]
Have the self test use bctest to check that bc is sane.

23 years agoUse bc's "print" feature whenever it is available,
Bodo Möller [Wed, 6 Dec 2000 10:32:55 +0000 (10:32 +0000)]
Use bc's "print" feature whenever it is available,
not just on certain platforms.

23 years agoAdd a comment.
Bodo Möller [Wed, 6 Dec 2000 09:53:29 +0000 (09:53 +0000)]
Add a comment.

23 years agoWorkaround for broken (or missing) bc.
Bodo Möller [Wed, 6 Dec 2000 09:48:57 +0000 (09:48 +0000)]
Workaround for broken (or missing) bc.

23 years agoremove useless instruction
Ulf Möller [Wed, 6 Dec 2000 04:48:50 +0000 (04:48 +0000)]
remove useless instruction

23 years agoIntel assembler version for bn_sub_part_words(). I haven't got
Ulf Möller [Wed, 6 Dec 2000 04:16:38 +0000 (04:16 +0000)]
Intel assembler version for bn_sub_part_words().  I haven't got
reliable timings yet, please try it out!

23 years agoanother fix for the debug print
Ulf Möller [Wed, 6 Dec 2000 04:14:37 +0000 (04:14 +0000)]
another fix for the debug print

23 years agotest_mod_mul is useful, let's run it more often.
Ulf Möller [Wed, 6 Dec 2000 04:14:30 +0000 (04:14 +0000)]
test_mod_mul is useful, let's run it more often.

23 years agomove constants for debug functions to end of file
Ulf Möller [Wed, 6 Dec 2000 00:19:09 +0000 (00:19 +0000)]
move constants for debug functions to end of file

23 years agoUpdate the internal docs.
Richard Levitte [Tue, 5 Dec 2000 19:18:51 +0000 (19:18 +0000)]
Update the internal docs.

23 years agoTypo and additional information about cert-chain building.
Lutz Jänicke [Tue, 5 Dec 2000 16:47:22 +0000 (16:47 +0000)]
Typo and additional information about cert-chain building.

23 years agoAdd EXAMPLES for SSL_CIPHER_description() output.
Lutz Jänicke [Tue, 5 Dec 2000 16:45:26 +0000 (16:45 +0000)]
Add EXAMPLES for SSL_CIPHER_description() output.

23 years agoDiscuss
Bodo Möller [Tue, 5 Dec 2000 10:30:21 +0000 (10:30 +0000)]

23 years agoOn Windows, Rainbow uses _stdcall convention under Windows.
Richard Levitte [Tue, 5 Dec 2000 08:16:25 +0000 (08:16 +0000)]
On Windows, Rainbow uses _stdcall convention under Windows.
Spotted by plin <>

23 years agopush the flags too
Ulf Möller [Tue, 5 Dec 2000 06:38:45 +0000 (06:38 +0000)]
push the flags too

23 years agolooks like it works now
Ulf Möller [Tue, 5 Dec 2000 05:39:43 +0000 (05:39 +0000)]
looks like it works now

23 years agosave registers in the debug output code (return value is overwritten too)
Ulf Möller [Tue, 5 Dec 2000 05:10:05 +0000 (05:10 +0000)]
save registers in the debug output code (return value is overwritten too)

23 years agomore of the same: add printf() for perlasm.
Ulf Möller [Tue, 5 Dec 2000 04:39:39 +0000 (04:39 +0000)]
more of the same: add printf() for perlasm.

23 years agominor modification to the previous change
Ulf Möller [Tue, 5 Dec 2000 03:57:58 +0000 (03:57 +0000)]
minor modification to the previous change

23 years agoPERLASM - the wierdest programming language since Intercal.
Ulf Möller [Tue, 5 Dec 2000 03:51:46 +0000 (03:51 +0000)]
PERLASM - the wierdest programming language since Intercal.

add debug output facilities.

23 years agoUse assert as in the rest of the BN library.
Ulf Möller [Tue, 5 Dec 2000 02:00:40 +0000 (02:00 +0000)]
Use assert as in the rest of the BN library.

23 years agoImprove formatting.
Bodo Möller [Mon, 4 Dec 2000 19:04:55 +0000 (19:04 +0000)]
Improve formatting.

23 years agoIt's completely unnecessary to add a compression algorithm that is
Richard Levitte [Mon, 4 Dec 2000 17:17:03 +0000 (17:17 +0000)]
It's completely unnecessary to add a compression algorithm that is
really undefined.
Spotted by Jeffrey Altman <>

23 years agoRemove the last bn_wexpand()s that made us break constness. Of
Richard Levitte [Mon, 4 Dec 2000 17:11:59 +0000 (17:11 +0000)]
Remove the last bn_wexpand()s that made us break constness.  Of
course, that means we need to handle the cases where the two arrays to
bn_mul_recursive() and bn_mul_part_recursive() differ in size.

I haven't yet changed the comments that describe bn_mul_recursive()
and bn_mul_part_recursive().  I want this to be tested by more people
before I consider this change final.  Please test away!

23 years agoChange error message to "bignum too long"
Bodo Möller [Mon, 4 Dec 2000 09:24:54 +0000 (09:24 +0000)]
Change error message to "bignum too long"

23 years agoSync up with a minor change in lhash.h
Geoff Thorpe [Mon, 4 Dec 2000 04:54:59 +0000 (04:54 +0000)]
Sync up with a minor change in lhash.h

23 years agoANSI C doesn't allow trailing semi-colons after a function's closing brace
Geoff Thorpe [Mon, 4 Dec 2000 04:52:38 +0000 (04:52 +0000)]
ANSI C doesn't allow trailing semi-colons after a function's closing brace
so these macros probably shouldn't be used like that at all. So, this
change removes the misleading comment and also adds an implicit trailing
semi-colon to the DECLARE macros so they too don't require one.

23 years agoUpdate the documentation to the current state of the LHASH changes. There
Geoff Thorpe [Mon, 4 Dec 2000 04:35:04 +0000 (04:35 +0000)]
Update the documentation to the current state of the LHASH changes. There
will probably be more when the lh_doall[_arg] callbacks are similarly
tidied up, but this 'pod' should now be current.

23 years agoMake a note of the LHASH changes.
Geoff Thorpe [Mon, 4 Dec 2000 03:35:35 +0000 (03:35 +0000)]
Make a note of the LHASH changes.

23 years agoMake the remaining LHASH macro changes. This should leave no remaining
Geoff Thorpe [Mon, 4 Dec 2000 03:02:44 +0000 (03:02 +0000)]
Make the remaining LHASH macro changes. This should leave no remaining
cases of function pointer casting in lh_new() calls - and leave only the
lh_doall and lh_doall_arg cases to be finished.

23 years agoFix warnings.
Ben Laurie [Sun, 3 Dec 2000 10:04:22 +0000 (10:04 +0000)]
Fix warnings.

23 years agoinclude <limits.h>
Bodo Möller [Sun, 3 Dec 2000 09:55:08 +0000 (09:55 +0000)]
include <limits.h>

23 years agoDon't allow BIGNUMs to become so large that computations with dmax
Bodo Möller [Sun, 3 Dec 2000 09:39:04 +0000 (09:39 +0000)]
Don't allow BIGNUMs to become so large that computations with dmax
might overflow.

23 years agoUse the new LHASH macros to declare type-safe wrapper functions that can
Geoff Thorpe [Sat, 2 Dec 2000 23:16:54 +0000 (23:16 +0000)]
Use the new LHASH macros to declare type-safe wrapper functions that can
be used as the hash/compare callbacks without function pointer casting.

For now, this is just happening in the apps/ directory whilst a few people
check the approach. The rest of the library will be moved across to the
same idea if there's no problems with this.

23 years agoNext step in tidying up the LHASH code. This commit defines DECLARE and
Geoff Thorpe [Sat, 2 Dec 2000 23:08:59 +0000 (23:08 +0000)]
Next step in tidying up the LHASH code. This commit defines DECLARE and
IMPLEMENT macros for defining wrapper functions for "hash" and "cmp" callbacks
that are specific to the underlying item type in a hash-table. This prevents
function pointer casting altogether, and also provides some type-safety
because the macro does per-variable casting from the (void *) type used in
LHASH itself to the type declared in the macro - and if that doesn't match the
prototype expected by the "hash" or "cmp" function then a compiler error will

NB: IMPLEMENT macros are not required unless predeclared forms are required
(either in a header file, or further up in a C file than the implementation
needs to be). The DECLARE macros must occur after the type-specific hash/cmp
callbacks are declared. Also, the IMPLEMENT and DECLARE macros are such that
they can be prefixed with "static" if desired and a trailing semi-colon should
be appended (making it look more like a regular declaration and easier on
auto-formatting text-editors too).

Now that these macros are defined, I will next be commiting changes to a
number of places in the library where the casting was doing bad things. After
that, the final step will be to make the analogous changes for the lh_doall
and lh_doall_arg functions (more specifically, their callback parameters).