openssl.git
4 years agoRevert "Missing perldoc markup around < literal"
Rich Salz [Wed, 15 Jul 2015 08:52:51 +0000 (04:52 -0400)]
Revert "Missing perldoc markup around < literal"

This reverts commit e5c0bc6cc49a23b50a272801c4bd53639c25fca4.
Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoGH322: Fix typo in generated comment.
Ernie Hershey [Wed, 15 Jul 2015 03:08:44 +0000 (23:08 -0400)]
GH322: Fix typo in generated comment.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
4 years agoMaintain backwards-compatible SSLv23_method macros
Viktor Dukhovni [Wed, 15 Jul 2015 01:26:31 +0000 (21:26 -0400)]
Maintain backwards-compatible SSLv23_method macros

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoCan't use -trusted with -CA{path,file}
Rich Salz [Thu, 9 Jul 2015 18:54:13 +0000 (14:54 -0400)]
Can't use -trusted with -CA{path,file}

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
4 years agoMissing perldoc markup around < literal
GitHub User [Thu, 9 Jul 2015 19:02:29 +0000 (15:02 -0400)]
Missing perldoc markup around < literal

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoConversion to UTF-8 where needed
Richard Levitte [Mon, 13 Jul 2015 14:53:37 +0000 (16:53 +0200)]
Conversion to UTF-8 where needed

This leaves behind files with names ending with '.iso-8859-1'.  These
should be safe to remove.  If something went wrong when re-encoding,
there will be some files with names ending with '.utf8' left behind.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoSmall script to re-encode files that need it to UTF-8
Richard Levitte [Mon, 13 Jul 2015 14:50:16 +0000 (16:50 +0200)]
Small script to re-encode files that need it to UTF-8

This requires 'iconv' and that 'file' can take the options '-b' and '-i'.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoRemove extra '; \' in apps/Makefile
Richard Levitte [Mon, 13 Jul 2015 13:48:57 +0000 (15:48 +0200)]
Remove extra '; \' in apps/Makefile

Fixes GH#330

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoSet numeric IDs for tar as well
Richard Levitte [Fri, 10 Jul 2015 16:29:17 +0000 (18:29 +0200)]
Set numeric IDs for tar as well

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoStop using tardy
Richard Levitte [Fri, 10 Jul 2015 13:40:53 +0000 (15:40 +0200)]
Stop using tardy

Instead of piping through tardy, and possibly suffering from bugs in certain
versions, use --transform, --owner and --group directly with GNU tar (we
already expect that tar variant).

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agocorrect example
Dr. Stephen Henson [Thu, 9 Jul 2015 18:32:36 +0000 (19:32 +0100)]
correct example

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoExit on error in ecparam
Peter Waltenberg [Thu, 9 Jul 2015 18:57:30 +0000 (14:57 -0400)]
Exit on error in ecparam

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agomake stacks
Dr. Stephen Henson [Thu, 9 Jul 2015 11:45:22 +0000 (12:45 +0100)]
make stacks

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoSort @sstacklst correctly.
Dr. Stephen Henson [Thu, 9 Jul 2015 11:44:46 +0000 (12:44 +0100)]
Sort @sstacklst correctly.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoApply some missing updates from previous commits
Matt Caswell [Thu, 9 Jul 2015 08:45:22 +0000 (09:45 +0100)]
Apply some missing updates from previous commits

Reviewed-by: Stephen Henson <steve@openssl.org>
4 years agoUpdate CHANGES and NEWS for the new release
Matt Caswell [Thu, 2 Jul 2015 14:38:32 +0000 (15:38 +0100)]
Update CHANGES and NEWS for the new release

Reviewed-by: Stephen Henson <steve@openssl.org>
4 years agoExtend -show_chain option to verify to show more info
Matt Caswell [Thu, 25 Jun 2015 11:28:28 +0000 (12:28 +0100)]
Extend -show_chain option to verify to show more info

The -show_chain flag to the verify command line app shows information about
the chain that has been built. This commit adds the text "untrusted" against
those certificates that have been used from the untrusted list.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoAdd help text for some verify options
Matt Caswell [Thu, 25 Jun 2015 11:27:05 +0000 (12:27 +0100)]
Add help text for some verify options

Fills in the help text for a number of options to verify that were blank.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoAdd documentation for some missing verify options
Matt Caswell [Thu, 25 Jun 2015 11:34:38 +0000 (12:34 +0100)]
Add documentation for some missing verify options

