Compare commits

...

164 Commits

Author SHA1 Message Date
Richard Levitte
04572965ea Time for release of OpenSSL 0.9.7.
The tag will be OpenSSL_0_9_7.
2002-12-30 23:54:11 +00:00
Andy Polyakov
1832f5e751 My English is definitely not good as my assembly skills:-) And it looks
like titles can't be multi-line (it doesn't look good on the FAQ web-page).
2002-12-30 20:20:25 +00:00
Andy Polyakov
d3f56a69fb It probably belongs in PROBLEMS, but it's more likely to be a FAQ. 2002-12-30 11:08:56 +00:00
Richard Levitte
bfbc667397 Since we're including Kerberos 5 headers in our exported header files (when
OpenSSL is configured to use Kerberos), we'd better tell pkg-config users
where they can be found.
PR: 421
2002-12-29 23:03:16 +00:00
Lutz Jänicke
cb284033f5 Add information about AES cipher suites to ciphers manual page.
If no authentication method is mentioned in the cipher suite name (e.g.
AES128-SHA), RSA authentication is used (PR #396).
2002-12-29 21:23:43 +00:00
Lutz Jänicke
ef9d3a10c3 Fix wrong handling of session ID in SSLv2 client code.
PR: 377
2002-12-29 20:58:55 +00:00
Richard Levitte
20c9a50710 OS/2 does binary by default, apparently.
Reported by Brian Havard <brianh@kheldar.apana.org.au>.
2002-12-29 10:20:01 +00:00
Richard Levitte
5b9aa0e474 Make sure OPENSSL_SYS_ macros are defined. 2002-12-28 02:37:05 +00:00
Richard Levitte
475cc45a61 make update 2002-12-28 02:30:47 +00:00
Richard Levitte
21fa937c9f Make sure OPENSSL_SYS_ macros are defined, and in md5_locl.h, switch
back to using OPENSSL_SYS_ULTRASPARC.
2002-12-28 02:30:26 +00:00
Richard Levitte
bae500aa21 make update 2002-12-28 01:35:25 +00:00
Richard Levitte
5534b7f133 Hmm, the variables $x96_elf_asm and others contain a number of colons,
so when removing one reference, if should be replaced with the
appropriate number of colons, or chaos will follow...
2002-12-28 01:35:11 +00:00
Andy Polyakov
163d6401c5 According to Tim Rice <tim@multitalents.net> assembler support in SCO5
never worked anyway. Note this is not going to HEAD as we intend to
provide an alternative solution as soon as 0.9.7 is out.
2002-12-27 16:49:47 +00:00
Andy Polyakov
fc24169eaf I can't confirm the claim being removed and nobody seems to speak up for it.
Yes, this implies that corresponding targets in beta6 pass the test suite.
2002-12-27 15:06:13 +00:00
Andy Polyakov
0c78046356 UltraSPARC performance "tune-up." 2002-12-27 14:50:13 +00:00
Andy Polyakov
4b8e01a22f FAQ addenum as discussed in RT#417. 2002-12-27 14:29:18 +00:00
Richard Levitte
a882c80e6f Kenneth R. Robinette just told me the latest snapshot works well with
MIT Kerberos.
2002-12-27 14:01:42 +00:00
Richard Levitte
5de00c254d Can't find the referense to errors on XP with Kerberos 2002-12-27 08:09:11 +00:00
Richard Levitte
d7b612e737 Add SPKM among the related stanrds. 2002-12-26 22:35:07 +00:00
Richard Levitte
d95b69b32c Updates 2002-12-26 22:25:04 +00:00
Richard Levitte
1dbfa26b5a Update our list of implemented and related standards. 2002-12-26 00:21:55 +00:00
Richard Levitte
342a584c2b Update our list of implemented and related standards. 2002-12-26 00:17:49 +00:00
Richard Levitte
718d8a931d Spelling error.
This patch was taken from the OpenBSD copy of OpenSSL 0.9.7 beta3 with patches
2002-12-25 22:17:00 +00:00
Richard Levitte
39db27cb83 Avoid double definition of config.
PR: 420
2002-12-24 23:53:50 +00:00
Richard Levitte
cc81432b5b Updates 2002-12-24 23:52:10 +00:00
Lutz Jänicke
c71414b3a9 Some more adjustments
Submitted by: Jeffrey Altman <jaltman@columbia.edu>, "Kenneth R. Robinette" <support@securenetterm.com>
2002-12-24 21:53:34 +00:00
Richard Levitte
542e010aa5 Cygwin needs the library locatin for .DLLs to be set in PATH. Unfortunately,
the conditional was set to add the library directory to PATH when the
platform is NOT Cygwin.  Corrected.
PR: 404
2002-12-24 10:50:18 +00:00
Richard Levitte
84ce9aa177 All VMS-specific problems have been solved.
Confirmed by Mark Daniel <Mark.Daniel@wasd.vsm.com.au>
2002-12-24 10:38:08 +00:00
Richard Levitte
4c94c028a7 Finally, a bn_div_words() in VAX assembler that goes through all tests.
PR: 413
2002-12-23 11:25:55 +00:00
Richard Levitte
88a908e50d Stop a possible memory leak.
(I wonder why s2_connect() handles the initial buffer allocation slightly
differently...)
PR: 416
2002-12-21 23:49:25 +00:00
Richard Levitte
d7de7bcf3e Make AES_ENCRYPT and AES_DECRYPT macros instead of static constants.
PR: 411
2002-12-20 18:21:38 +00:00
Andy Polyakov
cbdda5cc87 Fix for "shift count too large" when compiling for hpux-parisc2 and
irix-mips. The bug was introduced with accelerated support for x86_64.
My fault! Fixed now.
2002-12-20 18:10:39 +00:00
Richard Levitte
4e356d9876 More accurate comments. 2002-12-20 16:38:40 +00:00
Richard Levitte
ff3ab1699b A little debugging. 2002-12-20 16:38:09 +00:00
Richard Levitte
8eeefabf32 Propagate MAKEDEPPROG to the subdirs under crypto/. 2002-12-20 15:28:45 +00:00
Lutz Jänicke
214b8b998a Fix Kerberos5/SSL interaction
Submitted by: "Kenneth R. Robinette" <support@securenetterm.com>
Reviewed by:
PR:
2002-12-20 12:47:16 +00:00
Richard Levitte
2ef9e7efe6 Keep the internal lowercase 'surname', for programmer's sake. 2002-12-20 09:39:42 +00:00
Richard Levitte
449598e723 Be consistent with capitalisation of object names. 2002-12-20 09:24:24 +00:00
Richard Levitte
5201cb5acb Be consistent with capitalisation of object names. 2002-12-20 09:18:21 +00:00
Richard Levitte
ab79ac44d5 There was a mixup between INSTALLTOP and OPENSSLDIR... 2002-12-20 07:51:08 +00:00
Richard Levitte
e286dfe6ed We stupidly had a separate LIBKRB5 variable for KRB5 library dependencies,
and then didn't support it very well.  And that when there already is a
useful variable for exactly this kind of thing; EX_LIBS...
2002-12-19 22:10:20 +00:00
Richard Levitte
17e3b273e6 Because the contents of openssl.pc may have to change when a configuration
has been performed (and possibly changed), have it depend on Makefile.ssl.
2002-12-19 21:56:42 +00:00
Richard Levitte
c93c8d1123 Small tweaks for code consistency. 2002-12-19 21:55:50 +00:00
Richard Levitte
d5bf2e06b3 I have no idea what possesed me to compile s_socket.c as POSIXly code.
Incidently, it now compiles so much better without _POSIX_C_SOURCE.
2002-12-19 19:42:55 +00:00
Richard Levitte
bbd6c8bd16 If _XOPEN_SOURCE_EXTENDED or _XOPEN_SOURCE are defined, _POSIX_C_SOURCE gets
defined in DECC$TYPES.H.  If _POSIX_C_SOURCE is defined, certain types do
not get defined (u_char, u_int, ...).  DECC.H gets included by assert.h
and others.  Now, in6.h uses the types u_char, u_int and so on, and gets
included as part of other header inclusions, and will of course fail because
of the missing types.

On the other hand, _XOPEN_SOURCE_EXTENDED is needed to get gethostname()
properly declared...

Solution: define _XOPEN_SOURCE_EXTENDED much later, so DECC$TYPES.H has
a chance to be included *first*, so the otherwise missing types get defined
properly.

Personal: *mumble* *mumble*
2002-12-19 19:38:51 +00:00
Richard Levitte
00f76ad0df It was pointed out to me that .pc files are normally stored in
${prefix}/lib/pkgconfig, not ${prefix}/lib/pkginfo.
2002-12-19 17:44:45 +00:00
Richard Levitte
4b70367430 It was pointed out to me that .pc files are normally stored in
${prefix}/lib/pkgconfig, not ${prefix}/lib/pkginfo.
2002-12-19 17:42:25 +00:00
Richard Levitte
ce9cbfc815 Update the current status 2002-12-18 10:24:04 +00:00
Andy Polyakov
a92a9f02fb Fix for RT#405, Solaris refuses to invoke preprocessor if egrep returns 1.
Linux for example doesn't exhibit this behaviour, but I add "exit 0" to all
potentially affected rules, just to be on the safe side.
2002-12-18 09:02:07 +00:00
Richard Levitte
b65d3741b3 Move on to beta7 (hopefully, that will never appear) 2002-12-17 14:48:24 +00:00
Richard Levitte
fcf8f4d453 Time to release OpenSSL 0.9.7 beta6.
The tag will be OpenSSL_0_9_7-beta6.
2002-12-17 14:24:51 +00:00
Richard Levitte
13617646da A few more NEWS items. 2002-12-17 14:21:55 +00:00
Andy Polyakov
7a3565009e Make "perl des-586.pl a.out" work, see RT#402 2002-12-17 08:01:28 +00:00
Andy Polyakov
9f3864fde3 Some of Sun compiler drivers (well, one of those I have) collect all
options specified with -Wl in the beginnig of the ld command line which
kind of obsoletes the idea as it's -z defaultextract that will be
closest to lib*.a and not -z allextract:-(
2002-12-16 18:59:05 +00:00
Andy Polyakov
db186beee4 This is rollback to 0.9.6h bn_mul.c to address problem reported in RT#272. 2002-12-16 18:17:24 +00:00
Richard Levitte
1f1a32541f Protect loading routines with a lock.
PR: 373
2002-12-16 06:06:06 +00:00
Geoff Thorpe
0465313e70 "=head3" tags only work with recent versions of the pod tools and 0.9.7
should cooperate with older environments. This replaces them with "I<..>"
tags.
2002-12-15 21:20:25 +00:00
Geoff Thorpe
8d2563f136 The ampersand is not required in these constructs, and was giving AIX
warnings.

Reported by: Bernhard Simon.
2002-12-15 16:45:28 +00:00
Andy Polyakov
21996c6d8e Always forget this one... 2002-12-15 16:00:26 +00:00
Andy Polyakov
fcc5349156 Another Solaris shared build clean-up. This is not actually needed if one
uses WorkShop C. It's gcc driver that brings copy of libgcc.a into .so
otherwise. In case you wonder what it's -Wl,-z... and not just -z. Problem
is that gcc driver apparently omits all -z options but -z text. Don't ask
me why. I'm not committing corresponding workaround into the HEAD as
Makefile.shared reportedly needs even more work...
2002-12-15 15:27:53 +00:00
Andy Polyakov
1a07628209 DES PIC-ification. "Cygwin" companion. Problem was that preprocessor macro
is not expanded if prepended with a $-sign.
2002-12-15 10:05:29 +00:00
Richard Levitte
814af7e175 Make sure manual pages are properly linked to on systems that have case
insensitive file names, as well as those that do not have symlinks.
Incidently, both these cases apply on DOS/Windows...
2002-12-15 06:45:46 +00:00
Richard Levitte
bf683ec609 Update the make system for installations:
- define a HERE variable to indicate where the source tree is (not
  used right now)
- make more use of copying and making attribute changes to {file}.new,
  and then move it to {file}
- use 'mv -f' to avoid all those questions to the user when the file
  in question doesn't have write attributes for that user.
2002-12-15 06:00:29 +00:00
Richard Levitte
e851895f04 Don't define macros in terms of asm() when __STRICT_ANSI is defined. 2002-12-15 05:54:58 +00:00
Andy Polyakov
a2049ba394 Ooops! No ROTATE on some platforms after x86_64 performance patch... 2002-12-15 00:44:00 +00:00
Andy Polyakov
a8239afc86 As you might have noticed I tried to change for . prefix, because it's
the one to be used to denote local labels in single function scope.
Problem is that SHA uses same label set across functions, therefore I
have to switch back to $ prefix.
2002-12-14 23:13:19 +00:00
Andy Polyakov
bb38cd49e4 Solaris shared build fix-ups. See RT#238,239 for details. 2002-12-14 21:51:23 +00:00
Andy Polyakov
1cbdbcd587 x86_64 performance patch. 2002-12-14 20:45:39 +00:00
cvs2svn
7e201e9f73 This commit was manufactured by cvs2svn to create branch
'OpenSSL_0_9_7-stable'.
2002-12-14 20:42:08 +00:00
Andy Polyakov
2f98abbcb6 x86_64 performance patch. 2002-12-14 20:42:05 +00:00
Andy Polyakov
270fa8aeda DES PIC-ification. Windows companion. 2002-12-14 17:54:30 +00:00
Andy Polyakov
9fc866c5eb DES PIC-ification. Windows companion. 2002-12-14 17:52:35 +00:00
Geoff Thorpe
4329db3726 The ampersand is not required in these constructs, and was giving AIX
warnings.

Reported by: Bernhard Simon.
2002-12-13 22:01:46 +00:00
Andy Polyakov
6f7ac8e1b0 IA-32 assembler modules (primarily DES) PIC-ification. Idea is to keep
shared libraries shared.
2002-12-13 17:56:14 +00:00
Andy Polyakov
b0e88fb11b IA-32 assembler modules (primarily DES) PIC-ification. Idea is to keep
shared libraries shared.
2002-12-13 17:31:01 +00:00
Richard Levitte
04c71cd725 OK, there's at least one application author who has provided dynamic locking
callbacks
2002-12-13 07:30:59 +00:00
Richard Levitte
a1457874c6 OK, there's at least one application author who has provided dynamic locking
callbacks
2002-12-13 07:30:53 +00:00
Richard Levitte
d64b16ab25 BIO_new_bio_pair() was unnecessarily described in it's own page as well as in
BIO_s_bio.pod.  The most logical is to move everything needed from
BIO_new_bio_pair.pod to BIO_s_bio.pod (including the nice example)
and toss BIO_new_bio_pair.pod.  I hope I got all the info over properly.
PR: 370
2002-12-12 22:12:04 +00:00
Richard Levitte
18be6c4116 BIO_new_bio_pair() was unnecessarily described in it's own page as well as in
BIO_s_bio.pod.  The most logical is to move everything needed from
BIO_new_bio_pair.pod to BIO_s_bio.pod (including the nice example)
and toss BIO_new_bio_pair.pod.  I hope I got all the info over properly.
PR: 370
2002-12-12 22:12:02 +00:00
Richard Levitte
f30b793779 BIO_set_nbio() is enumerated, but not explained. Remove it from enumeration
since it's both enumerated and explained in BIO_s_connect.pod.
PR: 370
2002-12-12 22:08:52 +00:00
Richard Levitte
dad1535f7a BIO_set_nbio() is enumerated, but not explained. Remove it from enumeration
since it's both enumerated and explained in BIO_s_connect.pod.
PR: 370
2002-12-12 22:08:49 +00:00
Richard Levitte
f60e6604b8 I forgot one item I intend to work on. 2002-12-12 19:40:55 +00:00
Richard Levitte
94ea9c84c5 Skip DH-specific tests when no-dh has been configured.
PR: 353
2002-12-12 18:43:32 +00:00
Richard Levitte
0d3f2ccb62 Skip DH-specific tests when no-dh has been configured.
PR: 353
2002-12-12 18:43:10 +00:00
Richard Levitte
5c72869563 Add a static lock called HWCRHK, for the case of having an application
that wants to use the hw_ncipher engine without having given any
callbacks for the dynamic type of locks.
2002-12-12 17:41:36 +00:00
Richard Levitte
14676ffcd6 Document the modifications in 0.9.7 that will make the hw_ncipher.c
engine work properly even in bad situations.
2002-12-12 17:40:15 +00:00
Geoff Thorpe
e5a08ce44d Make 'tunala' link with zlib if possible (so it works if openssl was
configured with zlib support).
2002-12-11 19:07:03 +00:00
Richard Levitte
712419b73a In CRYPTO_lock(), check that the application cares about locking (provided
callbacks) before attempting to lock.
2002-12-11 08:56:42 +00:00
Richard Levitte
b9b6e14b4a In CRYPTO_lock(), check that the application cares about locking (provided
callbacks) before attempting to lock.
2002-12-11 08:56:35 +00:00
Richard Levitte
7627efc92f sk_*_push() returns the number of items on the stack, not the index of the
pushed item.  The index is the number of items - 1.  And if a NULL item was
found, actually use it.
Finally, provide a little bit of safety in CRYPTO_lock() by asserting the a
requested dynamic lock really must exist, instead of just being silent about it
2002-12-11 08:33:37 +00:00
Richard Levitte
442d42300b sk_*_push() returns the number of items on the stack, not the index of the
pushed item.  The index is the number of items - 1.  And if a NULL item was
found, actually use it.
Finally, provide a little bit of safety in CRYPTO_lock() by asserting the a
requested dynamic lock really must exist, instead of just being silent about it
2002-12-11 08:33:31 +00:00
Richard Levitte
cd7f458e28 Let's not forget the other places where HEADER_DES_H and HEADER_DES_OLD_H
were defined.
2002-12-11 07:37:57 +00:00
Richard Levitte
75e1c74724 Let's not forget the other places where HEADER_DES_H and HEADER_DES_OLD_H
were defined.
2002-12-11 07:37:54 +00:00
Richard Levitte
ea01493df0 Let's not forget the other places where HEADER_DES_H and HEADER_DES_OLD_H
were defined.
2002-12-11 07:24:47 +00:00
Richard Levitte
5db2b5e573 Let's not forget the other places where HEADER_DES_H and HEADER_DES_OLD_H
were defined.
2002-12-11 07:24:43 +00:00
Richard Levitte
323edf1908 Since HEADER_DES_H has been the protector of des.h since libdes
(before SSLeay, maybe?), it's better to have that macro protect
the compatibility header des_old.h.  In the new des.h, let's use
a slightly different protecting macro.

The rationale is that there are application that might include (via
other header files, perhaps) both an old libdes des.h and OpenSSL's
des.h.  Whichever comes first would overshadow the other because of
the clash in protecting macro.  This fix solves that problem.
2002-12-11 06:59:49 +00:00
Richard Levitte
005ef84c5d Since HEADER_DES_H has been the protector of des.h since libdes
(before SSLeay, maybe?), it's better to have that macro protect
the compatibility header des_old.h.  In the new des.h, let's use
a slightly different protecting macro.

The rationale is that there are application that might include (via
other header files, perhaps) both an old libdes des.h and OpenSSL's
des.h.  Whichever comes first would overshadow the other because of
the clash in protecting macro.  This fix solves that problem.
2002-12-11 06:59:16 +00:00
Geoff Thorpe
f92570f00a This stops a compiler warning from -Wmissing-prototypes.
(Noticed by Nils Larsch)
2002-12-11 03:34:26 +00:00
Lutz Jänicke
9314e366c8 Update -Olimit setting.
Submitted by: Bernhard Simon <simon@zid.tuwien.ac.at>
Reviewed by:
PR:
2002-12-10 18:48:14 +00:00
Lutz Jänicke
ba9cf37d59 Update -Olimit setting.
Submitted by: Bernhard Simon <simon@zid.tuwien.ac.at>
Reviewed by:
PR:
2002-12-10 18:47:31 +00:00
Ralf S. Engelschall
b22c7a1cfb test commit (just removing tailing blanks) #2 after migration 2002-12-10 12:01:39 +00:00
Ralf S. Engelschall
99efc0f50f test commit (removing trailing blanks) after migration 2002-12-10 10:51:18 +00:00
Ralf S. Engelschall
d979d09ccc test blank-line commit after migration -- just ignore 2002-12-10 10:49:22 +00:00
Richard Levitte
2581aacd52 A memset() too many got converted into a OPENSSL_cleanse().
PR: 393
2002-12-10 08:26:10 +00:00
Richard Levitte
c17810b087 A memset() too many got converted into a OPENSSL_cleanse().
PR: 393
2002-12-10 08:26:05 +00:00
Andy Polyakov
e0b2073fd4 BN_sqr test failure entry. 2002-12-09 13:43:38 +00:00
Lutz Jänicke
123e5dfc3a Fix wrong URI.
Submitted by: assar@kth.se
Reviewed by:
PR: 390
2002-12-09 08:49:58 +00:00
Lutz Jänicke
533a0c4ce7 Fix wrong URI.
Submitted by: assar@kth.se
Reviewed by:
PR: 390
2002-12-09 08:49:35 +00:00
Richard Levitte
0edad88a31 make update 2002-12-09 02:19:27 +00:00
Richard Levitte
4ccfe5f49b Hmm, Geoff's change made things quite interesting. We can now give
users the option of disabling deprecated functions, which should of
course be reflected in libeay.num and .def files.  Quite nice,
actually.
2002-12-09 02:18:16 +00:00
Geoff Thorpe
e189872486 Nils Larsch submitted;
- a patch to fix a memory leak in rsa_gen.c
  - a note about compiler warnings with unions
  - a note about improving structure element names

This applies his patch and implements a solution to the notes.
2002-12-08 16:45:26 +00:00
Richard Levitte
fdaea9ed2e Since it's defined in draft-ietf-tls-compression-04.txt, let's make
ZLIB a known compression method, with the identity 1.
2002-12-08 09:31:41 +00:00
Geoff Thorpe
5daec7ea0e Undefine OPENSSL_NO_DEPRECATED inside openssl application code if we are
being built with it defined - it is not a symbol to affect how openssl
itself builds, but to alter the way openssl headers can be used from an API
point of view. The "deprecated" function wrappers will always remain inside
OpenSSL at least as long as they're still being used internally. :-)

The exception is dsaparam which has been updated to the BN_GENCB-based
functions to test the new functionality. If GENCB_TEST is defined, dsaparam
will support a "-timebomb <n>" switch to cancel parameter-generation if it
gets as far as 'n' seconds without completion.
2002-12-08 05:38:44 +00:00
Geoff Thorpe
e9224c7177 This is a first-cut at improving the callback mechanisms used in
key-generation and prime-checking functions. Rather than explicitly passing
callback functions and caller-defined context data for the callbacks, a new
structure BN_GENCB is defined that encapsulates this; a pointer to the
structure is passed to all such functions instead.

This wrapper structure allows the encapsulation of "old" and "new" style
callbacks - "new" callbacks return a boolean result on the understanding
that returning FALSE should terminate keygen/primality processing.  The
BN_GENCB abstraction will allow future callback modifications without
needing to break binary compatibility nor change the API function
prototypes. The new API functions have been given names ending in "_ex" and
the old functions are implemented as wrappers to the new ones.  The
OPENSSL_NO_DEPRECATED symbol has been introduced so that, if defined,
declaration of the older functions will be skipped. NB: Some
openssl-internal code will stick with the older callbacks for now, so
appropriate "#undef" logic will be put in place - this is in case the user
is *building* openssl (rather than *including* its headers) with this
symbol defined.

There is another change in the new _ex functions; the key-generation
functions do not return key structures but operate on structures passed by
the caller, the return value is a boolean. This will allow for a smoother
transition to having key-generation as "virtual function" in the various
***_METHOD tables.
2002-12-08 05:24:31 +00:00
Geoff Thorpe
e90e719739 Fix a warning, and do some constification as a lucky side-effect :-) 2002-12-08 05:19:43 +00:00
Richard Levitte
7ba666fa0e Since it's defined in draft-ietf-tls-compression-04.txt, let's make
ZLIB a known compression method, with the identity 1.
2002-12-08 02:41:11 +00:00
Richard Levitte
86a62cf15c Implement a stateful variant if the ZLIB compression method. The old
stateless variant is kept, but isn't used anywhere.
2002-12-08 02:39:38 +00:00
Richard Levitte
b11405723d Forgot one. 2002-12-07 20:03:42 +00:00
Richard Levitte
4c3a2b4f8a Add a few items I intend to work on for 0.9.8 and on. 2002-12-07 20:02:20 +00:00
Richard Levitte
93f3decc4f I haven't worked on OCSP at all for a long time, and my KRB5 work will
be concentrated on Heimdal support.
2002-12-07 19:59:54 +00:00
Andy Polyakov
bbf8198feb Workaround for GCC-ia64 compiler bug.
Submitted by: <appro>
Reviewed by:
PR:
2002-12-06 17:18:10 +00:00
Andy Polyakov
1c799131ae Workaround for GCC-ia64 compiler bug.
Submitted by: <appro>
Reviewed by:
PR:
2002-12-06 17:16:25 +00:00
Andy Polyakov
b1d4b48d39 linux64-sparcv9 support
Submitted by: <appro>
Reviewed by:
PR:
2002-12-06 16:45:11 +00:00
Richard Levitte
bed4559052 Some compilers are quite picky about non-void functions that don't return
anything.
2002-12-06 08:50:25 +00:00
Richard Levitte
3dda0dd2a2 Some compilers are quite picky about non-void functions that don't return
anything.
2002-12-06 08:50:06 +00:00
Richard Levitte
7f87c1c0fc Apparently, bash is more forgiving than sh. To be backward
compatible, don't use ==, use = instead...
2002-12-06 08:44:24 +00:00
Richard Levitte
fa63a98ad8 Apparently, bash is more forgiving than sh. To be backward
compatible, don't use ==, use = instead...
2002-12-06 08:43:41 +00:00
Richard Levitte
1fc73fef48 Keep NEWS in HEAD up to date. 2002-12-06 00:39:03 +00:00
Richard Levitte
90543bd07a Keep STATUS in HEAD up to date. 2002-12-05 23:01:17 +00:00
Richard Levitte
43ecece595 Merge in relevant changes from the OpenSSL 0.9.6h release. 2002-12-05 21:50:13 +00:00
Richard Levitte
4ba8cabf62 SSL_CERT_FILE should be used in place of the system default file, not as
a first alternative to try
2002-12-05 21:07:26 +00:00
Richard Levitte
f68bb3c51f Corrected DJGPP patch 2002-12-05 20:50:25 +00:00
Andy Polyakov
6d4ac67ac1 linux64-sparcv9 support finally debugged and tested.
Submitted by:
Reviewed by:
PR:
2002-12-05 13:17:52 +00:00
Richard Levitte
b84d5b72f1 Make sure to implement the cryptodev engine only when /dev/crypto exists. 2002-12-05 10:16:28 +00:00
Richard Levitte
8cbccedf7c make update 2002-12-05 01:55:48 +00:00
Richard Levitte
1c24347062 Declare another general file. 2002-12-05 01:42:14 +00:00
Richard Levitte
9ef888130d Allow users to modify /MD to /MT.
PR: 380
2002-12-05 01:35:04 +00:00
Richard Levitte
4387f47832 Make sure using SSL_CERT_FILE actually works, and has priority over system defaults.
PR: 376
2002-12-05 01:20:47 +00:00
Richard Levitte
38d6e4bb50 If an application supports static locks, it MUST support dynamic locks as
well to be able to use the CHIL engine.
PR: 281
2002-12-05 00:56:58 +00:00
Richard Levitte
ced621e3c2 PR: 381 2002-12-05 00:05:48 +00:00
Richard Levitte
85940ea8ea Only check for a result buffer if the allocated string is a prompt string.
PR: 381
2002-12-05 00:04:30 +00:00
Richard Levitte
439ae4d398 Do not implement RC4 stuff if RC4 is disabled. Concequently, apply the same
rule for SHA stuff.
PR: 381
2002-12-04 22:54:02 +00:00
Richard Levitte
4fbe40c54f gethostname() is more a BSD feature than an XOPEN one.
PR: 379
2002-12-04 22:48:01 +00:00
Richard Levitte
578ca7e4cd Correct a few typos that I introduced after applying DJGPP patches. 2002-12-04 19:13:43 +00:00
Bodo Möller
7e8c30b589 In ECPKParameters_print, output the private key length correctly
(length of the order of the group, not length of the actual key, which
will be shorter in some cases).

Submitted by: Nils Larsch
2002-12-04 17:43:01 +00:00
Bodo Möller
2b32b28191 Don't compute timings here, we can do this elsewhere.
Include X9.62 signature examples.

Submitted by: Nils Larsch
2002-12-04 17:38:40 +00:00
Lutz Jänicke
532215f2db Missing ")"
Submitted by: Christian Hohnstaedt <chohnstaedt@innominate.com>
Reviewed by:
PR:
2002-12-04 13:30:58 +00:00
Richard Levitte
5319be4438 DJGPP patches.
PR: 347
2002-12-04 09:54:10 +00:00
Richard Levitte
f7a3e73ef6 Add support for x86_64.
PR: 348
2002-12-04 09:17:43 +00:00
Richard Levitte
ff3345cb72 A gcc 3.0 bug is triggered by our code. Add a section about it in PROBLEMS.
PR: 375
2002-12-04 08:24:18 +00:00
Dr. Stephen Henson
716b2079dc Make ASN1_TYPE_get() work for V_ASN1_NULL type. 2002-12-04 00:49:46 +00:00
Dr. Stephen Henson
e7b6228fd3 Typo in X509v3_get_ext_by_critical 2002-12-04 00:16:00 +00:00
Dr. Stephen Henson
2053c43de2 In asn1_d2i_read_bio, don't assume BIO_read will
return the requested number of bytes when reading
content.
2002-12-03 23:50:59 +00:00
Richard Levitte
1c3e4a3660 EXIT() may mean return(). That's confusing, so let's have it really mean
exit() in whatever way works for the intended platform, and define
OPENSSL_EXIT() to have the old meaning (the name is of course because
it's only used in the openssl program)
2002-12-03 16:33:03 +00:00
Richard Levitte
4707991520 Make CRYPTO_cleanse() independent of endianness. 2002-12-03 16:06:40 +00:00
Richard Levitte
7a1f92fdc3 Windows CE updates, contributed by Steven Reddie <smr@essemer.com.au> 2002-12-03 14:20:44 +00:00
Richard Levitte
e7a285694e define USE_SOCKETS so sys/param.h gets included (and thusly, MAXHOSTNAMELEN
gets defined).
PR: 371
2002-12-02 22:49:02 +00:00
Richard Levitte
6ab285bf4c I think I got it now. Apparently, the case of having to shift down
the divisor was a bit more complex than I first saw.  The lost bit
can't just be discarded, as there are cases where it is important.
For example, look at dividing 320000 with 80000 vs. 80001 (all
decimals), the difference is crucial.  The trick here is to check if
that lost bit was 1, and in that case, do the following:

1. subtract the quotient from the remainder
2. as long as the remainder is negative, add the divisor (the whole
   divisor, not the shofted down copy) to it, and decrease the
   quotient by one.

There's probably a nice mathematical proof for this already, but I
won't bother with that, unless someone requests it from me.
2002-12-02 21:31:45 +00:00
Richard Levitte
1d3159bcca Make some names consistent. 2002-12-02 02:40:27 +00:00
Richard Levitte
f60ceb54eb Through some experimentation and thinking, I think I finally got the
proper implementation of bn_div_words() for VAX.

If the tests go through well, the next step will be to test on Alpha.
2002-12-02 02:28:27 +00:00
Richard Levitte
0f995b2f40 Small bugfix: even when r == d, we need to adjust r and q.
PR: 366
2002-12-01 02:17:23 +00:00
Richard Levitte
848f735ae4 EXIT() needs to be in a function that returns int. 2002-12-01 01:23:35 +00:00
Richard Levitte
a678430602 Redo the VAX assembler version of bn_div_words().
PR: 366
2002-12-01 00:49:36 +00:00
Richard Levitte
e9b553dac1 Remove incorrect assert.
PR: 360
2002-11-29 15:18:22 +00:00
81 changed files with 1638 additions and 1024 deletions

30
CHANGES
View File

@@ -2,7 +2,35 @@
OpenSSL CHANGES
_______________
Changes between 0.9.6h and 0.9.7 [XX xxx 2002]
Changes between 0.9.6h and 0.9.7 [31 Dec 2002]
*) Fix session ID handling in SSLv2 client code: the SERVER FINISHED
code (06) was taken as the first octet of the session ID and the last
octet was ignored consequently. As a result SSLv2 client side session
caching could not have worked due to the session ID mismatch between
client and server.
Behaviour observed by Crispin Flowerday <crispin@flowerday.cx> as
PR #377.
[Lutz Jaenicke]
*) Change the declaration of needed Kerberos libraries to use EX_LIBS
instead of the special (and badly supported) LIBKRB5. LIBKRB5 is
removed entirely.
[Richard Levitte]
*) The hw_ncipher.c engine requires dynamic locks. Unfortunately, it
seems that in spite of existing for more than a year, many application
author have done nothing to provide the necessary callbacks, which
means that this particular engine will not work properly anywhere.
This is a very unfortunate situation which forces us, in the name
of usability, to give the hw_ncipher.c a static lock, which is part
of libcrypto.
NOTE: This is for the 0.9.7 series ONLY. This hack will never
appear in 0.9.8 or later. We EXPECT application authors to have
dealt properly with this when 0.9.8 is released (unless we actually
make such changes in the libcrypto locking code that changes will
have to be made anyway).
[Richard Levitte]
*) In asn1_d2i_read_bio() repeatedly call BIO_read() until all content
octets have been read, EOF or an error occurs. Without this change

