Compare commits

...

54 Commits

Author SHA1 Message Date
Dr. Stephen Henson
0a0a3ea339 Changes for release 2003-09-30 12:09:13 +00:00
Dr. Stephen Henson
3c28bfdc82 Fix for ASN1 parsing bugs. 2003-09-30 12:05:11 +00:00
Dr. Stephen Henson
4b650cb731 Fix warning on Win32. 2003-09-29 17:17:54 +00:00
Richard Levitte
411a301c04 Make MD5 assembler code able to handle messages larger than 2GB on 32-bit
systems and above.
PR: 664
2003-09-27 22:14:43 +00:00
Richard Levitte
3cb08a4fb1 Have ssl3_ssl3_send_client_verify() change the state to SSL3_ST_SW_CERT_VRFY_B.
PR: 679
2003-09-27 19:32:12 +00:00
Richard Levitte
a01fc63c11 Have ssl3_send_certificate_request() change the state to SSL3_ST_SW_CERT_REQ_B.
PR: 680
2003-09-27 19:28:54 +00:00
Richard Levitte
a5bb5c9688 Remove extra argument to BIO_printf().
PR: 685
2003-09-27 18:31:43 +00:00
Richard Levitte
6023462f60 Correct small documentation error.
PR: 698
2003-09-27 10:39:21 +00:00
Dr. Stephen Henson
94f5c934f6 In order to get the expected self signed error when
calling X509_verify_cert() in x509.c the cert should
not be added to the trusted store.
2003-09-21 02:11:31 +00:00
Geoff Thorpe
19ed670b51 These should be write-locks, not read-locks. 2003-09-08 16:01:38 +00:00
Dr. Stephen Henson
3158c87a02 Only accept a client certificate if the server requests
one, as required by SSL/TLS specs.
2003-09-03 23:35:54 +00:00
Richard Levitte
0841f288e5 Undo the change that left LD_LIBRARY_PATH unchanged. The errors I saw
weren't due to that, but to a change on the SCO machines I used for
testing, where my $PATH was suddenly incorrect.
2003-08-14 06:30:32 +00:00
Bodo Möller
46a539a2c9 make sure no error is left in the queue that is intentionally ignored 2003-08-11 18:56:50 +00:00
Richard Levitte
58c84c1230 Typo, I had typed { instead of [. 2003-08-09 09:30:39 +00:00
Richard Levitte
e5c1a02519 Some installations (currently, it's been noted on a sco5 system where
gcc is used to build with) don't take it too well if LD_LIBRARY_PATH
is messed with when linknig programs.  I'm going to assume that it's
OK to leave it unchanged when linking non-shared.
2003-08-08 09:36:46 +00:00
Richard Levitte
782576dbec Correct two problems, found by Martin Kochanski <cardbox@easynet.co.uk>:
1. CreateToolhelp32Snapshot returns INVALID_HANDLE_VALUE, not NULL, on error.
2. On Windows CE, a snapshot handle is closed with CloseToolhelp32Snapshot,
   not CloseHandle.
2003-08-07 11:57:45 +00:00
Bodo Möller
e9dcc3fb34 add OpenSSL license
fix typo
2003-08-06 10:40:19 +00:00
Bodo Möller
702eb4dc0a tolerate extra data at end of client hello for SSL 3.0 2003-07-21 15:16:20 +00:00
Bodo Möller
a7a53184bf typo 2003-07-21 14:58:32 +00:00
Richard Levitte
8848960020 Add a slash so grep doesn't return both ./crypto/bio/bss_mem.o and
./crypto/mem.o when we're looking for mem.o.
2003-07-03 21:43:50 +00:00
Richard Levitte
f6ab5d5761 Document the last change.
PR: 587
2003-06-19 19:04:17 +00:00
Richard Levitte
a974518704 We set the export flag for 512 *bit* keys, not 512 *byte* ones.
PR: 587
2003-06-19 18:55:53 +00:00
Richard Levitte
d84aa433d4 Incorrect patching removed. 2003-06-12 06:56:45 +00:00
Richard Levitte
647cfb980e Typo.
PR: 584
2003-06-12 01:04:09 +00:00
Richard Levitte
9f0d2f6b09 Make sure ssize_t is defined on SunOS4.
PR: 585
2003-06-12 00:56:30 +00:00
Richard Levitte
29e301065f Make sure DSO-dlfcn works properly on SunOS4.
PR: 585
2003-06-12 00:51:57 +00:00
Richard Levitte
b9c2b03352 Remove debugging output that wasn't supposed to be committed in the first place. 2003-06-11 18:46:22 +00:00
Richard Levitte
c2edb62beb Make sure to NUL-terminate the string on end-of-file (and error)
PR: 643
2003-06-11 18:43:47 +00:00
Richard Levitte
0a02757b03 Correct a typo (basically, one can't just replace 'memset' with
'OPENSSL_cleanse', there's an argument to remove as well).
2003-05-22 09:35:46 +00:00
Richard Levitte
fd37856472 String not properly NUL-terminated when no X509_NAME is given.
PR: 618
2003-05-21 14:44:59 +00:00
Richard Levitte
46956f0670 Don't forget that strlen() doesn't include the ending NUL.
PR: 618
2003-05-21 14:41:02 +00:00
Richard Levitte
528c1ad2ae Cleanse the MD context properly when done adding or getting random data.
PR: 619
2003-05-21 14:35:04 +00:00
Richard Levitte
3b9e8c7c36 Fix sign bugs.
PR: 621
2003-05-21 14:29:22 +00:00
Bodo Möller
3ad23eb282 fix typo
Submitted by: Nils Larsch
2003-04-22 12:45:47 +00:00
Richard Levitte
adc88583a9 Typo.
PR: 562
2003-04-17 21:49:47 +00:00
Richard Levitte
19b114410e Memory leak fix: RSA_blinding_on() didn't free Ai under certain circumstances.
Memory leak fix: RSA_blinding_on() would leave a dangling pointer in
                 rsa->blinding under certain circumstances.
Double definition fix: RSA_FLAG_NO_BLINDING was defined twice.
2003-04-16 06:25:25 +00:00
Richard Levitte
51c21d0fec Memory leak fix: local blinding structure not freed in rsa_eay_private_decrypt() 2003-04-15 13:01:43 +00:00
Richard Levitte
0698f54e0e The release is tagged, time to hope we won't have to work on 0.9.6k. 2003-04-10 20:41:02 +00:00
Richard Levitte
e352a9e6ec I forgot to change the status bits to release.
This file will be retagged.
2003-04-10 20:30:41 +00:00
Richard Levitte
51c4754658 Time to release 0.9.6j.
The ticket will be OpenSSL_0_9_6j.
2003-04-10 20:21:28 +00:00
Richard Levitte
335340af42 make update 2003-04-10 20:11:28 +00:00
Richard Levitte
d373ca98fd Add the change from HEAD that allows us to parse multi-line comments. 2003-04-10 20:07:51 +00:00
Richard Levitte
1db625bcfd new NEWS 2003-04-10 19:33:23 +00:00
Richard Levitte
86d79b3cef Make the same changes for svr5 shared library building as in
0.9.7-stable.
2003-04-09 06:49:01 +00:00
Richard Levitte
e45b2a6218 Some ld implementations use LD_LIBRARY_PATH to find libraries, and
what's worse, they seem to use LD_LIBRARY_PATH as the first
directories to look into.  This is documented in the manual page for
ld on OpenUNIX 8.  Therefore, we need to hack LD_LIBRARY_PATH to
include the directory where the newly built libcrypto and libssl are.
2003-04-09 06:48:19 +00:00
Richard Levitte
5d4bf96a65 Include rand.h, so RAND_status() and friends get properly declared. 2003-04-08 11:07:09 +00:00
Bodo Möller
223c80ea7d make RSA blinding thread-safe 2003-04-02 09:50:17 +00:00
Richard Levitte
60511b8bb8 Fix the problem with missing definition of THREADS on VMS.
Also produce a better configuration header file.
PR: 548
2003-03-27 12:25:12 +00:00
Bodo Möller
20fda79fab PR:make sure RSA blinding works when the PRNG is not properly seeded;
enable it automatically only for the built-in engine
2003-03-20 17:24:54 +00:00
Ben Laurie
66e1081a15 Blinding fix. 2003-03-20 16:00:18 +00:00
Bodo Möller
ef42d6a4ed countermeasure against new Klima-Pokorny-Rosa atack 2003-03-19 19:20:30 +00:00
Bodo Möller
00223b969d fix formatting 2003-03-18 12:50:07 +00:00
Bodo Möller
3d1120f61a year 2003 2003-02-24 17:46:46 +00:00
Richard Levitte
fc68e4a01b Release of 0.9.6i is tagged, let's pretend to move on to 0.9.6j. 2003-02-19 12:56:04 +00:00
52 changed files with 496 additions and 89 deletions

51
CHANGES
View File

@@ -2,6 +2,57 @@
OpenSSL CHANGES
_______________
Changes between 0.9.6j and 0.9.6k [30 Sep 2003]
*) Fix various bugs revealed by running the NISCC test suite:
Stop out of bounds reads in the ASN1 code when presented with
invalid tags (CAN-2003-0543 and CAN-2003-0544).
If verify callback ignores invalid public key errors don't try to check
certificate signature with the NULL public key.
[Steve Henson]
*) In ssl3_accept() (ssl/s3_srvr.c) only accept a client certificate
if the server requested one: as stated in TLS 1.0 and SSL 3.0
specifications.
[Steve Henson]
*) In ssl3_get_client_hello() (ssl/s3_srvr.c), tolerate additional
extra data after the compression methods not only for TLS 1.0
but also for SSL 3.0 (as required by the specification).
[Bodo Moeller; problem pointed out by Matthias Loepfe]
*) Change X509_certificate_type() to mark the key as exported/exportable
when it's 512 *bits* long, not 512 bytes.
[Richard Levitte]
Changes between 0.9.6i and 0.9.6j [10 Apr 2003]
*) Countermeasure against the Klima-Pokorny-Rosa extension of
Bleichbacher's attack on PKCS #1 v1.5 padding: treat
a protocol version number mismatch like a decryption error
in ssl3_get_client_key_exchange (ssl/s3_srvr.c).
[Bodo Moeller]
*) Turn on RSA blinding by default in the default implementation
to avoid a timing attack. Applications that don't want it can call
RSA_blinding_off() or use the new flag RSA_FLAG_NO_BLINDING.
They would be ill-advised to do so in most cases.
[Ben Laurie, Steve Henson, Geoff Thorpe, Bodo Moeller]
*) Change RSA blinding code so that it works when the PRNG is not
seeded (in this case, the secret RSA exponent is abused as
an unpredictable seed -- if it is not unpredictable, there
is no point in blinding anyway). Make RSA blinding thread-safe
by remembering the creator's thread ID in rsa->blinding and
having all other threads use local one-time blinding factors
(this requires more computation than sharing rsa->blinding, but
avoids excessive locking; and if an RSA object is not shared
between threads, blinding will still be very fast).
[Bodo Moeller]
Changes between 0.9.6h and 0.9.6i [19 Feb 2003]
*) In ssl3_get_record (ssl/s3_pkt.c), minimize information leaked

