Commit graph

2217 commits

Author SHA1 Message Date
Richard Levitte
854067e8e4 API change. 2000-07-07 17:00:36 +00:00
Richard Levitte
eb2f937b93 Change the overall RAND routines to actually make use of engines.
This seems to work, but I'm a little unsure that I got it all right,
and would like this to be reviewed.
2000-07-07 16:57:16 +00:00
Richard Levitte
64c4f5732d Add the possibility to load prvate and public keys from an engine and
implement it for nCipher hardware.  The interface in itself should be
clear enough, but the nCipher implementation is currently not the
best when it comes to getting a passphrase from the user.  However,
getting it better is a little hard until a better user interaction
method is create.

Also, use the possibility in req, so we can start to create CSR's with
keys from the nForce box.

WARNING: I've made *no* tests yet, mostly because I didn't implement
this on the machine where I have an nForce box to play with.  All I
know is that it compiles cleanly on Linux...
2000-07-06 18:40:10 +00:00
Richard Levitte
f3052a9eee Don't initialise the pointers to mutex functions directly in the structure.
This is correctly taken care of by hwcrhk_init().  While we're at it, give
this engine the official name of the library used (CHIL, for Cryptographic
Hardware Interface Library).
2000-07-05 16:00:18 +00:00
Richard Levitte
e1e9ead6fb Merge in the latest changes from the main trunk, and extra in apps/speed.c 2000-06-30 17:52:33 +00:00
Richard Levitte
5ac85984ec Check for missing engine name, and also, do not count up the number of given algorithms when an engine is given 2000-06-30 15:58:37 +00:00
Richard Levitte
e11b297730 p_CSwift_AttachKeyParam actually returns more than one kind of error. Detect the input size error, treat any that are not specially checked as 'request failed', not as 'provide parameters', and for those, add the actual status code to the error message 2000-06-30 15:54:48 +00:00
Richard Levitte
48555cf0fc Cryptoswitch actually has a few more statuses than SW_OK. Let's provide the possibility for a better granularity in error checking 2000-06-30 15:52:07 +00:00
Richard Levitte
ae02fc5348 Make it possible to turn off compilation of hardware support through
the configuration parameter 'no-hw'.
2000-06-30 11:02:02 +00:00
Richard Levitte
93e147dd32 `make update' 2000-06-29 21:26:46 +00:00
Richard Levitte
3257904c56 It makes much more sense and is much more consistent with the rest of
OpenSSL to have to opt out hardware support instead of having to opt
it in.  And since the hardware support modules are self-contained and
actually check that the vendor stuff is loadable, it still works as
expected, or at least, so I think...
2000-06-29 21:20:14 +00:00
Richard Levitte
2a7619d762 Give the programmer of extra engines the possibility to actually make
it functional :-).
2000-06-29 16:33:59 +00:00
Richard Levitte
70d03c4f59 Make the use of logstream thread-safe. 2000-06-29 16:32:34 +00:00
Richard Levitte
5971d37400 Use the new control to add a log stream. 2000-06-29 16:17:28 +00:00
Richard Levitte
d813a428a7 When closing the hwcrhk engine, also remove the reference to the
logstream.
2000-06-29 16:16:50 +00:00
Richard Levitte
3b2972d8d9 Add the possibility to control some engine internals. 2000-06-29 14:26:07 +00:00
Richard Levitte
2165d91196 Rename 'hwcrhk' to 'ncipher' in all public symbols. Redo the logging function so it takes a BIO. Make module-local functions static 2000-06-29 13:00:07 +00:00
Richard Levitte
fc99c92835 The error ENGINE_R_HWCRYPTOHOOK_REPORTS should never have been used 2000-06-29 12:58:52 +00:00
Richard Levitte
1dde74f229 Rename 'hwcrhk' to 'ncipher' in all public symbols 2000-06-26 23:15:16 +00:00
Geoff Thorpe
665b5ab5a7 Strange how one line can make a world of difference, particularly when
the one line turns an error return value into a success return value.
:-) "openssl speed -engine hwcrhk rsa1024" now passes through ok.
2000-06-26 15:58:33 +00:00
Geoff Thorpe
13232559fc Get rid of those annoying "?"s from cvs update :-) 2000-06-26 13:36:04 +00:00
Richard Levitte
1b2f8b6e2a Things merged from the main trunk, among others some well needed Win32
fixes.
2000-06-23 22:24:53 +00:00
Geoff Thorpe
ccd98b43ed 'make update' in the engine branch. 2000-06-20 14:12:35 +00:00
Geoff Thorpe
d32e8acf08 Now that the branch has been updated with the DSO changes in the head,
correct the DSO-dependant code in the engine code.
2000-06-20 13:59:48 +00:00
Richard Levitte
d8c4d0e819 Merge of stuff from main trunk, all conflicts resolved, and addition
of dynamic lock support in the nCipher code.
2000-06-19 17:35:39 +00:00
Richard Levitte
b215f70a0e Merge of stuff from main trunk, all conflicts resolved, and addition
of dynamic lock support in the nCipher code.
2000-06-19 17:28:22 +00:00
Richard Levitte
7ed20a2158 Merge of stuff from main trunk, all conflicts resolved. 2000-06-19 14:44:57 +00:00
Geoff Thorpe
6c62150674 The README for the engine code was quite out of date. Hopefully it is
now less so.
2000-06-15 17:50:08 +00:00
Geoff Thorpe
aa23a57918 (1) In the atalla initialisation, use the test from Ben's earlier
Atalla code to see if the accelerator is running.
(2) Turn some spaces into tabs.
2000-06-15 17:32:42 +00:00
Geoff Thorpe
8e2c277353 Ah, ok so my problem had been typographical rather than philosophical.
It's cute to observe that Atalla having no RSA-specific form of mod_exp
causes a DSA server to achieve about 6 times as many signatures per
second than an RSA server. :-)
2000-06-15 17:14:45 +00:00
Geoff Thorpe
f18ef82a9f Little typo. 2000-06-14 17:54:28 +00:00
Geoff Thorpe
cc015c48db This adds Atalla support code to the ENGINE framework. If you have an
Atalla card, you should be able to compile with the "hw-atalla" switch
with "./config" or "perl Configure", and then you can use the command-
line switch "-engine atalla" inside speed, s_cient and s_server (after
checking out note (1)).

Notes:
  (1) I've turned on native name translation when loading the shared-
      library, but this means that the Unix shared library needs to be
      libatasi.so rather than atasi.so. I got around this in my testing
      by creating a symbollic link from /usr/lib/libatasi.so to the real
      library, but something better will be needed. It also assumes in
      win32 that the DLL will be called atasi.dll - but as I don't have
      a win32/atalla environment to try I have no idea yet if this is
      the case.
  (2) Currently DSA verifies are not accelerated because I haven't yet
      got a mod_exp-based variant of BN_mod_exp2_mont() that yields
      correct results.
  (3) Currently the "init()" doesn't fail if the shared library can
      load successfully but the card is not operational. In this case,
      the ENGINE_init() call will succeed, but all RSA, DSA, DH, and
      the two BN_*** operations will fail until the ENGINE is switched
      back to something that does work. I expect to correct this next.
  (4) Although the API for the Atalla card just has the one crypto
      function suggesting an RSA private key operation - this is in
      fact just a straight mod_exp function that ignores all the RSA
      key parameters except the (private) exponent and modulus. This is
      why the only accelerator work is taking place inside the mod_exp
      function and there's no optimisation of RSA private key operations
      based on CRT etc.
2000-06-14 17:04:10 +00:00
Richard Levitte
9a4051050c Geoff inspired me to nullify some pointers if initialisation went
wrong.  Additionally, just give a new value to hndidx once.
2000-06-14 16:57:57 +00:00
Geoff Thorpe
4c4ea428cc DSO_bind() is effectively a method-specific wrapper for dlopen() or
whatever the underlying API is. It must return (void *) because shared
libraries can expose functions, structures, or whatever. However, some
compilers give loads of warnings about casted function pointers through
this code, so I am explicitly casting them to the right prototypes.
2000-06-14 14:28:16 +00:00
Geoff Thorpe
28e94dc70d I'm working on Atalla ENGINE code, and the existing bn_exp.c hooks
(initiated by ./config and the presence of SDK headers) are conflicting.
2000-06-14 13:27:47 +00:00
Geoff Thorpe
f812743544 If initialisation fails for any reason, the global function pointers
should be NULL'd out.
2000-06-14 13:24:37 +00:00
Geoff Thorpe
87f3435f78 This hooks the "hwcrhk" engine Richard just submitted into the default
engine list if HW_NCIPHER is defined. I want to play :-)
2000-06-13 18:11:38 +00:00
Richard Levitte
86787f93d6 - merged in the latest from the main trunk, fixed all conflicts
- implemented nCipher support via the nfhwcrhk library (not well tested).
- make update + make depend
2000-06-13 16:21:06 +00:00
Geoff Thorpe
05d909c549 * Migrate the engine code's Malloc + Free calls to the newer
OPENSSL_malloc and OPENSSL_free.

* 3 "normal" files (crypto/rsa/rsa_lib.c, crypto/dsa/dsa_lib.c
  and crypto/dh/dh_lib.c) had their Malloc's and Free's missed
  when Richard merged the changes across to this branch -
  probably because those files have been changed in this branch
  and gave some grief to the merge - so I've changed them
  manually here.
2000-06-09 11:42:02 +00:00
Richard Levitte
d44c7dcf00 Merge in code from main trunk to BRANCH_engine. 2000-06-08 11:00:37 +00:00
cvs2svn
5decfb7002 This commit was manufactured by cvs2svn to create branch 'BRANCH_engine'. 2000-06-01 22:19:22 +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
922ebc7b0d Don't include <stdlib.h>. In the NO_FP_API case, don't include <stdio.h>. 2000-06-01 19:34:25 +00:00
Richard Levitte
b194041adf Small documentation bug, probably a cut'n'paste, corrected. 2000-06-01 17:40:34 +00:00
Ulf Möller
db82b8f9bd Bug fix for 64 bit HP-UX.
Submitted by: Karsten Spang <ks@bellesystems.com>
2000-06-01 14:24:59 +00:00
Richard Levitte
a9ef75c50d Small fix to enable reading from stdin as well.
Contributed by Yoichiro Okabe <okabe@wizsoft.co.jp>
2000-06-01 11:23:20 +00:00
Geoff Thorpe
7edd20916a "make update" + stripping the type-specific stack functions out of
libeay.num and ssleay.num.
2000-06-01 06:07:19 +00:00
Geoff Thorpe
e41c8d6ad4 This change will cause builds (by default) to not use different STACK
structures and functions for each stack type. The previous behaviour
can be enabled by configuring with the "-DDEBUG_SAFESTACK" option.
This will also cause "make update" (mkdef.pl in particular) to
update the libeay.num and ssleay.num symbol tables with the number of
extra functions DEBUG_SAFESTACK creates.

The way this change works is to accompany each DECLARE_STACK_OF()
macro with a set of "#define"d versions of the sk_##type##_***
functions that ensures all the existing "type-safe" stack calls are
precompiled into the underlying stack calls. The presence or abscence
of the DEBUG_SAFESTACK symbol controls whether this block of
"#define"s or the DECLARE_STACK_OF() macro is taking effect. The
block of "#define"s is in turn generated and maintained by a perl
script (util/mkstack.pl) that encompasses the block with delimiting
C comments. This works in a similar way to the auto-generated error
codes and, like the other such maintenance utilities, is invoked
by the "make update" target.

A long (but mundane) commit will follow this with the results of
"make update" - this will include all the "#define" blocks for
each DECLARE_STACK_OF() statement, along with stripped down
libeay.num and ssleay.num files.
2000-06-01 05:13:52 +00:00
Geoff Thorpe
ccd86b68ef The previous commit to crypto/stack/*.[ch] pulled the type-safety strings
yet tighter, and also put some heat on the rest of the library by
insisting (correctly) that compare callbacks used in stacks are prototyped
with "const" parameters. This has led to a depth-first explosion of
compiler warnings in the code where 1 constification has led to 3 or 4
more. Fortunately these have all been resolved to completion and the code
seems cleaner as a result - in particular many of the _cmp() functions
should have been prototyped with "const"s, and now are. There was one
little problem however;

X509_cmp() should by rights compare "const X509 *" pointers, and it is now
declared as such. However, it's internal workings can involve
recalculating hash values and extensions if they have not already been
setup. Someone with a more intricate understanding of the flow control of
X509 might be able to tighten this up, but for now - this seemed the
obvious place to stop the "depth-first" constification of the code by
using an evil cast (they have migrated all the way here from safestack.h).

Fortunately, this is the only place in the code where this was required
to complete these type-safety changes, and it's reasonably clear and
commented, and seemed the least unacceptable of the options. Trying to
take the constification further ends up exploding out considerably, and
indeed leads directly into generalised ASN functions which are not likely
to cooperate well with this.
2000-06-01 02:36:58 +00:00