Bodo Möller [Sat, 3 Mar 2001 15:31:34 +0000 (15:31 +0000)]
EC_set_half and the 'h' component of struct bn_ec_struct are unnecessary.
The computations for which h was used can be done more efficiently
by using BN_rshift1.
Richard Levitte [Fri, 2 Mar 2001 10:38:19 +0000 (10:38 +0000)]
Introduce the possibility to access global variables through
functions on platform were that's the best way to handle exporting
global variables in shared libraries. To enable this functionality,
one must configure with "EXPORT_VAR_AS_FN" or defined the C macro
"OPENSSL_EXPORT_VAR_AS_FUNCTION" in crypto/opensslconf.h (the latter
is normally done by Configure or something similar).
To implement a global variable, use the macro OPENSSL_IMPLEMENT_GLOBAL
in the source file (foo.c) like this:
To declare a global variable, use the macros OPENSSL_DECLARE_GLOBAL
and OPENSSL_GLOBAL_REF in the header file (foo.h) like this:
OPENSSL_DECLARE_GLOBAL(int,foo);
#define foo OPENSSL_GLOBAL_REF(foo)
OPENSSL_DECLARE_GLOBAL(double,bar);
#define bar OPENSSL_GLOBAL_REF(bar)
The #defines are very important, and therefore so is including the
header file everywere where the defined globals are used.
The macro OPENSSL_EXPORT_VAR_AS_FUNCTION also affects the definition
of ASN.1 items, but that structure is a bt different.
The largest change is in util/mkdef.pl which has been enhanced with
better and easier to understand logic to choose which symbols should
go into the Windows .def files as well as a number of fixes and code
cleanup (among others, algorithm keywords are now sorted
lexicographically to avoid constant rewrites).
Geoff Thorpe [Fri, 23 Feb 2001 00:02:56 +0000 (00:02 +0000)]
Fix an oversight - when checking a potential session ID for conflicts with
an SSL_CTX's session cache, it is necessary to compare the ssl_version at
the same time (a conflict is defined, courtesy of SSL_SESSION_cmp(), as a
matching id/id_length pair and a matching ssl_version). However, the
SSL_SESSION that will result from the current negotiation does not
necessarily have the same ssl version as the "SSL_METHOD" in use by the
SSL_CTX - part of the work in a handshake is to agree on an ssl version!
This is fixed by having the check function accept an SSL pointer rather
than the SSL_CTX it belongs to.
[Thanks to Lutz for illuminating the full extent of my stupidity]
Richard Levitte [Thu, 22 Feb 2001 17:41:15 +0000 (17:41 +0000)]
CONF_METHOD is one of the few places where you find MS_FAR. I can't
really see why we need to define these function pointers with MS_FAR
if it's not done cosistently everywhere.
If we decide to support MS_FAR modifiers, it's better to have the
named something more unique for OpenSSL and to define them in e_os2.h.
Richard Levitte [Thu, 22 Feb 2001 14:45:02 +0000 (14:45 +0000)]
e_os.h does not belong with the exported headers. Do not put it there
and make all files the depend on it include it without prefixing it
with openssl/.
This means that all Makefiles will have $(TOP) as one of the include
directories.
Richard Levitte [Thu, 22 Feb 2001 13:59:36 +0000 (13:59 +0000)]
Always include opensslconf.h, even if it's already been done before.
The reason is that some parts are only included when certain other
include files have been included.
Also, it seems that the rest of the OpenSSL code assumes that all
kinds of M$ Windows are MSDOS as well...
Geoff Thorpe [Wed, 21 Feb 2001 21:38:32 +0000 (21:38 +0000)]
If a callback is generating a new session ID for SSLv2, then upon exiting,
the ID will be padded out to 16 bytes if the callback attempted to generate
a shorter one. The problem is that the uniqueness checking function used in
callbacks may mistakenly think a 9-byte ID is unique when in fact its
padded 16-byte version is not. This makes the checking function detect
SSLv2 cases, and ensures the padded form is checked rather than the shorter
one passed by the callback.
Geoff Thorpe [Wed, 21 Feb 2001 18:38:48 +0000 (18:38 +0000)]
This adds command-line support to s_server for controlling the generation
of session IDs. Namely, passing "-id_prefix <text>" will set a
generate_session_id() callback that generates session IDs as random data
with <text> block-copied over the top of the start of the ID. This can be
viewed by watching the session ID s_client's output when it connects.
This is mostly useful for testing any SSL/TLS code (eg. proxies) that wish
to deal with multiple servers, when each of which might be generating a
unique range of session IDs (eg. with a certain prefix).
Geoff Thorpe [Wed, 21 Feb 2001 18:06:26 +0000 (18:06 +0000)]
This change allows a callback to be used to override the generation of
SSL/TLS session IDs in a server. According to RFC2246, the session ID is an
arbitrary value chosen by the server. It can be useful to have some control
over this "arbitrary value" so as to choose it in ways that can aid in
things like external session caching and balancing (eg. clustering). The
default session ID generation is to fill the ID with random data.
The callback used by default is built in to ssl_sess.c, but registering a
callback in an SSL_CTX or in a particular SSL overrides this. BTW: SSL
callbacks will override SSL_CTX callbacks, and a new SSL structure inherits
any callback set in its 'parent' SSL_CTX. The header comments describe how
this mechanism ticks, and source code comments describe (hopefully) why it
ticks the way it does.
Man pages are on the way ...
[NB: Lutz was also hacking away and helping me to figure out how best to do
this.]
Richard Levitte [Wed, 21 Feb 2001 14:12:03 +0000 (14:12 +0000)]
Modify mkdef.pl to recognise and parse prprocessor conditionals of the
form '#if defined(...) || defined(...) || ...' and '#if !defined(...)
&& !defined(...) && ...'. This also avoids the growing number of
special cases it was previously handling (some of them wrongly).
Richard Levitte [Tue, 20 Feb 2001 19:13:46 +0000 (19:13 +0000)]
With later version of DEC C on VMS, some functions (strcmp(), for
example) are declared with some extra linkage information. This
generates a warning when using the function name as a value to a
regular function pointer with the "correct" definition of the
function. Therefore, use a macro to cast the appropriate function on
VMS.
Richard Levitte [Tue, 20 Feb 2001 17:37:02 +0000 (17:37 +0000)]
I forgot there was a reason why the inclusions and definition of u_int
was made in a certain sequence. This change restores the earlier
"chain of command".
Geoff Thorpe [Tue, 20 Feb 2001 16:31:15 +0000 (16:31 +0000)]
The callbacks in the NAME_FUNCS structure are not used directly as LHASH
callbacks, and their prototypes were consistent as they were. These casts
need reversing.
Also, I personally find line breaks during parameter lists (ie a line
ending in a comma) easier to read at a glance than line breaks at the end
of a function call and before a dereference on the return value (ie a line
ending in a closed-bracket followed by a line starting with "->").
Richard Levitte [Tue, 20 Feb 2001 13:23:42 +0000 (13:23 +0000)]
Include OpenSSL header files earlier so macros like OPENSSL_SYS_VMS
get a chance to be defined.
Make a batter file name translator (uhm, no, that's not the finished
variant :-)).
Richard Levitte [Tue, 20 Feb 2001 12:40:42 +0000 (12:40 +0000)]
Use 0 instead of NULL, at least for function casts, since there are
variants of stdio.h that define NULL in such a way that it's "unsafe"
to use for function pointer casting.
Richard Levitte [Mon, 19 Feb 2001 16:06:34 +0000 (16:06 +0000)]
Make all configuration macros available for application by making
sure they are available in opensslconf.h, by giving them names starting
with "OPENSSL_" to avoid conflicts with other packages and by making
sure e_os2.h will cover all platform-specific cases together with
opensslconf.h.
I've checked fairly well that nothing breaks with this (apart from
external software that will adapt if they have used something like
NO_KRB5), but I can't guarantee it completely, so a review of this
change would be a good thing.