3
FAQ
View File

@@ -63,7 +63,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.7a was released on February 19, 2003.
OpenSSL 0.9.7c was released on September 30, 2003.
In addition to the current stable release, you can also access daily
snapshots of the OpenSSL development version at <URL:
@@ -674,6 +674,7 @@ The general answer is to check the config.log file generated when running
the OpenSSH configure script. It should contain the detailed information
on why the OpenSSL library was not detected or considered incompatible.
* Can I use OpenSSL's SSL library with non-blocking I/O?
Yes; make sure to read the SSL_get_error(3) manual page!

View File

@@ -216,7 +216,7 @@
$ md c:\openssl\lib
$ md c:\openssl\include
$ md c:\openssl\include\openssl
$ copy /b inc32\* c:\openssl\include\openssl
$ copy /b inc32\openssl\* c:\openssl\include\openssl
$ copy /b out32dll\ssleay32.lib c:\openssl\lib
$ copy /b out32dll\libeay32.lib c:\openssl\lib
$ copy /b out32dll\ssleay32.dll c:\openssl\bin

View File

@@ -12,7 +12,7 @@
---------------
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
* Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@@ -368,9 +368,10 @@ do_svr3-shared:
find . -name "*.o" -print > allobjs ; \
OBJS= ; export OBJS ; \
for obj in `ar t lib$$i.a` ; do \
OBJS="$${OBJS} `grep $$obj allobjs`" ; \
OBJS="$${OBJS} `grep /$$obj allobjs`" ; \
done ; \
set -x; ${CC} -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
set -x; ${CC} ${SHARED_LDFLAGS} \
-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
$${OBJS} $$libs ${EX_LIBS} ) || exit 1; \
libs="$$libs -l$$i"; \
@@ -384,13 +385,15 @@ do_svr5-shared:
else \
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
SHARE_FLAG='-G'; \
(${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
find . -name "*.o" -print > allobjs ; \
OBJS= ; export OBJS ; \
for obj in `ar t lib$$i.a` ; do \
OBJS="$${OBJS} `grep $$obj allobjs`" ; \
OBJS="$${OBJS} `grep /$$obj allobjs`" ; \
done ; \
set -x; ${CC} ${SHARED_LDFLAGS} \
-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
$${SHARE_FLAG} -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
$${OBJS} $$libs ${EX_LIBS} ) || exit 1; \
libs="$$libs -l$$i"; \

12
NEWS
View File

@@ -5,6 +5,18 @@
This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file.
Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k:
o Security: fix various ASN1 parsing bugs.
o SSL/TLS protocol fix for unrequested client certificates.
Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j:
o Security: counter the Klima-Pokorny-Rosa extension of
Bleichbacher's attack
o Security: make RSA blinding default.
o Build: shared library support fixes.
Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i:
o Important security related bugfixes.

2
README
View File

@@ -1,5 +1,5 @@
OpenSSL 0.9.6i Feb 19 2003
OpenSSL 0.9.6k 30 Sep 2003
Copyright (c) 1998-2003 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson

6
STATUS
View File

@@ -1,12 +1,16 @@
OpenSSL STATUS Last modified at
______________ $Date: 2003/02/19 12:34:17 $
______________ $Date: 2003/09/30 12:09:11 $
DEVELOPMENT STATE
o OpenSSL 0.9.8: Under development...
o OpenSSL 0.9.7c: Released on September 30th, 2003
o OpenSSL 0.9.7b: Released on April 10th, 2003
o OpenSSL 0.9.7a: Released on February 19th, 2003
o OpenSSL 0.9.7: Released on December 31st, 2002
o OpenSSL 0.9.6k: Released on September 30th, 2003
o OpenSSL 0.9.6j: Released on April 10th, 2003
o OpenSSL 0.9.6i: Released on February 19th, 2003
o OpenSSL 0.9.6h: Released on December 5th, 2002
o OpenSSL 0.9.6g: Released on August 9th, 2002

View File

@@ -81,6 +81,7 @@ all: exe
exe: $(PROGRAM)
req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o req $(CFLAG) sreq.o $(A_OBJ) $(RAND_OBJ) $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
sreq.o: req.c
@@ -135,6 +136,7 @@ $(DLIBCRYPTO):
$(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
$(RM) $(PROGRAM)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS)
-(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs)

View File

@@ -805,7 +805,7 @@ $ ENDIF
$!
$! Set Up Initial CC Definitions, Possibly With User Ones
$!
$ CCDEFS = "VMS=1,MONOLITH"
$ CCDEFS = "VMS=1,MONOLITH,THREADS"
$ IF F$TRNLNM("OPENSSL_NO_ASM") THEN CCDEFS = CCDEFS + ",NO_ASM"
$ IF F$TRNLNM("OPENSSL_NO_RSA") THEN CCDEFS = CCDEFS + ",NO_RSA"
$ IF F$TRNLNM("OPENSSL_NO_DSA") THEN CCDEFS = CCDEFS + ",NO_DSA"

View File

@@ -219,7 +219,7 @@ int MAIN(int argc, char **argv)
}
BIO_free(in);
if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
BIO_printf(bio_err, "Error converting key\n", outfile);
BIO_printf(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
return (1);
}
@@ -243,8 +243,7 @@ int MAIN(int argc, char **argv)
if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
p8pass, strlen(p8pass),
NULL, 0, iter, p8inf))) {
BIO_printf(bio_err, "Error encrypting key\n",
outfile);
BIO_printf(bio_err, "Error encrypting key\n");
ERR_print_errors(bio_err);
return (1);
}
@@ -287,7 +286,7 @@ int MAIN(int argc, char **argv)
}
if (!p8) {
BIO_printf (bio_err, "Error reading key\n", outfile);
BIO_printf (bio_err, "Error reading key\n");
ERR_print_errors(bio_err);
return (1);
}
@@ -301,13 +300,13 @@ int MAIN(int argc, char **argv)
}
if (!p8inf) {
BIO_printf(bio_err, "Error decrypting key\n", outfile);
BIO_printf(bio_err, "Error decrypting key\n");
ERR_print_errors(bio_err);
return (1);
}
if (!(pkey = EVP_PKCS82PKEY(p8inf))) {
BIO_printf(bio_err, "Error converting key\n", outfile);
BIO_printf(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
return (1);
}

View File

@@ -1063,7 +1063,7 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
BIO_free(io);
io=NULL;
if (!X509_STORE_add_cert(ctx,x)) goto end;
/*if (!X509_STORE_add_cert(ctx,x)) goto end;*/
/* NOTE: this certificate can/should be self signed, unless it was
* a certificate request in which case it is not. */

View File

@@ -29,7 +29,7 @@ RC4-MD5, but a re-connect tries to use DES-CBC-SHA. So netscape, when
doing a re-connect, always takes the first cipher in the cipher list.
If we accept a netscape connection, demand a client cert, have a
non-self-sighed CA which does not have it's CA in netscape, and the
non-self-signed CA which does not have it's CA in netscape, and the
browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta
Netscape browsers do not really notice the server sending a

View File

@@ -274,7 +274,7 @@ int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING *str)
* otherwise it is the number of bytes per character
*/
const static char tag2nbyte[] = {
const static signed char tag2nbyte[] = {
-1, -1, -1, -1, -1, /* 0-4 */
-1, -1, -1, -1, -1, /* 5-9 */
-1, -1, 0, -1, /* 10-13 */

View File

@@ -123,7 +123,7 @@ extern "C" {
#define B_ASN1_NUMERICSTRING 0x0001
#define B_ASN1_PRINTABLESTRING 0x0002
#define B_ASN1_T61STRING 0x0004
#define B_ASN1_TELETEXSTRING 0x0008
#define B_ASN1_TELETEXSTRING 0x0004
#define B_ASN1_VIDEOTEXSTRING 0x0008
#define B_ASN1_IA5STRING 0x0010
#define B_ASN1_GRAPHICSTRING 0x0020

View File

@@ -104,10 +104,12 @@ int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass,
l<<=7L;
l|= *(p++)&0x7f;
if (--max == 0) goto err;
if (l > (INT_MAX >> 7L)) goto err;
}
l<<=7L;
l|= *(p++)&0x7f;
tag=(int)l;
if (--max == 0) goto err;
}
else
{

View File

@@ -825,5 +825,5 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
* had the buffer been large enough.) */
return -1;
else
return (retlen <= INT_MAX) ? retlen : -1;
return (retlen <= INT_MAX) ? (int)retlen : -1;
}

