Commit graph

3672 commits

Author SHA1 Message Date
Geoff Thorpe
7ae551fd03 In RSA, DSA, DH, and RAND - if the "***_new()" function fails because the
ENGINE code does not return a default, set an error.
2001-04-30 15:24:41 +00:00
Dr. Stephen Henson
c2e45f6ddf Win32 fixes:
define LLONG properly for VC++.

stop compiler complaining about signed/unsigned mismatch in apps/engine.c
2001-04-29 16:30:59 +00:00
Richard Levitte
f9a4ad4fa6 A method to create shared libraries on AIX, and according to
"Howard Chu" <hyc@highlandsun.com>, it may be general enough
to work on any Unixly system.
2001-04-27 21:33:44 +00:00
Richard Levitte
10645a4f13 make update 2001-04-27 08:59:00 +00:00
Geoff Thorpe
06cb0353e5 For some inexplicable reason, I'd (a) left the debugging irreversibly
turned on, and (b) left a somewhat curious debugging string in the output.
2001-04-27 00:31:21 +00:00
Geoff Thorpe
b41f836e5f Some fixes to the reference-counting in ENGINE code. First, there were a
few statements equivalent to "ENGINE_add(ENGINE_openssl())" etc. The inner
call to ENGINE_openssl() (as with other functions like it) orphans a
structural reference count. Second, the ENGINE_cleanup() function also
needs to clean up the functional reference counts held internally as the
list of "defaults" (ie. as used when RSA_new() requires an appropriate
ENGINE reference). So ENGINE_clear_defaults() was created and is called
from within ENGINE_cleanup(). Third, some of the existing code was
logically broken in its treatment of reference counts and locking (my
fault), so the necessary bits have been restructured and tidied up.

To test this stuff, compiling with ENGINE_REF_COUNT_DEBUG will cause every
reference count change (both structural and functional) to log a message to
'stderr'. Using with "openssl engine" for example shows this in action
quite well as the 'engine' sub-command cleans up after itself properly.

Also replaced some spaces with tabs.
2001-04-26 23:04:30 +00:00
Richard Levitte
26a81abffc Make proper use of all disabling variables. 2001-04-26 21:02:57 +00:00
Geoff Thorpe
ab03b0df4c "make update" 2001-04-26 20:56:30 +00:00
Geoff Thorpe
e5a77633cf Make notes about ENGINE changes. 2001-04-26 20:42:12 +00:00
Richard Levitte
6f8a82c7af Linux shared libraries can be linked with debug symbols.
Tru64 shared libraries can be linked with static libraries.
2001-04-26 20:17:59 +00:00
Richard Levitte
7a7f47ea80 make update 2001-04-26 19:45:31 +00:00
Geoff Thorpe
0ce5f3e4f5 This adds 2 things to the ENGINE code.
* "ex_data" - a CRYPTO_EX_DATA structure in the ENGINE structure itself
   that allows an ENGINE to store its own information there rather than in
   global variables. It follows the declarations and implementations used
   in RSA code, for better or worse. However there's a problem when storing
   state with ENGINEs because, unlike related structure types in OpenSSL,
   there is no ENGINE-vs-ENGINE_METHOD separation. Because of what ENGINE
   is, it has method pointers as its structure elements ...  which leads
   to;

 * ENGINE_FLAGS_BY_ID_COPY - if an ENGINE should not be used just as a
   reference to an "implementation" (eg. to get to a hardware device), but
   should also be able to maintain state, then this flag can be set by the
   ENGINE implementation. The result is that any call to ENGINE_by_id()
   will not result in the existing ENGINE being returned (with its
   structural reference count incremented) but instead a new copy of the
   ENGINE will be returned that can maintain its own state independantly of
   any other copies returned in the past or future. Eg. key-generation
   might involve a series of ENGINE-specific control commands to set
   algorithms, sizes, module-keys, ids, ACLs, etc. A final command could
   generate the key. An ENGINE doing this would *have* to declare
   ENGINE_FLAGS_BY_ID_COPY so that the state of that process can be
   maintained "per-handle" and unaffected by other code having a reference
   to the same ENGINE structure.