View File

@@ -161,25 +161,25 @@ my %table=(
# surrounds it with #APP #NO_APP comment pair which (at least Solaris
# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
# error message.
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_sol_asm}:dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_sol_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### Solaris x86 with Sun C setups
"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### SPARC Solaris with GNU C setups
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris64-sparcv9-gcc31","gcc:-mcpu=ultrasparc -m64 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris64-sparcv9-gcc31","gcc:-mcpu=ultrasparc -m64 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# gcc pre-2.8 doesn't understand -mcpu=ultrasparc, so fall down to -mv8
# but keep the assembler modules.
"solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
####
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
#### SPARC Solaris with Sun C setups
# DO NOT use /xO[34] on sparc with SC3.0. It is broken, and will not pass the tests
@@ -203,9 +203,8 @@ my %table=(
# it's a real mess with -mcpu=ultrasparc option under Linux, but
# -Wa,-Av8plus should do the trick no matter what.
"linux-sparcv9","gcc:-mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# !!!Folowing can't be even tested yet!!!
# We have to wait till 64-bit glibc for SPARC is operational!!!
#"linux64-sparcv9","sparc64-linux-gcc:-m64 -mcpu=v9 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT:ULTRASPARC::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
# GCC 3.1 is a requirement
"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
# Sunos configs, assuming sparc for the gcc one.
##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:::",
@@ -392,7 +391,7 @@ my %table=(
"linux-s390", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-s390x", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-x86_64", "gcc:-DL_ENDIAN -DNO_ASM ::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"linux-x86_64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR BF_PTR2 DES_INT DES_UNROLL:asm/x86_64-gcc.o:::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
"NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
@@ -481,7 +480,7 @@ my %table=(
# SCO cc.
"sco5-cc", "cc:-belf::(unknown)::-lsocket -lresolv -lnsl:${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:svr3-shared:-Kpic", # des options?
"sco5-cc-pentium", "cc:-Kpentium::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:::", # des options?
"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lresolv -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC", # the SCO assembler doesn't seem to like our assembler files ...
"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lresolv -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:svr3-shared:-fPIC",
# Sinix/ReliantUNIX RM400
# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g */
@@ -528,7 +527,7 @@ my %table=(
"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::",
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown):::::::",
"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown):::::::",
# K&R C is no longer supported; you need gcc on old Ultrix installations
##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
@@ -1017,10 +1016,12 @@ else
}
}
$withargs{"krb5-lib"} .= " -lresolv"
if ("$lresolv");
if ("$lresolv" ne "");
$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
if $withargs{"krb5-include"} eq "" &&
$withargs{"krb5-dir"} ne "";
$libs.=$withargs{"krb5-lib"}." " if $withargs{"krb5-lib"} ne "";
}
# The DSO code currently always implements all functions so that no
@@ -1076,7 +1077,7 @@ else
# }
}
$lflags="$libs$lflags"if ($libs ne "");
$lflags="$libs$lflags" if ($libs ne "");
if ($no_asm)
{
@@ -1084,6 +1085,11 @@ if ($no_asm)
$sha1_obj=$md5_obj=$rmd160_obj="";
}
if (!$no_shared)
{
$cast_obj=""; # CAST assembler is not PIC
}
if ($threads)
{
$cflags=$thread_cflags;
@@ -1099,20 +1105,16 @@ if ($zlib)
# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
my $shared_mark = "";
if ($shared_target ne "")
if ($shared_target eq "")
{
$no_shared = 1;
}
if (!$no_shared)
{
if ($shared_cflag ne "")
{
$cflags = "$shared_cflag $cflags";
}
if (!$no_shared)
{
#$shared_mark = "\$(SHARED_LIBS)";
}
}
else
{
$no_shared = 1;
}
if ($sys_id ne "")
@@ -1238,7 +1240,6 @@ while (<IN>)
s/^ARFLAGS=.*/ARFLAGS= $arflags/;
s/^PERL=.*/PERL= $perl/;
s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
@@ -1286,8 +1287,6 @@ print "ARFLAGS =$arflags\n";
print "PERL =$perl\n";
print "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
if $withargs{"krb5-include"} ne "";
print "LIBKRB5 =",$withargs{"krb5-lib"},"\n"
if $withargs{"krb5-lib"} ne "";
my $des_ptr=0;
my $des_risc1=0;

32
FAQ
View File

@@ -44,6 +44,8 @@ OpenSSL - Frequently Asked Questions
* What is special about OpenSSL on Redhat?
* Why does the OpenSSL compilation fail on MacOS X?
* Why does the OpenSSL test suite fail on MacOS X?
* Why does the OpenSSL test suite fail in BN_sqr test [on a 64-bit platform]?
* Why does OpenBSD-i386 build fail on des-586.s with "Unimplemented segment type"?
[PROG] Questions about programming with OpenSSL
@@ -66,7 +68,7 @@ OpenSSL - Frequently Asked Questions
* Which is the current version of OpenSSL?
The current version is available from <URL: http://www.openssl.org>.
OpenSSL 0.9.6h was released on December 5, 2002.
OpenSSL 0.9.7 was released on December 31, 2002.
In addition to the current stable release, you can also access daily
snapshots of the OpenSSL development version at <URL:
@@ -552,6 +554,34 @@ libraries you just built.
Look in the file PROBLEMS for a more detailed explanation and for possible
solutions.
* Why does the OpenSSL test suite fail in BN_sqr test [on a 64-bit platform]?
Failure in BN_sqr test is most likely caused by a failure to configure the
toolkit for current platform or lack of support for the platform in question.
Run './config -t' and './apps/openssl version -p'. Do these platform
identifiers match? If they don't, then you most likely failed to run
./config and you're hereby advised to do so before filing a bug report.
If ./config itself fails to run, then it's most likely problem with your
local environment and you should turn to your system administrator (or
similar). If identifiers match (and/or no alternative identifier is
suggested by ./config script), then the platform is unsupported. There might
or might not be a workaround. Most notably on SPARC64 platforms with GNU
C compiler you should be able to produce a working build by running
'./config -m32'. I understand that -m32 might not be what you want/need,
but the build should be operational. For further details turn to
<openssl-dev@openssl.org>.
* Why does OpenBSD-i386 build fail on des-586.s with "Unimplemented segment type"?
As of 0.9.7 assembler routines were overhauled for position independence
of the machine code, which is essential for shared library support. For
some reason OpenBSD is equipped with an out-of-date GNU assembler which
finds the new code offensive. To work around the problem, configure with
no-asm (and sacrifice a great deal of performance) or upgrade /usr/bin/as.
For your convenience a pre-compiled replacement binary is provided at
http://www.openssl.org/~appro/i386-openbsd3-as, which is compiled from
binutils-2.8 released in 1997.
[PROG] ========================================================================
* Is OpenSSL thread-safe?

View File

@@ -140,8 +140,8 @@
standard headers). If it is a problem with OpenSSL itself, please
report the problem to <openssl-bugs@openssl.org> (note that your
message will be recorded in the request tracker publicly readable
via http://www.openssl.org/rt2.html and will be forwarded to a public
mailing list). Include the output of "make report" in your message.
via http://www.openssl.org/support/rt2.html and will be forwarded to a
public mailing list). Include the output of "make report" in your message.
Please check out the request tracker. Maybe the bug was already
reported or has already been fixed.
@@ -162,7 +162,7 @@
in Makefile.ssl and run "make clean; make". Please send a bug
report to <openssl-bugs@openssl.org>, including the output of
"make report" in order to be added to the request tracker at
http://www.openssl.org/rt2.html.
http://www.openssl.org/support/rt2.html.
4. If everything tests ok, install OpenSSL with

View File