View File

@@ -495,6 +495,7 @@ static int buffer_gets(BIO *b, char *buf, int size)
if (i <= 0)
{
BIO_copy_next_retry(b);
*buf='\0';
if (i < 0) return((num > 0)?num:i);
if (i == 0) return(num);
}

View File

@@ -1,4 +1,57 @@
/* crypto/bio/bss_bio.c -*- Mode: C; c-file-style: "eay" -*- */
/* ====================================================================
* Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
/* Special method for a BIO where the other endpoint is also a BIO
* of this kind, handled by the same thread (i.e. the "peer" is actually
@@ -503,7 +556,7 @@ static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr)
break;
case BIO_C_DESTROY_BIO_PAIR:
/* Effects both BIOs in the pair -- call just once!
/* Affects both BIOs in the pair -- call just once!
* Or let BIO_free(bio1); BIO_free(bio2); do the job. */
bio_destroy_pair(bio);
ret = 1;

View File

@@ -259,6 +259,8 @@ typedef struct bn_blinding_st
BIGNUM *A;
BIGNUM *Ai;
BIGNUM *mod; /* just a reference */
unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b;
* used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
} BN_BLINDING;
/* Used for montgomery multiplication */

View File

@@ -224,7 +224,7 @@ 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;
int c1,c2,neg,zero;
BN_ULONG ln,lo,*p;
# ifdef BN_COUNT
@@ -376,7 +376,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int tn,
/* The overflow will stop before we over write
* words we should not overwrite */
if (ln < c1)
if (ln < (BN_ULONG)c1)
{
do {
p++;

View File

@@ -1139,7 +1139,7 @@ $ ENDIF
$!
$! Set Up Initial CC Definitions, Possibly With User Ones
$!
$ CCDEFS = "VMS=1,TCPIP_TYPE_''P5',DSO_VMS"
$ CCDEFS = "VMS=1,TCPIP_TYPE_''P5',DSO_VMS,THREADS"
$ IF F$TRNLNM("OPENSSL_NO_ASM") THEN CCDEFS = CCDEFS + ",NO_ASM"
$ IF F$TRNLNM("OPENSSL_NO_RSA") THEN CCDEFS = CCDEFS + ",NO_RSA"
$ IF F$TRNLNM("OPENSSL_NO_DSA") THEN CCDEFS = CCDEFS + ",NO_DSA"

View File

@@ -123,7 +123,11 @@ DSO_METHOD *DSO_METHOD_dlfcn(void)
# endif
# endif
#else
# define DLOPEN_FLAG RTLD_NOW /* Hope this works everywhere else */
# ifdef OPENSSL_SYS_SUNOS
# define DLOPEN_FLAG 1
# else
# define DLOPEN_FLAG RTLD_NOW /* Hope this works everywhere else */
# endif
#endif
/* For this DSO_METHOD, our meth_data STACK will contain;

View File

@@ -293,7 +293,7 @@ sub md5_block
&mov(&DWP(12,$tmp2,"",0),$D);
&cmp($tmp1,$X) unless $normal; # check count
&jge(&label("start")) unless $normal;
&jae(&label("start")) unless $normal;
&pop("eax"); # pop the temp variable off the stack
&pop("ebx");

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 0x0090609fL
#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.6i Feb 19 2003"
#define OPENSSL_VERSION_NUMBER 0x009060bfL
#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.6k 30 Sep 2003"
#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT

View File

@@ -141,7 +141,10 @@ sub main'jle { &out1("jle",@_); }
sub main'jz { &out1("jz",@_); }
sub main'jge { &out1("jge",@_); }
sub main'jl { &out1("jl",@_); }
sub main'ja { &out1("ja",@_); }
sub main'jae { &out1("jae",@_); }
sub main'jb { &out1("jb",@_); }
sub main'jbe { &out1("jbe",@_); }
sub main'jc { &out1("jc",@_); }
sub main'jnc { &out1("jnc",@_); }
sub main'jnz { &out1("jnz",@_); }

View File

@@ -149,7 +149,10 @@ sub main'jle { &out1("jle NEAR",@_); }
sub main'jz { &out1("jz NEAR",@_); }
sub main'jge { &out1("jge NEAR",@_); }
sub main'jl { &out1("jl NEAR",@_); }
sub main'ja { &out1("ja NEAR",@_); }
sub main'jae { &out1("jae NEAR",@_); }
sub main'jb { &out1("jb NEAR",@_); }
sub main'jbe { &out1("jbe NEAR",@_); }
sub main'jc { &out1("jc NEAR",@_); }
sub main'jnc { &out1("jnc NEAR",@_); }
sub main'jnz { &out1("jnz NEAR",@_); }

View File

@@ -154,7 +154,10 @@ sub main'jnz { &out1("jnz",@_); }
sub main'jz { &out1("jz",@_); }
sub main'jge { &out1("jge",@_); }
sub main'jl { &out1("jl",@_); }
sub main'ja { &out1("ja",@_); }
sub main'jae { &out1("jae",@_); }
sub main'jb { &out1("jb",@_); }
sub main'jbe { &out1("jbe",@_); }
sub main'jc { &out1("jc",@_); }
sub main'jnc { &out1("jnc",@_); }
sub main'jno { &out1("jno",@_); }

View File

@@ -292,7 +292,7 @@ static void ssleay_rand_add(const void *buf, int num, double add)
st_idx=0;
}
}
memset((char *)&m,0,sizeof(m));
OPENSSL_cleanse((char *)&m,sizeof(m));
if (!do_not_lock) CRYPTO_w_lock(CRYPTO_LOCK_RAND);
/* Don't just copy back local_md into md -- this could mean that
@@ -493,7 +493,7 @@ static int ssleay_rand_bytes(unsigned char *buf, int num)
MD_Final(md,&m);
CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
memset(&m,0,sizeof(m));
OPENSSL_cleanse(&m,sizeof(m));
if (ok)
return(1);
else

View File

@@ -102,7 +102,7 @@ int RAND_egd(const char *path)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (strlen(path) > sizeof(addr.sun_path))
if (strlen(path) >= sizeof(addr.sun_path))
return (-1);
strcpy(addr.sun_path,path);
len = offsetof(struct sockaddr_un, sun_path) + strlen(path);
@@ -134,7 +134,7 @@ int RAND_egd_bytes(const char *path,int bytes)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (strlen(path) > sizeof(addr.sun_path))
if (strlen(path) >= sizeof(addr.sun_path))
return (-1);
strcpy(addr.sun_path,path);
len = offsetof(struct sockaddr_un, sun_path) + strlen(path);

View File

@@ -162,6 +162,7 @@ typedef BOOL (WINAPI *GETCURSORINFO)(PCURSORINFO);
typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT);
typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD);
typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE);
typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, DWORD);
typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32);
typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32);
@@ -414,7 +415,7 @@ int RAND_poll(void)
* This seeding method was proposed in Peter Gutmann, Software
* Generation of Practically Strong Random Numbers,
* http://www.usenix.org/publications/library/proceedings/sec98/gutmann.html
* revised version at http://www.cryptoengines.com/~peter/06_random.pdf
* revised version at http://www.cryptoengines.com/~peter/06_random.pdf
* (The assignment of entropy estimates below is arbitrary, but based
* on Peter's analysis the full poll appears to be safe. Additional
* interactive seeding is encouraged.)
@@ -423,6 +424,7 @@ int RAND_poll(void)
if (kernel)
{
CREATETOOLHELP32SNAPSHOT snap;
CLOSETOOLHELP32SNAPSHOT close_snap;
HANDLE handle;
HEAP32FIRST heap_first;
@@ -440,6 +442,8 @@ int RAND_poll(void)
snap = (CREATETOOLHELP32SNAPSHOT)
GetProcAddress(kernel, "CreateToolhelp32Snapshot");
close_snap = (CLOSETOOLHELP32SNAPSHOT)
GetProcAddress(kernel, "CloseToolhelp32Snapshot");
heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First");
heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next");
heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst");
@@ -455,7 +459,7 @@ int RAND_poll(void)
heaplist_next && process_first && process_next &&
thread_first && thread_next && module_first &&
module_next && (handle = snap(TH32CS_SNAPALL,0))
!= NULL)
!= INVALID_HANDLE_VALUE)
{
/* heap list and heap walking */
/* HEAPLIST32 contains 3 fields that will change with
@@ -517,8 +521,10 @@ int RAND_poll(void)
do
RAND_add(&m, m.dwSize, 9);
while (module_next(handle, &m));
CloseHandle(handle);
if (close_snap)
close_snap(handle);
else
CloseHandle(handle);
}
FreeLibrary(kernel);

View File

@@ -114,9 +114,9 @@ rsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
rsa_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
rsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
rsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
rsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
rsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
rsa_lib.o: ../cryptlib.h
rsa_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
rsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
rsa_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h
rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
rsa_none.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h

View File

@@ -164,6 +164,12 @@ struct rsa_st
*/
#define RSA_FLAG_SIGN_VER 0x40
#define RSA_FLAG_NO_BLINDING 0x80 /* new with 0.9.6j and 0.9.7b; the built-in
* RSA implementation now uses blinding by
* default (ignoring RSA_FLAG_BLINDING),
* but other engines might not need it
*/
#define RSA_PKCS1_PADDING 1
#define RSA_SSLV23_PADDING 2
#define RSA_NO_PADDING 3
@@ -329,6 +335,7 @@ void ERR_load_RSA_strings(void);
#define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124
#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125
#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123
#define RSA_R_INTERNAL_ERROR 133
#define RSA_R_INVALID_MESSAGE_LENGTH 131
#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126
#define RSA_R_KEY_SIZE_TOO_SMALL 120

View File

@@ -190,6 +190,59 @@ err:
return(r);
}
static int rsa_eay_blinding(RSA *rsa, BN_CTX *ctx)
{
int ret = 1;
CRYPTO_w_lock(CRYPTO_LOCK_RSA);
/* Check again inside the lock - the macro's check is racey */
if(rsa->blinding == NULL)
ret = RSA_blinding_on(rsa, ctx);
CRYPTO_w_unlock(CRYPTO_LOCK_RSA);
return ret;
}
#define BLINDING_HELPER(rsa, ctx, err_instr) \
do { \
if((!((rsa)->flags & RSA_FLAG_NO_BLINDING)) && \
((rsa)->blinding == NULL) && \
!rsa_eay_blinding(rsa, ctx)) \
err_instr \
} while(0)
static BN_BLINDING *setup_blinding(RSA *rsa, BN_CTX *ctx)
{
BIGNUM *A, *Ai;
BN_BLINDING *ret = NULL;
/* added in OpenSSL 0.9.6j and 0.9.7b */
/* NB: similar code appears in RSA_blinding_on (rsa_lib.c);
* this should be placed in a new function of its own, but for reasons
* of binary compatibility can't */
BN_CTX_start(ctx);
A = BN_CTX_get(ctx);
if ((RAND_status() == 0) && rsa->d != NULL && rsa->d->d != NULL)
{
/* if PRNG is not properly seeded, resort to secret exponent as unpredictable seed */
RAND_add(rsa->d->d, rsa->d->dmax * sizeof rsa->d->d[0], 0);
if (!BN_pseudo_rand_range(A,rsa->n)) goto err;
}
else
{
if (!BN_rand_range(A,rsa->n)) goto err;
}
if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err;
if (!rsa->meth->bn_mod_exp(A,A,rsa->e,rsa->n,ctx,rsa->_method_mod_n))
goto err;
ret = BN_BLINDING_new(A,Ai,rsa->n);
BN_free(Ai);
err:
BN_CTX_end(ctx);
return ret;
}
/* signing */
static int RSA_eay_private_encrypt(int flen, unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
@@ -198,6 +251,8 @@ static int RSA_eay_private_encrypt(int flen, unsigned char *from,
int i,j,k,num=0,r= -1;
unsigned char *buf=NULL;
BN_CTX *ctx=NULL;
int local_blinding = 0;
BN_BLINDING *blinding = NULL;
BN_init(&f);
BN_init(&ret);
@@ -234,10 +289,39 @@ static int RSA_eay_private_encrypt(int flen, unsigned char *from,
goto err;
}
if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
RSA_blinding_on(rsa,ctx);
if (rsa->flags & RSA_FLAG_BLINDING)
if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
BLINDING_HELPER(rsa, ctx, goto err;);
blinding = rsa->blinding;
/* Now unless blinding is disabled, 'blinding' is non-NULL.
* But the BN_BLINDING object may be owned by some other thread
* (we don't want to keep it constant and we don't want to use
* lots of locking to avoid race conditions, so only a single
* thread can use it; other threads have to use local blinding
* factors) */
if (!(rsa->flags & RSA_FLAG_NO_BLINDING))
{
if (blinding == NULL)
{
RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, RSA_R_INTERNAL_ERROR);
goto err;
}
}
if (blinding != NULL)
{
if (blinding->thread_id != CRYPTO_thread_id())
{
/* we need a local one-time blinding factor */
blinding = setup_blinding(rsa, ctx);
if (blinding == NULL)
goto err;
local_blinding = 1;
}
}
if (blinding)
if (!BN_BLINDING_convert(&f, blinding, ctx)) goto err;
if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
((rsa->p != NULL) &&
@@ -251,8 +335,8 @@ static int RSA_eay_private_encrypt(int flen, unsigned char *from,
if (!rsa->meth->bn_mod_exp(&ret,&f,rsa->d,rsa->n,ctx,NULL)) goto err;
}
if (rsa->flags & RSA_FLAG_BLINDING)
if (!BN_BLINDING_invert(&ret,rsa->blinding,ctx)) goto err;
if (blinding)
if (!BN_BLINDING_invert(&ret, blinding, ctx)) goto err;
/* put in leading 0 bytes if the number is less than the
* length of the modulus */
@@ -266,6 +350,8 @@ err:
if (ctx != NULL) BN_CTX_free(ctx);
BN_clear_free(&ret);
BN_clear_free(&f);
if (local_blinding)
BN_BLINDING_free(blinding);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
@@ -282,6 +368,8 @@ static int RSA_eay_private_decrypt(int flen, unsigned char *from,
unsigned char *p;
unsigned char *buf=NULL;
BN_CTX *ctx=NULL;
int local_blinding = 0;
BN_BLINDING *blinding = NULL;
BN_init(&f);
BN_init(&ret);
@@ -313,10 +401,39 @@ static int RSA_eay_private_decrypt(int flen, unsigned char *from,
goto err;
}
if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
RSA_blinding_on(rsa,ctx);
if (rsa->flags & RSA_FLAG_BLINDING)
if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
BLINDING_HELPER(rsa, ctx, goto err;);
blinding = rsa->blinding;
/* Now unless blinding is disabled, 'blinding' is non-NULL.
* But the BN_BLINDING object may be owned by some other thread
* (we don't want to keep it constant and we don't want to use
* lots of locking to avoid race conditions, so only a single
* thread can use it; other threads have to use local blinding
* factors) */
if (!(rsa->flags & RSA_FLAG_NO_BLINDING))
{
if (blinding == NULL)
{
RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT, RSA_R_INTERNAL_ERROR);
goto err;
}
}
if (blinding != NULL)
{
if (blinding->thread_id != CRYPTO_thread_id())
{
/* we need a local one-time blinding factor */
blinding = setup_blinding(rsa, ctx);
if (blinding == NULL)
goto err;
local_blinding = 1;
}
}
if (blinding)
if (!BN_BLINDING_convert(&f, blinding, ctx)) goto err;
/* do the decrypt */
if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
@@ -332,8 +449,8 @@ static int RSA_eay_private_decrypt(int flen, unsigned char *from,
goto err;
}
if (rsa->flags & RSA_FLAG_BLINDING)
if (!BN_BLINDING_invert(&ret,rsa->blinding,ctx)) goto err;
if (blinding)
if (!BN_BLINDING_invert(&ret, blinding, ctx)) goto err;
p=buf;
j=BN_bn2bin(&ret,p); /* j is only used with no-padding mode */
@@ -365,6 +482,8 @@ err:
if (ctx != NULL) BN_CTX_free(ctx);
BN_clear_free(&f);
BN_clear_free(&ret);
if (local_blinding)
BN_BLINDING_free(blinding);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);

View File

@@ -1,6 +1,6 @@
/* crypto/rsa/rsa_err.c */
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
* Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -113,6 +113,7 @@ static ERR_STRING_DATA RSA_str_reasons[]=
{RSA_R_DMP1_NOT_CONGRUENT_TO_D ,"dmp1 not congruent to d"},
{RSA_R_DMQ1_NOT_CONGRUENT_TO_D ,"dmq1 not congruent to d"},
{RSA_R_D_E_NOT_CONGRUENT_TO_1 ,"d e not congruent to 1"},
{RSA_R_INTERNAL_ERROR ,"internal error"},
{RSA_R_INVALID_MESSAGE_LENGTH ,"invalid message length"},
{RSA_R_IQMP_NOT_INVERSE_OF_Q ,"iqmp not inverse of q"},
{RSA_R_KEY_SIZE_TOO_SMALL ,"key size too small"},

View File

@@ -62,6 +62,7 @@
#include <openssl/lhash.h>
#include <openssl/bn.h>
#include <openssl/rsa.h>
#include <openssl/rand.h>
const char *RSA_version="RSA" OPENSSL_VERSION_PTEXT;
@@ -71,7 +72,9 @@ static STACK_OF(CRYPTO_EX_DATA_FUNCS) *rsa_meth=NULL;
RSA *RSA_new(void)
{
return(RSA_new_method(NULL));
RSA *r=RSA_new_method(NULL);
return r;
}
void RSA_set_default_method(RSA_METHOD *meth)
@@ -251,12 +254,13 @@ void RSA_blinding_off(RSA *rsa)
BN_BLINDING_free(rsa->blinding);
rsa->blinding=NULL;
}
rsa->flags&= ~RSA_FLAG_BLINDING;
rsa->flags &= ~RSA_FLAG_BLINDING;
rsa->flags |= RSA_FLAG_NO_BLINDING;
}
int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
{
BIGNUM *A,*Ai;
BIGNUM *A,*Ai = NULL;
BN_CTX *ctx;
int ret=0;
@@ -267,21 +271,42 @@ int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
else
ctx=p_ctx;
/* XXXXX: Shouldn't this be RSA_blinding_off(rsa)? */
if (rsa->blinding != NULL)
{
BN_BLINDING_free(rsa->blinding);
rsa->blinding = NULL;
}
/* NB: similar code appears in setup_blinding (rsa_eay.c);
* this should be placed in a new function of its own, but for reasons
* of binary compatibility can't */
BN_CTX_start(ctx);
A = BN_CTX_get(ctx);
if (!BN_rand_range(A,rsa->n)) goto err;
if ((RAND_status() == 0) && rsa->d != NULL && rsa->d->d != NULL)
{
/* if PRNG is not properly seeded, resort to secret exponent as unpredictable seed */
RAND_add(rsa->d->d, rsa->d->dmax * sizeof rsa->d->d[0], 0);
if (!BN_pseudo_rand_range(A,rsa->n)) goto err;
}
else
{
if (!BN_rand_range(A,rsa->n)) goto err;
}
if ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err;
if (!rsa->meth->bn_mod_exp(A,A,rsa->e,rsa->n,ctx,rsa->_method_mod_n))
goto err;
rsa->blinding=BN_BLINDING_new(A,Ai,rsa->n);
rsa->flags|=RSA_FLAG_BLINDING;
BN_free(Ai);
goto err;
if ((rsa->blinding=BN_BLINDING_new(A,Ai,rsa->n)) == NULL) goto err;
/* to make things thread-safe without excessive locking,
* rsa->blinding will be used just by the current thread: */
rsa->blinding->thread_id = CRYPTO_thread_id();
rsa->flags |= RSA_FLAG_BLINDING;
rsa->flags &= ~RSA_FLAG_NO_BLINDING;
ret=1;
err:
if (Ai != NULL) BN_free(Ai);
BN_CTX_end(ctx);
if (ctx != p_ctx) BN_CTX_free(ctx);
return(ret);

View File

@@ -94,6 +94,7 @@ int i;
OPENSSL_free(b);
}
strncpy(buf,"NO X509_NAME",len);
buf[len-1]='\0';
return buf;
}