2001-04-26 19:35:44 +00:00
Richard Levitte
21023745e2 Clean up ENGINE before exiting. 2001-04-26 16:08:10 +00:00
Richard Levitte
a679116f6f Provide the possibility to clean up internal ENGINE structures. This
takes care of what would otherwise be seen as a memory leak.
2001-04-26 16:07:08 +00:00
Richard Levitte
3988bb34aa gcc warns when certain values of an enumeration aren't taken care of,
unless there's a default clause.
2001-04-26 15:53:42 +00:00
Richard Levitte
9e78e6c3f8 Check for OPENSSL_NO_RSA, OPENSSL_NO_DSA and OPENSSL_NO_DH and disable
appropriate code if any of them is defined.
2001-04-26 15:45:12 +00:00
Richard Levitte
3caff6092a engine.h includes all the needed header files, so don't do it again
here.
2001-04-26 15:04:22 +00:00
Richard Levitte
0d96bf8950 We shouldn't skip over header files to avoid functions of disabled algorithms. The selection is done in a different way 2001-04-26 12:01:12 +00:00
Richard Levitte
91dc71f98d User OPENSSL_UNISTD instead of <unistd.h>.
Spotted by Mark Crispin <MRC@Panda.COM>
2001-04-26 08:26:18 +00:00
Geoff Thorpe
b7b6c047ca This change to the "dl", "dlfcn", and "win32" DSO_METHODs adds the filename
or symbol name to the error stack in the event a load or bind operation
failed.
2001-04-25 22:40:55 +00:00
Lutz Jänicke
0ea659475c Typo (reported by Petr Lancaric <Petr.Lancaric@ips-ag.cz>) 2001-04-25 15:24:47 +00:00
Geoff Thorpe
1e20bb0648 Make update. 2001-04-22 17:21:19 +00:00
Dr. Stephen Henson
c962479bdf Fix ASN1 bug when decoding OTHER type.
Various S/MIME DSA related fixes.
2001-04-21 12:06:01 +00:00
Richard Levitte
b31ccc362c Script to create shareable images (shared libraries in Unixly terms)
on VMS.
2001-04-20 13:09:10 +00:00
Richard Levitte
0cd5866726 VMS was behind when it comes to OCSP. 2001-04-20 12:37:14 +00:00
Geoff Thorpe
2a8a10eda6 Add notes about the new ENGINE functionality. 2001-04-19 23:06:00 +00:00
Geoff Thorpe
f11bc84080 Changes to "openssl engine" to support the new control command code in
ENGINE.

 * Extra verbosity can be added with more "v"'s, eg. '-vvv' gives
   information about input flags and descriptions for each control command
   in each ENGINE. Check the output of "openssl engine -vvv" for example.

 * '-pre <cmd>' and '-post <cmd>' can be used to invoke control commands on
   the specified ENGINE (or on all of them if no engine id is specified,
   although that usually gets pretty ugly). '-post' commands are only
   attempted if '-t' is specified and the engine successfully initialises.
   '-pre' commands are always attempted whether or not '-t' causes an
   initialisation to be tried afterwards. Multiple '-pre' and/or '-post'
   commands can be specified and they will be called in the order they
   occur on the command line.

Parameterised commands (the normal case, there are currently no
unparameterised ones) are split into command and argument via a separating
colon. Eg. "openssl engine -pre SO_PATH:/lib/libdriver.so <id>" results in
the call;
    ENGINE_ctrl_cmd_string(e, "SO_PATH", "/lib/libdriver.so", 0);