Fills in a couple of verify options that were lacking documentation.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoReject calls to X509_verify_cert that have not been reinitialised
Matt Caswell [Thu, 25 Jun 2015 08:47:15 +0000 (09:47 +0100)]
Reject calls to X509_verify_cert that have not been reinitialised

The function X509_verify_cert checks the value of |ctx->chain| at the
beginning, and if it is NULL then it initialises it, along with the value
of ctx->untrusted. The normal way to use X509_verify_cert() is to first
call X509_STORE_CTX_init(); then set up various parameters etc; then call
X509_verify_cert(); then check the results; and finally call
X509_STORE_CTX_cleanup(). The initial call to X509_STORE_CTX_init() sets
|ctx->chain| to NULL. The only place in the OpenSSL codebase  where
|ctx->chain| is set to anything other than a non NULL value is in
X509_verify_cert itself. Therefore the only ways that |ctx->chain| could be
non NULL on entry to X509_verify_cert is if one of the following occurs:
1) An application calls X509_verify_cert() twice without re-initialising
in between.
2) An application reaches inside the X509_STORE_CTX structure and changes
the value of |ctx->chain| directly.

With regards to the second of these, we should discount this - it should
not be supported to allow this.

With regards to the first of these, the documentation is not exactly
crystal clear, but the implication is that you must call
X509_STORE_CTX_init() before each call to X509_verify_cert(). If you fail
to do this then, at best, the results would be undefined.

Calling X509_verify_cert() with |ctx->chain| set to a non NULL value is
likely to have unexpected results, and could be dangerous. This commit
changes the behaviour of X509_verify_cert() so that it causes an error if
|ctx->chain| is anything other than NULL (because this indicates that we
have not been initialised properly). It also clarifies the associated
documentation. This is a follow up commit to CVE-2015-1793.

Reviewed-by: Stephen Henson <steve@openssl.org>
4 years agoAdd test for CVE-2015-1793
Matt Caswell [Wed, 1 Jul 2015 23:15:56 +0000 (00:15 +0100)]
Add test for CVE-2015-1793

This adds a test for CVE-2015-1793. This adds a new test file
verify_extra_test.c, which could form the basis for additional
verification tests.

Reviewed-by: Stephen Henson <steve@openssl.org>
4 years agoFix alternate chains certificate forgery issue
Matt Caswell [Wed, 24 Jun 2015 14:55:36 +0000 (15:55 +0100)]
Fix alternate chains certificate forgery issue

During certificate verfification, OpenSSL will attempt to find an
alternative certificate chain if the first attempt to build such a chain
fails. An error in the implementation of this logic can mean that an
attacker could cause certain checks on untrusted certificates to be
bypassed, such as the CA flag, enabling them to use a valid leaf
certificate to act as a CA and "issue" an invalid certificate.

This occurs where at least one cert is added to the first chain from the
trust store, but that chain still ends up being untrusted. In that case
ctx->last_untrusted is decremented in error.

Patch provided by the BoringSSL project.

CVE-2015-1793

Reviewed-by: Stephen Henson <steve@openssl.org>
4 years agoDocument the nameopt change
Richard Levitte [Tue, 7 Jul 2015 12:50:10 +0000 (14:50 +0200)]
Document the nameopt change

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoMake "oneline" the default for nameopt
Richard Levitte [Tue, 7 Jul 2015 09:13:20 +0000 (11:13 +0200)]
Make "oneline" the default for nameopt

There's no reason why we should default to a output format that is
old, and confusing in some cases.

This affects the commands "ca", "crl", "req" and "x509".

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agodocument -2 return value
Dr. Stephen Henson [Mon, 6 Jul 2015 13:17:49 +0000 (14:17 +0100)]
document -2 return value

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoRelax CCM tag check.
Dr. Stephen Henson [Tue, 9 Jun 2015 22:17:06 +0000 (23:17 +0100)]
Relax CCM tag check.