@@ -15,6 +15,11 @@ OPTIONS=
CONFIGURE_ARGS=
SHLIB_TARGET=
# HERE indicates where this Makefile lives. This can be used to indicate
# where sub-Makefiles are expected to be. Currently has very limited usage,
# and should probably not be bothered with at all.
HERE=.
# INSTALL_PREFIX is for package builders so that they can configure
# for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
# Normally it is left empty.
@@ -154,7 +159,6 @@ RMD160_ASM_OBJ= asm/rm86-out.o
# KRB5 stuff
KRB5_INCLUDES=
LIBKRB5=
# When we're prepared to use shared libraries in the programs we link here
# we might set SHLIB_MARK to '$(SHARED_LIBS)'.
@@ -274,10 +278,7 @@ do_gnu-shared:
libs="$$libs -l$$i"; \
done
DETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \
my_ld=`${CC} -print-prog-name=ld 2>&1` && \
[ -n "$$my_ld" ] && \
$$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
DETECT_GNU_LD=(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
# For Darwin AKA Mac OS/X (dyld)
do_darwin-shared:
@@ -355,10 +356,13 @@ do_solaris-shared:
else \
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
set -x; ${CC} ${SHARED_LDFLAGS} \
-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
MINUSZ='-z '; \
(${CC} -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
set -x; ${CC} ${SHARED_LDFLAGS} -G -dy -z text \
-o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
-z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
$${MINUSZ}allextract lib$$i.a $${MINUSZ}defaultextract \
$$libs ${EX_LIBS} -lc ) || exit 1; \
libs="$$libs -l$$i"; \
done; \
fi
@@ -514,7 +518,7 @@ do_reliantunix-shared:
libs="$$libs -l$$i"; \
done
openssl.pc:
openssl.pc: Makefile.ssl
@ ( echo 'prefix=$(INSTALLTOP)'; \
echo 'exec_prefix=$${prefix}'; \
echo 'libdir=$${exec_prefix}/lib'; \
@@ -525,7 +529,7 @@ openssl.pc:
echo 'Version: '$(VERSION); \
echo 'Requires: '; \
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
echo 'Cflags: -I$${includedir}' ) > openssl.pc
echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
Makefile.ssl: Makefile.org
@echo "Makefile.ssl is older than Makefile.org."
@@ -597,8 +601,8 @@ rehash.time: certs
@(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; \
export OPENSSL OPENSSL_DEBUG_MEMORY; \
LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
if [ "$(PLATFORM)" == "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
elif [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
$(PERL) tools/c_rehash certs)
touch rehash.time
@@ -609,8 +613,8 @@ tests: rehash
@(cd test && echo "testing..." && \
$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
@LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
if [ "$(PLATFORM)" == "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
elif [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
apps/openssl version -a
@@ -706,7 +710,7 @@ dist_pem_h:
install: all install_docs
@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkginfo \
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig \
$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
@@ -731,7 +735,7 @@ install: all install_docs
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
fi; \
done;
@if [ -n "$(SHARED_LIBS)" ]; then \
@@ -743,15 +747,15 @@ install: all install_docs
if [ "$(PLATFORM)" != "Cygwin" ]; then \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
else \
c=`echo $$i | sed 's/^lib\(.*\)/cyg\1-$(SHLIB_VERSION_NUMBER)/'`; \
cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
mv $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
fi ); \
fi; \
done; \
@@ -760,7 +764,7 @@ install: all install_docs
set $(MAKE); \
$$1 -f $$here/Makefile link-shared ); \
fi
cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkginfo
cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
install_docs:
@$(PERL) $(TOP)/util/mkdir-p.pl \
@@ -769,6 +773,11 @@ install_docs:
$(INSTALL_PREFIX)$(MANDIR)/man5 \
$(INSTALL_PREFIX)$(MANDIR)/man7
@pod2man="`cd util; ./pod2mantest $(PERL)`"; \
here="`pwd`"; \
filecase=; \
if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" ]; then \
filecase=-i; \
fi; \
for i in doc/apps/*.pod; do \
fn=`basename $$i .pod`; \
if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
@@ -778,10 +787,12 @@ install_docs:
--section=$$sec --center=OpenSSL \
--release=$(VERSION) `basename $$i`") \
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$$sec; \
$(PERL) util/extract-names.pl < $$i | grep -v "^$$fn" | \
while read n; do \
util/point.sh $$fn.$$sec $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$n.$$sec; \
done; \
$(PERL) util/extract-names.pl < $$i | \
grep -v $$filecase "^$$fn\$$" | \
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
while read n; do \
$$here/util/point.sh $$fn.$$sec $$n.$$sec; \
done); \
done; \
for i in doc/crypto/*.pod doc/ssl/*.pod; do \
fn=`basename $$i .pod`; \
@@ -792,10 +803,12 @@ install_docs:
--section=$$sec --center=OpenSSL \
--release=$(VERSION) `basename $$i`") \
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$$sec; \
$(PERL) util/extract-names.pl < $$i | grep -v "^$$fn" | \
while read n; do \
util/point.sh $$fn.$$sec $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$n.$$sec; \
done; \
$(PERL) util/extract-names.pl < $$i | \
grep -v $$filecase "^$$fn\$$" | \
(cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
while read n; do \
$$here/util/point.sh $$fn.$$sec $$n.$$sec; \
done); \
done
# DO NOT DELETE THIS LINE -- make depend depends on it.

5
NEWS
View File

@@ -18,11 +18,14 @@
o New elliptic curve library section.
o New AES (Rijndael) library section.
o Support for new platforms: Windows CE, Tandem OSS, A/UX, AIX 64-bit,
Linux x86_64
Linux x86_64, Linux 64-bit on Sparc v9
o Extended support for some platforms: VxWorks
o Enhanced support for shared libraries.
o Now only builds PIC code when shared library support is requested.
o Support for pkg-config.
o Lots of new manuals.
o Makes symbolic links to or copies of manuals to cover all described
functions.
o Change DES API to clean up the namespace (some applications link also
against libdes providing similar functions having the same name).
Provide macros for backward compatibility (will be removed in the

View File

@@ -62,3 +62,11 @@ What happens is that gcc might optimize a little too agressively, and
you end up with an extra incrementation when *header != '4'.
We recommend that you upgrade gcc to as high a 3.x version as you can.
* solaris64-sparcv9-cc SHA-1 performance with WorkShop 6 compiler.
As subject suggests SHA-1 might perform poorly (4 times slower)
if compiled with WorkShop 6 compiler and -xarch=v9. The cause for
this seems to be the fact that compiler emits multiplication to
perform shift operations:-( To work the problem around configure
with './Configure solaris64-sparcv9-cc -DMD32_REG_T=int'.

2
README
View File

@@ -1,5 +1,5 @@
OpenSSL 0.9.7-beta6-dev xx XXX 2002
OpenSSL 0.9.7 31 Dec 2002
Copyright (c) 1998-2002 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson

14
STATUS
View File

@@ -1,15 +1,11 @@
OpenSSL STATUS Last modified at
______________ $Date: 2002/12/05 22:51:17 $
______________ $Date: 2002/12/30 23:54:11 $
DEVELOPMENT STATE
o OpenSSL 0.9.8: Under development...
o OpenSSL 0.9.7-beta5: Released on December 5th, 2002
o OpenSSL 0.9.7-beta4: Released on November 19th, 2002
o OpenSSL 0.9.7-beta3: Released on July 30th, 2002
o OpenSSL 0.9.7-beta2: Released on June 16th, 2002
o OpenSSL 0.9.7-beta1: Released on June 1st, 2002
o OpenSSL 0.9.7: Released on December 31st, 2002
o OpenSSL 0.9.6h: Released on December 5th, 2002
o OpenSSL 0.9.6g: Released on August 9th, 2002
o OpenSSL 0.9.6f: Released on August 8th, 2002
@@ -31,9 +27,6 @@
RELEASE SHOWSTOPPERS
o BN_mod_mul verification fails for mips3-sgi-irix
unless configured with no-asm
o [2002-11-21]
PR 343 mentions that scrubbing memory with 'memset(ptr, 0, n)' may
be optimized away in modern compilers. This is definitely not good
@@ -67,9 +60,8 @@
UTIL (a new set of library functions to support some higher level
functionality that is currently missing).
Shared library support for VMS.
Kerberos 5 authentication
Kerberos 5 authentication (Heimdal)
Constification
OCSP
NEEDS PATCH

71
TABLE
View File

@@ -1945,7 +1945,7 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag =
$shared_ldflag = -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -1995,7 +1995,7 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag =
$shared_ldflag = -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -3377,13 +3377,13 @@ $arflags =
*** linux-x86_64
$cc = gcc
$cflags = -DL_ENDIAN -DNO_ASM
$cflags = -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id =
$lflags = -ldl
$bn_ops = SIXTY_FOUR_BIT_LONG
$bn_obj =
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR BF_PTR2 DES_INT DES_UNROLL
$bn_obj = asm/x86_64-gcc.o
$des_obj =
$bf_obj =
$md5_obj =
@@ -3395,7 +3395,32 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= linux-shared
$shared_cflag = -fPIC
$shared_ldflag =
$shared_ldflag = -m64
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
*** linux64-sparcv9
$cc = gcc
$cflags = -m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall
$unistd =
$thread_cflag = -D_REENTRANT
$sys_id = ULTRASPARC
$lflags = -ldl
$bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR
$bn_obj =
$des_obj =
$bf_obj =
$md5_obj = asm/md5-sparcv9.o
$sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
$shared_target= linux-shared
$shared_cflag = -fPIC
$shared_ldflag = -m64
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -3683,15 +3708,15 @@ $thread_cflag = (unknown)
$sys_id =
$lflags = -lsocket -lresolv -lnsl
$bn_ops = BN_LLONG DES_PTR DES_RISC1 DES_UNROLL RC4_INDEX MD2_INT
$bn_obj = asm/bn86-elf.o asm/co86-elf.o
$des_obj = asm/dx86-elf.o asm/yx86-elf.o
$bf_obj = asm/bx86-elf.o
$md5_obj = asm/mx86-elf.o
$sha1_obj = asm/sx86-elf.o
$cast_obj = asm/cx86-elf.o
$rc4_obj = asm/rx86-elf.o
$rmd160_obj = asm/rm86-elf.o
$rc5_obj = asm/r586-elf.o
$bn_obj =
$des_obj =
$bf_obj =
$md5_obj =
$sha1_obj =
$cast_obj =
$rc4_obj =
$rmd160_obj =
$rc5_obj =
$dso_scheme = dlfcn
$shared_target= svr3-shared
$shared_cflag = -fPIC
@@ -3770,7 +3795,7 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag =
$shared_ldflag = -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -3820,7 +3845,7 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag =
$shared_ldflag = -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -3870,7 +3895,7 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag =
$shared_ldflag = -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -3895,7 +3920,7 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag =
$shared_ldflag = -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -3945,7 +3970,7 @@ $rc5_obj = asm/r586-sol.o
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag =
$shared_ldflag = -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -3995,7 +4020,7 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag = -m64
$shared_ldflag = -m64 -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -4020,7 +4045,7 @@ $rc5_obj =
$dso_scheme = dlfcn
$shared_target= solaris-shared
$shared_cflag = -fPIC
$shared_ldflag = -m64
$shared_ldflag = -m64 -shared
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
$ranlib =
$arflags =
@@ -4077,7 +4102,7 @@ $arflags =
*** ultrix-cc
$cc = cc
$cflags = -std1 -O -Olimit 1000 -DL_ENDIAN
$cflags = -std1 -O -Olimit 2500 -DL_ENDIAN
$unistd =
$thread_cflag = (unknown)
$sys_id =

View File

@@ -18,7 +18,6 @@ PERL= perl
RM= rm -f
# KRB5 stuff
KRB5_INCLUDES=
LIBKRB5=
PEX_LIBS=
EX_LIBS=
@@ -99,17 +98,20 @@ install:
@for i in $(EXE); \
do \
(echo installing $$i; \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
done;
@for i in $(SCRIPTS); \
do \
(echo installing $$i; \
cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
done
@cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR); \
chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
@cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
tags:
ctags $(SRC)
@@ -148,8 +150,8 @@ $(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
fi
-(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; \
LIBPATH="`pwd`"; LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; \
if [ "$(PLATFORM)" == "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
elif [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
$(PERL) tools/c_rehash certs)

View File

@@ -1021,7 +1021,7 @@ bad:
}
if (verbose)
BIO_printf(bio_err, "Succesfully loaded extensions file %s\n", extfile);
BIO_printf(bio_err, "Successfully loaded extensions file %s\n", extfile);
/* We can have sections in the ext file */
if (!extensions && !(extensions = NCONF_get_string(extconf, "default", "extensions")))

View File

@@ -166,7 +166,7 @@ $! TCPIP_PROGRAMS = ",S_SERVER,S_CLIENT,SESS_ID,CIPHERS,S_TIME,"
$!
$! Setup exceptional compilations
$!
$ COMPILEWITH_CC2 = ",S_SOCKET,S_SERVER,S_CLIENT,"
$ COMPILEWITH_CC2 = ",S_SERVER,S_CLIENT,"
$!
$ PHASE := LIB
$!

View File

@@ -135,7 +135,6 @@ static int req_check_len(int len,int n_min,int n_max);
static int check_end(char *str, char *end);
#ifndef MONOLITH
static char *default_config_file=NULL;
static CONF *config=NULL;
#endif
static CONF *req_conf=NULL;
static int batch=0;

13
config
View File

@@ -547,12 +547,13 @@ EOF
ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
i386-apple-darwin*) OUT="darwin-i386-cc" ;;
sparc64-*-linux2)
#Before we can uncomment following lines we have to wait at least
#till 64-bit glibc for SPARC is operational:-(
#echo "WARNING! If you wish to build 64-bit library, then you have to"
#echo " invoke './Configure linux64-sparcv9' *manually*."
#echo " Type return if you want to continue, Ctrl-C to abort."
#read waste < /dev/tty
echo "WARNING! If *know* that your GNU C supports 64-bit/V9 ABI"
echo " and wish to build 64-bit library, then you have to"
echo " invoke './Configure linux64-sparcv9' *manually*."
if [ "$TEST" = "false" ]; then
echo " You have about 5 seconds to press Ctrl-C to abort."
(stty -icanon min 0 time 50; read waste) < /dev/tty
fi
OUT="linux-sparcv9" ;;
sparc-*-linux2)
KARCH=`awk '/^type/{print$3}' /proc/cpuinfo`

View File