Application code should similarly allow arbitrary name-value string pairs
to be passed into ENGINEs in a manner matching that in apps/engine.c,
either using the same colon-separated format, or entered as two distinct
strings. Eg. as stored in a registry. The last parameter of
ENGINE_ctrl_cmd_string can be changed from 0 to 1 if the command should
only be attempted if it's supported by the specified ENGINE (eg. for
commands like "FORK_CHECK:1" that may or may not apply to the run-time
ENGINE).
2001-04-19 02:08:26 +00:00
Geoff Thorpe
e2f3ae1252 Some more tweaks to ENGINE code.
This change adds some basic control commands to the existing ENGINEs
(except the software 'openssl' engine). All these engines currently load
shared-libraries for hardware APIs, so they've all been given "SO_PATH"
commands that will configure the chosen ENGINE to load its shared library
from the given path. Eg. by calling;
    ENGINE_ctrl_cmd_string(e, "SO_PATH", <path>, 0).

The nCipher 'chil' ENGINE has also had "FORK_CHECK" and "THREAD_LOCKING"
commands added so these settings could be handled via application-level
configuration rather than in application source code.

Changes to "openssl engine" to test and examine these control commands will
be made shortly. It will also provide the necessary tips to application
programs wanting to support these dynamic control commands.
2001-04-19 01:45:40 +00:00
Geoff Thorpe
40fcda292f Some BIG tweaks to ENGINE code.
This change adds some new functionality to the ENGINE code and API to
make it possible for ENGINEs to describe and implement their own control
commands that can be interrogated and used by calling applications at
run-time. The source code includes numerous comments explaining how it all
works and some of the finer details. But basically, an ENGINE will normally
declare an array of ENGINE_CMD_DEFN entries in its ENGINE - and the various
new ENGINE_CTRL_*** command types take care of iterating through this list
of definitions, converting command numbers to names, command names to
numbers, getting descriptions, getting input flags, etc. These
administrative commands are handled directly in the base ENGINE code rather
than in each ENGINE's ctrl() handler, unless they specify the
ENGINE_FLAGS_MANUAL_CMD_CTRL flag (ie. if they're doing something clever or
dynamic with the command definitions).

There is also a new function, ENGINE_cmd_is_executable(), that will
determine if an ENGINE control command is of an "executable" type that
can be used in another new function, ENGINE_ctrl_cmd_string(). If not, the
control command is not supposed to be exposed out to user/config level
access - eg. it could involve the exchange of binary data, returning
results to calling code, etc etc. If the command is executable then
ENGINE_ctrl_cmd_string() can be called using a name/arg string pair. The
control command's input flags will be used to determine necessary
conversions before the control command is called, and commands of this
form will always return zero or one (failure or success, respectively).
This is set up so that arbitrary applications can support control commands
in a consistent way so that tweaking particular ENGINE behaviour is
specific to the ENGINE and the host environment, and independant of the
application or OpenSSL.

Some code demonstrating this stuff in action will applied shortly to the
various ENGINE implementations, as well as "openssl engine" support for
executing arbitrary control commands before and/or after initialising
various ENGINEs.
2001-04-19 00:41:55 +00:00
Geoff Thorpe
59bc3126c5 Some more tweaks to ENGINE code.
The existing ENGINEs (including the default 'openssl' software engine) were
static, declared inside the source file for each engine implementation. The
reason this was not going boom was that all the ENGINEs had reference
counts that never hit zero (once linked into the internal list, each would
always have at least 1 lasting structural reference).

To fix this so it will stay standing when an "unload" function is added to
match ENGINE_load_builtin_engines(), the "constructor" functions for each
ENGINE implementation have been changed to dynamically allocate and
construct their own ENGINEs using API functions. The other benefit of this
is that no ENGINE implementation has to include the internal "engine_int.h"
header file any more.
2001-04-18 21:46:00 +00:00
Geoff Thorpe
4d6115a5cc Make a note of the recent ENGINE developments. 2001-04-18 21:12:02 +00:00
Bodo Möller
3a25b96caf typo 2001-04-18 15:11:42 +00:00
Bodo Möller
6e6d04e29a fix md_rand.c locking bugs 2001-04-18 15:07:35 +00:00
Geoff Thorpe
48ff225300 Make the shared library name and function symbol for the "nuron" ENGINE
static data where they could be parameterised by ctrl() commands.
2001-04-18 04:47:01 +00:00
Geoff Thorpe
a4a9d97a3e Some more tweaks from ENGINE code.
Previously RAND_get_rand_method was returning a non-const pointer, but it
should be const. As with all other such cases, METHOD pointers are stored and
returned as "const". The only methods one should be able to alter are methods
"local" to the relevant code, in which case a non-const handle to the methods
should already exist.