View File

@@ -490,7 +490,7 @@ static int internal_verify(X509_STORE_CTX *ctx)
ok=(*cb)(0,ctx);
if (!ok) goto end;
}
if (X509_verify(xs,pkey) <= 0)
else if (X509_verify(xs,pkey) <= 0)
{
ctx->error=X509_V_ERR_CERT_SIGNATURE_FAILURE;
ctx->current_cert=xs;

View File

@@ -99,14 +99,15 @@ int X509_certificate_type(X509 *x, EVP_PKEY *pkey)
case EVP_PKEY_RSA:
ret|=EVP_PKS_RSA;
break;
case EVP_PKS_DSA:
case EVP_PKEY_DSA:
ret|=EVP_PKS_DSA;
break;
default:
break;
}
if (EVP_PKEY_size(pk) <= 512)
if (EVP_PKEY_size(pk) <= 512/8) /* /8 because it's 512 bits we look
for, not bytes */
ret|=EVP_PKT_EXP;
if(pkey==NULL) EVP_PKEY_free(pk);
return(ret);

View File

@@ -168,7 +168,7 @@ Diffie-Hellman) key exchange should be used instead.
=item SSL_OP_NETSCAPE_CA_DN_BUG
If we accept a netscape connection, demand a client cert, have a
non-self-sighed CA which does not have it's CA in netscape, and the
non-self-signed CA which does not have it's CA in netscape, and the
browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta
=item SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG

2
e_os.h
View File

@@ -301,6 +301,8 @@ extern "C" {
# define pid_t int /* pid_t is missing on NEXTSTEP/OPENSTEP
* (unless when compiling with -D_POSIX_SOURCE,
* which doesn't work for us) */
# endif
# if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS)
# define ssize_t int /* ditto */
# endif
# ifdef NEWS4 /* setvbuf is missing on mips-sony-bsd */

View File

@@ -187,6 +187,73 @@ $!
$ WRITE H_FILE "/* This file was automatically built using makevms.com */"
$ WRITE H_FILE "/* and [.CRYPTO]OPENSSLCONF.H_IN */"
$
$!
$! Write a few macros that indicate how this system was built.
$!
$ WRITE H_FILE ""
$ WRITE H_FILE "#ifdef OPENSSL_ALGORITHM_DEFINES"
$ CONFIG_LOGICALS := NO_RSA,NO_DSA,NO_DH,NO_MD2,NO_MD5,NO_RIPEMD,-
NO_SHA,NO_SHA0,NO_SHA1,NO_DES/NO_MDC2;NO_MDC2,NO_RC2,NO_RC4,NO_RC5,-
NO_IDEA,NO_BF,NO_CAST,NO_HMAC,NO_SSL2
$ CONFIG_LOG_I = 0
$ CONFIG_LOG_LOOP:
$ CONFIG_LOG_E1 = F$ELEMENT(CONFIG_LOG_I,",",CONFIG_LOGICALS)
$ CONFIG_LOG_I = CONFIG_LOG_I + 1
$ IF CONFIG_LOG_E1 .EQS. "" THEN GOTO CONFIG_LOG_LOOP
$ IF CONFIG_LOG_E1 .EQS. "," THEN GOTO CONFIG_LOG_LOOP_END
$ CONFIG_LOG_E2 = F$EDIT(CONFIG_LOG_E1,"TRIM")
$ CONFIG_LOG_E1 = F$ELEMENT(0,";",CONFIG_LOG_E2)
$ CONFIG_LOG_E2 = F$ELEMENT(1,";",CONFIG_LOG_E2)
$ CONFIG_LOG_E0 = F$ELEMENT(0,"/",CONFIG_LOG_E1)
$ CONFIG_LOG_E1 = F$ELEMENT(1,"/",CONFIG_LOG_E1)
$ IF F$TRNLNM("OPENSSL_"+CONFIG_LOG_E0)
$ THEN
$ WRITE H_FILE "# ifndef ",CONFIG_LOG_E0
$ WRITE H_FILE "# define ",CONFIG_LOG_E0
$ WRITE H_FILE "# endif"
$ IF CONFIG_LOG_E1 .NES. "/"
$ THEN
$ WRITE H_FILE "# ifndef ",CONFIG_LOG_E1
$ WRITE H_FILE "# define ",CONFIG_LOG_E1
$ WRITE H_FILE "# endif"
$ ENDIF
$ ELSE
$ IF CONFIG_LOG_E2 .NES. ";"
$ THEN
$ IF F$TRNLNM("OPENSSL_"+CONFIG_LOG_E2)
$ THEN
$ WRITE H_FILE "# ifndef ",CONFIG_LOG_E2
$ WRITE H_FILE "# define ",CONFIG_LOG_E2
$ WRITE H_FILE "# endif"
$ ENDIF
$ ENDIF
$ ENDIF
$ GOTO CONFIG_LOG_LOOP
$ CONFIG_LOG_LOOP_END:
$ WRITE H_FILE "#endif"
$ WRITE H_FILE "#ifdef OPENSSL_THREAD_DEFINES"
$ WRITE H_FILE "# ifndef THREADS"
$ WRITE H_FILE "# define THREADS"
$ WRITE H_FILE "# endif"
$ WRITE H_FILE "#endif"
$ WRITE H_FILE "#ifdef OPENSSL_OTHER_DEFINES"
$ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP"
$ THEN
$ WRITE H_FILE "# ifndef NO_ASM"
$ WRITE H_FILE "# define NO_ASM"
$ WRITE H_FILE "# endif"
$ ENDIF
$ IF RSAREF.EQS."RSAREF"
$ THEN
$ WRITE H_FILE "# ifndef RSAref"
$ WRITE H_FILE "# define RSAref"
$ WRITE H_FILE "# endif"
$ ENDIF
$ WRITE H_FILE "# ifndef DSO_VMS"
$ WRITE H_FILE "# define DSO_VMS"
$ WRITE H_FILE "# endif"
$ WRITE H_FILE "#endif"
$!
$! Different tar version may have named the file differently
$ IF F$SEARCH("[.CRYPTO]OPENSSLCONF.H_IN") .NES. ""
$ THEN

View File

@@ -1,7 +1,7 @@
%define libmaj 0
%define libmin 9
%define librel 6
%define librev i
%define librev k
Release: 1
%define openssldir /var/ssl

View File

@@ -1608,6 +1608,7 @@ static int ssl3_send_client_verify(SSL *s)
*(d++)=SSL3_MT_CERTIFICATE_VERIFY;
l2n3(n,d);
s->state=SSL3_ST_CW_CERT_VRFY_B;
s->init_num=(int)n+4;
s->init_off=0;
}

View File

@@ -420,10 +420,11 @@ int ssl3_accept(SSL *s)
if (ret == 2)
s->state = SSL3_ST_SR_CLNT_HELLO_C;
else {
/* could be sent for a DH cert, even if we
* have not asked for it :-) */
ret=ssl3_get_client_certificate(s);
if (ret <= 0) goto end;
if (s->s3->tmp.cert_request)
{
ret=ssl3_get_client_certificate(s);
if (ret <= 0) goto end;
}
s->init_num=0;
s->state=SSL3_ST_SR_KEY_EXCH_A;
}
@@ -828,6 +829,9 @@ static int ssl3_get_client_hello(SSL *s)
}
/* TLS does not mind if there is extra stuff */
#if 0 /* SSL 3.0 does not mind either, so we should disable this test
* (was enabled in 0.9.6d through 0.9.6j and 0.9.7 through 0.9.7b,
* in earlier SSLeay/OpenSSL releases this test existed but was buggy) */
if (s->version == SSL3_VERSION)
{
if (p < (d+n))
@@ -839,6 +843,7 @@ static int ssl3_get_client_hello(SSL *s)
goto f_err;
}
}
#endif
/* Given s->session->ciphers and ssl_get_ciphers_by_id(s), we must
* pick a cipher */
@@ -1333,6 +1338,7 @@ static int ssl3_send_certificate_request(SSL *s)
s->init_num += 4;
#endif
s->state = SSL3_ST_SW_CERT_REQ_B;
}
/* SSL3_ST_SW_CERT_REQ_B */
@@ -1425,7 +1431,7 @@ static int ssl3_get_client_key_exchange(SSL *s)
if (i != SSL_MAX_MASTER_KEY_LENGTH)
{
al=SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_DECRYPT);
/* SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_DECRYPT); */
}
if ((al == -1) && !((p[0] == (s->client_version>>8)) && (p[1] == (s->client_version & 0xff))))
@@ -1441,30 +1447,28 @@ static int ssl3_get_client_key_exchange(SSL *s)
(p[0] == (s->version>>8)) && (p[1] == (s->version & 0xff))))
{
al=SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_PROTOCOL_VERSION_NUMBER);
goto f_err;
/* SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_PROTOCOL_VERSION_NUMBER); */
/* The Klima-Pokorny-Rosa extension of Bleichenbacher's attack
* (http://eprint.iacr.org/2003/052/) exploits the version
* number check as a "bad version oracle" -- an alert would
* reveal that the plaintext corresponding to some ciphertext
* made up by the adversary is properly formatted except
* that the version number is wrong. To avoid such attacks,
* we should treat this just like any other decryption error. */
}
}
if (al != -1)
{
#if 0
goto f_err;
#else
/* Some decryption failure -- use random value instead as countermeasure
* against Bleichenbacher's attack on PKCS #1 v1.5 RSA padding
* (see RFC 2246, section 7.4.7.1).
* But note that due to length and protocol version checking, the
* attack is impractical anyway (see section 5 in D. Bleichenbacher:
* "Chosen Ciphertext Attacks Against Protocols Based on the RSA
* Encryption Standard PKCS #1", CRYPTO '98, LNCS 1462, pp. 1-12).
*/
* (see RFC 2246, section 7.4.7.1). */
ERR_clear_error();
i = SSL_MAX_MASTER_KEY_LENGTH;
p[0] = s->client_version >> 8;
p[1] = s->client_version & 0xff;
RAND_pseudo_bytes(p+2, i-2); /* should be RAND_bytes, but we cannot work around a failure */
#endif
}
s->session->master_key_length=