@@ -141,7 +141,7 @@ depend:
@for i in $(SDIRS) ;\
do \
(cd $$i && echo "making depend in crypto/$$i..." && \
$(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' PERL='${PERL}' depend ); \
$(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ); \
done;
clean:

View File

@@ -56,8 +56,9 @@
#error AES is disabled.
#endif
static const int AES_DECRYPT = 0;
static const int AES_ENCRYPT = 1;
#define AES_ENCRYPT 1
#define AES_DECRYPT 0
/* Because array size can't be a const in C, the following two are macros.
Both sizes are in bytes. */
#define AES_MAXNR 14

View File

@@ -149,7 +149,12 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
ASN1_CTX c;
int want=HEADER_SIZE;
int eos=0;
#if defined(__GNUC__) && defined(__ia64)
/* pathetic compiler bug in all known versions as of Nov. 2002 */
long off=0;
#else
int off=0;
#endif
int len=0;
b=BUF_MEM_new();

View File

@@ -247,7 +247,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
ret=0;
break;
}
#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS)
#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2)
if (!(num & BIO_FP_TEXT))
strcat(p,"b");
else

View File

@@ -136,6 +136,8 @@ asm/ia64-cpp.o: asm/ia64.S
$(CC) $(ASFLAGS) -c -o asm/ia64-cpp.o /tmp/ia64.$$$$.s; \
rm -f /tmp/ia64.$$$$.s
asm/x86_64-gcc.o: asm/x86_64-gcc.c
files:
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO

View File

@@ -172,7 +172,7 @@ n=12 ;(AP) n by value (input)
; }
;
; Using EDIV would be very easy, if it didn't do signed calculations.
; Any time, any of the input numbers are signed, there are problems,
; Any time any of the input numbers are signed, there are problems,
; usually with integer overflow, at which point it returns useless
; data (the quotient gets the value of l, and the remainder becomes 0).
;
@@ -180,21 +180,26 @@ n=12 ;(AP) n by value (input)
; it by 2 (unsigned), do the division, multiply the resulting quotient
; and remainder by 2, add the bit that was dropped when dividing by 2
; to the remainder, and do some adjustment so the remainder doesn't
; end up larger than the divisor. This method works as long as the
; divisor is positive, so we'll keep that (with a small adjustment)
; as the main method.
; For some cases when the divisor is negative (from EDIV's point of
; view, i.e. when the highest bit is set), dividing the dividend by
; 2 isn't enough, it needs to be divided by 4. Furthermore, the
; divisor needs to be divided by 2 (unsigned) as well, to avoid more
; problems with the sign. In this case, a little extra fiddling with
; the remainder is required.
; end up larger than the divisor. For some cases when the divisor is
; negative (from EDIV's point of view, i.e. when the highest bit is set),
; dividing the dividend by 2 isn't enough, and since some operations
; might generate integer overflows even when the dividend is divided by
; 4 (when the high part of the shifted down dividend ends up being exactly
; half of the divisor, the result is the quotient 0x80000000, which is
; negative...) it needs to be divided by 8. Furthermore, the divisor needs
; to be divided by 2 (unsigned) as well, to avoid more problems with the sign.
; In this case, a little extra fiddling with the remainder is required.
;
; So, the simplest way to handle this is always to divide the dividend
; by 4, and to divide the divisor by 2 if it's highest bit is set.
; After EDIV has been used, the quotient gets multiplied by 4 if the
; original divisor was positive, otherwise 2. The remainder, oddly
; enough, is *always* multiplied by 4.
; by 8, and to divide the divisor by 2 if it's highest bit is set.
; After EDIV has been used, the quotient gets multiplied by 8 if the
; original divisor was positive, otherwise 4. The remainder, oddly
; enough, is *always* multiplied by 8.
; NOTE: in the case mentioned above, where the high part of the shifted
; down dividend ends up being exactly half the shifted down divisor, we
; end up with a 33 bit quotient. That's no problem however, it usually
; means we have ended up with a too large remainder as well, and the
; problem is fixed by the last part of the algorithm (next paragraph).
;
; The routine ends with comparing the resulting remainder with the
; original divisor and if the remainder is larger, subtract the
@@ -204,15 +209,19 @@ n=12 ;(AP) n by value (input)
; The complete algorithm looks like this:
;
; d' = d
; l' = l & 3
; [h,l] = [h,l] >> 2
; l' = l & 7
; [h,l] = [h,l] >> 3
; [q,r] = floor([h,l] / d) # This is the EDIV operation
; if (q < 0) q = -q # I doubt this is necessary any more
;
; r' = r >> 30
; if (d' >= 0) q = q << 1
; q = q << 1
; r = (r << 2) + l'
; r' = r >> 29
; if (d' >= 0)
; q' = q >> 29
; q = q << 3
; else
; q' = q >> 30
; q = q << 2
; r = (r << 3) + l'
;
; if (d' < 0)
; {
@@ -220,14 +229,14 @@ n=12 ;(AP) n by value (input)
; while ([r',r] < 0)
; {
; [r',r] = [r',r] + d
; q = q - 1
; [q',q] = [q',q] - 1
; }
; }
;
; while ([r',r] >= d)
; while ([r',r] >= d')
; {
; [r',r] = [r',r] - d
; q = q + 1
; [r',r] = [r',r] - d'
; [q',q] = [q',q] + 1
; }
;
; return q
@@ -236,31 +245,37 @@ h=4 ;(AP) h by value (input)
l=8 ;(AP) l by value (input)
d=12 ;(AP) d by value (input)
;lprim=r5
;rprim=r6
;dprim=r7
;r2 = l, q
;r3 = h, r
;r4 = d
;r5 = l'
;r6 = r'
;r7 = d'
;r8 = q'
.psect code,nowrt
.entry bn_div_words,^m<r2,r3,r4,r5,r6,r7>
.entry bn_div_words,^m<r2,r3,r4,r5,r6,r7,r8>
movl l(ap),r2
movl h(ap),r3
movl d(ap),r4
bicl3 #^XFFFFFFFC,r2,r5 ; l' = l & 3
bicl3 #^X00000003,r2,r2
bicl3 #^XFFFFFFF8,r2,r5 ; l' = l & 7
bicl3 #^X00000007,r2,r2
bicl3 #^XFFFFFFFC,r3,r6
bicl3 #^X00000003,r3,r3
bicl3 #^XFFFFFFF8,r3,r6
bicl3 #^X00000007,r3,r3
addl r6,r2
rotl #-2,r2,r2 ; l = l >> 2
rotl #-2,r3,r3 ; h = h >> 2
rotl #-3,r2,r2 ; l = l >> 3
rotl #-3,r3,r3 ; h = h >> 3
movl #0,r6
movl r4,r7 ; d' = d
movl #0,r6 ; r' = 0
movl #0,r8 ; q' = 0
tstl r4
beql 666$ ; Uh-oh, the divisor is 0...
bgtr 1$
@@ -277,37 +292,36 @@ d=12 ;(AP) d by value (input)
3$:
tstl r7
blss 4$
ashl #1,r2,r2 ; q = q << 1
4$:
ashl #1,r2,r2 ; q = q << 1
rotl #2,r3,r3 ; r = r << 2
bicl3 #^XFFFFFFFC,r3,r6 ; r' gets the high bits from r
bicl3 #^X00000003,r3,r3
rotl #3,r2,r2 ; q = q << 3
bicl3 #^XFFFFFFF8,r2,r8 ; q' gets the high bits from q
bicl3 #^X00000007,r2,r2
bsb 41$
4$: ; else
rotl #2,r2,r2 ; q = q << 2
bicl3 #^XFFFFFFFC,r2,r8 ; q' gets the high bits from q
bicl3 #^X00000003,r2,r2
41$:
rotl #3,r3,r3 ; r = r << 3
bicl3 #^XFFFFFFF8,r3,r6 ; r' gets the high bits from r
bicl3 #^X00000007,r3,r3
addl r5,r3 ; r = r + l'
tstl r7
bgeq 5$
bitl #1,r7
beql 5$ ; if d < 0 && d & 1
subl r2,r3 ; [r',r] = [r',r] - q
sbwc #0,r6
beql 5$ ; if d' < 0 && d' & 1
subl r2,r3 ; [r',r] = [r',r] - [q',q]
sbwc r8,r6
45$:
bgeq 5$ ; while r < 0
decl r2 ; q = q - 1
addl r7,r3 ; [r',r] = [r',r] + d
decl r2 ; [q',q] = [q',q] - 1
sbwc #0,r8
addl r7,r3 ; [r',r] = [r',r] + d'
adwc #0,r6
brb 45$
5$:
tstl r6
bneq 6$
cmpl r3,r7
blssu 42$ ; while [r',r] >= d'
6$:
subl r7,r3 ; [r',r] = [r',r] - d
sbwc #0,r6
incl r2 ; q = q + 1
brb 5$
; The return points are placed in the middle to keep a short distance from
; all the branch points
42$:
; movl r3,r1
movl r2,r0
@@ -315,6 +329,18 @@ d=12 ;(AP) d by value (input)
666$:
movl #^XFFFFFFFF,r0
ret
5$:
tstl r6
bneq 6$
cmpl r3,r7
blssu 42$ ; while [r',r] >= d'
6$:
subl r7,r3 ; [r',r] = [r',r] - d'
sbwc #0,r6
incl r2 ; [q',q] = [q',q] + 1
adwc #0,r8
brb 5$
.title vax_bn_add_words unsigned add of two arrays
;

575
crypto/bn/asm/x86_64-gcc.c Normal file
View File

@@ -0,0 +1,575 @@
/*
* x86_64 BIGNUM accelerator version 0.1, December 2002.
*
* Implemented by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
* project.
*
* Rights for redistribution and usage in source and binary forms are
* granted according to the OpenSSL license. Warranty of any kind is
* disclaimed.
*
* Q. Version 0.1? It doesn't sound like Andy, he used to assign real
* versions, like 1.0...
* A. Well, that's because this code is basically a quick-n-dirty
* proof-of-concept hack. As you can see it's implemented with
* inline assembler, which means that you're bound to GCC and that
* there must be a room for fine-tuning.
*
* Q. Why inline assembler?
* A. x86_64 features own ABI I'm not familiar with. Which is why
* I decided to let the compiler take care of subroutine
* prologue/epilogue as well as register allocation.
*
* Q. How much faster does it get?
* A. Unfortunately people sitting on x86_64 hardware are prohibited
* to disclose the performance numbers, so they (SuSE labs to be
* specific) wouldn't tell me. However! Very similar coding technique
* (reaching out for 128-bit result from 64x64-bit multiplication)
* results in >3 times performance improvement on MIPS and I see no
* reason why gain on x86_64 would be so much different:-)
*/
#define BN_ULONG unsigned long
/*
* "m"(a), "+m"(r) is the way to favor DirectPath <20>-code;
* "g"(0) let the compiler to decide where does it
* want to keep the value of zero;
*/
#define mul_add(r,a,word,carry) do { \
register BN_ULONG high,low; \
asm ("mulq %3" \
: "=a"(low),"=d"(high) \
: "a"(word),"m"(a) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+r"(carry),"+d"(high)\
: "a"(low),"g"(0) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+m"(r),"+d"(high) \
: "r"(carry),"g"(0) \
: "cc"); \
carry=high; \
} while (0)
#define mul(r,a,word,carry) do { \
register BN_ULONG high,low; \
asm ("mulq %3" \
: "=a"(low),"=d"(high) \
: "a"(word),"g"(a) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+r"(carry),"+d"(high)\
: "a"(low),"g"(0) \
: "cc"); \
(r)=carry, carry=high; \
} while (0)
#define sqr(r0,r1,a) \
asm ("mulq %2" \
: "=a"(r0),"=d"(r1) \
: "a"(a) \
: "cc");
BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
{
BN_ULONG c1=0;
if (num <= 0) return(c1);
while (num&~3)
{
mul_add(rp[0],ap[0],w,c1);
mul_add(rp[1],ap[1],w,c1);
mul_add(rp[2],ap[2],w,c1);
mul_add(rp[3],ap[3],w,c1);
ap+=4; rp+=4; num-=4;
}
if (num)
{
mul_add(rp[0],ap[0],w,c1); if (--num==0) return c1;
mul_add(rp[1],ap[1],w,c1); if (--num==0) return c1;
mul_add(rp[2],ap[2],w,c1); return c1;
}
return(c1);
}
BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
{
BN_ULONG c1=0;
if (num <= 0) return(c1);
while (num&~3)
{
mul(rp[0],ap[0],w,c1);
mul(rp[1],ap[1],w,c1);
mul(rp[2],ap[2],w,c1);
mul(rp[3],ap[3],w,c1);
ap+=4; rp+=4; num-=4;
}
if (num)
{
mul(rp[0],ap[0],w,c1); if (--num == 0) return c1;
mul(rp[1],ap[1],w,c1); if (--num == 0) return c1;
mul(rp[2],ap[2],w,c1);
}
return(c1);
}
void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
{
if (n <= 0) return;
while (n&~3)
{
sqr(r[0],r[1],a[0]);
sqr(r[2],r[3],a[1]);
sqr(r[4],r[5],a[2]);
sqr(r[6],r[7],a[3]);
a+=4; r+=8; n-=4;
}
if (n)
{
sqr(r[0],r[1],a[0]); if (--n == 0) return;
sqr(r[2],r[3],a[1]); if (--n == 0) return;
sqr(r[4],r[5],a[2]);
}
}
BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
{ BN_ULONG ret,waste;
asm ("divq %3"
: "=a"(ret),"=d"(waste)
: "a"(l),"d"(h),"g"(d)
: "cc");
return ret;
}
BN_ULONG bn_add_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int n)
{ BN_ULONG ret,i;
if (n <= 0) return 0;
asm (
" subq %2,%2 \n"
".align 16 \n"
"1: movq (%4,%2,8),%0 \n"
" adcq (%5,%2,8),%0 \n"
" movq %0,(%3,%2,8) \n"
" leaq 1(%2),%2 \n"
" loop 1b \n"
" sbbq %0,%0 \n"
: "+a"(ret),"+c"(n),"+r"(i)
: "r"(rp),"r"(ap),"r"(bp)
: "cc"
);
return ret&1;
}
#ifndef SIMICS
BN_ULONG bn_sub_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int n)
{ BN_ULONG ret,i;
if (n <= 0) return 0;
asm (
" subq %2,%2 \n"
".align 16 \n"
"1: movq (%4,%2,8),%0 \n"
" sbbq (%5,%2,8),%0 \n"
" movq %0,(%3,%2,8) \n"
" leaq 1(%2),%2 \n"
" loop 1b \n"
" sbbq %0,%0 \n"
: "+a"(ret),"+c"(n),"+r"(i)
: "r"(rp),"r"(ap),"r"(bp)
: "cc"
);
return ret&1;
}
#else
/* Simics 1.4<7 has buggy sbbq:-( */
#define BN_MASK2 0xffffffffffffffffL
BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
{
BN_ULONG t1,t2;
int c=0;
if (n <= 0) return((BN_ULONG)0);
for (;;)
{
t1=a[0]; t2=b[0];
r[0]=(t1-t2-c)&BN_MASK2;
if (t1 != t2) c=(t1 < t2);
if (--n <= 0) break;
t1=a[1]; t2=b[1];
r[1]=(t1-t2-c)&BN_MASK2;
if (t1 != t2) c=(t1 < t2);
if (--n <= 0) break;
t1=a[2]; t2=b[2];
r[2]=(t1-t2-c)&BN_MASK2;
if (t1 != t2) c=(t1 < t2);
if (--n <= 0) break;
t1=a[3]; t2=b[3];
r[3]=(t1-t2-c)&BN_MASK2;
if (t1 != t2) c=(t1 < t2);
if (--n <= 0) break;
a+=4;
b+=4;
r+=4;
}
return(c);
}
#endif
/* mul_add_c(a,b,c0,c1,c2) -- c+=a*b for three word number c=(c2,c1,c0) */
/* mul_add_c2(a,b,c0,c1,c2) -- c+=2*a*b for three word number c=(c2,c1,c0) */
/* sqr_add_c(a,i,c0,c1,c2) -- c+=a[i]^2 for three word number c=(c2,c1,c0) */
/* sqr_add_c2(a,i,c0,c1,c2) -- c+=2*a[i]*a[j] for three word number c=(c2,c1,c0) */
#if 0
/* original macros are kept for reference purposes */
#define mul_add_c(a,b,c0,c1,c2) { \
BN_ULONG ta=(a),tb=(b); \
t1 = ta * tb; \
t2 = BN_UMULT_HIGH(ta,tb); \
c0 += t1; t2 += (c0<t1)?1:0; \
c1 += t2; c2 += (c1<t2)?1:0; \
}
#define mul_add_c2(a,b,c0,c1,c2) { \
BN_ULONG ta=(a),tb=(b),t0; \
t1 = BN_UMULT_HIGH(ta,tb); \
t0 = ta * tb; \
t2 = t1+t1; c2 += (t2<t1)?1:0; \
t1 = t0+t0; t2 += (t1<t0)?1:0; \
c0 += t1; t2 += (c0<t1)?1:0; \
c1 += t2; c2 += (c1<t2)?1:0; \
}
#else
#define mul_add_c(a,b,c0,c1,c2) do { \
asm ("mulq %3" \
: "=a"(t1),"=d"(t2) \
: "a"(a),"m"(b) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+r"(c0),"+d"(t2) \
: "a"(t1),"g"(0) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+r"(c1),"+r"(c2) \
: "d"(t2),"g"(0) \
: "cc"); \
} while (0)
#define sqr_add_c(a,i,c0,c1,c2) do { \
asm ("mulq %2" \
: "=a"(t1),"=d"(t2) \
: "a"(a[i]) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+r"(c0),"+d"(t2) \
: "a"(t1),"g"(0) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+r"(c1),"+r"(c2) \
: "d"(t2),"g"(0) \
: "cc"); \
} while (0)
#define mul_add_c2(a,b,c0,c1,c2) do { \
asm ("mulq %3" \
: "=a"(t1),"=d"(t2) \
: "a"(a),"m"(b) \
: "cc"); \
asm ("addq %0,%0; adcq %2,%1" \
: "+d"(t2),"+r"(c2) \
: "g"(0) \
: "cc"); \
asm ("addq %0,%0; adcq %2,%1" \
: "+a"(t1),"+d"(t2) \
: "g"(0) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+r"(c0),"+d"(t2) \
: "a"(t1),"g"(0) \
: "cc"); \
asm ("addq %2,%0; adcq %3,%1" \
: "+r"(c1),"+r"(c2) \
: "d"(t2),"g"(0) \
: "cc"); \
} while (0)
#endif
#define sqr_add_c2(a,i,j,c0,c1,c2) \
mul_add_c2((a)[i],(a)[j],c0,c1,c2)
void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
BN_ULONG bl,bh;
BN_ULONG t1,t2;
BN_ULONG c1,c2,c3;
c1=0;
c2=0;
c3=0;
mul_add_c(a[0],b[0],c1,c2,c3);
r[0]=c1;
c1=0;
mul_add_c(a[0],b[1],c2,c3,c1);
mul_add_c(a[1],b[0],c2,c3,c1);
r[1]=c2;
c2=0;
mul_add_c(a[2],b[0],c3,c1,c2);
mul_add_c(a[1],b[1],c3,c1,c2);
mul_add_c(a[0],b[2],c3,c1,c2);
r[2]=c3;
c3=0;
mul_add_c(a[0],b[3],c1,c2,c3);
mul_add_c(a[1],b[2],c1,c2,c3);
mul_add_c(a[2],b[1],c1,c2,c3);
mul_add_c(a[3],b[0],c1,c2,c3);
r[3]=c1;
c1=0;
mul_add_c(a[4],b[0],c2,c3,c1);
mul_add_c(a[3],b[1],c2,c3,c1);
mul_add_c(a[2],b[2],c2,c3,c1);
mul_add_c(a[1],b[3],c2,c3,c1);
mul_add_c(a[0],b[4],c2,c3,c1);
r[4]=c2;
c2=0;
mul_add_c(a[0],b[5],c3,c1,c2);
mul_add_c(a[1],b[4],c3,c1,c2);
mul_add_c(a[2],b[3],c3,c1,c2);
mul_add_c(a[3],b[2],c3,c1,c2);
mul_add_c(a[4],b[1],c3,c1,c2);
mul_add_c(a[5],b[0],c3,c1,c2);
r[5]=c3;
c3=0;
mul_add_c(a[6],b[0],c1,c2,c3);
mul_add_c(a[5],b[1],c1,c2,c3);
mul_add_c(a[4],b[2],c1,c2,c3);
mul_add_c(a[3],b[3],c1,c2,c3);
mul_add_c(a[2],b[4],c1,c2,c3);
mul_add_c(a[1],b[5],c1,c2,c3);
mul_add_c(a[0],b[6],c1,c2,c3);
r[6]=c1;
c1=0;
mul_add_c(a[0],b[7],c2,c3,c1);
mul_add_c(a[1],b[6],c2,c3,c1);
mul_add_c(a[2],b[5],c2,c3,c1);
mul_add_c(a[3],b[4],c2,c3,c1);
mul_add_c(a[4],b[3],c2,c3,c1);
mul_add_c(a[5],b[2],c2,c3,c1);
mul_add_c(a[6],b[1],c2,c3,c1);
mul_add_c(a[7],b[0],c2,c3,c1);
r[7]=c2;
c2=0;
mul_add_c(a[7],b[1],c3,c1,c2);
mul_add_c(a[6],b[2],c3,c1,c2);
mul_add_c(a[5],b[3],c3,c1,c2);
mul_add_c(a[4],b[4],c3,c1,c2);
mul_add_c(a[3],b[5],c3,c1,c2);
mul_add_c(a[2],b[6],c3,c1,c2);
mul_add_c(a[1],b[7],c3,c1,c2);
r[8]=c3;
c3=0;
mul_add_c(a[2],b[7],c1,c2,c3);
mul_add_c(a[3],b[6],c1,c2,c3);
mul_add_c(a[4],b[5],c1,c2,c3);
mul_add_c(a[5],b[4],c1,c2,c3);
mul_add_c(a[6],b[3],c1,c2,c3);
mul_add_c(a[7],b[2],c1,c2,c3);
r[9]=c1;
c1=0;
mul_add_c(a[7],b[3],c2,c3,c1);
mul_add_c(a[6],b[4],c2,c3,c1);
mul_add_c(a[5],b[5],c2,c3,c1);
mul_add_c(a[4],b[6],c2,c3,c1);
mul_add_c(a[3],b[7],c2,c3,c1);
r[10]=c2;
c2=0;
mul_add_c(a[4],b[7],c3,c1,c2);
mul_add_c(a[5],b[6],c3,c1,c2);
mul_add_c(a[6],b[5],c3,c1,c2);
mul_add_c(a[7],b[4],c3,c1,c2);
r[11]=c3;
c3=0;
mul_add_c(a[7],b[5],c1,c2,c3);
mul_add_c(a[6],b[6],c1,c2,c3);
mul_add_c(a[5],b[7],c1,c2,c3);
r[12]=c1;
c1=0;
mul_add_c(a[6],b[7],c2,c3,c1);
mul_add_c(a[7],b[6],c2,c3,c1);
r[13]=c2;
c2=0;
mul_add_c(a[7],b[7],c3,c1,c2);
r[14]=c3;
r[15]=c1;
}
void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
{
BN_ULONG bl,bh;
BN_ULONG t1,t2;
BN_ULONG c1,c2,c3;
c1=0;
c2=0;
c3=0;
mul_add_c(a[0],b[0],c1,c2,c3);
r[0]=c1;
c1=0;
mul_add_c(a[0],b[1],c2,c3,c1);
mul_add_c(a[1],b[0],c2,c3,c1);
r[1]=c2;
c2=0;
mul_add_c(a[2],b[0],c3,c1,c2);
mul_add_c(a[1],b[1],c3,c1,c2);
mul_add_c(a[0],b[2],c3,c1,c2);
r[2]=c3;
c3=0;
mul_add_c(a[0],b[3],c1,c2,c3);
mul_add_c(a[1],b[2],c1,c2,c3);
mul_add_c(a[2],b[1],c1,c2,c3);
mul_add_c(a[3],b[0],c1,c2,c3);
r[3]=c1;
c1=0;
mul_add_c(a[3],b[1],c2,c3,c1);
mul_add_c(a[2],b[2],c2,c3,c1);
mul_add_c(a[1],b[3],c2,c3,c1);
r[4]=c2;
c2=0;
mul_add_c(a[2],b[3],c3,c1,c2);
mul_add_c(a[3],b[2],c3,c1,c2);
r[5]=c3;
c3=0;
mul_add_c(a[3],b[3],c1,c2,c3);
r[6]=c1;
r[7]=c2;
}
void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
{
BN_ULONG bl,bh;
BN_ULONG t1,t2;
BN_ULONG c1,c2,c3;
c1=0;
c2=0;
c3=0;
sqr_add_c(a,0,c1,c2,c3);
r[0]=c1;
c1=0;
sqr_add_c2(a,1,0,c2,c3,c1);
r[1]=c2;
c2=0;
sqr_add_c(a,1,c3,c1,c2);
sqr_add_c2(a,2,0,c3,c1,c2);
r[2]=c3;
c3=0;
sqr_add_c2(a,3,0,c1,c2,c3);
sqr_add_c2(a,2,1,c1,c2,c3);
r[3]=c1;
c1=0;
sqr_add_c(a,2,c2,c3,c1);
sqr_add_c2(a,3,1,c2,c3,c1);
sqr_add_c2(a,4,0,c2,c3,c1);
r[4]=c2;
c2=0;
sqr_add_c2(a,5,0,c3,c1,c2);
sqr_add_c2(a,4,1,c3,c1,c2);
sqr_add_c2(a,3,2,c3,c1,c2);
r[5]=c3;
c3=0;
sqr_add_c(a,3,c1,c2,c3);
sqr_add_c2(a,4,2,c1,c2,c3);
sqr_add_c2(a,5,1,c1,c2,c3);
sqr_add_c2(a,6,0,c1,c2,c3);
r[6]=c1;
c1=0;
sqr_add_c2(a,7,0,c2,c3,c1);
sqr_add_c2(a,6,1,c2,c3,c1);
sqr_add_c2(a,5,2,c2,c3,c1);
sqr_add_c2(a,4,3,c2,c3,c1);
r[7]=c2;
c2=0;
sqr_add_c(a,4,c3,c1,c2);
sqr_add_c2(a,5,3,c3,c1,c2);
sqr_add_c2(a,6,2,c3,c1,c2);
sqr_add_c2(a,7,1,c3,c1,c2);
r[8]=c3;
c3=0;
sqr_add_c2(a,7,2,c1,c2,c3);
sqr_add_c2(a,6,3,c1,c2,c3);
sqr_add_c2(a,5,4,c1,c2,c3);
r[9]=c1;
c1=0;
sqr_add_c(a,5,c2,c3,c1);
sqr_add_c2(a,6,4,c2,c3,c1);
sqr_add_c2(a,7,3,c2,c3,c1);
r[10]=c2;
c2=0;
sqr_add_c2(a,7,4,c3,c1,c2);
sqr_add_c2(a,6,5,c3,c1,c2);
r[11]=c3;
c3=0;
sqr_add_c(a,6,c1,c2,c3);
sqr_add_c2(a,7,5,c1,c2,c3);
r[12]=c1;
c1=0;
sqr_add_c2(a,7,6,c2,c3,c1);
r[13]=c2;
c2=0;
sqr_add_c(a,7,c3,c1,c2);
r[14]=c3;
r[15]=c1;
}
void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a)
{
BN_ULONG bl,bh;
BN_ULONG t1,t2;
BN_ULONG c1,c2,c3;
c1=0;
c2=0;
c3=0;
sqr_add_c(a,0,c1,c2,c3);
r[0]=c1;
c1=0;
sqr_add_c2(a,1,0,c2,c3,c1);
r[1]=c2;
c2=0;
sqr_add_c(a,1,c3,c1,c2);
sqr_add_c2(a,2,0,c3,c1,c2);
r[2]=c3;
c3=0;
sqr_add_c2(a,3,0,c1,c2,c3);
sqr_add_c2(a,2,1,c1,c2,c3);
r[3]=c1;
c1=0;
sqr_add_c(a,2,c2,c3,c1);
sqr_add_c2(a,3,1,c2,c3,c1);
r[4]=c2;
c2=0;
sqr_add_c2(a,3,2,c3,c1,c2);
r[5]=c3;
c3=0;
sqr_add_c(a,3,c1,c2,c3);
r[6]=c1;
r[7]=c2;
}

View File

@@ -150,6 +150,20 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
q; \
})
# define REMAINDER_IS_ALREADY_CALCULATED
# elif defined(__x86_64) && defined(SIXTY_FOUR_BIT_LONG)
/*
* Same story here, but it's 128-bit by 64-bit division. Wow!
* <appro@fy.chalmers.se>
*/
# define bn_div_words(n0,n1,d0) \
({ asm volatile ( \
"divq %4" \
: "=a"(q), "=d"(rem) \
: "a"(n1), "d"(n0), "g"(d0) \
: "cc"); \
q; \
})
# define REMAINDER_IS_ALREADY_CALCULATED
# endif /* __<cpu> */
# endif /* __GNUC__ */
#endif /* OPENSSL_NO_ASM */
@@ -268,6 +282,11 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
q=(BN_ULONG)(((((BN_ULLONG)n0)<<BN_BITS2)|n1)/d0);
#else
q=bn_div_words(n0,n1,d0);
#ifdef BN_DEBUG_LEVITTE
fprintf(stderr,"DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\
X) -> 0x%08X\n",
n0, n1, d0, q);
#endif
#endif
#ifndef REMAINDER_IS_ALREADY_CALCULATED
@@ -292,11 +311,18 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
BN_ULONG t2l,t2h,ql,qh;
q=bn_div_words(n0,n1,d0);
#ifdef BN_DEBUG_LEVITTE
fprintf(stderr,"DEBUG: bn_div_words(0x%08X,0x%08X,0x%08\
X) -> 0x%08X\n",
n0, n1, d0, q);
#endif
#ifndef REMAINDER_IS_ALREADY_CALCULATED
rem=(n1-q*d0)&BN_MASK2;
#endif
#ifdef BN_UMULT_HIGH
#if defined(BN_UMULT_LOHI)
BN_UMULT_LOHI(t2l,t2h,d1,q);
#elif defined(BN_UMULT_HIGH)
t2l = d1 * q;
t2h = BN_UMULT_HIGH(d1,q);
#else

View File

@@ -230,6 +230,21 @@ struct bignum_ctx
: "r"(a), "r"(b)); \
ret; })
# endif /* compiler */
# elif defined(__x86_64) && defined(SIXTY_FOUR_BIT_LONG)
# if defined(__GNUC__)
# define BN_UMULT_HIGH(a,b) ({ \
register BN_ULONG ret,discard; \
asm ("mulq %3" \
: "=a"(discard),"=d"(ret) \
: "a"(a), "g"(b) \
: "cc"); \
ret; })
# define BN_UMULT_LOHI(low,high,a,b) \
asm ("mulq %3" \
: "=a"(low),"=d"(high) \
: "a"(a),"g"(b) \
: "cc");
# endif
# endif /* cpu */
#endif /* OPENSSL_NO_ASM */
@@ -337,7 +352,7 @@ struct bignum_ctx
#define LBITS(a) ((a)&BN_MASK2l)
#define HBITS(a) (((a)>>BN_BITS4)&BN_MASK2l)
#define L2HBITS(a) ((BN_ULONG)((a)&BN_MASK2l)<<BN_BITS4)
#define L2HBITS(a) (((a)<<BN_BITS4)&BN_MASK2)
#define LLBITS(a) ((a)&BN_MASKl)
#define LHBITS(a) (((a)>>BN_BITS2)&BN_MASKl)
@@ -353,7 +368,7 @@ struct bignum_ctx
lt=(bl)*(lt); \
m1=(bl)*(ht); \
ht =(bh)*(ht); \
m=(m+m1)&BN_MASK2; if (m < m1) ht+=L2HBITS(1L); \
m=(m+m1)&BN_MASK2; if (m < m1) ht+=L2HBITS((BN_ULONG)1); \
ht+=HBITS(m); \
m1=L2HBITS(m); \
lt=(lt+m1)&BN_MASK2; if (lt < m1) ht++; \
@@ -418,10 +433,13 @@ void bn_sqr_comba4(BN_ULONG *r,const BN_ULONG *a);
int bn_cmp_words(const BN_ULONG *a,const BN_ULONG *b,int n);
int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b,
int cl, int dl);
#if 0
/* bn_mul.c rollback <appro> */
void bn_mul_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,
int dna,int dnb,BN_ULONG *t);
void bn_mul_part_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,
int n,int tna,int tnb,BN_ULONG *t);
#endif
void bn_sqr_recursive(BN_ULONG *r,const BN_ULONG *a, int n2, BN_ULONG *t);
void bn_mul_low_normal(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b, int n);
void bn_mul_low_recursive(BN_ULONG *r,BN_ULONG *a,BN_ULONG *b,int n2,

View File

@@ -56,325 +56,10 @@
* [including the GNU Public Licence.]
*/
#ifndef BN_DEBUG
# undef NDEBUG /* avoid conflicting definitions */
# define NDEBUG
#endif
#include <stdio.h>
#include <assert.h>
#include "cryptlib.h"
#include "bn_lcl.h"
#if defined(OPENSSL_NO_ASM) || !(defined(__i386) || defined(__i386__)) || defined(__DJGPP__) /* Assembler implementation exists only for x86 */
/* Here follows specialised variants of bn_add_words() and
bn_sub_words(). They have the property performing operations on
arrays of different sizes. The sizes of those arrays is expressed through
cl, which is the common length ( basicall, min(len(a),len(b)) ), and dl,
which is the delta between the two lengths, calculated as len(a)-len(b).
All lengths are the number of BN_ULONGs... For the operations that require
a result array as parameter, it must have the length cl+abs(dl).
These functions should probably end up in bn_asm.c as soon as there are
assembler counterparts for the systems that use assembler files. */
BN_ULONG bn_sub_part_words(BN_ULONG *r,
const BN_ULONG *a, const BN_ULONG *b,
int cl, int dl)
{
BN_ULONG c, t;
assert(cl >= 0);
c = bn_sub_words(r, a, b, cl);
if (dl == 0)
return c;
r += cl;
a += cl;
b += cl;
if (dl < 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
#endif
for (;;)
{
t = b[0];
r[0] = (0-t-c)&BN_MASK2;
if (t != 0) c=1;
if (++dl >= 0) break;
t = b[1];
r[1] = (0-t-c)&BN_MASK2;
if (t != 0) c=1;
if (++dl >= 0) break;
t = b[2];
r[2] = (0-t-c)&BN_MASK2;
if (t != 0) c=1;
if (++dl >= 0) break;
t = b[3];
r[3] = (0-t-c)&BN_MASK2;
if (t != 0) c=1;
if (++dl >= 0) break;
b += 4;
r += 4;
}
}
else
{
int save_dl = dl;
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c = %d)\n", cl, dl, c);
#endif
while(c)
{
t = a[0];
r[0] = (t-c)&BN_MASK2;
if (t != 0) c=0;
if (--dl <= 0) break;
t = a[1];
r[1] = (t-c)&BN_MASK2;
if (t != 0) c=0;
if (--dl <= 0) break;
t = a[2];
r[2] = (t-c)&BN_MASK2;
if (t != 0) c=0;
if (--dl <= 0) break;
t = a[3];
r[3] = (t-c)&BN_MASK2;
if (t != 0) c=0;
if (--dl <= 0) break;
save_dl = dl;
a += 4;
r += 4;
}
if (dl > 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, c == 0)\n", cl, dl);
#endif
if (save_dl > dl)
{
switch (save_dl - dl)
{
case 1:
r[1] = a[1];
if (--dl <= 0) break;
case 2:
r[2] = a[2];
if (--dl <= 0) break;
case 3:
r[3] = a[3];
if (--dl <= 0) break;
}
a += 4;
r += 4;
}
}
if (dl > 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_sub_part_words %d + %d (dl > 0, copy)\n", cl, dl);
#endif
for(;;)
{
r[0] = a[0];
if (--dl <= 0) break;
r[1] = a[1];
if (--dl <= 0) break;
r[2] = a[2];
if (--dl <= 0) break;
r[3] = a[3];
if (--dl <= 0) break;
a += 4;
r += 4;
}
}
}
return c;
}
#endif
BN_ULONG bn_add_part_words(BN_ULONG *r,
const BN_ULONG *a, const BN_ULONG *b,
int cl, int dl)
{
BN_ULONG c, l, t;
assert(cl >= 0);
c = bn_add_words(r, a, b, cl);
if (dl == 0)
return c;
r += cl;
a += cl;
b += cl;
if (dl < 0)
{
int save_dl = dl;
#ifdef BN_COUNT
fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, c = %d)\n", cl, dl, c);
#endif
while (c)
{
l=(c+b[0])&BN_MASK2;
c=(l < c);
r[0]=l;
if (++dl >= 0) break;
l=(c+b[1])&BN_MASK2;
c=(l < c);
r[1]=l;
if (++dl >= 0) break;
l=(c+b[2])&BN_MASK2;
c=(l < c);
r[2]=l;
if (++dl >= 0) break;
l=(c+b[3])&BN_MASK2;
c=(l < c);
r[3]=l;
if (++dl >= 0) break;
save_dl = dl;
b+=4;
r+=4;
}
if (dl < 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, c == 0)\n", cl, dl);
#endif
if (save_dl < dl)
{
switch (dl - save_dl)
{
case 1:
r[1] = b[1];
if (++dl >= 0) break;
case 2:
r[2] = b[2];
if (++dl >= 0) break;
case 3:
r[3] = b[3];
if (++dl >= 0) break;
}
b += 4;
r += 4;
}
}
if (dl < 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_add_part_words %d + %d (dl < 0, copy)\n", cl, dl);
#endif
for(;;)
{
r[0] = b[0];
if (++dl >= 0) break;
r[1] = b[1];
if (++dl >= 0) break;
r[2] = b[2];
if (++dl >= 0) break;
r[3] = b[3];
if (++dl >= 0) break;
b += 4;
r += 4;
}
}
}
else
{
int save_dl = dl;
#ifdef BN_COUNT
fprintf(stderr, " bn_add_part_words %d + %d (dl > 0)\n", cl, dl);
#endif
while (c)
{
t=(a[0]+c)&BN_MASK2;
c=(t < c);
r[0]=t;
if (--dl <= 0) break;
t=(a[1]+c)&BN_MASK2;
c=(t < c);
r[1]=t;
if (--dl <= 0) break;
t=(a[2]+c)&BN_MASK2;
c=(t < c);
r[2]=t;
if (--dl <= 0) break;
t=(a[3]+c)&BN_MASK2;
c=(t < c);
r[3]=t;
if (--dl <= 0) break;
save_dl = dl;
a+=4;
r+=4;
}
#ifdef BN_COUNT
fprintf(stderr, " bn_add_part_words %d + %d (dl > 0, c == 0)\n", cl, dl);
#endif
if (dl > 0)
{
if (save_dl > dl)
{
switch (save_dl - dl)
{
case 1:
r[1] = a[1];
if (--dl <= 0) break;
case 2:
r[2] = a[2];
if (--dl <= 0) break;
case 3:
r[3] = a[3];
if (--dl <= 0) break;
}
a += 4;
r += 4;
}
}
if (dl > 0)
{
#ifdef BN_COUNT
fprintf(stderr, " bn_add_part_words %d + %d (dl > 0, copy)\n", cl, dl);
#endif
for(;;)
{
r[0] = a[0];
if (--dl <= 0) break;
r[1] = a[1];
if (--dl <= 0) break;
r[2] = a[2];
if (--dl <= 0) break;
r[3] = a[3];
if (--dl <= 0) break;
a += 4;
r += 4;
}
}
}
return c;
}
#ifdef BN_RECURSION
/* Karatsuba recursive multiplication algorithm
* (cf. Knuth, The Art of Computer Programming, Vol. 2) */
@@ -390,15 +75,14 @@ BN_ULONG bn_add_part_words(BN_ULONG *r,
* a[1]*b[1]
*/
void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
int dna, int dnb, BN_ULONG *t)
BN_ULONG *t)
{
int n=n2/2,c1,c2;
int tna=n+dna, tnb=n+dnb;
unsigned int neg,zero;
BN_ULONG ln,lo,*p;
# ifdef BN_COUNT
fprintf(stderr," bn_mul_recursive %d * %d\n",n2,n2);
printf(" bn_mul_recursive %d * %d\n",n2,n2);
# endif
# ifdef BN_MUL_COMBA
# if 0
@@ -408,40 +92,34 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
return;
}
# endif
/* Only call bn_mul_comba 8 if n2 == 8 and the
* two arrays are complete [steve]
*/
if (n2 == 8 && dna == 0 && dnb == 0)
if (n2 == 8)
{
bn_mul_comba8(r,a,b);
return;
}
# endif /* BN_MUL_COMBA */
/* Else do normal multiply */
if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL)
{
bn_mul_normal(r,a,n2+dna,b,n2+dnb);
if ((dna + dnb) < 0)
memset(&r[2*n2 + dna + dnb], 0,
sizeof(BN_ULONG) * -(dna + dnb));
/* This should not happen */
bn_mul_normal(r,a,n2,b,n2);
return;
}
/* r=(a[0]-a[1])*(b[1]-b[0]) */
c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna);
c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n);
c1=bn_cmp_words(a,&(a[n]),n);
c2=bn_cmp_words(&(b[n]),b,n);
zero=neg=0;
switch (c1*3+c2)
{
case -4:
bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
bn_sub_words(t, &(a[n]),a, n); /* - */
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
break;
case -3:
zero=1;
break;
case -2:
bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
bn_sub_part_words(&(t[n]),&(b[n]),b, tnb,tnb-n); /* + */
bn_sub_words(t, &(a[n]),a, n); /* - */
bn_sub_words(&(t[n]),&(b[n]),b, n); /* + */
neg=1;
break;
case -1:
@@ -450,22 +128,21 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
zero=1;
break;
case 2:
bn_sub_part_words(t, a, &(a[n]),tna,n-tna); /* + */
bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
bn_sub_words(t, a, &(a[n]),n); /* + */
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
neg=1;
break;
case 3:
zero=1;
break;
case 4:
bn_sub_part_words(t, a, &(a[n]),tna,n-tna);
bn_sub_part_words(&(t[n]),&(b[n]),b, tnb,tnb-n);
bn_sub_words(t, a, &(a[n]),n);
bn_sub_words(&(t[n]),&(b[n]),b, n);
break;
}
# ifdef BN_MUL_COMBA
if (n == 4 && dna == 0 && dnb == 0) /* XXX: bn_mul_comba4 could take
extra args to do this well */
if (n == 4)
{
if (!zero)
bn_mul_comba4(&(t[n2]),t,&(t[n]));
@@ -475,9 +152,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
bn_mul_comba4(r,a,b);
bn_mul_comba4(&(r[n2]),&(a[n]),&(b[n]));
}
else if (n == 8 && dna == 0 && dnb == 0) /* XXX: bn_mul_comba8 could
take extra args to do this
well */
else if (n == 8)
{
if (!zero)
bn_mul_comba8(&(t[n2]),t,&(t[n]));
@@ -492,11 +167,11 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
{
p= &(t[n2*2]);
if (!zero)
bn_mul_recursive(&(t[n2]),t,&(t[n]),n,0,0,p);
bn_mul_recursive(&(t[n2]),t,&(t[n]),n,p);
else
memset(&(t[n2]),0,n2*sizeof(BN_ULONG));
bn_mul_recursive(r,a,b,n,0,0,p);
bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),n,dna,dnb,p);
bn_mul_recursive(r,a,b,n,p);
bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),n,p);
}
/* t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign
@@ -545,39 +220,39 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
/* n+tn is the word length
* t needs to be n*4 is size, as does r */
void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
int tna, int tnb, BN_ULONG *t)
void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int tn,
int n, BN_ULONG *t)
{
int i,j,n2=n*2;
unsigned int c1,c2,neg,zero;
BN_ULONG ln,lo,*p;
# ifdef BN_COUNT
fprintf(stderr," bn_mul_part_recursive (%d+%d) * (%d+%d)\n",
tna, n, tnb, n);
printf(" bn_mul_part_recursive %d * %d\n",tn+n,tn+n);
# endif
if (n < 8)
{
bn_mul_normal(r,a,n+tna,b,n+tnb);
i=tn+n;
bn_mul_normal(r,a,i,b,i);
return;
}
/* r=(a[0]-a[1])*(b[1]-b[0]) */
c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna);
c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n);
c1=bn_cmp_words(a,&(a[n]),n);
c2=bn_cmp_words(&(b[n]),b,n);
zero=neg=0;
switch (c1*3+c2)
{
case -4:
bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
bn_sub_words(t, &(a[n]),a, n); /* - */
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
break;
case -3:
zero=1;
/* break; */
case -2:
bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */
bn_sub_part_words(&(t[n]),&(b[n]),b, tnb,tnb-n); /* + */
bn_sub_words(t, &(a[n]),a, n); /* - */
bn_sub_words(&(t[n]),&(b[n]),b, n); /* + */
neg=1;
break;
case -1:
@@ -586,16 +261,16 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
zero=1;
/* break; */
case 2:
bn_sub_part_words(t, a, &(a[n]),tna,n-tna); /* + */
bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */
bn_sub_words(t, a, &(a[n]),n); /* + */
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
neg=1;
break;
case 3:
zero=1;
/* break; */
case 4:
bn_sub_part_words(t, a, &(a[n]),tna,n-tna);
bn_sub_part_words(&(t[n]),&(b[n]),b, tnb,tnb-n);
bn_sub_words(t, a, &(a[n]),n);
bn_sub_words(&(t[n]),&(b[n]),b, n);
break;
}
/* The zero case isn't yet implemented here. The speedup
@@ -614,59 +289,54 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
{
bn_mul_comba8(&(t[n2]),t,&(t[n]));
bn_mul_comba8(r,a,b);
bn_mul_normal(&(r[n2]),&(a[n]),tna,&(b[n]),tnb);
memset(&(r[n2+tna+tnb]),0,sizeof(BN_ULONG)*(n2-tna-tnb));
bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn);
memset(&(r[n2+tn*2]),0,sizeof(BN_ULONG)*(n2-tn*2));
}
else
{
p= &(t[n2*2]);
bn_mul_recursive(&(t[n2]),t,&(t[n]),n,0,0,p);
bn_mul_recursive(r,a,b,n,0,0,p);
bn_mul_recursive(&(t[n2]),t,&(t[n]),n,p);
bn_mul_recursive(r,a,b,n,p);
i=n/2;
/* If there is only a bottom half to the number,
* just do it */
if (tna > tnb)
j = tna - i;
else
j = tnb - i;
j=tn-i;
if (j == 0)
{
bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),
i,tna-i,tnb-i,p);
bn_mul_recursive(&(r[n2]),&(a[n]),&(b[n]),i,p);
memset(&(r[n2+i*2]),0,sizeof(BN_ULONG)*(n2-i*2));
}
else if (j > 0) /* eg, n == 16, i == 8 and tn == 11 */
{
bn_mul_part_recursive(&(r[n2]),&(a[n]),&(b[n]),
i,tna-i,tnb-i,p);
memset(&(r[n2+tna+tnb]),0,
sizeof(BN_ULONG)*(n2-tna-tnb));
j,i,p);
memset(&(r[n2+tn*2]),0,
sizeof(BN_ULONG)*(n2-tn*2));
}
else /* (j < 0) eg, n == 16, i == 8 and tn == 5 */
{
memset(&(r[n2]),0,sizeof(BN_ULONG)*n2);
if (tna < BN_MUL_RECURSIVE_SIZE_NORMAL
&& tnb < BN_MUL_RECURSIVE_SIZE_NORMAL)
if (tn < BN_MUL_RECURSIVE_SIZE_NORMAL)
{
bn_mul_normal(&(r[n2]),&(a[n]),tna,&(b[n]),tnb);
bn_mul_normal(&(r[n2]),&(a[n]),tn,&(b[n]),tn);
}
else
{
for (;;)
{
i/=2;
if (i < tna && i < tnb)
if (i < tn)
{
bn_mul_part_recursive(&(r[n2]),
&(a[n]),&(b[n]),
i,tna-i,tnb-i,p);
tn-i,i,p);
break;
}
else if (i <= tna && i <= tnb)
else if (i == tn)
{
bn_mul_recursive(&(r[n2]),
&(a[n]),&(b[n]),
i,tna-i,tnb-i,p);
i,p);
break;
}
}
@@ -727,10 +397,10 @@ void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
int n=n2/2;
# ifdef BN_COUNT
fprintf(stderr," bn_mul_low_recursive %d * %d\n",n2,n2);
printf(" bn_mul_low_recursive %d * %d\n",n2,n2);
# endif
bn_mul_recursive(r,a,b,n,0,0,&(t[0]));
bn_mul_recursive(r,a,b,n,&(t[0]));
if (n >= BN_MUL_LOW_RECURSIVE_SIZE_NORMAL)
{
bn_mul_low_recursive(&(t[0]),&(a[0]),&(b[n]),n,&(t[n2]));
@@ -761,7 +431,7 @@ void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
BN_ULONG ll,lc,*lp,*mp;
# ifdef BN_COUNT
fprintf(stderr," bn_mul_high %d * %d\n",n2,n2);
printf(" bn_mul_high %d * %d\n",n2,n2);
# endif
n=n2/2;
@@ -814,8 +484,8 @@ void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
else
# endif
{
bn_mul_recursive(&(t[0]),&(r[0]),&(r[n]),n,0,0,&(t[n2]));
bn_mul_recursive(r,&(a[n]),&(b[n]),n,0,0,&(t[n2]));
bn_mul_recursive(&(t[0]),&(r[0]),&(r[n]),n,&(t[n2]));
bn_mul_recursive(r,&(a[n]),&(b[n]),n,&(t[n2]));
}
/* s0 == low(al*bl)
@@ -940,19 +610,19 @@ void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
int ret=0;
int top,al,bl;
BIGNUM *rr;
int ret = 0;
#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
int i;
#endif
#ifdef BN_RECURSION
BIGNUM *t=NULL;
int j=0,k;
BIGNUM *t;
int j,k;
#endif
#ifdef BN_COUNT
fprintf(stderr,"BN_mul %d * %d\n",a->top,b->top);
printf("BN_mul %d * %d\n",a->top,b->top);
#endif
bn_check_top(a);
@@ -1005,55 +675,21 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
#ifdef BN_RECURSION
if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL))
{
if (i >= -1 && i <= 1)
if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA) && bl<b->dmax)
{
int sav_j =0;
/* Find out the power of two lower or equal
to the longest of the two numbers */
if (i >= 0)
{
j = BN_num_bits_word((BN_ULONG)al);
}
if (i == -1)
{
j = BN_num_bits_word((BN_ULONG)bl);
}
sav_j = j;
j = 1<<(j-1);
assert(j <= al || j <= bl);
k = j+j;
t = BN_CTX_get(ctx);
if (al > j || bl > j)
{
bn_wexpand(t,k*4);
bn_wexpand(rr,k*4);
bn_mul_part_recursive(rr->d,a->d,b->d,
j,al-j,bl-j,t->d);
}
else /* al <= j || bl <= j */
{
bn_wexpand(t,k*2);
bn_wexpand(rr,k*2);
bn_mul_recursive(rr->d,a->d,b->d,
j,al-j,bl-j,t->d);
}
rr->top=top;
goto end;
}
#if 0
if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA))
{
BIGNUM *tmp_bn = (BIGNUM *)b;
if (bn_wexpand(tmp_bn,al) == NULL) goto err;
tmp_bn->d[bl]=0;
#if 0 /* tribute to const-ification, bl<b->dmax above covers for this */
if (bn_wexpand(b,al) == NULL) goto err;
#endif
b->d[bl]=0;
bl++;
i--;
}
else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA))
else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA) && al<a->dmax)
{
BIGNUM *tmp_bn = (BIGNUM *)a;
if (bn_wexpand(tmp_bn,bl) == NULL) goto err;
tmp_bn->d[al]=0;
#if 0 /* tribute to const-ification, al<a->dmax above covers for this */
if (bn_wexpand(a,bl) == NULL) goto err;
#endif
a->d[al]=0;
al++;
i++;
}
@@ -1070,17 +706,26 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
if (bn_wexpand(t,k*2) == NULL) goto err;
if (bn_wexpand(rr,k*2) == NULL) goto err;
bn_mul_recursive(rr->d,a->d,b->d,al,t->d);
rr->top=top;
goto end;
}
#if 0 /* tribute to const-ification, rsa/dsa performance is not affected */
else
{
if (bn_wexpand(t,k*4) == NULL) goto err;
if (bn_wexpand(rr,k*4) == NULL) goto err;
if (bn_wexpand(a,k) == NULL ) goto err;
if (bn_wexpand(b,k) == NULL ) goto err;
if (bn_wexpand(t,k*4) == NULL ) goto err;
if (bn_wexpand(rr,k*4) == NULL ) goto err;
for (i=a->top; i<k; i++)
a->d[i]=0;
for (i=b->top; i<k; i++)
b->d[i]=0;
bn_mul_part_recursive(rr->d,a->d,b->d,al-j,j,t->d);
}
rr->top=top;
goto end;
}
#endif
}
}
#endif /* BN_RECURSION */
if (bn_wexpand(rr,top) == NULL) goto err;
@@ -1103,7 +748,7 @@ void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
BN_ULONG *rr;
#ifdef BN_COUNT
fprintf(stderr," bn_mul_normal %d * %d\n",na,nb);
printf(" bn_mul_normal %d * %d\n",na,nb);
#endif
if (na < nb)
@@ -1116,13 +761,7 @@ void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
}
rr= &(r[na]);
if (nb <= 0)
{
(void)bn_mul_words(r,a,na,0);
return;
}
else
rr[0]=bn_mul_words(r,a,na,b[0]);
rr[0]=bn_mul_words(r,a,na,b[0]);
for (;;)
{
@@ -1143,7 +782,7 @@ void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
{
#ifdef BN_COUNT
fprintf(stderr," bn_mul_low_normal %d * %d\n",n,n);
printf(" bn_mul_low_normal %d * %d\n",n,n);
#endif
bn_mul_words(r,a,n,b[0]);

View File

@@ -104,7 +104,8 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] =
"dynlock",
"engine",
"ui",
#if CRYPTO_NUM_LOCKS != 32
"hwcrhk", /* This is a HACK which will disappear in 0.9.8 */
#if CRYPTO_NUM_LOCKS != 33
# error "Inconsistency between crypto.h and cryptlib.c"
#endif
};
@@ -207,10 +208,18 @@ int CRYPTO_get_new_dynlockid(void)
i=sk_CRYPTO_dynlock_find(dyn_locks,NULL);
/* If there was none, push, thereby creating a new one */
if (i == -1)
i=sk_CRYPTO_dynlock_push(dyn_locks,pointer);
/* Since sk_push() returns the number of items on the
stack, not the location of the pushed item, we need
to transform the returned number into a position,
by decreasing it. */
i=sk_CRYPTO_dynlock_push(dyn_locks,pointer) - 1;
else
/* If we found a place with a NULL pointer, put our pointer
in it. */
sk_CRYPTO_dynlock_set(dyn_locks,i,pointer);
CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
if (!i)
if (i == -1)
{
dynlock_destroy_callback(pointer->data,__FILE__,__LINE__);
OPENSSL_free(pointer);
@@ -402,15 +411,17 @@ void CRYPTO_lock(int mode, int type, const char *file, int line)
#endif
if (type < 0)
{
struct CRYPTO_dynlock_value *pointer
= CRYPTO_get_dynlock_value(type);
if (pointer && dynlock_lock_callback)
if (dynlock_lock_callback != NULL)
{
dynlock_lock_callback(mode, pointer, file, line);
}
struct CRYPTO_dynlock_value *pointer
= CRYPTO_get_dynlock_value(type);
CRYPTO_destroy_dynlockid(type);
OPENSSL_assert(pointer != NULL);
dynlock_lock_callback(mode, pointer, file, line);
CRYPTO_destroy_dynlockid(type);
}
}
else
if (locking_callback != NULL)

View File

@@ -127,7 +127,8 @@ extern "C" {
#define CRYPTO_LOCK_DYNLOCK 29
#define CRYPTO_LOCK_ENGINE 30
#define CRYPTO_LOCK_UI 31
#define CRYPTO_NUM_LOCKS 32
#define CRYPTO_LOCK_HWCRHK 32 /* This is a HACK which will disappear in 0.9.8 */
#define CRYPTO_NUM_LOCKS 33
#define CRYPTO_LOCK 1
#define CRYPTO_UNLOCK 2

View File

@@ -67,19 +67,27 @@ des: des.o cbc3_enc.o lib
# elf
asm/dx86-elf.o: asm/dx86unix.cpp
$(CPP) -DELF -x c asm/dx86unix.cpp | as -o asm/dx86-elf.o
$(CPP) -DELF \
`(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC; exit 0`\
-x c asm/dx86unix.cpp | as -o asm/dx86-elf.o
asm/yx86-elf.o: asm/yx86unix.cpp
$(CPP) -DELF -x c asm/yx86unix.cpp | as -o asm/yx86-elf.o
$(CPP) -DELF \
`(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC; exit 0`\
-x c asm/yx86unix.cpp | as -o asm/yx86-elf.o
# solaris
asm/dx86-sol.o: asm/dx86unix.cpp
$(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s
$(CC) -E -DSOL \
`(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC; exit 0`\
asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s
as -o asm/dx86-sol.o asm/dx86-sol.s
rm -f asm/dx86-sol.s
asm/yx86-sol.o: asm/yx86unix.cpp
$(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s
$(CC) -E -DSOL \
`(echo $(CFLAGS) | egrep -ie '-[fK]PIC') > /dev/null 2>&1 && echo -DPIC; exit 0`\
asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s
as -o asm/yx86-sol.o asm/yx86-sol.s
rm -f asm/yx86-sol.s

View File

@@ -26,11 +26,17 @@ sub fcrypt_body
&comment("");
&comment("Load the 2 words");
$ks="ebp";
$trans="ebp";
&xor( $L, $L);
&xor( $R, $R);
&mov($ks,&wparam(1));
# PIC-ification:-)
if ($cpp) { &picmeup("edx","DES_SPtrans"); }
else { &lea("edx",&DWP("DES_SPtrans")); }
&push("edx"); # becomes &swtmp(1)
#
&mov($trans,&wparam(1)); # reloaded with DES_SPtrans in D_ENCRYPT
&push(&DWC(25)); # add a variable
@@ -39,11 +45,11 @@ sub fcrypt_body
{
&comment("");
&comment("Round $i");
&D_ENCRYPT($i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
&D_ENCRYPT($i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx");
&comment("");
&comment("Round ".sprintf("%d",$i+1));
&D_ENCRYPT($i+1,$R,$L,($i+1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
&D_ENCRYPT($i+1,$R,$L,($i+1)*2,$trans,"eax","ebx","ecx","edx");
}
&mov("ebx", &swtmp(0));
&mov("eax", $L);
@@ -61,14 +67,14 @@ sub fcrypt_body
&mov(&DWP(0,"edx","",0),"eax");
&mov(&DWP(4,"edx","",0),$L);
&pop("ecx"); # remove variable
&add("esp",8); # remove variables
&function_end($name);
}
sub D_ENCRYPT
{
local($r,$L,$R,$S,$ks,$desSP,$u,$tmp1,$tmp2,$t)=@_;
local($r,$L,$R,$S,$trans,$u,$tmp1,$tmp2,$t)=@_;
&mov( $u, &wparam(2)); # 2
&mov( $t, $R);
@@ -85,9 +91,9 @@ sub D_ENCRYPT
&shl( $tmp2, 16); # 1
&xor( $u, $tmp1); # 2
&xor( $t, $tmp2); # 2
&mov( $tmp1, &DWP(&n2a($S*4),$ks,"",0)); # 2
&mov( $tmp1, &DWP(&n2a($S*4),$trans,"",0)); # 2
&xor( $u, $tmp1);
&mov( $tmp2, &DWP(&n2a(($S+1)*4),$ks,"",0)); # 2
&mov( $tmp2, &DWP(&n2a(($S+1)*4),$trans,"",0)); # 2
&xor( $u, $R);
&xor( $t, $R);
&xor( $t, $tmp2);
@@ -99,31 +105,28 @@ sub D_ENCRYPT
&movb( &LB($tmp1), &LB($u) );
&movb( &LB($tmp2), &HB($u) );
&rotr( $t, 4 );
&mov( $ks, &DWP(" $desSP",$tmp1,"",0));
&mov( $trans, &swtmp(1));
&xor( $L, &DWP(" ",$trans,$tmp1,0));
&movb( &LB($tmp1), &LB($t) );
&xor( $L, $ks);
&mov( $ks, &DWP("0x200+$desSP",$tmp2,"",0));
&xor( $L, $ks);
&xor( $L, &DWP("0x200",$trans,$tmp2,0));
&movb( &LB($tmp2), &HB($t) );
&shr( $u, 16);
&mov( $ks, &DWP("0x100+$desSP",$tmp1,"",0));
&xor( $L, $ks);
&xor( $L, &DWP("0x100",$trans,$tmp1,0));
&movb( &LB($tmp1), &HB($u) );
&shr( $t, 16);
&mov( $ks, &DWP("0x300+$desSP",$tmp2,"",0));
&xor( $L, $ks);
&mov( $ks, &wparam(1));
&xor( $L, &DWP("0x300",$trans,$tmp2,0));
&movb( &LB($tmp2), &HB($t) );
&and( $u, "0xff" );
&and( $t, "0xff" );
&mov( $tmp1, &DWP("0x600+$desSP",$tmp1,"",0));
&mov( $tmp1, &DWP("0x600",$trans,$tmp1,0));
&xor( $L, $tmp1);
&mov( $tmp1, &DWP("0x700+$desSP",$tmp2,"",0));
&mov( $tmp1, &DWP("0x700",$trans,$tmp2,0));
&xor( $L, $tmp1);
&mov( $tmp1, &DWP("0x400+$desSP",$u,"",0));
&mov( $tmp1, &DWP("0x400",$trans,$u,0));
&xor( $L, $tmp1);
&mov( $tmp1, &DWP("0x500+$desSP",$t,"",0));
&mov( $tmp1, &DWP("0x500",$trans,$t,0));
&xor( $L, $tmp1);
&mov( $trans, &wparam(1));
}
sub n2a

View File

@@ -40,7 +40,7 @@ sub DES_encrypt
&comment("");
&comment("Load the 2 words");
$ks="ebp";
$trans="ebp";
if ($do_ip)
{
@@ -72,7 +72,11 @@ sub DES_encrypt
&rotl($L,3);
}
&mov( $ks, &wparam(1) );
# PIC-ification:-)
if ($cpp) { &picmeup($trans,"DES_SPtrans"); }
else { &lea($trans,&DWP("DES_SPtrans")); }
&mov( "ecx", &wparam(1) );
&cmp("ebx","0");
&je(&label("start_decrypt"));
@@ -80,11 +84,11 @@ sub DES_encrypt
{
&comment("");
&comment("Round $i");
&D_ENCRYPT($i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
&D_ENCRYPT($i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx");
&comment("");
&comment("Round ".sprintf("%d",$i+1));
&D_ENCRYPT($i+1,$R,$L,($i+1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
&D_ENCRYPT($i+1,$R,$L,($i+1)*2,$trans,"eax","ebx","ecx","edx");
}
&jmp(&label("end"));
@@ -94,10 +98,10 @@ sub DES_encrypt
{
&comment("");
&comment("Round $i");
&D_ENCRYPT(15-$i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
&D_ENCRYPT(15-$i,$L,$R,$i*2,$trans,"eax","ebx","ecx","edx");
&comment("");
&comment("Round ".sprintf("%d",$i-1));
&D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx");
&D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$trans,"eax","ebx","ecx","edx");
}
&set_label("end");
@@ -134,43 +138,36 @@ sub DES_encrypt
sub D_ENCRYPT
{
local($r,$L,$R,$S,$ks,$desSP,$u,$tmp1,$tmp2,$t)=@_;
local($r,$L,$R,$S,$trans,$u,$tmp1,$tmp2,$t)=@_;
&mov( $u, &DWP(&n2a($S*4),$ks,"",0));
&mov( $u, &DWP(&n2a($S*4),$tmp2,"",0));
&xor( $tmp1, $tmp1);
&mov( $t, &DWP(&n2a(($S+1)*4),$ks,"",0));
&mov( $t, &DWP(&n2a(($S+1)*4),$tmp2,"",0));
&xor( $u, $R);
&xor( $tmp2, $tmp2);
&xor( $t, $R);
&and( $u, "0xfcfcfcfc" );
&and( $t, "0xcfcfcfcf" );
&movb( &LB($tmp1), &LB($u) );
&movb( &LB($tmp2), &HB($u) );
&rotr( $t, 4 );
&mov( $ks, &DWP(" $desSP",$tmp1,"",0));
&xor( $L, &DWP(" ",$trans,$tmp1,0));
&movb( &LB($tmp1), &LB($t) );
&xor( $L, $ks);
&mov( $ks, &DWP("0x200+$desSP",$tmp2,"",0));
&xor( $L, $ks); ######
&xor( $L, &DWP("0x200",$trans,$tmp2,0));
&movb( &LB($tmp2), &HB($t) );
&shr( $u, 16);
&mov( $ks, &DWP("0x100+$desSP",$tmp1,"",0));
&xor( $L, $ks); ######
&xor( $L, &DWP("0x100",$trans,$tmp1,0));
&movb( &LB($tmp1), &HB($u) );
&shr( $t, 16);
&mov( $ks, &DWP("0x300+$desSP",$tmp2,"",0));
&xor( $L, $ks);
&mov( $ks, &wparam(1) );
&xor( $L, &DWP("0x300",$trans,$tmp2,0));
&movb( &LB($tmp2), &HB($t) );
&and( $u, "0xff" );
&and( $t, "0xff" );
&mov( $tmp1, &DWP("0x600+$desSP",$tmp1,"",0));
&xor( $L, $tmp1);
&mov( $tmp1, &DWP("0x700+$desSP",$tmp2,"",0));
&xor( $L, $tmp1);
&mov( $tmp1, &DWP("0x400+$desSP",$u,"",0));
&xor( $L, $tmp1);
&mov( $tmp1, &DWP("0x500+$desSP",$t,"",0));
&xor( $L, $tmp1);
&xor( $L, &DWP("0x600",$trans,$tmp1,0));
&xor( $L, &DWP("0x700",$trans,$tmp2,0));
&mov( $tmp2, &wparam(1) );
&xor( $L, &DWP("0x400",$trans,$u,0));
&xor( $L, &DWP("0x500",$trans,$t,0));
}
sub n2a

View File

@@ -56,8 +56,8 @@
* [including the GNU Public Licence.]
*/
#ifndef HEADER_DES_H
#define HEADER_DES_H
#ifndef HEADER_NEW_DES_H
#define HEADER_NEW_DES_H
#ifdef OPENSSL_NO_DES
#error DES is disabled.

View File

@@ -162,7 +162,18 @@
#if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)
#define ROTATE(a,n) (_lrotr(a,n))
#else
#elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(NO_ASM) && !defined(NO_INLINE_ASM)
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
# define ROTATE(a,n) ({ register unsigned int ret; \
asm ("rorl %1,%0" \
: "=r"(ret) \
: "I"(n),"0"(a) \
: "cc"); \
ret; \
})
# endif
#endif
#ifndef ROTATE
#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n))))
#endif

View File

@@ -88,14 +88,14 @@
*
*/
#ifndef HEADER_DES_OLD_H
#define HEADER_DES_OLD_H
#ifndef HEADER_DES_H
#define HEADER_DES_H
#ifdef OPENSSL_NO_DES
#error DES is disabled.
#endif
#ifndef HEADER_DES_H
#ifndef HEADER_NEW_DES_H
#error You must include des.h, not des_old.h directly.
#endif

View File

@@ -222,6 +222,7 @@ end:
static int cb_exit(int ec)
{
EXIT(ec);
return(0); /* To keep some compilers quiet */
}
static void MS_CALLBACK dsa_cb(int p, int n, void *arg)

View File

@@ -91,11 +91,19 @@ static int hwcrhk_init(ENGINE *e);
static int hwcrhk_finish(ENGINE *e);
static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
/* Functions to handle mutexes */
/* Functions to handle mutexes if have dynamic locks */
static int hwcrhk_mutex_init(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext*);
static int hwcrhk_mutex_lock(HWCryptoHook_Mutex*);
static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex*);
static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex*);
#if 1 /* This is a HACK which will disappear in 0.9.8 */
/* Functions to handle mutexes if only have static locks */
static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m,
HWCryptoHook_CallerContext *c);
static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m);
static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m);
static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m);
#endif
/* BIGNUM stuff */
static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
@@ -573,9 +581,17 @@ static int hwcrhk_init(ENGINE *e)
}
else if (CRYPTO_get_locking_callback() != NULL)
{
HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_LOCKING_MISSING);
HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DYNAMIC_LOCKING_MISSING);
ERR_add_error_data(1,"You HAVE to add dynamic locking callbacks via CRYPTO_set_dynlock_{create,lock,destroy}_callback()");
#if 1 /* This is a HACK which will disappear in 0.9.8 */
hwcrhk_globals.maxmutexes = 1; /* Only have one lock */
hwcrhk_globals.mutex_init = hwcrhk_static_mutex_init;
hwcrhk_globals.mutex_acquire = hwcrhk_static_mutex_lock;
hwcrhk_globals.mutex_release = hwcrhk_static_mutex_unlock;
hwcrhk_globals.mutex_destroy = hwcrhk_static_mutex_destroy;
#else
goto err;
#endif
}
}
@@ -1181,6 +1197,26 @@ static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex *mt)
CRYPTO_destroy_dynlockid(mt->lockid);
}
/* Mutex upcalls to use if the application does not support dynamic locks */
static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m,
HWCryptoHook_CallerContext *c)
{
return 0;
}
static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m)
{
CRYPTO_w_lock(CRYPTO_LOCK_HWCRHK);
return 0;
}
static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m)
{
CRYPTO_w_unlock(CRYPTO_LOCK_HWCRHK);
}
static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m)
{
}
static int hwcrhk_get_pass(const char *prompt_info,
int *len_io, char *buf,
HWCryptoHook_PassphraseContext *ppctx,

View File

@@ -86,7 +86,7 @@ static ERR_STRING_DATA HWCRHK_str_reasons[]=
{HWCRHK_R_CHIL_ERROR ,"chil error"},
{HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
{HWCRHK_R_DSO_FAILURE ,"dso failure"},
{HWCRHK_R_LOCKING_MISSING ,"locking missing"},
{HWCRHK_R_DYNAMIC_LOCKING_MISSING ,"dynamic locking missing"},
{HWCRHK_R_MISSING_KEY_COMPONENTS ,"missing key components"},
{HWCRHK_R_NOT_INITIALISED ,"not initialised"},
{HWCRHK_R_NOT_LOADED ,"not loaded"},

View File

@@ -84,7 +84,7 @@ static void ERR_HWCRHK_error(int function, int reason, char *file, int line);
#define HWCRHK_R_CHIL_ERROR 102
#define HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
#define HWCRHK_R_DSO_FAILURE 104
#define HWCRHK_R_LOCKING_MISSING 114
#define HWCRHK_R_DYNAMIC_LOCKING_MISSING 114
#define HWCRHK_R_MISSING_KEY_COMPONENTS 105
#define HWCRHK_R_NOT_INITIALISED 106
#define HWCRHK_R_NOT_LOADED 107

View File

@@ -81,7 +81,7 @@ int ENGINE_register_ciphers(ENGINE *e)
int num_nids = e->ciphers(e, NULL, &nids, 0);
if(num_nids > 0)
return engine_table_register(&cipher_table,
&engine_unregister_all_ciphers, e, nids,
engine_unregister_all_ciphers, e, nids,
num_nids, 0);
}
return 1;
@@ -103,7 +103,7 @@ int ENGINE_set_default_ciphers(ENGINE *e)
int num_nids = e->ciphers(e, NULL, &nids, 0);
if(num_nids > 0)
return engine_table_register(&cipher_table,
&engine_unregister_all_ciphers, e, nids,
engine_unregister_all_ciphers, e, nids,
num_nids, 1);
}
return 1;