In CCM mode don't require a tag before initialising decrypt: this allows
the tag length to be set without requiring the tag.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoDup peer_chain properly in SSL_SESSION
Dr. Stephen Henson [Tue, 30 Jun 2015 12:58:25 +0000 (13:58 +0100)]
Dup peer_chain properly in SSL_SESSION

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoCheck for errors with SRP
Dr. Stephen Henson [Thu, 25 Jun 2015 14:07:25 +0000 (15:07 +0100)]
Check for errors with SRP

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agomake update
Dr. Stephen Henson [Thu, 25 Jun 2015 14:06:14 +0000 (15:06 +0100)]
make update

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoUse single master secret generation function.
Dr. Stephen Henson [Wed, 17 Jun 2015 03:10:04 +0000 (04:10 +0100)]
Use single master secret generation function.

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoCheck dgram_sctp_write() return value.
Kurt Roeckx [Sat, 20 Jun 2015 14:46:33 +0000 (16:46 +0200)]
Check dgram_sctp_write() return value.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoCheck BIO_dgram_sctp_wait_for_dry() return value for error
Kurt Roeckx [Sat, 20 Jun 2015 14:28:08 +0000 (16:28 +0200)]
Check BIO_dgram_sctp_wait_for_dry() return value for error

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agomissing break
Dr. Stephen Henson [Thu, 25 Jun 2015 03:05:07 +0000 (04:05 +0100)]
missing break

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoDon't output bogus errors in PKCS12_parse
Dr. Stephen Henson [Wed, 24 Jun 2015 11:28:50 +0000 (12:28 +0100)]
Don't output bogus errors in PKCS12_parse

PR#3923

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoAdd docs for ssl verification parameter functions.
Dr. Stephen Henson [Wed, 17 Jun 2015 14:51:41 +0000 (15:51 +0100)]
Add docs for ssl verification parameter functions.

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoFix windows build
Rich Salz [Tue, 23 Jun 2015 22:33:02 +0000 (18:33 -0400)]
Fix windows build

Move #include's inside the #ifdef.

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoFix PSK client handling.
Dr. Stephen Henson [Mon, 22 Jun 2015 13:03:08 +0000 (14:03 +0100)]
Fix PSK client handling.

The PSK identity hint should be stored in the SSL_SESSION structure
and not in the parent context (which will overwrite values used
by other SSL structures with the same SSL_CTX).

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoAdd PSK GCM ciphersuites from RFC5487
Dr. Stephen Henson [Wed, 17 Jun 2015 13:47:53 +0000 (14:47 +0100)]
Add PSK GCM ciphersuites from RFC5487

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoPSK trace keyex fixes.
Dr. Stephen Henson [Wed, 17 Jun 2015 13:47:27 +0000 (14:47 +0100)]
PSK trace keyex fixes.

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoAvoid duplication.
Dr. Stephen Henson [Sat, 20 Jun 2015 14:44:03 +0000 (15:44 +0100)]
Avoid duplication.

We always free the handshake buffer when digests are freed so move
it into ssl_free_digest_list()

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoTidy up ssl3_digest_cached_records logic.
Dr. Stephen Henson [Tue, 16 Jun 2015 13:44:29 +0000 (14:44 +0100)]
Tidy up ssl3_digest_cached_records logic.

Rewrite ssl3_digest_cached_records handling. Only digest cached records
if digest array is NULL: this means it is safe to call
ssl3_digest_cached_records multiple times (subsequent calls are no op).

Remove flag TLS1_FLAGS_KEEP_HANDSHAKE instead only update handshake buffer
if digest array is NULL.

Add additional "keep" parameter to ssl3_digest_cached_records to indicate
if the handshake buffer should be retained after digesting cached records
(needed for TLS 1.2 client authentication).

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoMore secure storage of key material.
Rich Salz [Fri, 24 Apr 2015 20:39:40 +0000 (16:39 -0400)]
More secure storage of key material.

Add secure heap for storage of private keys (when possible).
Add BIO_s_secmem(), CBIGNUM, etc.
Add BIO_CTX_secure_new so all BIGNUM's in the context are secure.
Contributed by Akamai Technologies under the Corporate CLA.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoAdd $! to errors, use script basename.
Rich Salz [Tue, 23 Jun 2015 11:27:23 +0000 (07:27 -0400)]
Add $! to errors, use script basename.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoGH297: Fix NAME section of SSL_CTX_use_serverinfo.pod
Vitezslav Cizek [Tue, 16 Jun 2015 19:57:59 +0000 (15:57 -0400)]
GH297: Fix NAME section of SSL_CTX_use_serverinfo.pod

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoRT3682: Avoid double-free on OCSP parse error
Rich Salz [Sat, 13 Jun 2015 13:29:10 +0000 (09:29 -0400)]
RT3682: Avoid double-free on OCSP parse error