This change has been forced by the constifying of the ENGINE code (before
which RAND_METHOD was the only method pointer in an ENGINE structure that was
not constant).
2001-04-18 04:18:16 +00:00
Geoff Thorpe
404f952aa3 Some more tweaks to ENGINE code.
ENGINE handler functions should take the ENGINE structure as a parameter -
this is because ENGINE structures can be copied, and like other
structure/method setups in OpenSSL, it should be possible for init(),
finish(), ctrl(), etc to adjust state inside the ENGINE structures rather
than globally. This commit includes the dependant changes in the ENGINE
implementations.
2001-04-18 03:57:05 +00:00
Geoff Thorpe
dcd87618ab Some more tweaks to ENGINE code.
Previous changes permanently removed the commented-out old code for where
it was possible to create and use an ENGINE statically, and this code gets
rid of the ENGINE_FLAGS_MALLOCED flag that supported the distinction with
dynamically allocated ENGINEs. It also moves the area for ENGINE_FLAGS_***
values from engine_int.h to engine.h - because it should be possible to
declare ENGINEs just from declarations in exported headers.
2001-04-18 03:03:16 +00:00
Geoff Thorpe
d54bf14559 Some more tweaks to ENGINE code.
* Constify the get/set functions, and add some that functions were missing.

* Add a new 'ENGINE_cpy()' function that will produce a new ENGINE based
  copied from an original (except for the references, ie. the new copy will
  be like an ENGINE returned from 'ENGINE_new()' - a structural reference).

* Removed the "null parameter" checking in the get/set functions - it is
  legitimate to set NULL values as a way of *changing* an ENGINE (ie.
  removing a handler that previously existed). Also, passing a NULL pointer
  for an ENGINE is obviously wrong for these functions, so don't bother
  checking for it. The result is a number of error codes and strings could
  be removed.
2001-04-18 02:01:36 +00:00
Geoff Thorpe
ea3a429efe Structural references should never be decremented directly - so leave that
to ENGINE_free(). Also, remove "#if 0" code that has no useful future.
2001-04-18 01:07:28 +00:00
Geoff Thorpe
e3f1223fe4 This moves string constants out of vendor headers and into C files. 2001-04-18 00:43:23 +00:00
Geoff Thorpe
7ef6e3fe2f 'make update' 2001-04-17 23:53:58 +00:00
Lutz Jänicke
197322455d Clarify request of client certificates. This is a FAQ. 2001-04-17 13:18:56 +00:00
Ben Laurie
4f19a0672b Fix warning. 2001-04-16 03:00:57 +00:00
Lutz Jänicke
854e076df8 Constify (Jason Molenda <jason@molenda.com>) 2001-04-14 14:50:02 +00:00
Lutz Jänicke
cb2a0e1319 Missing link ("Greg Stark" <gstark@ethentica.com>) 2001-04-12 21:11:31 +00:00
Lutz Jänicke
638b0d4277 Fix wrong information with respect to CAs listed to the client
(follows from technical discussion with Amit Chopra <amitc@pspl.co.in>).
2001-04-12 16:02:34 +00:00
Bodo Möller
f2346808de update so that changes going into the 0.9.6 tree can be logged 2001-04-12 12:42:20 +00:00
Bodo Möller
d7818facb9 undo previous change ... 2001-04-12 12:03:41 +00:00
Bodo Möller
bcf95a2183 update from 0.9.6a 2001-04-12 12:01:47 +00:00
Lutz Jänicke
f7181a9179 Typo (Jun-ichiro itojun Hagino <itojun@iijlab.net>) 2001-04-12 11:45:42 +00:00