View File

@@ -78,7 +78,7 @@ int ENGINE_register_DH(ENGINE *e)
{
if(e->dh_meth)
return engine_table_register(&dh_table,
&engine_unregister_all_DH, e, &dummy_nid, 1, 0);
engine_unregister_all_DH, e, &dummy_nid, 1, 0);
return 1;
}
@@ -94,7 +94,7 @@ int ENGINE_set_default_DH(ENGINE *e)
{
if(e->dh_meth)
return engine_table_register(&dh_table,
&engine_unregister_all_DH, e, &dummy_nid, 1, 1);
engine_unregister_all_DH, e, &dummy_nid, 1, 1);
return 1;
}

View File

@@ -81,7 +81,7 @@ int ENGINE_register_digests(ENGINE *e)
int num_nids = e->digests(e, NULL, &nids, 0);
if(num_nids > 0)
return engine_table_register(&digest_table,
&engine_unregister_all_digests, e, nids,
engine_unregister_all_digests, e, nids,
num_nids, 0);
}
return 1;
@@ -103,7 +103,7 @@ int ENGINE_set_default_digests(ENGINE *e)
int num_nids = e->digests(e, NULL, &nids, 0);
if(num_nids > 0)
return engine_table_register(&digest_table,
&engine_unregister_all_digests, e, nids,
engine_unregister_all_digests, e, nids,
num_nids, 1);
}
return 1;

View File

@@ -78,7 +78,7 @@ int ENGINE_register_DSA(ENGINE *e)
{
if(e->dsa_meth)
return engine_table_register(&dsa_table,
&engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
return 1;
}
@@ -94,7 +94,7 @@ int ENGINE_set_default_DSA(ENGINE *e)
{
if(e->dsa_meth)
return engine_table_register(&dsa_table,
&engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
return 1;
}

View File

@@ -78,7 +78,7 @@ int ENGINE_register_RAND(ENGINE *e)
{
if(e->rand_meth)
return engine_table_register(&rand_table,
&engine_unregister_all_RAND, e, &dummy_nid, 1, 0);
engine_unregister_all_RAND, e, &dummy_nid, 1, 0);
return 1;
}
@@ -94,7 +94,7 @@ int ENGINE_set_default_RAND(ENGINE *e)
{
if(e->rand_meth)
return engine_table_register(&rand_table,
&engine_unregister_all_RAND, e, &dummy_nid, 1, 1);
engine_unregister_all_RAND, e, &dummy_nid, 1, 1);
return 1;
}

View File

@@ -78,7 +78,7 @@ int ENGINE_register_RSA(ENGINE *e)
{
if(e->rsa_meth)
return engine_table_register(&rsa_table,
&engine_unregister_all_RSA, e, &dummy_nid, 1, 0);
engine_unregister_all_RSA, e, &dummy_nid, 1, 0);
return 1;
}
@@ -94,7 +94,7 @@ int ENGINE_set_default_RSA(ENGINE *e)
{
if(e->rsa_meth)
return engine_table_register(&rsa_table,
&engine_unregister_all_RSA, e, &dummy_nid, 1, 1);
engine_unregister_all_RSA, e, &dummy_nid, 1, 1);
return 1;
}

View File

@@ -126,6 +126,7 @@ static unsigned char *ustrsep(char **p,const char *sep)
static int test1_exit(int ec)
{
EXIT(ec);
return(0); /* To keep some compilers quiet */
}
static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,

View File

@@ -198,7 +198,7 @@
*
* <appro@fy.chalmers.se>
*/
# if defined(__i386) || defined(__i386__)
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
# define ROTATE(a,n) ({ register unsigned int ret; \
asm ( \
"roll %1,%0" \
@@ -224,7 +224,7 @@
*/
# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
/* some GNU C inline assembler templates by <appro@fy.chalmers.se> */
# if (defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)
# if (defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)) && !defined(I386_ONLY)
# define BE_FETCH32(a) ({ register unsigned int l=(a);\
asm ( \
"bswapl %0" \
@@ -610,3 +610,28 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c)
*/
return 1;
}
#ifndef MD32_REG_T
#define MD32_REG_T long
/*
* This comment was originaly written for MD5, which is why it
* discusses A-D. But it basically applies to all 32-bit digests,
* which is why it was moved to common header file.
*
* In case you wonder why A-D are declared as long and not
* as MD5_LONG. Doing so results in slight performance
* boost on LP64 architectures. The catch is we don't
* really care if 32 MSBs of a 64-bit register get polluted
* with eventual overflows as we *save* only 32 LSBs in
* *either* case. Now declaring 'em long excuses the compiler
* from keeping 32 MSBs zeroed resulting in 13% performance
* improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
* Well, to be honest it should say that this *prevents*
* performance degradation.
* <appro@fy.chalmers.se>
* Apparently there're LP64 compilers that generate better
* code if A-D are declared int. Most notably GCC-x86_64
* generates better code.
* <appro@fy.chalmers.se>
*/
#endif

View File