Found by Kurt Cancemi.

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoRT3856: Fix memory leaks in test code
Russell Webb [Sat, 13 Jun 2015 14:35:55 +0000 (10:35 -0400)]
RT3856: Fix memory leaks in test code

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agomake update
Richard Levitte [Mon, 22 Jun 2015 23:58:10 +0000 (01:58 +0200)]
make update

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoRearrange rsaz
Richard Levitte [Mon, 22 Jun 2015 23:55:46 +0000 (01:55 +0200)]
Rearrange rsaz

A small rearrangement so the inclusion of rsaz_exp.h would be
unconditional, but what that header defines becomes conditional.

This solves the weirdness where rsaz_exp.h gets in and out of the
dependency list for bn_exp.c, depending on the present architecture.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoRT3907-fix
Rich Salz [Mon, 22 Jun 2015 23:26:50 +0000 (19:26 -0400)]
RT3907-fix

Typo in local variable name; introduced by previous fix.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoRT3907: avoid "local" in testssl script
Rich Salz [Sat, 13 Jun 2015 21:18:47 +0000 (17:18 -0400)]
RT3907: avoid "local" in testssl script

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoRemove SESS_CERT entirely.
Dr. Stephen Henson [Sun, 21 Jun 2015 18:42:04 +0000 (19:42 +0100)]
Remove SESS_CERT entirely.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoMove peer chain to SSL_SESSION structure.
Dr. Stephen Henson [Sun, 21 Jun 2015 18:34:33 +0000 (19:34 +0100)]
Move peer chain to SSL_SESSION structure.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoRemove unnuecessary ifdefs.
Dr. Stephen Henson [Sun, 21 Jun 2015 18:18:50 +0000 (19:18 +0100)]
Remove unnuecessary ifdefs.

If RSA or DSA is disabled we will never use a ciphersuite with
RSA/DSA authentication as it is already filtered out by the cipher
list logic.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoRemove certificates from sess_cert
Dr. Stephen Henson [Sun, 21 Jun 2015 18:08:57 +0000 (19:08 +0100)]
Remove certificates from sess_cert

As numerous comments indicate the certificate and key array is not an
appopriate structure to store the peers certificate: so remove it and
just the s->session->peer instead.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoRemove peer temp keys from SESS_CERT
Dr. Stephen Henson [Sun, 21 Jun 2015 15:26:08 +0000 (16:26 +0100)]
Remove peer temp keys from SESS_CERT

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoRT3917: add cleanup on an error path
Rich Salz [Sun, 21 Jun 2015 19:37:53 +0000 (15:37 -0400)]
RT3917: add cleanup on an error path

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoCleanup mttest.c : because we no longer use stdio here, don't include it
Richard Levitte [Sun, 21 Jun 2015 19:35:59 +0000 (21:35 +0200)]
Cleanup mttest.c : because we no longer use stdio here, don't include it

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoAdd -ldl to the build of mttest.c
Richard Levitte [Sun, 21 Jun 2015 17:19:59 +0000 (19:19 +0200)]
Add -ldl to the build of mttest.c

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoCleanup mttest.c : use BIO_free only, no preceding hacks
Richard Levitte [Sun, 21 Jun 2015 17:19:17 +0000 (19:19 +0200)]
Cleanup mttest.c : use BIO_free only, no preceding hacks

Since [sc]_ssl->[rw]bio aren't available, do not try to fiddle with
them.  Surely, a BIO_free on the "main" BIOs should be enough

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoCleanup mttest.c : do not try to output reference counts when threads are done
Richard Levitte [Sun, 21 Jun 2015 17:16:50 +0000 (19:16 +0200)]
Cleanup mttest.c : do not try to output reference counts when threads are done

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoCleanup mttest.c : better error reporting when certs are miggins
Richard Levitte [Sun, 21 Jun 2015 17:13:57 +0000 (19:13 +0200)]
Cleanup mttest.c : better error reporting when certs are miggins

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoCleanup mttest.c : make ssl_method a pointer to const
Richard Levitte [Sun, 21 Jun 2015 17:12:33 +0000 (19:12 +0200)]
Cleanup mttest.c : make ssl_method a pointer to const

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoCleanup mttest.c : modernise output
Richard Levitte [Sun, 21 Jun 2015 17:11:43 +0000 (19:11 +0200)]
Cleanup mttest.c : modernise output

Construct bio_err and bio_stdout from file handles instead of FILE
pointers, since the latter might not be implemented (when OPENSSL_NO_STDIO
is defined).
Convert all output to use BIO_printf.
Change lh_foo to lh_SSL_SESSION_foo.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoCleanup mttest.c : modernise the threads setup
Richard Levitte [Sun, 21 Jun 2015 17:03:44 +0000 (19:03 +0200)]
Cleanup mttest.c : modernise the threads setup

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoCleanup mttest.c : remove MS_CALLBACK
Richard Levitte [Sun, 21 Jun 2015 16:51:18 +0000 (18:51 +0200)]
Cleanup mttest.c : remove MS_CALLBACK

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoRevert "Avoid duplication."
Dr. Stephen Henson [Sun, 21 Jun 2015 15:06:21 +0000 (16:06 +0100)]
Revert "Avoid duplication."

This reverts commit d480e182fe20fcaeca7817a4693eeaf594bb1a32.

Commit broke TLS handshakes due to fragility of digest caching: that will be
fixed separately.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoAvoid duplication.
Dr. Stephen Henson [Sat, 20 Jun 2015 14:44:03 +0000 (15:44 +0100)]
Avoid duplication.

We always free the handshake buffer when digests are freed so move
it into ssl_free_digest_list()

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoremove unnecessary NULL checks
Dr. Stephen Henson [Sat, 20 Jun 2015 14:37:22 +0000 (15:37 +0100)]
remove unnecessary NULL checks

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agotypo: should be OPENSSL_free
Dr. Stephen Henson [Sat, 20 Jun 2015 15:10:54 +0000 (16:10 +0100)]
typo: should be OPENSSL_free

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoMake preprocessor error into real preprocessor error
Richard Levitte [Mon, 15 Jun 2015 07:59:25 +0000 (09:59 +0200)]
Make preprocessor error into real preprocessor error

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
4 years agoRemove one extraneous parenthesis
Richard Levitte [Sat, 13 Jun 2015 11:13:55 +0000 (13:13 +0200)]
Remove one extraneous parenthesis

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
4 years agoRT2547: Tighten perms on generated privkey files
Rich Salz [Sat, 2 May 2015 14:01:33 +0000 (10:01 -0400)]
RT2547: Tighten perms on generated privkey files

When generating a private key, try to make the output file be readable
only by the owner.  Put it in CHANGES file since it might be noticeable.

Add "int private" flag to apps that write private keys, and check that it's
set whenever we do write a private key.  Checked via assert so that this
bug (security-related) gets fixed.  Thanks to Viktor for help in tracing
the code-paths where private keys are written.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
4 years agoRefactor into clear_ciphers; RT3588
Rich Salz [Sat, 13 Jun 2015 14:50:00 +0000 (10:50 -0400)]
Refactor into clear_ciphers; RT3588

While closing RT3588 (Remove obsolete comment) Kurt and I saw that a
few lines to completely clear the SSL cipher state could be moved into
a common function.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
4 years agoFix argument processing error from the option parsing change over.
Tim Hudson [Mon, 15 Jun 2015 04:55:34 +0000 (14:55 +1000)]
Fix argument processing error from the option parsing change over.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoFix argument processing error from the option parsing change over.
Tim Hudson [Mon, 15 Jun 2015 01:36:32 +0000 (11:36 +1000)]
Fix argument processing error from the option parsing change over.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoEncode b == NULL or blen == 0 as zero.
Dr. Stephen Henson [Fri, 12 Jun 2015 21:18:36 +0000 (22:18 +0100)]
Encode b == NULL or blen == 0 as zero.

PR#3904

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoAllow a zero length extension block
Adam Langley [Fri, 12 Jun 2015 07:05:49 +0000 (08:05 +0100)]
Allow a zero length extension block

It is valid for an extension block to be present in a ClientHello, but to
be of zero length.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoFix ABI break with HMAC
Matt Caswell [Fri, 12 Jun 2015 12:08:04 +0000 (13:08 +0100)]
Fix ABI break with HMAC

Recent HMAC changes broke ABI compatibility due to a new field in HMAC_CTX.
This backs that change out, and does it a different way.

Thanks to Timo Teras for the concept.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoUpdate CHANGES and NEWS
Matt Caswell [Wed, 10 Jun 2015 10:49:31 +0000 (11:49 +0100)]
Update CHANGES and NEWS

Updates to CHANGES and NEWS to take account of the latest security fixes.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agobn/bn_gf2m.c: avoid infinite loop wich malformed ECParamters.
Andy Polyakov [Wed, 10 Jun 2015 22:18:01 +0000 (00:18 +0200)]
bn/bn_gf2m.c: avoid infinite loop wich malformed ECParamters.

CVE-2015-1788

Reviewed-by: Matt Caswell <matt@openssl.org>
4 years agoPKCS#7: Fix NULL dereference with missing EncryptedContent.
Emilia Kasper [Tue, 12 May 2015 17:00:30 +0000 (19:00 +0200)]
PKCS#7: Fix NULL dereference with missing EncryptedContent.

CVE-2015-1790

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoFix length checks in X509_cmp_time to avoid out-of-bounds reads.
Emilia Kasper [Wed, 8 Apr 2015 14:56:43 +0000 (16:56 +0200)]
Fix length checks in X509_cmp_time to avoid out-of-bounds reads.

Also tighten X509_cmp_time to reject more than three fractional
seconds in the time; and to reject trailing garbage after the offset.

CVE-2015-1789

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoMore ssl_session_dup fixes
Matt Caswell [Thu, 11 Jun 2015 00:30:06 +0000 (01:30 +0100)]
More ssl_session_dup fixes

Fix error handling in ssl_session_dup, as well as incorrect setting up of
the session ticket. Follow on from CVE-2015-1791.

Thanks to LibreSSL project for reporting these issues.

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoe_aes_cbc_hmac_sha*.c: address linker warning about OPENSSL_ia32cap_P size mismatch.
Andy Polyakov [Thu, 11 Jun 2015 06:51:53 +0000 (08:51 +0200)]
e_aes_cbc_hmac_sha*.c: address linker warning about OPENSSL_ia32cap_P size mismatch.

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agogcm.c: address linker warning about OPENSSL_ia32cap_P size mismatch.
Andy Polyakov [Mon, 1 Jun 2015 20:51:33 +0000 (22:51 +0200)]
gcm.c: address linker warning about OPENSSL_ia32cap_P size mismatch.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoTidy disabled algorithm handling.
Dr. Stephen Henson [Sun, 7 Jun 2015 20:47:39 +0000 (21:47 +0100)]
Tidy disabled algorithm handling.

Determine disabled algorithm masks when algorithms are loaded instead of
recalculating them each time.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoRestore GOST mac setup.
Dr. Stephen Henson [Sun, 7 Jun 2015 20:46:19 +0000 (21:46 +0100)]
Restore GOST mac setup.

Restore GOST mac setup which was accidentally removed during cipher
refactor.

Reviewed-by: Rich Salz <rsalz@openssl.org>
4 years agoRemove SSL_OP_TLS_BLOCK_PADDING_BUG
Emilia Kasper [Tue, 9 Jun 2015 12:17:50 +0000 (14:17 +0200)]
Remove SSL_OP_TLS_BLOCK_PADDING_BUG

This is a workaround so old that nobody remembers what buggy clients
it was for. It's also been broken in stable branches for two years and
nobody noticed (see
https://boringssl-review.googlesource.com/#/c/1694/).

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoDTLS handshake message fragments musn't span packets
Matt Caswell [Mon, 1 Jun 2015 16:25:29 +0000 (17:25 +0100)]
DTLS handshake message fragments musn't span packets

It should not be possible for DTLS message fragments to span multiple
packets. However previously if the message header fitted exactly into one
packet, and the fragment body was in the next packet then this would work.
Obviously this would fail if packets get re-ordered mid-flight.

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoCorrect type of RECORD_LAYER_get_rrec_length()
Matt Caswell [Tue, 2 Jun 2015 07:57:02 +0000 (08:57 +0100)]
Correct type of RECORD_LAYER_get_rrec_length()

The underlying field returned by RECORD_LAYER_get_rrec_length() is an
unsigned int. The return type of the function should match that.

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoFix leak in HMAC error path
Matt Caswell [Mon, 8 Jun 2015 08:29:56 +0000 (09:29 +0100)]
Fix leak in HMAC error path

In the event of an error in the HMAC function, leaks can occur because the
HMAC_CTX does not get cleaned up.

Thanks to the BoringSSL project for reporting this issue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoEC_POINT_is_on_curve does not return a boolean
Matt Caswell [Thu, 4 Jun 2015 13:22:00 +0000 (14:22 +0100)]
EC_POINT_is_on_curve does not return a boolean

The function EC_POINT_is_on_curve does not return a boolean value.
It returns 1 if the point is on the curve, 0 if it is not, and -1
on error. Many usages within OpenSSL were incorrectly using this
function and therefore not correctly handling error conditions.

With thanks to the Open Crypto Audit Project for reporting this issue.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
4 years agoChange BIO_number_read and BIO_number_written() to be 64 bit
Matt Caswell [Thu, 4 Jun 2015 09:35:08 +0000 (10:35 +0100)]
Change BIO_number_read and BIO_number_written() to be 64 bit

The return type of BIO_number_read() and BIO_number_written() as well as
the corresponding num_read and num_write members in the BIO structure has
been changed from unsigned long to uint64_t. On platforms where an unsigned
long is 32 bits (e.g. Windows) these counters could overflow if >4Gb is
transferred.

With thanks to the Open Crypto Audit Project for reporting this issue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
4 years agoTighten extension handling
Matt Caswell [Thu, 30 Apr 2015 14:20:25 +0000 (15:20 +0100)]
Tighten extension handling

This adds additional checks to the processing of extensions in a ClientHello
to ensure that either no extensions are present, or if they are then they
take up the exact amount of space expected.

With thanks to the Open Crypto Audit Project for reporting this issue.

Reviewed-by: Stephen Henson <steve@openssl.org>
4 years agoFix memory leaks in BIO_dup_chain()
Matt Caswell [Thu, 30 Apr 2015 13:51:10 +0000 (14:51 +0100)]
Fix memory leaks in BIO_dup_chain()

This fixes a memory leak that can occur whilst duplicating a BIO chain if
the call to CRYPTO_dup_ex_data() fails. It also fixes a second memory leak
where if a failure occurs after successfully creating the first BIO in the
chain, then the beginning of the new chain was not freed.

With thanks to the Open Crypto Audit Project for reporting this issue.

Reviewed-by: Stephen Henson <steve@openssl.org>
4 years agoReplace memset with OPENSSL_clear_free()
Matt Caswell [Thu, 30 Apr 2015 13:04:30 +0000 (14:04 +0100)]
Replace memset with OPENSSL_clear_free()

BUF_MEM_free() attempts to cleanse memory using memset immediately prior
to a free. This is at risk of being optimised away by the compiler, so
replace with a call to OPENSSL_clear_free() instead.

With thanks to the Open Crypto Audit Project for reporting this issue.

Reviewed-by: Stephen Henson <steve@openssl.org>
4 years agoMake sure test/gost2814789test.c can see configuration macros
Richard Levitte [Tue, 9 Jun 2015 23:51:23 +0000 (01:51 +0200)]
Make sure test/gost2814789test.c can see configuration macros

test/gost2814789test.c needs to include openssl/e_os2.h or it wouldn't
see the defined OPENSSL_NO_* macros.

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoWhen making libcrypto from apps or test, make sure to include engines
Richard Levitte [Tue, 9 Jun 2015 21:06:23 +0000 (23:06 +0200)]
When making libcrypto from apps or test, make sure to include engines

For librypto to be complete, the stuff in both crypto/ and engines/
have to be built.  Doing 'make test' or 'make apps' from a clean
source tree failed to do so.
Corrected by using the new 'build_libcrypto' in the top Makefile.

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoAdd and rearrange building of libraries
Richard Levitte [Tue, 9 Jun 2015 23:34:26 +0000 (01:34 +0200)]
Add and rearrange building of libraries

There's a need for a target that will build all of libcrypto, so let's
add 'build_libcrypto' that does this.  For ortogonality, let's also
add 'build_libssl'.  Have both also depend on 'libcrypto.pc' and
'libssl.pc' so those get built together with the libraries.
This makes 'all' depend on fewer things directly.

Reviewed-by: Tim Hudson <tjh@openssl.org>
4 years agoFix -DZLIB build for opaque COMP types
Rich Salz [Wed, 20 May 2015 10:56:14 +0000 (06:56 -0400)]
Fix -DZLIB build for opaque COMP types

Reviewed-by: Richard Levitte <levitte@openssl.org>