View File

@@ -898,7 +898,7 @@ $ ENDIF
$!
$! Set Up Initial CC Definitions, Possibly With User Ones
$!
$ CCDEFS = "VMS=1,TCPIP_TYPE_''P5'"
$ CCDEFS = "VMS=1,TCPIP_TYPE_''P5',THREADS"
$ IF F$TRNLNM("OPENSSL_NO_ASM") THEN CCDEFS = CCDEFS + ",NO_ASM"
$ IF F$TRNLNM("OPENSSL_NO_RSA") THEN CCDEFS = CCDEFS + ",NO_RSA"
$ IF F$TRNLNM("OPENSSL_NO_DSA") THEN CCDEFS = CCDEFS + ",NO_DSA"

View File

@@ -207,7 +207,7 @@ static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey)
ok=1;
else
#endif
if (!X509_check_private_key(c->pkeys[i].x509,pkey))
if (!X509_check_private_key(c->pkeys[i].x509,pkey))
{
if ((i == SSL_PKEY_DH_RSA) || (i == SSL_PKEY_DH_DSA))
{
@@ -241,6 +241,8 @@ static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey)
return(0);
}
ERR_clear_error(); /* make sure no error from X509_check_private_key()
* is left if we have chosen to ignore it */
if (c->pkeys[i].privatekey != NULL)
EVP_PKEY_free(c->pkeys[i].privatekey);
CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);

View File

@@ -81,11 +81,11 @@ SSL_SESSION *SSL_get1_session(SSL *ssl)
/* Need to lock this all up rather than just use CRYPTO_add so that
* somebody doesn't free ssl->session between when we check it's
* non-null and when we up the reference count. */
CRYPTO_r_lock(CRYPTO_LOCK_SSL_SESSION);
CRYPTO_w_lock(CRYPTO_LOCK_SSL_SESSION);
sess = ssl->session;
if(sess)
sess->references++;
CRYPTO_r_unlock(CRYPTO_LOCK_SSL_SESSION);
CRYPTO_w_unlock(CRYPTO_LOCK_SSL_SESSION);
return(sess);
}

View File

@@ -253,75 +253,99 @@ $(DLIBCRYPTO):
(cd ..; $(MAKE) DIRS=crypto all)
$(RSATEST): $(RSATEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(RSATEST) $(CFLAGS) $(RSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(BNTEST): $(BNTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(BNTEST) $(CFLAGS) $(BNTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(EXPTEST): $(EXPTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(EXPTEST) $(CFLAGS) $(EXPTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(IDEATEST): $(IDEATEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(IDEATEST) $(CFLAGS) $(IDEATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(MD2TEST): $(MD2TEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(MD2TEST) $(CFLAGS) $(MD2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(SHATEST): $(SHATEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(SHATEST) $(CFLAGS) $(SHATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(SHA1TEST): $(SHA1TEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(SHA1TEST) $(CFLAGS) $(SHA1TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(RMDTEST): $(RMDTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(RMDTEST) $(CFLAGS) $(RMDTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(MDC2TEST): $(MDC2TEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(MDC2TEST) $(CFLAGS) $(MDC2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(MD4TEST): $(MD4TEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(MD4TEST) $(CFLAGS) $(MD4TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(MD5TEST): $(MD5TEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(MD5TEST) $(CFLAGS) $(MD5TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(HMACTEST): $(HMACTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(HMACTEST) $(CFLAGS) $(HMACTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(RC2TEST): $(RC2TEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(RC2TEST) $(CFLAGS) $(RC2TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(BFTEST): $(BFTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(BFTEST) $(CFLAGS) $(BFTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(CASTTEST): $(CASTTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(CASTTEST) $(CFLAGS) $(CASTTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(RC4TEST): $(RC4TEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(RC4TEST) $(CFLAGS) $(RC4TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(RC5TEST): $(RC5TEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(RC5TEST) $(CFLAGS) $(RC5TEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(DESTEST): $(DESTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(DESTEST) $(CFLAGS) $(DESTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(RANDTEST): $(RANDTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(RANDTEST) $(CFLAGS) $(RANDTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(DHTEST): $(DHTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(DHTEST) $(CFLAGS) $(DHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(DSATEST): $(DSATEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(DSATEST) $(CFLAGS) $(DSATEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(METHTEST): $(METHTEST).o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(METHTEST) $(CFLAGS) $(METHTEST).o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
$(SSLTEST): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o $(SSLTEST) $(CFLAGS) $(SSLTEST).o $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS)
dummytest: dummytest.o $(DLIBCRYPTO)
LD_LIBRARY_PATH=..:$$LD_LIBRARY_PATH \
$(CC) -o dummytest $(CFLAGS) dummytest.o $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
# DO NOT DELETE THIS LINE -- make depend depends on it.

View File

@@ -729,7 +729,7 @@ $ ENDIF
$!
$! Set Up Initial CC Definitions, Possibly With User Ones
$!
$ CCDEFS = "VMS=1,TCPIP_TYPE_''P4'"
$ CCDEFS = "VMS=1,TCPIP_TYPE_''P4',THREADS"
$ IF F$TRNLNM("OPENSSL_NO_ASM") THEN CCDEFS = CCDEFS + ",NO_ASM"
$ IF F$TRNLNM("OPENSSL_NO_RSA") THEN CCDEFS = CCDEFS + ",NO_RSA"
$ IF F$TRNLNM("OPENSSL_NO_DSA") THEN CCDEFS = CCDEFS + ",NO_DSA"

View File

@@ -314,6 +314,10 @@ sub do_defs
}
s/\/\*.*?\*\///gs; # ignore comments
if (/\/\*/) { # if we have part
$line = $_; # of a comment,
next; # continue reading
}
s/{[^{}]*}//gs; # ignore {} blocks
if (/^\#\s*ifndef (.*)/) {
push(@tag,$1);

View File

@@ -320,7 +320,7 @@ EOF
print OUT <<"EOF";
/* $cfile */
/* ====================================================================
* Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
* Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions