openssl.git
9 years agopub_decode_gost94, pub_decode_gost01: check for NULL after allocating databuf pub_enc...
Jonas Maebe [Sun, 8 Dec 2013 21:53:29 +0000 (22:53 +0100)]
pub_decode_gost94, pub_decode_gost01: check for NULL after allocating databuf pub_encode_gost94, pub_encode_gost01: check for NULL after allocating databuf and octet

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoengine_md_copy: check for NULL after allocating to_md->HashBuffer
Jonas Maebe [Sun, 8 Dec 2013 21:49:19 +0000 (22:49 +0100)]
engine_md_copy: check for NULL after allocating to_md->HashBuffer

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoprocess_pci_value: free (*policy)->data before setting to NULL after failed realloc
Jonas Maebe [Sun, 8 Dec 2013 21:48:28 +0000 (22:48 +0100)]
process_pci_value: free (*policy)->data before setting to NULL after failed realloc

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agodo_ext_i2d: free ext_der or ext_oct on error path
Jonas Maebe [Sun, 8 Dec 2013 21:47:45 +0000 (22:47 +0100)]
do_ext_i2d: free ext_der or ext_oct on error path

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agodo_othername: check for NULL after allocating objtmp
Jonas Maebe [Sun, 8 Dec 2013 21:47:10 +0000 (22:47 +0100)]
do_othername: check for NULL after allocating objtmp

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoNETSCAPE_SPKI_b64_encode: free der_spki and b64_str on error path
Jonas Maebe [Sun, 8 Dec 2013 21:46:44 +0000 (22:46 +0100)]
NETSCAPE_SPKI_b64_encode: free der_spki and b64_str on error path

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoget_cert_by_subject: check for NULL when allocating hent
Jonas Maebe [Sun, 8 Dec 2013 21:45:58 +0000 (22:45 +0100)]
get_cert_by_subject: check for NULL when allocating hent

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoUI_construct_prompt: check for NULL when allocating prompt
Jonas Maebe [Sun, 8 Dec 2013 21:45:15 +0000 (22:45 +0100)]
UI_construct_prompt: check for NULL when allocating prompt

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agohashbn: check for NULL result when allocating bin and return an error if it fails...
Jonas Maebe [Sun, 8 Dec 2013 17:14:59 +0000 (18:14 +0100)]
hashbn: check for NULL result when allocating bin and return an error if it fails all (in)direct callers of hashbn: propagate potential error in hashbn

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoJPAKE_CTX_new: check for NULL result when allocating ctx
Jonas Maebe [Sun, 8 Dec 2013 17:14:10 +0000 (18:14 +0100)]
JPAKE_CTX_new: check for NULL result when allocating ctx

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoold_hmac_encode: check for NULL result when allocating *pder
Jonas Maebe [Sun, 8 Dec 2013 17:12:13 +0000 (18:12 +0100)]
old_hmac_encode: check for NULL result when allocating *pder

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agodev_crypto_md5_copy: return error if allocating to_md->data fails
Jonas Maebe [Sun, 8 Dec 2013 17:11:34 +0000 (18:11 +0100)]
dev_crypto_md5_copy: return error if allocating to_md->data fails

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agodev_crypto_md5_update: check result of realloc(md_data->data) and don't leak memory...
Jonas Maebe [Sun, 8 Dec 2013 17:10:50 +0000 (18:10 +0100)]
dev_crypto_md5_update: check result of realloc(md_data->data) and don't leak memory if it fails

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agodev_crypto_cipher: return immediately if allocating cin/cout failed
Jonas Maebe [Sun, 8 Dec 2013 17:09:58 +0000 (18:09 +0100)]
dev_crypto_cipher: return immediately if allocating cin/cout failed

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agodev_crypto_init_key: return error if allocating CDATA(ctx)->key failed
Jonas Maebe [Sun, 8 Dec 2013 17:09:20 +0000 (18:09 +0100)]
dev_crypto_init_key: return error if allocating CDATA(ctx)->key failed

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoAdd support for Camellia HMAC-Based cipher suites from RFC6367
Hubert Kario [Wed, 23 Jul 2014 13:03:59 +0000 (15:03 +0200)]
Add support for Camellia HMAC-Based cipher suites from RFC6367

While RFC6367 focuses on Camellia-GCM cipher suites, it also adds a few
cipher suites that use SHA-2 based HMAC that can be very easily
added.

Tested against gnutls 3.3.5

PR#3443

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFixed out-of-bounds read errors in ssl3_get_key_exchange.
Matt Caswell [Sat, 26 Jul 2014 22:47:40 +0000 (23:47 +0100)]
Fixed out-of-bounds read errors in ssl3_get_key_exchange.

PR#3450

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoRT2751: Declare get_issuer_sk() earlier.
Rich Salz [Fri, 15 Aug 2014 21:20:26 +0000 (17:20 -0400)]
RT2751: Declare get_issuer_sk() earlier.

Add a declaration for get_issuer_sk() so that other
functions in x509_vf.c could use it.  (Planned work
around cross-certification chains.)
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
9 years agocryptodev_digest_copy: return error if allocating dstate->mac_data fails
Jonas Maebe [Sun, 8 Dec 2013 16:20:30 +0000 (17:20 +0100)]
cryptodev_digest_copy: return error if allocating dstate->mac_data fails

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agocryptodev_digest_update: don't leak original state->mac_data if realloc fails
Jonas Maebe [Sun, 8 Dec 2013 16:18:17 +0000 (17:18 +0100)]
cryptodev_digest_update: don't leak original state->mac_data if realloc fails

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agocms_SignerInfo_content_sign: free sig on failure path
Jonas Maebe [Sun, 8 Dec 2013 16:16:57 +0000 (17:16 +0100)]
cms_SignerInfo_content_sign: free sig on failure path

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agortcp_new: return failure if allocation of bi->ptr failed
Jonas Maebe [Sun, 8 Dec 2013 16:16:12 +0000 (17:16 +0100)]
rtcp_new: return failure if allocation of bi->ptr failed

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agomulti_split: check for NULL when allocating parts and bpart, and for failure of sk_BI...
Jonas Maebe [Mon, 9 Dec 2013 21:02:06 +0000 (22:02 +0100)]
multi_split: check for NULL when allocating parts and bpart, and for failure of sk_BIO_push()

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoBIO_new_dgram_sctp, dgram_sctp_read: zero entire authchunks
Jonas Maebe [Thu, 5 Dec 2013 22:19:15 +0000 (23:19 +0100)]
BIO_new_dgram_sctp, dgram_sctp_read: zero entire authchunks

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agomime_hdr_addparam: free tmpname, tmpval and mparam on error path, and check whether...
Jonas Maebe [Tue, 3 Dec 2013 16:11:48 +0000 (17:11 +0100)]
mime_hdr_addparam: free tmpname, tmpval and mparam on error path, and check whether sk_MIME_PARAM_push succeeds

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agomime_hdr_new: free mhdr, tmpname, tmpval on error path
Jonas Maebe [Tue, 3 Dec 2013 16:10:12 +0000 (17:10 +0100)]
mime_hdr_new: free mhdr, tmpname, tmpval on error path

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoASN1_verify, ASN1_item_verify: cleanse and free buf_in on error path
Jonas Maebe [Mon, 2 Dec 2013 21:44:31 +0000 (22:44 +0100)]
ASN1_verify, ASN1_item_verify: cleanse and free buf_in on error path

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoSetBlob: free rgSetBlob on error path
Jonas Maebe [Mon, 2 Dec 2013 21:34:20 +0000 (22:34 +0100)]
SetBlob: free rgSetBlob on error path

Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoFix use after free bug.
Istvan Noszticzius [Fri, 15 Aug 2014 15:43:28 +0000 (16:43 +0100)]
Fix use after free bug.

Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoRT783: Minor optimization to ASN1_INTEGER_set
Frédéric Giudicelli [Fri, 15 Aug 2014 02:34:49 +0000 (22:34 -0400)]
RT783: Minor optimization to ASN1_INTEGER_set

Remove local variable and avoid extra assignment.

Reviewed-by: Emilia Kasper <emilia@silkandcyanide.net>
9 years agoRT2465: Silence some gcc warnings
Rob Austein [Fri, 15 Aug 2014 04:03:14 +0000 (00:03 -0400)]
RT2465: Silence some gcc warnings

"Another machine, another version of gcc, another batch
of compiler warnings."  Add "=NULL" to some local variable
declarations that are set by passing thier address into a
utility function; confuses GCC it might not be set.

Reviewed-by: Emilia Käsper <emilia@silkandcyanide.net>
9 years agoRT3023: Redundant logical expressions
Hans Wennborg [Fri, 15 Aug 2014 04:54:00 +0000 (00:54 -0400)]
RT3023: Redundant logical expressions

Remove some redundant logical expressions

Reviewed-by: Emilia Kasper <emilia@silkandcyanide.net>
9 years agoMerge branch 'master' of git.openssl.org:openssl
Rich Salz [Fri, 15 Aug 2014 14:41:50 +0000 (10:41 -0400)]
Merge branch 'master' of git.openssl.org:openssl

9 years agoRT3268: Fix spelling errors in CHANGES file.
Claus Assmann [Fri, 15 Aug 2014 04:44:14 +0000 (00:44 -0400)]
RT3268: Fix spelling errors in CHANGES file.

Fix a bunch of typo's and speling (sic) errors in the CHANGES file.

Reviewed-by: Tim Hudson <tjh@cryptsoft.com>
9 years agoRevision of custom extension code.
Dr. Stephen Henson [Tue, 5 Aug 2014 14:21:36 +0000 (15:21 +0100)]
Revision of custom extension code.

Move custom extension structures from SSL_CTX to CERT structure.

This change means the form can be revised in future without binary
compatibility issues. Also since CERT is part of SSL structures
so per-SSL custom extensions could be supported in future as well as
per SSL_CTX.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoInclude error messages on extension check failure.
Dr. Stephen Henson [Mon, 11 Aug 2014 21:03:21 +0000 (22:03 +0100)]
Include error messages on extension check failure.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agomake depend
Emilia Kasper [Thu, 14 Aug 2014 13:24:07 +0000 (15:24 +0200)]
make depend

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoFurther improve/fix ec_GFp_simple_points_make_affine (ecp_smpl.c) and
Bodo Moeller [Wed, 13 Aug 2014 15:37:19 +0000 (17:37 +0200)]
Further improve/fix ec_GFp_simple_points_make_affine (ecp_smpl.c) and
group_order_tests (ectest.c).  Also fix the EC_POINTs_mul documentation (ec.h).

Reviewed-by: emilia@openssl.org
9 years agoRT1665: Fix podpath to get xref's right
Matt Caswell [Wed, 13 Aug 2014 04:28:03 +0000 (00:28 -0400)]
RT1665: Fix podpath to get xref's right

In Makefile, when build manpages, put the current directory
at the start of the podpath so that cross-refs find the
local directory first.

Reviewed-by: Tim Hudson <tjh@cryptosoft.com>
9 years agoRT3239: Extra comma in NAME lines of two manpages
Ingo Schwarze [Tue, 12 Aug 2014 19:47:06 +0000 (15:47 -0400)]
RT3239: Extra comma in NAME lines of two manpages

In two OpenSSL manual pages, in the NAME section, the last word of the
name list is followed by a stray trailing comma. While this may seem
minor, it is worth fixing because it may confuse some makewhatis(8)
implementations.

While here, also add the missing word "size" to the one line
description in SSL_CTX_set_max_cert_list(3).

Reviewed by: Dr Stephen Henson <shenson@drh-consultancy.co.uk>

9 years agoMerge branch 'master' of git.openssl.org:openssl
Rich Salz [Tue, 12 Aug 2014 19:33:36 +0000 (15:33 -0400)]
Merge branch 'master' of git.openssl.org:openssl

9 years agoPR 719: Configure not exiting with child status
nnposter@users.sourceforge.net [Tue, 12 Aug 2014 03:36:27 +0000 (23:36 -0400)]
PR 719: Configure not exiting with child status

If subcommand fails, just die.
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
9 years agoPR 718: Configure not exiting with child status
nnposter@users.sourceforge.net [Tue, 12 Aug 2014 03:36:27 +0000 (23:36 -0400)]
PR 718: Configure not exiting with child status

If subcommand fails, just die.
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
9 years agoPR 2580: dgst missing current SHA algorithms
Nick Lewis [Tue, 12 Aug 2014 02:56:46 +0000 (22:56 -0400)]
PR 2580: dgst missing current SHA algorithms

Update the dgst.pod page to include SHA224...512 algorithms.
Update apps/progs.pl to add them to the digest command table.

Reviewed-by: Tim Hudson <tjh@cryptosoft.com>
9 years agoRevert "RT 2820: Case-insensitive filenames on Darwin"
Rich Salz [Tue, 12 Aug 2014 15:22:50 +0000 (11:22 -0400)]
Revert "RT 2820: Case-insensitive filenames on Darwin"

This reverts commit 691edc997a35682eb7fa29445036182d2c9eb1de.

9 years agoRT2609: Typo in EXAMPLE section of req.pod
Nick Urbanik [Tue, 12 Aug 2014 03:15:13 +0000 (23:15 -0400)]
RT2609: Typo in EXAMPLE section of req.pod

The x509_extensions should be req_extensions in the
config example in req.pod

Reviewed-by: tjh@cryptsoft.com
9 years agoFix d4a4370050f7d72239b92a60ab9d4a2dd5e9fd84
Dr Stephen Henson [Mon, 11 Aug 2014 21:32:57 +0000 (17:32 -0400)]
Fix d4a4370050f7d72239b92a60ab9d4a2dd5e9fd84

Fully remove old error, per drH
Reviewed-by: rsalz
9 years agoRT 2820: Case-insensitive filenames on Darwin
Jim Reid [Mon, 11 Aug 2014 19:06:54 +0000 (15:06 -0400)]
RT 2820: Case-insensitive filenames on Darwin

Add darwin-*-cc as one of the systems for case-insensitive
filenames.  Fixes the manpage install so it doesn't create
looping symlinks.

9 years agoMerge branch 'master' of git.openssl.org:openssl
Rich Salz [Mon, 11 Aug 2014 17:45:03 +0000 (13:45 -0400)]
Merge branch 'master' of git.openssl.org:openssl

9 years agoUndo 77bf69dced875200f6f0e385a4a270298f8d3c45
Rich Salz [Mon, 11 Aug 2014 17:44:25 +0000 (13:44 -0400)]
Undo 77bf69dced875200f6f0e385a4a270298f8d3c45

Not approved; mistakenly pushed commit that added README.md

9 years agoRT 2517: Various typo's.
Scott Schaefer [Mon, 11 Aug 2014 15:37:18 +0000 (11:37 -0400)]
RT 2517: Various typo's.
Reviewed-by: Emilia Kasper
Many of these were already fixed, this catches the last
few that were missed.

9 years agoRT 2517: Various typo's.
Scott Schaefer [Mon, 11 Aug 2014 15:37:18 +0000 (11:37 -0400)]
RT 2517: Various typo's.

Many of these were already fixed, this catches the last
few that were missed.

9 years agoAdd README.md
Rich Salz [Mon, 11 Aug 2014 15:35:32 +0000 (11:35 -0400)]
Add README.md

A small markdown README for GitHub users; points them to
the right README and the website and RT tracker.

9 years agoFix SRP authentication ciphersuites.
Dr. Stephen Henson [Fri, 8 Aug 2014 10:24:25 +0000 (11:24 +0100)]
Fix SRP authentication ciphersuites.

The addition of SRP authentication needs to be checked in various places
to work properly. Specifically:

A certificate is not sent.
A certificate request must not be sent.
Server key exchange message must not contain a signature.
If appropriate SRP authentication ciphersuites should be chosen.
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoTest SRP authentication ciphersuites.
Dr. Stephen Henson [Fri, 8 Aug 2014 10:19:39 +0000 (11:19 +0100)]
Test SRP authentication ciphersuites.

Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoUndo a90081576c94f9f54de1755188a00ccc1760549a
Rich Salz [Sat, 9 Aug 2014 12:02:20 +0000 (08:02 -0400)]
Undo a90081576c94f9f54de1755188a00ccc1760549a

Undo unapproved commit that removed DJGPP and WATT32

9 years agoRT 1988: Add "const" to SSL_use_RSAPrivateKey_ASN1
Viktor Szakats [Sat, 9 Aug 2014 03:15:59 +0000 (23:15 -0400)]
RT 1988: Add "const" to SSL_use_RSAPrivateKey_ASN1

The "unsigned char *d" should be const.
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
9 years agoRT 1505: Use SSL3_AL_FATAL not "2"
Matthieu Crapet [Fri, 8 Aug 2014 22:03:58 +0000 (18:03 -0400)]
RT 1505: Use SSL3_AL_FATAL not "2"

Use SSL3_AL_FATAL instead of the literal constant "2"
Every bit of cleanup helps.
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoRemove DJGPP (and therefore WATT32) #ifdef's.
Rich Salz [Fri, 8 Aug 2014 20:46:14 +0000 (16:46 -0400)]
Remove DJGPP (and therefore WATT32) #ifdef's.

DJGPP is no longer a supported platform.  Remove all #ifdef, etc.,
cases that refer to it.  DJGPP also #define'd WATT32, so that
is now removed as well.

9 years agoCheck SRP parameters early.
Dr. Stephen Henson [Sun, 3 Aug 2014 20:25:22 +0000 (21:25 +0100)]
Check SRP parameters early.

Check SRP parameters when they are received so we can send back an
appropriate alert.
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
9 years agoFix SRP buffer overrun vulnerability.
Dr. Stephen Henson [Thu, 31 Jul 2014 19:56:22 +0000 (20:56 +0100)]
Fix SRP buffer overrun vulnerability.

Invalid parameters passed to the SRP code can be overrun an internal
buffer. Add sanity check that g, A, B < N to SRP code.

Thanks to Sean Devlin and Watson Ladd of Cryptography Services, NCC
Group for reporting this issue.

9 years agoFix SRP ciphersuite DoS vulnerability.
Dr. Stephen Henson [Thu, 24 Jul 2014 23:50:06 +0000 (00:50 +0100)]
Fix SRP ciphersuite DoS vulnerability.

If a client attempted to use an SRP ciphersuite and it had not been
set up correctly it would crash with a null pointer read. A malicious
server could exploit this in a DoS attack.

Thanks to Joonas Kuorilehto and Riku Hietamäki from Codenomicon
for reporting this issue.

CVE-2014-2970
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix race condition in ssl_parse_serverhello_tlsext
Gabor Tyukasz [Wed, 23 Jul 2014 21:42:06 +0000 (23:42 +0200)]
Fix race condition in ssl_parse_serverhello_tlsext

CVE-2014-3509
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoFix OID handling:
Emilia Kasper [Wed, 2 Jul 2014 17:02:33 +0000 (19:02 +0200)]
Fix OID handling:

- Upon parsing, reject OIDs with invalid base-128 encoding.
- Always NUL-terminate the destination buffer in OBJ_obj2txt printing function.

CVE-2014-3508

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix DTLS anonymous EC(DH) denial of service
Emilia Käsper [Thu, 24 Jul 2014 20:15:29 +0000 (22:15 +0200)]
Fix DTLS anonymous EC(DH) denial of service

CVE-2014-3510

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agoFix protocol downgrade bug in case of fragmented packets
David Benjamin [Wed, 23 Jul 2014 20:32:21 +0000 (22:32 +0200)]
Fix protocol downgrade bug in case of fragmented packets

CVE-2014-3511

Reviewed-by: Emilia Käsper <emilia@openssl.org>
Reviewed-by: Bodo Möller <bodo@openssl.org>
9 years agoRemove some duplicate DTLS code.
Adam Langley [Fri, 6 Jun 2014 21:47:07 +0000 (14:47 -0700)]
Remove some duplicate DTLS code.

In a couple of functions, a sequence number would be calculated twice.

Additionally, in |dtls1_process_out_of_seq_message|, we know that
|frag_len| <= |msg_hdr->msg_len| so the later tests for |frag_len <
msg_hdr->msg_len| can be more clearly written as |frag_len !=
msg_hdr->msg_len|, since that's the only remaining case.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoApplying same fix as in dtls1_process_out_of_seq_message. A truncated DTLS fragment...
Matt Caswell [Thu, 24 Jul 2014 22:54:28 +0000 (23:54 +0100)]
Applying same fix as in dtls1_process_out_of_seq_message. A truncated DTLS fragment would cause *ok to be clear, but the return value would still be the number of bytes read.

Problem identified by Emilia Käsper, based on previous issue/patch by Adam
Langley.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix return code for truncated DTLS fragment.
Adam Langley [Fri, 6 Jun 2014 21:44:20 +0000 (14:44 -0700)]
Fix return code for truncated DTLS fragment.

Previously, a truncated DTLS fragment in
|dtls1_process_out_of_seq_message| would cause *ok to be cleared, but
the return value would still be the number of bytes read. This would
cause |dtls1_get_message| not to consider it an error and it would
continue processing as normal until the calling function noticed that
*ok was zero.

I can't see an exploit here because |dtls1_get_message| uses
|s->init_num| as the length, which will always be zero from what I can
see.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix memory leak from zero-length DTLS fragments.
Adam Langley [Fri, 6 Jun 2014 21:30:33 +0000 (14:30 -0700)]
Fix memory leak from zero-length DTLS fragments.

The |pqueue_insert| function can fail if one attempts to insert a
duplicate sequence number. When handling a fragment of an out of
sequence message, |dtls1_process_out_of_seq_message| would not call
|dtls1_reassemble_fragment| if the fragment's length was zero. It would
then allocate a fresh fragment and attempt to insert it, but ignore the
return value, leaking the fragment.

This allows an attacker to exhaust the memory of a DTLS peer.

Fixes CVE-2014-3507

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoFix DTLS handshake message size checks.
Matt Caswell [Fri, 6 Jun 2014 21:25:52 +0000 (14:25 -0700)]
Fix DTLS handshake message size checks.

In |dtls1_reassemble_fragment|, the value of
|msg_hdr->frag_off+frag_len| was being checked against the maximum
handshake message size, but then |msg_len| bytes were allocated for the
fragment buffer. This means that so long as the fragment was within the
allowed size, the pending handshake message could consume 16MB + 2MB
(for the reassembly bitmap). Approx 10 outstanding handshake messages
are allowed, meaning that an attacker could consume ~180MB per DTLS
connection.

In the non-fragmented path (in |dtls1_process_out_of_seq_message|), no
check was applied.

Fixes CVE-2014-3506

Wholly based on patch by Adam Langley with one minor amendment.

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoAdded comment for the frag->reassembly == NULL case as per feedback from Emilia
Matt Caswell [Thu, 24 Jul 2014 22:33:34 +0000 (23:33 +0100)]
Added comment for the frag->reassembly == NULL case as per feedback from Emilia

Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoAvoid double free when processing DTLS packets.
Adam Langley [Fri, 6 Jun 2014 21:19:21 +0000 (14:19 -0700)]
Avoid double free when processing DTLS packets.

The |item| variable, in both of these cases, may contain a pointer to a
|pitem| structure within |s->d1->buffered_messages|. It was being freed
in the error case while still being in |buffered_messages|. When the
error later caused the |SSL*| to be destroyed, the item would be double
freed.

Thanks to Wah-Teh Chang for spotting that the fix in 1632ef74 was
inconsistent with the other error paths (but correct).

Fixes CVE-2014-3505

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
9 years agoUpdate $default_depflags to match current defaults.
Bodo Moeller [Fri, 1 Aug 2014 17:02:10 +0000 (19:02 +0200)]
Update $default_depflags to match current defaults.

9 years agoSync with clean-up 1.0.2 CHANGES file.
Bodo Moeller [Fri, 1 Aug 2014 16:41:17 +0000 (18:41 +0200)]
Sync with clean-up 1.0.2 CHANGES file.
(If a change is already present in 1.0.1f or 1.0.1h,
don't list it again under changes between 1.0.1h and 1.0.2.)

9 years agoSync with current 1.0.2 CHANGES file.
Bodo Moeller [Fri, 1 Aug 2014 16:18:52 +0000 (18:18 +0200)]
Sync with current 1.0.2 CHANGES file.

9 years agoSimplify and fix ec_GFp_simple_points_make_affine
Bodo Moeller [Fri, 1 Aug 2014 15:18:14 +0000 (17:18 +0200)]
Simplify and fix ec_GFp_simple_points_make_affine
(which didn't always handle value 0 correctly).

Reviewed-by: emilia@openssl.org
9 years agoAdd conditional unit testing interface.
Dr. Stephen Henson [Wed, 23 Jul 2014 12:18:06 +0000 (13:18 +0100)]
Add conditional unit testing interface.

Don't call internal functions directly call them through
SSL_test_functions(). This also makes unit testing work on
Windows and platforms that don't export internal functions
from shared libraries.

By default unit testing is not enabled: it requires the compile
time option "enable-unit-test".
Reviewed-by: Geoff Thorpe <geoff@openssl.org>
9 years agoDon't call setenv in gost2814789t.c
Dr. Stephen Henson [Wed, 23 Jul 2014 16:19:48 +0000 (17:19 +0100)]
Don't call setenv in gost2814789t.c

The call to setenv in gost2814789t.c is not portable and may
not reflect the location of the GOST ENGINE on all platforms anyway.
Instead set OPENSSL_ENGINES in test/Makefile
Reviewed-by: Geoff Thorpe <geoff@openssl.org>
9 years agoRemove demos/tunala
Geoff Thorpe [Mon, 21 Jul 2014 13:27:54 +0000 (09:27 -0400)]
Remove demos/tunala

This has been unmaintained for a long time. If it's still of interest
to anyone, it can be obtained easily enough by reverting this commit.
(It could join other demo code in some other repository, perhaps.) In
any case we don't want it taking up space in the baseline source
package, so <snip>.

Signed-off-by: Geoff Thorpe <geoff@openssl.org>
9 years agoCHANGES: mention new platforms.
Andy Polyakov [Tue, 22 Jul 2014 18:19:37 +0000 (20:19 +0200)]
CHANGES: mention new platforms.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years ago"EC_POINT_invert" was checking "dbl" function pointer instead of "invert".
Billy Brumley [Mon, 21 Jul 2014 21:08:23 +0000 (22:08 +0100)]
"EC_POINT_invert" was checking "dbl" function pointer instead of "invert".

PR#2569

Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoRemove old unused and unmaintained demonstration code.
Tim Hudson [Mon, 21 Jul 2014 19:26:17 +0000 (05:26 +1000)]
Remove old unused and unmaintained demonstration code.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
9 years agosha1-ppc.pl: shave off one cycle from BODY_20_39
Andy Polyakov [Mon, 21 Jul 2014 13:29:09 +0000 (15:29 +0200)]
sha1-ppc.pl: shave off one cycle from BODY_20_39
and improve performance by 10% on POWER[78].

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
9 years agoMinor documentation update removing "really" and a
Tim Hudson [Mon, 21 Jul 2014 10:03:50 +0000 (20:03 +1000)]
Minor documentation update removing "really" and a
statement of opinion rather than a fact.

Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoAdd test header, sync ordinals with 1.0.2
Dr. Stephen Henson [Sun, 20 Jul 2014 11:54:39 +0000 (12:54 +0100)]
Add test header, sync ordinals with 1.0.2

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoEngage GHASH for PowerISA 2.0.7.
Andy Polyakov [Sun, 20 Jul 2014 12:16:31 +0000 (14:16 +0200)]
Engage GHASH for PowerISA 2.0.7.

[and split ppccap.c to ppccap.c and ppc_arch.h]

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoAdd GHASH for PowerISA 2.0.7.
Andy Polyakov [Sun, 20 Jul 2014 12:14:26 +0000 (14:14 +0200)]
Add GHASH for PowerISA 2.0.7.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoWindows build fixes.
Dr. Stephen Henson [Sat, 19 Jul 2014 20:46:40 +0000 (21:46 +0100)]
Windows build fixes.

Add cmac.h to mkdef.pl
Remove ENGINE_load_rsax from engine.h: no longer built.
Update ordinals
Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix documentation for RSA_set_method(3)
Dr. Stephen Henson [Sat, 19 Jul 2014 13:20:05 +0000 (14:20 +0100)]
Fix documentation for RSA_set_method(3)

PR#1675
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoCheck the test registry size during add_test()
Mike Bland [Thu, 17 Jul 2014 23:08:04 +0000 (19:08 -0400)]
Check the test registry size during add_test()

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoUpdate heartbeat_test #includes
Mike Bland [Wed, 18 Jun 2014 21:00:41 +0000 (17:00 -0400)]
Update heartbeat_test #includes

ssl/ssl_locl.h now comes first to ensure that it will compile standalone.
test/testutil.h is considered to be in the same directory as the test file,
since the test file will be linked into test/ and built there.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoUse testutil registry in heartbeat_test
Mike Bland [Tue, 15 Jul 2014 22:55:55 +0000 (18:55 -0400)]
Use testutil registry in heartbeat_test

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agotest/testutil.c test registry functions.
Mike Bland [Thu, 19 Jun 2014 16:27:54 +0000 (12:27 -0400)]
test/testutil.c test registry functions.

These help standardize the structure of main() and result reporting.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoRFC 5649 support.
Dr. Stephen Henson [Fri, 18 Jul 2014 12:52:03 +0000 (13:52 +0100)]
RFC 5649 support.

Add support for RFC5649 key wrapping with padding.

Add RFC5649 tests to evptests.txt

Based on PR#3434 contribution by Petr Spacek <pspacek@redhat.com>.

EVP support and minor changes added by Stephen Henson.

Doxygen comment block updates by Tim Hudson.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoMake *Final work for key wrap again.
Dr. Stephen Henson [Thu, 17 Jul 2014 21:27:50 +0000 (22:27 +0100)]
Make *Final work for key wrap again.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoSanity check lengths for AES wrap algorithm.
Dr. Stephen Henson [Thu, 17 Jul 2014 01:50:48 +0000 (02:50 +0100)]
Sanity check lengths for AES wrap algorithm.

Reviewed-by: Tim Hudson <tjh@openssl.org>
9 years agoFix typo, add reference.
Jeffrey Walton [Thu, 17 Jul 2014 10:25:02 +0000 (11:25 +0100)]
Fix typo, add reference.

PR#3456
Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
9 years agoDisabled XTS mode in enc utility as it is not supported
Matt Caswell [Sun, 13 Jul 2014 22:28:13 +0000 (23:28 +0100)]
Disabled XTS mode in enc utility as it is not supported

PR#3442

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
9 years agoRevert "Add GHASH for PowerISA 2.07."
Andy Polyakov [Wed, 16 Jul 2014 11:38:15 +0000 (13:38 +0200)]
Revert "Add GHASH for PowerISA 2.07."

This reverts commit 927f2e5dea1da17bcc2c3d2baf7258318b57515c.