@@ -86,21 +86,7 @@ int MD4_Init(MD4_CTX *c)
void md4_block_host_order (MD4_CTX *c, const void *data, int num)
{
const MD4_LONG *X=data;
register unsigned long A,B,C,D;
/*
* In case you wonder why A-D are declared as long and not
* as MD4_LONG. Doing so results in slight performance
* boost on LP64 architectures. The catch is we don't
* really care if 32 MSBs of a 64-bit register get polluted
* with eventual overflows as we *save* only 32 LSBs in
* *either* case. Now declaring 'em long excuses the compiler
* from keeping 32 MSBs zeroed resulting in 13% performance
* improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
* Well, to be honest it should say that this *prevents*
* performance degradation.
*
* <appro@fy.chalmers.se>
*/
register unsigned MD32_REG_T A,B,C,D;
A=c->A;
B=c->B;
@@ -176,25 +162,11 @@ void md4_block_host_order (MD4_CTX *c, const void *data, int num)
void md4_block_data_order (MD4_CTX *c, const void *data_, int num)
{
const unsigned char *data=data_;
register unsigned long A,B,C,D,l;
/*
* In case you wonder why A-D are declared as long and not
* as MD4_LONG. Doing so results in slight performance
* boost on LP64 architectures. The catch is we don't
* really care if 32 MSBs of a 64-bit register get polluted
* with eventual overflows as we *save* only 32 LSBs in
* *either* case. Now declaring 'em long excuses the compiler
* from keeping 32 MSBs zeroed resulting in 13% performance
* improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
* Well, to be honest it should say that this *prevents*
* performance degradation.
*
* <appro@fy.chalmers.se>
*/
register unsigned MD32_REG_T A,B,C,D,l;
#ifndef MD32_XARRAY
/* See comment in crypto/sha/sha_locl.h for details. */
unsigned long XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
# define X(i) XX##i
#else
MD4_LONG XX[MD4_LBLOCK];

View File

@@ -129,7 +129,8 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
md5_dgst.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md5.h
md5_dgst.o: ../../include/openssl/opensslconf.h
md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c
md5_dgst.o: md5_locl.h
md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h

View File

@@ -59,6 +59,8 @@
#ifndef HEADER_MD5_H
#define HEADER_MD5_H
#include <openssl/e_os2.h>
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -86,21 +86,7 @@ int MD5_Init(MD5_CTX *c)
void md5_block_host_order (MD5_CTX *c, const void *data, int num)
{
const MD5_LONG *X=data;
register unsigned long A,B,C,D;
/*
* In case you wonder why A-D are declared as long and not
* as MD5_LONG. Doing so results in slight performance
* boost on LP64 architectures. The catch is we don't
* really care if 32 MSBs of a 64-bit register get polluted
* with eventual overflows as we *save* only 32 LSBs in
* *either* case. Now declaring 'em long excuses the compiler
* from keeping 32 MSBs zeroed resulting in 13% performance
* improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
* Well, to be honest it should say that this *prevents*
* performance degradation.
*
* <appro@fy.chalmers.se>
*/
register unsigned MD32_REG_T A,B,C,D;
A=c->A;
B=c->B;
@@ -193,25 +179,11 @@ void md5_block_host_order (MD5_CTX *c, const void *data, int num)
void md5_block_data_order (MD5_CTX *c, const void *data_, int num)
{
const unsigned char *data=data_;
register unsigned long A,B,C,D,l;
/*
* In case you wonder why A-D are declared as long and not
* as MD5_LONG. Doing so results in slight performance
* boost on LP64 architectures. The catch is we don't
* really care if 32 MSBs of a 64-bit register get polluted
* with eventual overflows as we *save* only 32 LSBs in
* *either* case. Now declaring 'em long excuses the compiler
* from keeping 32 MSBs zeroed resulting in 13% performance
* improvement under SPARC Solaris7/64 and 5% under AlphaLinux.
* Well, to be honest it should say that this *prevents*
* performance degradation.
*
* <appro@fy.chalmers.se>
*/
register unsigned MD32_REG_T A,B,C,D,l;
#ifndef MD32_XARRAY
/* See comment in crypto/sha/sha_locl.h for details. */
unsigned long XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
# define X(i) XX##i
#else
MD5_LONG XX[MD5_LBLOCK];

View File

@@ -58,7 +58,7 @@
#include <stdlib.h>
#include <string.h>
#include <openssl/opensslconf.h>
#include <openssl/e_os2.h>
#include <openssl/md5.h>
#ifndef MD5_LONG_LOG2

View File

@@ -826,8 +826,8 @@ static ASN1_OBJECT nid_objs[NUM_NID]={
{"RSA-MDC2","mdc2WithRSA",NID_mdc2WithRSA,4,&(lvalues[531]),0},
{"RC4-40","rc4-40",NID_rc4_40,0,NULL},
{"RC2-40-CBC","rc2-40-cbc",NID_rc2_40_cbc,0,NULL},
{"gn","givenName",NID_givenName,3,&(lvalues[535]),0},
{"SN","surname",NID_surname,3,&(lvalues[538]),0},
{"GN","givenName",NID_givenName,3,&(lvalues[535]),0},
{"SN","surName",NID_surname,3,&(lvalues[538]),0},
{"initials","initials",NID_initials,3,&(lvalues[541]),0},
{NULL,NULL,NID_undef,0,NULL},
{"crlDistributionPoints","X509v3 CRL Distribution Points",
@@ -1780,6 +1780,7 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
&(nid_objs[70]),/* "DSA-SHA1-old" */
&(nid_objs[67]),/* "DSA-old" */
&(nid_objs[297]),/* "DVCS" */
&(nid_objs[99]),/* "GN" */
&(nid_objs[381]),/* "IANA" */
&(nid_objs[34]),/* "IDEA-CBC" */
&(nid_objs[35]),/* "IDEA-CFB" */
@@ -1926,7 +1927,6 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={
&(nid_objs[490]),/* "friendlyCountryName" */
&(nid_objs[156]),/* "friendlyName" */
&(nid_objs[509]),/* "generationQualifier" */
&(nid_objs[99]),/* "gn" */
&(nid_objs[163]),/* "hmacWithSHA1" */
&(nid_objs[432]),/* "holdInstructionCallIssuer" */
&(nid_objs[430]),/* "holdInstructionCode" */
@@ -3005,7 +3005,7 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
&(nid_objs[16]),/* "stateOrProvinceName" */
&(nid_objs[498]),/* "subtreeMaximumQuality" */
&(nid_objs[497]),/* "subtreeMinimumQuality" */
&(nid_objs[100]),/* "surname" */
&(nid_objs[100]),/* "surName" */
&(nid_objs[459]),/* "textEncodedORAddress" */
&(nid_objs[293]),/* "textNotice" */
&(nid_objs[106]),/* "title" */

View File

@@ -1596,7 +1596,7 @@
#define OBJ_commonName OBJ_X509,3L
#define SN_surname "SN"
#define LN_surname "surname"
#define LN_surname "surName"
#define NID_surname 100
#define OBJ_surname OBJ_X509,4L
@@ -1642,7 +1642,7 @@
#define NID_name 173
#define OBJ_name OBJ_X509,41L
#define SN_givenName "gn"
#define SN_givenName "GN"
#define LN_givenName "givenName"
#define NID_givenName 99
#define OBJ_givenName OBJ_X509,42L

View File

@@ -531,7 +531,8 @@ algorithm 29 : RSA-SHA1-2 : sha1WithRSA
X500 4 : X509
X509 3 : CN : commonName
X509 4 : SN : surname
!Cname surname
X509 4 : SN : surName
X509 5 : : serialNumber
X509 6 : C : countryName
X509 7 : L : localityName
@@ -541,7 +542,7 @@ X509 11 : OU : organizationalUnitName
X509 12 : : title
X509 13 : : description
X509 41 : name : name
X509 42 : gn : givenName
X509 42 : GN : givenName
X509 43 : : initials
X509 44 : : generationQualifier
X509 45 : : x500UniqueIdentifier

View File

@@ -47,7 +47,7 @@
#endif
#endif
#if (defined(HEADER_DES_H) || defined(HEADER_DES_OLD_H)) && !defined(DES_LONG)
#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
* %20 speed up (longs are 8 bytes, int's are 4). */
#ifndef DES_LONG

View File

@@ -25,8 +25,8 @@
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
* major minor fix final patch/beta)
*/
#define OPENSSL_VERSION_NUMBER 0x00907006L
#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7-beta6-dev xx XXX 2002"
#define OPENSSL_VERSION_NUMBER 0x0090700fL
#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7 31 Dec 2002"
#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT

View File

@@ -55,6 +55,8 @@
#ifndef HEADER_OPENSSL_TYPES_H
#define HEADER_OPENSSL_TYPES_H
#include <openssl/e_os2.h>
#ifdef NO_ASN1_TYPEDEFS
#define ASN1_INTEGER ASN1_STRING
#define ASN1_ENUMERATED ASN1_STRING

View File

@@ -146,9 +146,15 @@ sub cbc
&mov($count, &wparam(2)); # length
&and($count, 7);
&jz(&label("finish"));
&call(&label("PIC_point"));
&set_label("PIC_point");
&blindpop("edx");
&lea("ecx",&DWP(&label("cbc_enc_jmp_table")."-".&label("PIC_point"),"edx"));
&mov($count,&DWP(0,"ecx",$count,4))
&add($count,"edx");
&xor("ecx","ecx");
&xor("edx","edx");
&mov($count,&DWP(&label("cbc_enc_jmp_table"),"",$count,4));
#&mov($count,&DWP(&label("cbc_enc_jmp_table"),"",$count,4));
&jmp_ptr($count);
&set_label("ej7");
@@ -318,22 +324,23 @@ sub cbc
&set_label("cbc_enc_jmp_table",1);
&data_word("0");
&data_word(&label("ej1"));
&data_word(&label("ej2"));
&data_word(&label("ej3"));
&data_word(&label("ej4"));
&data_word(&label("ej5"));
&data_word(&label("ej6"));
&data_word(&label("ej7"));
&set_label("cbc_dec_jmp_table",1);
&data_word("0");
&data_word(&label("dj1"));
&data_word(&label("dj2"));
&data_word(&label("dj3"));
&data_word(&label("dj4"));
&data_word(&label("dj5"));
&data_word(&label("dj6"));
&data_word(&label("dj7"));
&data_word(&label("ej1")."-".&label("PIC_point"));
&data_word(&label("ej2")."-".&label("PIC_point"));
&data_word(&label("ej3")."-".&label("PIC_point"));
&data_word(&label("ej4")."-".&label("PIC_point"));
&data_word(&label("ej5")."-".&label("PIC_point"));
&data_word(&label("ej6")."-".&label("PIC_point"));
&data_word(&label("ej7")."-".&label("PIC_point"));
# not used
#&set_label("cbc_dec_jmp_table",1);
#&data_word("0");
#&data_word(&label("dj1")."-".&label("PIC_point"));
#&data_word(&label("dj2")."-".&label("PIC_point"));
#&data_word(&label("dj3")."-".&label("PIC_point"));
#&data_word(&label("dj4")."-".&label("PIC_point"));
#&data_word(&label("dj5")."-".&label("PIC_point"));
#&data_word(&label("dj6")."-".&label("PIC_point"));
#&data_word(&label("dj7")."-".&label("PIC_point"));
&function_end_B($name);

View File

@@ -92,6 +92,8 @@ sub get_mem
$addr="_$addr";
}
if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; }
$reg1="$regs{$reg1}" if defined($regs{$reg1});
$reg2="$regs{$reg2}" if defined($regs{$reg2});
if (($addr ne "") && ($addr ne 0))
@@ -111,6 +113,7 @@ sub get_mem
{
$ret.="[$reg1$post]"
}
$ret =~ s/\[\]//; # in case $addr was the only argument
return($ret);
}
@@ -151,7 +154,7 @@ sub main'push { &out1("push",@_); $stack+=4; }
sub main'pop { &out1("pop",@_); $stack-=4; }
sub main'bswap { &out1("bswap",@_); &using486(); }
sub main'not { &out1("not",@_); }
sub main'call { &out1("call",'_'.$_[0]); }
sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); }
sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); }
@@ -338,7 +341,7 @@ sub main'set_label
{
if (!defined($label{$_[0]}))
{
$label{$_[0]}="${label}${_[0]}";
$label{$_[0]}="\$${label}${_[0]}";
$label++;
}
if((defined $_[2]) && ($_[2] == 1))
@@ -363,3 +366,5 @@ sub out1p
push(@out,"\t$name\t ".&conv($p1)."\n");
}
sub main'blindpop { &out1("pop",@_); }

View File

@@ -98,6 +98,8 @@ sub get_mem
$addr="_$addr";
}
if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; }
$reg1="$regs{$reg1}" if defined($regs{$reg1});
$reg2="$regs{$reg2}" if defined($regs{$reg2});
if (($addr ne "") && ($addr ne 0))
@@ -117,6 +119,7 @@ sub get_mem
{
$ret.="$reg1$post]"
}
$ret =~ s/\+\]/]/; # in case $addr was the only argument
return($ret);
}
@@ -160,7 +163,7 @@ sub main'push { &out1("push",@_); $stack+=4; }
sub main'pop { &out1("pop",@_); $stack-=4; }
sub main'bswap { &out1("bswap",@_); &using486(); }
sub main'not { &out1("not",@_); }
sub main'call { &out1("call",'_'.$_[0]); }
sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); }
sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); }
@@ -322,7 +325,7 @@ sub main'set_label
{
if (!defined($label{$_[0]}))
{
$label{$_[0]}="${label}${_[0]}";
$label{$_[0]}="\$${label}${_[0]}";
$label++;
}
push(@out,"$label{$_[0]}:\n");
@@ -340,3 +343,5 @@ sub out1p
push(@out,"\t$name\t ".&conv($p1)."\n");
}
sub main'blindpop { &out1("pop",@_); }

View File

@@ -87,12 +87,12 @@ sub main'DWP
$ret.=$addr if ($addr ne "") && ($addr ne 0);
if ($reg2 ne "")
{
if($idx ne "")
if($idx ne "" && $idx != 0)
{ $ret.="($reg1,$reg2,$idx)"; }
else
{ $ret.="($reg1,$reg2)"; }
}
else
elsif ($reg1 ne "")
{ $ret.="($reg1)" }
return($ret);
}
@@ -167,7 +167,7 @@ sub main'pop { &out1("popl",@_); $stack-=4; }
sub main'pushf { &out0("pushf"); $stack+=4; }
sub main'popf { &out0("popf"); $stack-=4; }
sub main'not { &out1("notl",@_); }
sub main'call { &out1("call",$under.$_[0]); }
sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); }
sub main'ret { &out0("ret"); }
sub main'nop { &out0("nop"); }
@@ -542,3 +542,22 @@ sub popvars
&main'pop("edx");
&main'popf();
}
sub main'picmeup
{
local($dst,$sym)=@_;
local($tmp)=<<___;
#if (defined(ELF) || defined(SOL)) && defined(PIC)
.align 8
call 1f
1: popl $regs{$dst}
addl \$_GLOBAL_OFFSET_TABLE_+[.-1b],$regs{$dst}
movl $sym\@GOT($regs{$dst}),$regs{$dst}
#else
leal $sym,$regs{$dst}
#endif
___
push(@out,$tmp);
}
sub main'blindpop { &out1("popl",@_); }

View File

@@ -149,8 +149,28 @@
#if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)
#define ROTATE_l32(a,n) _lrotl(a,n)
#define ROTATE_r32(a,n) _lrotr(a,n)
#else
#elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(NO_ASM) && !defined(NO_INLINE_ASM)
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
# define ROTATE_l32(a,n) ({ register unsigned int ret; \
asm ("roll %%cl,%0" \
: "=r"(ret) \
: "c"(n),"0"(a) \
: "cc"); \
ret; \
})
# define ROTATE_r32(a,n) ({ register unsigned int ret; \
asm ("rorl %%cl,%0" \
: "=r"(ret) \
: "c"(n),"0"(a) \
: "cc"); \
ret; \
})
# endif
#endif
#ifndef ROTATE_l32
#define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f))))
#endif
#ifndef ROTATE_r32
#define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f)))
#endif

View File

@@ -90,8 +90,8 @@ int RIPEMD160_Init(RIPEMD160_CTX *c)
void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
{
const RIPEMD160_LONG *XX=p;
register unsigned long A,B,C,D,E;
register unsigned long a,b,c,d,e;
register unsigned MD32_REG_T A,B,C,D,E;
register unsigned MD32_REG_T a,b,c,d,e;
for (;num--;XX+=HASH_LBLOCK)
{
@@ -290,12 +290,12 @@ void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, int num)
{
const unsigned char *data=p;
register unsigned long A,B,C,D,E;
unsigned long a,b,c,d,e,l;
register unsigned MD32_REG_T A,B,C,D,E;
unsigned MD32_REG_T a,b,c,d,e,l;
#ifndef MD32_XARRAY
/* See comment in crypto/sha/sha_locl.h for details. */
unsigned long XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
# define X(i) XX##i
#else
RIPEMD160_LONG XX[16];

View File

@@ -224,10 +224,10 @@ int HASH_INIT (SHA_CTX *c)
void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, int num)
{
const SHA_LONG *W=d;
register unsigned long A,B,C,D,E,T;
register unsigned MD32_REG_T A,B,C,D,E,T;
#ifndef MD32_XARRAY
unsigned long XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
#else
SHA_LONG XX[16];
#endif
@@ -349,10 +349,10 @@ void HASH_BLOCK_HOST_ORDER (SHA_CTX *c, const void *d, int num)
void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, int num)
{
const unsigned char *data=p;
register unsigned long A,B,C,D,E,T,l;
register unsigned MD32_REG_T A,B,C,D,E,T,l;
#ifndef MD32_XARRAY
unsigned long XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
unsigned MD32_REG_T XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
#else
SHA_LONG XX[16];
#endif

View File

@@ -1158,7 +1158,7 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx)
ctx->chain=NULL;
}
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, &(ctx->ex_data));
OPENSSL_cleanse(&ctx->ex_data,sizeof(CRYPTO_EX_DATA));
memset(&ctx->ex_data,0,sizeof(CRYPTO_EX_DATA));
}
void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags)

View File

@@ -203,6 +203,10 @@ cipher suites using DH, including anonymous DH.
anonymous DH cipher suites.
=item B<AES>
cipher suites using AES.
=item B<3DES>
cipher suites using triple DES.
@@ -236,7 +240,9 @@ cipher suites using SHA1.
=head1 CIPHER SUITE NAMES
The following lists give the SSL or TLS cipher suites names from the
relevant specification and their OpenSSL equivalents.
relevant specification and their OpenSSL equivalents. It should be noted,
that several cipher suite names do not include the authentication used,
e.g. DES-CBC3-SHA. In these cases, RSA authentication is used.
=head2 SSL v3.0 cipher suites.
@@ -306,6 +312,24 @@ relevant specification and their OpenSSL equivalents.
TLS_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA
TLS_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA
=head2 AES ciphersuites from RFC3268, extending TLS v1.0
TLS_RSA_WITH_AES_128_CBC_SHA AES128-SHA
TLS_RSA_WITH_AES_256_CBC_SHA AES256-SHA
TLS_DH_DSS_WITH_AES_128_CBC_SHA DH-DSS-AES128-SHA
TLS_DH_DSS_WITH_AES_256_CBC_SHA DH-DSS-AES256-SHA
TLS_DH_RSA_WITH_AES_128_CBC_SHA DH-RSA-AES128-SHA
TLS_DH_RSA_WITH_AES_256_CBC_SHA DH-RSA-AES256-SHA
TLS_DHE_DSS_WITH_AES_128_CBC_SHA DHE-DSS-AES128-SHA
TLS_DHE_DSS_WITH_AES_256_CBC_SHA DHE-DSS-AES256-SHA
TLS_DHE_RSA_WITH_AES_128_CBC_SHA DHE-RSA-AES128-SHA
TLS_DHE_RSA_WITH_AES_256_CBC_SHA DHE-RSA-AES256-SHA
TLS_DH_anon_WITH_AES_128_CBC_SHA ADH-AES128-SHA
TLS_DH_anon_WITH_AES_256_CBC_SHA ADH-AES256-SHA
=head2 Additional Export 1024 and other cipher suites
Note: these ciphers can also be used in SSL v3.

View File

@@ -1,103 +0,0 @@
=pod
=head1 NAME
BIO_new_bio_pair - create a new BIO pair
=head1 SYNOPSIS
#include <openssl/bio.h>
int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2);
=head1 DESCRIPTION
BIO_new_bio_pair() creates a buffering BIO pair based on the
L<SSL_set_bio(3)|SSL_set_bio(3)> method. The BIO pair has two endpoints between which
data can be buffered. Its typical use is to connect one endpoint as underlying
input/output BIO to an SSL and access the other one controlled by the program
instead of accessing the network connection directly.
The two new BIOs B<bio1> and B<bio2> are symmetric with respect to their
functionality. The size of their buffers is determined by B<writebuf1> and
B<writebuf2>. If the size give is 0, the default size is used.
BIO_new_bio_pair() does not check whether B<bio1> or B<bio2> do point to
some other BIO, the values are overwritten, BIO_free() is not called.
The two BIOs, even though forming a BIO pair and must be BIO_free()'ed
separately. This can be of importance, as some SSL-functions like SSL_set_bio()
or SSL_free() call BIO_free() implicitly, so that the peer-BIO is left
untouched and must also be BIO_free()'ed.
=head1 EXAMPLE
The BIO pair can be used to have full control over the network access of an
application. The application can call select() on the socket as required
without having to go through the SSL-interface.
BIO *internal_bio, *network_bio;
...
BIO_new_bio_pair(internal_bio, 0, network_bio, 0);
SSL_set_bio(ssl, internal_bio, internal_bio);
SSL_operations();
...
application | TLS-engine
| |
+----------> SSL_operations()
| /\ ||
| || \/
| BIO-pair (internal_bio)
+----------< BIO-pair (network_bio)
| |
socket |
...
SSL_free(ssl); /* implicitly frees internal_bio */
BIO_free(network_bio);
...
As the BIO pair will only buffer the data and never directly access the
connection, it behaves non-blocking and will return as soon as the write
buffer is full or the read buffer is drained. Then the application has to
flush the write buffer and/or fill the read buffer.
Use the BIO_ctrl_pending(), to find out whether data is buffered in the BIO
and must be transfered to the network. Use BIO_ctrl_get_read_request() to
find out, how many bytes must be written into the buffer before the
SSL_operation() can successfully be continued.
=head1 WARNING
As the data is buffered, SSL_operation() may return with a ERROR_SSL_WANT_READ
condition, but there is still data in the write buffer. An application must
not rely on the error value of SSL_operation() but must assure that the
write buffer is always flushed first. Otherwise a deadlock may occur as
the peer might be waiting for the data before being able to continue.
=head1 RETURN VALUES
The following return values can occur:
=over 4
=item 1
The BIO pair was created successfully. The new BIOs are available in
B<bio1> and B<bio2>.
=item 0
The operation failed. The NULL pointer is stored into the locations for
B<bio1> and B<bio2>. Check the error stack for more information.
=back
=head1 SEE ALSO
L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>,
L<BIO_ctrl_pending(3)|BIO_ctrl_pending(3)>,
L<BIO_ctrl_get_read_request(3)|BIO_ctrl_get_read_request(3)>
=cut

View File

@@ -2,7 +2,7 @@
=head1 NAME
BIO_s_accept, BIO_set_nbio, BIO_set_accept_port, BIO_get_accept_port,
BIO_s_accept, BIO_set_accept_port, BIO_get_accept_port,
BIO_set_nbio_accept, BIO_set_accept_bios, BIO_set_bind_mode,
BIO_get_bind_mode, BIO_do_accept - accept BIO

View File

@@ -76,7 +76,9 @@ BIO_get_write_buf_size() returns the size of the write buffer.
BIO_new_bio_pair() combines the calls to BIO_new(), BIO_make_bio_pair() and
BIO_set_write_buf_size() to create a connected pair of BIOs B<bio1>, B<bio2>
with write buffer sizes B<writebuf1> and B<writebuf2>. If either size is
zero then the default size is used.
zero then the default size is used. BIO_new_bio_pair() does not check whether
B<bio1> or B<bio2> do point to some other BIO, the values are overwritten,
BIO_free() is not called.
BIO_get_write_guarantee() and BIO_ctrl_get_write_guarantee() return the maximum
length of data that can be currently written to the BIO. Writes larger than this
@@ -118,9 +120,59 @@ the application then waits for data to be available on the underlying transport
before flushing the write buffer it will never succeed because the request was
never sent!
=head1 RETURN VALUES
BIO_new_bio_pair() returns 1 on success, with the new BIOs available in
B<bio1> and B<bio2>, or 0 on failure, with NULL pointers stored into the
locations for B<bio1> and B<bio2>. Check the error stack for more information.
[XXXXX: More return values need to be added here]
=head1 EXAMPLE
TBA
The BIO pair can be used to have full control over the network access of an
application. The application can call select() on the socket as required
without having to go through the SSL-interface.
BIO *internal_bio, *network_bio;
...
BIO_new_bio_pair(internal_bio, 0, network_bio, 0);
SSL_set_bio(ssl, internal_bio, internal_bio);
SSL_operations();
...
application | TLS-engine
| |
+----------> SSL_operations()
| /\ ||
| || \/
| BIO-pair (internal_bio)
+----------< BIO-pair (network_bio)
| |
socket |
...
SSL_free(ssl); /* implicitly frees internal_bio */
BIO_free(network_bio);
...
As the BIO pair will only buffer the data and never directly access the
connection, it behaves non-blocking and will return as soon as the write
buffer is full or the read buffer is drained. Then the application has to
flush the write buffer and/or fill the read buffer.
Use the BIO_ctrl_pending(), to find out whether data is buffered in the BIO
and must be transfered to the network. Use BIO_ctrl_get_read_request() to
find out, how many bytes must be written into the buffer before the
SSL_operation() can successfully be continued.
=head1 WARNING
As the data is buffered, SSL_operation() may return with a ERROR_SSL_WANT_READ
condition, but there is still data in the write buffer. An application must
not rely on the error value of SSL_operation() but must assure that the
write buffer is always flushed first. Otherwise a deadlock may occur as
the peer might be waiting for the data before being able to continue.
=head1 SEE ALSO

View File

@@ -187,7 +187,7 @@ tell which one you are dealing with at any given point in time (after all
they are both simply (ENGINE *) pointers, the difference is in the way they
are used).
=head3 Structural references
I<Structural references>
This basic type of reference is typically used for creating new ENGINEs
dynamically, iterating across OpenSSL's internal linked-list of loaded
@@ -224,7 +224,7 @@ To clarify a particular function's handling of references, one should
always consult that function's documentation "man" page, or failing that
the openssl/engine.h header file includes some hints.
=head3 Functional references
I<Functional references>
As mentioned, functional references exist when the cryptographic
functionality of an ENGINE is required to be available. A functional
@@ -386,7 +386,7 @@ things, so we will simply illustrate the consequences as they apply to a
couple of simple cases and leave developers to consider these and the
source code to openssl's builtin utilities as guides.
=head3 Using a specific ENGINE implementation
I<Using a specific ENGINE implementation>
Here we'll assume an application has been configured by its user or admin
to want to use the "ACME" ENGINE if it is available in the version of
@@ -418,7 +418,7 @@ illustrates how to approach this;
/* Release the structural reference from ENGINE_by_id() */
ENGINE_free(e);
=head3 Automatically using builtin ENGINE implementations
I<Automatically using builtin ENGINE implementations>
Here we'll assume we want to load and register all ENGINE implementations
bundled with OpenSSL, such that for any cryptographic algorithm required by
@@ -469,7 +469,7 @@ in same cases both. ENGINE implementations should provide indications of
this in the descriptions attached to builtin control commands and/or in
external product documentation.
=head3 Issuing control commands to an ENGINE
I<Issuing control commands to an ENGINE>
Let's illustrate by example; a function for which the caller supplies the
name of the ENGINE it wishes to use, a table of string-pairs for use before
@@ -526,7 +526,7 @@ return success without doing anything. In this case we assume the user is
only supplying commands specific to the given ENGINE so we set this to
FALSE.
=head3 Discovering supported control commands
I<Discovering supported control commands>
It is possible to discover at run-time the names, numerical-ids, descriptions
and input parameters of the control commands supported from a structural

View File

@@ -42,9 +42,6 @@ whole or at least great parts) in OpenSSL.
2268 A Description of the RC2(r) Encryption Algorithm. R. Rivest.
January 1998. (Format: TXT=19048 bytes) (Status: INFORMATIONAL)
2314 PKCS 10: Certification Request Syntax Version 1.5. B. Kaliski.
March 1998. (Format: TXT=15814 bytes) (Status: INFORMATIONAL)
2315 PKCS 7: Cryptographic Message Syntax Version 1.5. B. Kaliski.
March 1998. (Format: TXT=69679 bytes) (Status: INFORMATIONAL)
@@ -52,10 +49,6 @@ whole or at least great parts) in OpenSSL.
J. Staddon. October 1998. (Format: TXT=73529 bytes) (Obsoletes
RFC2313) (Status: INFORMATIONAL)
2459 Internet X.509 Public Key Infrastructure Certificate and CRL
Profile. R. Housley, W. Ford, W. Polk, D. Solo. January 1999.
(Format: TXT=278438 bytes) (Status: PROPOSED STANDARD)
PKCS#8: Private-Key Information Syntax Standard
PKCS#12: Personal Information Exchange Syntax Standard, version 1.0.
@@ -65,6 +58,35 @@ PKCS#12: Personal Information Exchange Syntax Standard, version 1.0.
C. Adams. June 1999. (Format: TXT=43243 bytes) (Status: PROPOSED
STANDARD)
2712 Addition of Kerberos Cipher Suites to Transport Layer Security
(TLS). A. Medvinsky, M. Hur. October 1999. (Format: TXT=13763 bytes)
(Status: PROPOSED STANDARD)
2898 PKCS #5: Password-Based Cryptography Specification Version 2.0.
B. Kaliski. September 2000. (Format: TXT=68692 bytes) (Status:
INFORMATIONAL)
2986 PKCS #10: Certification Request Syntax Specification Version 1.7.
M. Nystrom, B. Kaliski. November 2000. (Format: TXT=27794 bytes)
(Obsoletes RFC2314) (Status: INFORMATIONAL)
3174 US Secure Hash Algorithm 1 (SHA1). D. Eastlake 3rd, P. Jones.
September 2001. (Format: TXT=35525 bytes) (Status: INFORMATIONAL)
3268 Advanced Encryption Standard (AES) Ciphersuites for Transport
Layer Security (TLS). P. Chown. June 2002. (Format: TXT=13530 bytes)
(Status: PROPOSED STANDARD)
3279 Algorithms and Identifiers for the Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List (CRL)
Profile. L. Bassham, W. Polk, R. Housley. April 2002. (Format:
TXT=53833 bytes) (Status: PROPOSED STANDARD)
3280 Internet X.509 Public Key Infrastructure Certificate and
Certificate Revocation List (CRL) Profile. R. Housley, W. Polk, W.
Ford, D. Solo. April 2002. (Format: TXT=295556 bytes) (Obsoletes
RFC2459) (Status: PROPOSED STANDARD)
Related:
--------
@@ -90,23 +112,60 @@ STARTTLS documents.
Certification and Related Services. B. Kaliski. February 1993.
(Format: TXT=17537 bytes) (Status: PROPOSED STANDARD)
2256 A Summary of the X.500(96) User Schema for use with LDAPv3. M.
Wahl. December 1997. (Format: TXT=32377 bytes) (Status: PROPOSED
STANDARD)
2025 The Simple Public-Key GSS-API Mechanism (SPKM). C. Adams. October
1996. (Format: TXT=101692 bytes) (Status: PROPOSED STANDARD)
2487 SMTP Service Extension for Secure SMTP over TLS. P. Hoffman.
January 1999. (Format: TXT=15120 bytes) (Status: PROPOSED STANDARD)
2510 Internet X.509 Public Key Infrastructure Certificate Management
Protocols. C. Adams, S. Farrell. March 1999. (Format: TXT=158178
bytes) (Status: PROPOSED STANDARD)
2511 Internet X.509 Certificate Request Message Format. M. Myers, C.
Adams, D. Solo, D. Kemp. March 1999. (Format: TXT=48278 bytes)
(Status: PROPOSED STANDARD)
2527 Internet X.509 Public Key Infrastructure Certificate Policy and
Certification Practices Framework. S. Chokhani, W. Ford. March 1999.
(Format: TXT=91860 bytes) (Status: INFORMATIONAL)
2538 Storing Certificates in the Domain Name System (DNS). D. Eastlake
3rd, O. Gudmundsson. March 1999. (Format: TXT=19857 bytes) (Status:
PROPOSED STANDARD)
2539 Storage of Diffie-Hellman Keys in the Domain Name System (DNS).
D. Eastlake 3rd. March 1999. (Format: TXT=21049 bytes) (Status:
PROPOSED STANDARD)
2559 Internet X.509 Public Key Infrastructure Operational Protocols -
LDAPv2. S. Boeyen, T. Howes, P. Richard. April 1999. (Format:
TXT=22889 bytes) (Updates RFC1778) (Status: PROPOSED STANDARD)
2585 Internet X.509 Public Key Infrastructure Operational Protocols:
FTP and HTTP. R. Housley, P. Hoffman. May 1999. (Format: TXT=14813
bytes) (Status: PROPOSED STANDARD)
2587 Internet X.509 Public Key Infrastructure LDAPv2 Schema. S.
Boeyen, T. Howes, P. Richard. June 1999. (Format: TXT=15102 bytes)
(Status: PROPOSED STANDARD)
2595 Using TLS with IMAP, POP3 and ACAP. C. Newman. June 1999.
(Format: TXT=32440 bytes) (Status: PROPOSED STANDARD)
2712 Addition of Kerberos Cipher Suites to Transport Layer Security
(TLS). A. Medvinsky, M. Hur. October 1999. (Format: TXT=13763 bytes)
(Status: PROPOSED STANDARD)
2631 Diffie-Hellman Key Agreement Method. E. Rescorla. June 1999.
(Format: TXT=25932 bytes) (Status: PROPOSED STANDARD)
2632 S/MIME Version 3 Certificate Handling. B. Ramsdell, Ed.. June
1999. (Format: TXT=27925 bytes) (Status: PROPOSED STANDARD)
2716 PPP EAP TLS Authentication Protocol. B. Aboba, D. Simon. October
1999. (Format: TXT=50108 bytes) (Status: EXPERIMENTAL)
2773 Encryption using KEA and SKIPJACK. R. Housley, P. Yee, W. Nace.
February 2000. (Format: TXT=20008 bytes) (Updates RFC0959) (Status:
EXPERIMENTAL)
2797 Certificate Management Messages over CMS. M. Myers, X. Liu, J.
Schaad, J. Weinstein. April 2000. (Format: TXT=103357 bytes) (Status:
PROPOSED STANDARD)
2817 Upgrading to TLS Within HTTP/1.1. R. Khare, S. Lawrence. May
2000. (Format: TXT=27598 bytes) (Updates RFC2616) (Status: PROPOSED
@@ -115,6 +174,77 @@ STARTTLS documents.
2818 HTTP Over TLS. E. Rescorla. May 2000. (Format: TXT=15170 bytes)
(Status: INFORMATIONAL)
2876 Use of the KEA and SKIPJACK Algorithms in CMS. J. Pawling. July
2000. (Format: TXT=29265 bytes) (Status: INFORMATIONAL)
2984 Use of the CAST-128 Encryption Algorithm in CMS. C. Adams.
October 2000. (Format: TXT=11591 bytes) (Status: PROPOSED STANDARD)
2985 PKCS #9: Selected Object Classes and Attribute Types Version 2.0.
M. Nystrom, B. Kaliski. November 2000. (Format: TXT=70703 bytes)
(Status: INFORMATIONAL)
3029 Internet X.509 Public Key Infrastructure Data Validation and
Certification Server Protocols. C. Adams, P. Sylvester, M. Zolotarev,
R. Zuccherato. February 2001. (Format: TXT=107347 bytes) (Status:
EXPERIMENTAL)
3039 Internet X.509 Public Key Infrastructure Qualified Certificates
Profile. S. Santesson, W. Polk, P. Barzin, M. Nystrom. January 2001.
(Format: TXT=67619 bytes) (Status: PROPOSED STANDARD)
3058 Use of the IDEA Encryption Algorithm in CMS. S. Teiwes, P.
Hartmann, D. Kuenzi. February 2001. (Format: TXT=17257 bytes)
(Status: INFORMATIONAL)
3161 Internet X.509 Public Key Infrastructure Time-Stamp Protocol
(TSP). C. Adams, P. Cain, D. Pinkas, R. Zuccherato. August 2001.
(Format: TXT=54585 bytes) (Status: PROPOSED STANDARD)
3185 Reuse of CMS Content Encryption Keys. S. Farrell, S. Turner.
October 2001. (Format: TXT=20404 bytes) (Status: PROPOSED STANDARD)
3207 SMTP Service Extension for Secure SMTP over Transport Layer
Security. P. Hoffman. February 2002. (Format: TXT=18679 bytes)
(Obsoletes RFC2487) (Status: PROPOSED STANDARD)
3217 Triple-DES and RC2 Key Wrapping. R. Housley. December 2001.
(Format: TXT=19855 bytes) (Status: INFORMATIONAL)
3274 Compressed Data Content Type for Cryptographic Message Syntax
(CMS). P. Gutmann. June 2002. (Format: TXT=11276 bytes) (Status:
PROPOSED STANDARD)
3278 Use of Elliptic Curve Cryptography (ECC) Algorithms in
Cryptographic Message Syntax (CMS). S. Blake-Wilson, D. Brown, P.
Lambert. April 2002. (Format: TXT=33779 bytes) (Status:
INFORMATIONAL)
3281 An Internet Attribute Certificate Profile for Authorization. S.
Farrell, R. Housley. April 2002. (Format: TXT=90580 bytes) (Status:
PROPOSED STANDARD)
3369 Cryptographic Message Syntax (CMS). R. Housley. August 2002.
(Format: TXT=113975 bytes) (Obsoletes RFC2630, RFC3211) (Status:
PROPOSED STANDARD)
3370 Cryptographic Message Syntax (CMS) Algorithms. R. Housley. August
2002. (Format: TXT=51001 bytes) (Obsoletes RFC2630, RFC3211) (Status:
PROPOSED STANDARD)
3377 Lightweight Directory Access Protocol (v3): Technical
Specification. J. Hodges, R. Morgan. September 2002. (Format:
TXT=9981 bytes) (Updates RFC2251, RFC2252, RFC2253, RFC2254, RFC2255,
RFC2256, RFC2829, RFC2830) (Status: PROPOSED STANDARD)
3394 Advanced Encryption Standard (AES) Key Wrap Algorithm. J. Schaad,
R. Housley. September 2002. (Format: TXT=73072 bytes) (Status:
INFORMATIONAL)
3436 Transport Layer Security over Stream Control Transmission
Protocol. A. Jungmaier, E. Rescorla, M. Tuexen. December 2002.
(Format: TXT=16333 bytes) (Status: PROPOSED STANDARD)
"Securing FTP with TLS", 01/27/2000, <draft-murray-auth-ftp-ssl-05.txt>
@@ -124,7 +254,3 @@ To be implemented:
These are documents that describe things that are planed to be
implemented in the hopefully short future.
2712 Addition of Kerberos Cipher Suites to Transport Layer Security
(TLS). A. Medvinsky, M. Hur. October 1999. (Format: TXT=13763 bytes)
(Status: PROPOSED STANDARD)

View File

@@ -17,7 +17,6 @@ MAKEFILE= Makefile.ssl
AR= ar r
# KRB5 stuff
KRB5_INCLUDES=
LIBKRB5=
CFLAGS= $(INCLUDES) $(CFLAG)

View File

@@ -1961,7 +1961,7 @@ krb5_error_code kssl_check_authent(
const EVP_CIPHER *enc = NULL;
unsigned char iv[EVP_MAX_IV_LENGTH];
unsigned char *p, *unenc_authent;
int padl, outl, unencbufsize;
int outl, unencbufsize;
struct tm tm_time, *tm_l, *tm_g;
time_t now, tl, tg, tr, tz_offset;
@@ -2029,44 +2029,23 @@ krb5_error_code kssl_check_authent(
*/
goto err;
}
if (!EVP_DecryptInit_ex(&ciph_ctx, enc, NULL, kssl_ctx->key, iv))
{
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT,
"EVP_DecryptInit_ex error decrypting authenticator.\n");
krb5rc = KRB5KRB_AP_ERR_BAD_INTEGRITY;
goto err;
}
if (!EVP_DecryptUpdate(&ciph_ctx, unenc_authent, &outl,
dec_authent->cipher->data, dec_authent->cipher->length))
{
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT,
"EVP_DecryptUpdate error decrypting authenticator.\n");
krb5rc = KRB5KRB_AP_ERR_BAD_INTEGRITY;
goto err;
}
if (outl > unencbufsize)
{
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT,
"Buffer overflow decrypting authenticator.\n");
krb5rc = KRB5KRB_AP_ERR_BAD_INTEGRITY;
goto err;
}
if (!EVP_DecryptFinal_ex(&ciph_ctx, &(unenc_authent[outl]), &padl))
{
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT,
"EVP_DecryptFinal_ex error decrypting authenticator.\n");
krb5rc = KRB5KRB_AP_ERR_BAD_INTEGRITY;
goto err;
}
outl += padl;
if (outl > unencbufsize)
{
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT,
"Buffer overflow decrypting authenticator.\n");
krb5rc = KRB5KRB_AP_ERR_BAD_INTEGRITY;
goto err;
}
EVP_CIPHER_CTX_cleanup(&ciph_ctx);
if (!EVP_CipherInit(&ciph_ctx,enc,kssl_ctx->key,iv,0))
{
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT,
"EVP_CipherInit error decrypting authenticator.\n");
krb5rc = KRB5KRB_AP_ERR_BAD_INTEGRITY;
goto err;
}
outl = dec_authent->cipher->length;
if (!EVP_Cipher(&ciph_ctx,unenc_authent,dec_authent->cipher->data,outl))
{
kssl_err_set(kssl_err, SSL_R_KRB5_S_INIT,
"EVP_Cipher error decrypting authenticator.\n");
krb5rc = KRB5KRB_AP_ERR_BAD_INTEGRITY;
goto err;
}
EVP_CIPHER_CTX_cleanup(&ciph_ctx);
#ifdef KSSL_DEBUG
printf("kssl_check_authent: decrypted authenticator[%d] =\n", outl);
@@ -2115,6 +2094,7 @@ krb5_error_code kssl_check_authent(
if (auth) KRB5_AUTHENT_free((KRB5_AUTHENT *) auth);
if (dec_authent) KRB5_ENCDATA_free(dec_authent);
if (unenc_authent) free(unenc_authent);
EVP_CIPHER_CTX_cleanup(&ciph_ctx);
return krb5rc;
}

View File

@@ -105,7 +105,7 @@ SSL_METHOD *SSLv23_client_method(void)
int ssl23_connect(SSL *s)
{
BUF_MEM *buf;
BUF_MEM *buf=NULL;
unsigned long Time=time(NULL);
void (*cb)(const SSL *ssl,int type,int val)=NULL;
int ret= -1;
@@ -159,6 +159,7 @@ int ssl23_connect(SSL *s)
goto end;
}
s->init_buf=buf;
buf=NULL;
}
if (!ssl3_setup_buffers(s)) { ret= -1; goto end; }
@@ -207,6 +208,8 @@ int ssl23_connect(SSL *s)
}
end:
s->in_handshake--;
if (buf != NULL)
BUF_MEM_free(buf);
if (cb != NULL)
cb(s,SSL_CB_CONNECT_EXIT,ret);
return(ret);

View File

@@ -208,10 +208,13 @@ int ssl2_connect(SSL *s)
if (!BUF_MEM_grow(buf,
SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER))
{
if (buf == s->init_buf)
buf=NULL;
ret= -1;
goto end;
}
s->init_buf=buf;
buf=NULL;
s->init_num=0;
s->state=SSL2_ST_SEND_CLIENT_HELLO_A;
s->ctx->stats.sess_connect++;
@@ -338,6 +341,8 @@ int ssl2_connect(SSL *s)
}
end:
s->in_handshake--;
if (buf != NULL)
BUF_MEM_free(buf);
if (cb != NULL)
cb(s,SSL_CB_CONNECT_EXIT,ret);
return(ret);
@@ -1009,7 +1014,7 @@ static int get_server_finished(SSL *s)
* or bad things can happen */
/* ZZZZZZZZZZZZZ */
s->session->session_id_length=SSL2_SSL_SESSION_ID_LENGTH;
memcpy(s->session->session_id,p,SSL2_SSL_SESSION_ID_LENGTH);
memcpy(s->session->session_id,p+1,SSL2_SSL_SESSION_ID_LENGTH);
}
else
{

View File

@@ -164,7 +164,7 @@ SSL_METHOD *SSLv3_client_method(void)
int ssl3_connect(SSL *s)
{
BUF_MEM *buf;
BUF_MEM *buf=NULL;
unsigned long Time=time(NULL),l;
long num1;
void (*cb)(const SSL *ssl,int type,int val)=NULL;
@@ -225,6 +225,7 @@ int ssl3_connect(SSL *s)
goto end;
}
s->init_buf=buf;
buf=NULL;
}
if (!ssl3_setup_buffers(s)) { ret= -1; goto end; }
@@ -503,6 +504,8 @@ int ssl3_connect(SSL *s)
}
end:
s->in_handshake--;
if (buf != NULL)
BUF_MEM_free(buf);
if (cb != NULL)
cb(s,SSL_CB_CONNECT_EXIT,ret);
return(ret);

View File

@@ -751,7 +751,12 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
*/
if (rule_str == NULL) return(NULL);
if (init_ciphers) load_ciphers();
if (init_ciphers)
{
CRYPTO_w_lock(CRYPTO_LOCK_SSL);
if (init_ciphers) load_ciphers();
CRYPTO_w_unlock(CRYPTO_LOCK_SSL);
}
/*
* To reduce the work to do we only want to process the compiled

View File

@@ -111,9 +111,6 @@
#define _BSD_SOURCE 1 /* Or gethostname won't be declared properly
on Linux and GNU platforms. */
#define _XOPEN_SOURCE_EXTENDED 1 /* Or gethostname won't be declared properly
on Compaq platforms (at least with DEC C).
*/
#include <assert.h>
#include <errno.h>
@@ -134,6 +131,13 @@
#include <openssl/engine.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#define _XOPEN_SOURCE_EXTENDED 1 /* Or gethostname won't be declared properly
on Compaq platforms (at least with DEC C).
Do not try to put it earlier, or IPv6 includes
get screwed...
*/
#ifdef OPENSSL_SYS_WINDOWS
#include <winsock.h>
#include "../crypto/bio/bss_file.c"

View File

@@ -119,8 +119,8 @@ apps:
@(cd ..; $(MAKE) DIRS=apps all)
SET_SO_PATHS=LIBPATH="`cd ..; pwd`"; LD_LIBRARY_PATH="$$LIBPATH"; DYLD_LIBRARY_PATH="$$LIBPATH"; SHLIB_PATH="$$LIBPATH"; \
if [ "$(PLATFORM)" == "DJGPP" ]; then PATH="$$LIBPATH\;$$PATH"; \
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="$$LIBPATH:$$PATH"; fi; \
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="$$LIBPATH\;$$PATH"; \
elif [ "$(PLATFORM)" = "Cygwin" ]; then PATH="$${LIBPATH}:$$PATH"; fi; \
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH
alltests: \

View File

@@ -121,8 +121,12 @@ $ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1
#############################################################################
echo test tls1 with 1024bit anonymous DH, multiple handshakes
$ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1
if ../apps/openssl no-dh; then
echo skipping anonymous DH tests
else
echo test tls1 with 1024bit anonymous DH, multiple handshakes
$ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1
fi
if ../apps/openssl no-rsa; then
echo skipping RSA tests
@@ -130,8 +134,12 @@ else
echo test tls1 with 1024bit RSA, no DHE, multiple handshakes
./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -num 10 -f -time $extra || exit 1
echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1
if ../apps/openssl no-dh; then
echo skipping RSA+DHE tests
else
echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1
fi
fi
exit 0

View File

@@ -159,16 +159,25 @@ $ if $severity .ne. 1 then goto exit3
$
$!###########################################################################
$
$ write sys$output "test tls1 with 1024bit anonymous DH, multiple handshakes"
$ 'ssltest' -v -bio_pair -tls1 -cipher "ADH" -dhe1024dsa -num 10 -f -time
$ if $severity .ne. 1 then goto exit3
$
$ set noon
$ define/user sys$output nla0:
$ mcr 'exe_dir'openssl no-rsa
$ save_severity=$SEVERITY
$ no_rsa=$SEVERITY
$ define/user sys$output nla0:
$ mcr 'exe_dir'openssl no-dh
$ no_dh=$SEVERITY
$ set on
$ if save_severity
$
$ if no_dh
$ then
$ write sys$output "skipping anonymous DH tests"
$ else
$ write sys$output "test tls1 with 1024bit anonymous DH, multiple handshakes"
$ 'ssltest' -v -bio_pair -tls1 -cipher "ADH" -dhe1024dsa -num 10 -f -time
$ if $severity .ne. 1 then goto exit3
$ endif
$
$ if no_rsa
$ then
$ write sys$output "skipping RSA tests"
$ else
@@ -176,9 +185,14 @@ $ write sys$output "test tls1 with 1024bit RSA, no DHE, multiple handshakes"
$ mcr 'texe_dir'ssltest -v -bio_pair -tls1 -cert [-.apps]server2.pem -no_dhe -num 10 -f -time
$ if $severity .ne. 1 then goto exit3
$
$ write sys$output "test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes"
$ mcr 'texe_dir'ssltest -v -bio_pair -tls1 -cert [-.apps]server2.pem -dhe1024dsa -num 10 -f -time
$ if $severity .ne. 1 then goto exit3
$ if no_dh
$ then
$ write sys$output "skipping RSA+DHE tests"
$ else
$ write sys$output "test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes"
$ mcr 'texe_dir'ssltest -v -bio_pair -tls1 -cert [-.apps]server2.pem -dhe1024dsa -num 10 -f -time
$ if $severity .ne. 1 then goto exit3
$ endif
$ endif
$
$ RET = 1

View File

@@ -27,13 +27,15 @@ all:
install:
@for i in $(APPS) ; \
do \
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
done;
@for i in $(MISC_APPS) ; \
do \
(cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
(cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
done;
files: