Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/openssl/dist Upstream changelog:
details: https://anonhg.NetBSD.org/src/rev/fd6a49197471
branches: trunk
changeset: 331383:fd6a49197471
user: spz <spz%NetBSD.org@localhost>
date: Sun Aug 10 07:33:40 2014 +0000
description:
Upstream changelog:
Changes between 1.0.1h and 1.0.1i [6 Aug 2014]
*) 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 discovering this issue.
(CVE-2014-3512)
[Steve Henson]
*) A flaw in the OpenSSL SSL/TLS server code causes the server to negotiate
TLS 1.0 instead of higher protocol versions when the ClientHello message
is badly fragmented. This allows a man-in-the-middle attacker to force a
downgrade to TLS 1.0 even if both the server and the client support a
higher protocol version, by modifying the client's TLS records.
Thanks to David Benjamin and Adam Langley (Google) for discovering and
researching this issue.
(CVE-2014-3511)
[David Benjamin]
*) OpenSSL DTLS clients enabling anonymous (EC)DH ciphersuites are subject
to a denial of service attack. A malicious server can crash the client
with a null pointer dereference (read) by specifying an anonymous (EC)DH
ciphersuite and sending carefully crafted handshake messages.
Thanks to Felix Gr??bert (Google) for discovering and researching this
issue.
(CVE-2014-3510)
[Emilia K??sper]
*) By sending carefully crafted DTLS packets an attacker could cause openssl
to leak memory. This can be exploited through a Denial of Service attack.
Thanks to Adam Langley for discovering and researching this issue.
(CVE-2014-3507)
[Adam Langley]
*) An attacker can force openssl to consume large amounts of memory whilst
processing DTLS handshake messages. This can be exploited through a
Denial of Service attack.
Thanks to Adam Langley for discovering and researching this issue.
(CVE-2014-3506)
[Adam Langley]
*) An attacker can force an error condition which causes openssl to crash
whilst processing DTLS packets due to memory being freed twice. This
can be exploited through a Denial of Service attack.
Thanks to Adam Langley and Wan-Teh Chang for discovering and researching
this issue.
(CVE-2014-3505)
[Adam Langley]
*) If a multithreaded client connects to a malicious server using a resumed
session and the server sends an ec point format extension it could write
up to 255 bytes to freed memory.
Thanks to Gabor Tyukasz (LogMeIn Inc) for discovering and researching this
issue.
(CVE-2014-3509)
[Gabor Tyukasz]
*) A malicious server can crash an OpenSSL client with a null pointer
dereference (read) by specifying an SRP ciphersuite even though it was not
properly negotiated with the client. This can be exploited through a
Denial of Service attack.
Thanks to Joonas Kuorilehto and Riku Hietam?ki (Codenomicon) for
discovering and researching this issue.
(CVE-2014-5139)
[Steve Henson]
*) A flaw in OBJ_obj2txt may cause pretty printing functions such as
X509_name_oneline, X509_name_print_ex et al. to leak some information
from the stack. Applications may be affected if they echo pretty printing
output to the attacker.
Thanks to Ivan Fratric (Google) for discovering this issue.
(CVE-2014-3508)
[Emilia K??sper, and Steve Henson]
*) Fix ec_GFp_simple_points_make_affine (thus, EC_POINTs_mul etc.)
for corner cases. (Certain input points at infinity could lead to
bogus results, with non-infinity inputs mapped to infinity too.)
[Bodo Moeller]
diffstat:
crypto/external/bsd/openssl/dist/crypto/bn/bn_sqr.c | 1 +
crypto/external/bsd/openssl/dist/crypto/ec/ec_lib.c | 2 +-
crypto/external/bsd/openssl/dist/crypto/ec/ecp_smpl.c | 178 +-
crypto/external/bsd/openssl/dist/crypto/evp/evp_pbe.c | 2 +-
crypto/external/bsd/openssl/dist/crypto/objects/obj_dat.c | 16 +-
crypto/external/bsd/openssl/dist/crypto/objects/obj_dat.h | 3429 ++++-----
crypto/external/bsd/openssl/dist/crypto/objects/obj_dat.pl | 2 +-
crypto/external/bsd/openssl/dist/crypto/ocsp/ocsp_ht.c | 16 +-
crypto/external/bsd/openssl/dist/crypto/ocsp/ocsp_lib.c | 13 +-
crypto/external/bsd/openssl/dist/crypto/pem/pvkfmt.c | 5 +
crypto/external/bsd/openssl/dist/crypto/pkcs7/Makefile | 14 -
crypto/external/bsd/openssl/dist/crypto/rand/rand_lcl.h | 1 +
crypto/external/bsd/openssl/dist/crypto/rand/rand_lib.c | 3 +-
crypto/external/bsd/openssl/dist/crypto/srp/srp_lib.c | 6 +
crypto/external/bsd/openssl/dist/crypto/ui/ui_lib.c | 2 +-
crypto/external/bsd/openssl/dist/doc/apps/asn1parse.pod | 10 +
crypto/external/bsd/openssl/dist/doc/apps/ca.pod | 25 +-
crypto/external/bsd/openssl/dist/doc/apps/ciphers.pod | 195 +-
crypto/external/bsd/openssl/dist/doc/apps/cms.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/apps/crl.pod | 6 +
crypto/external/bsd/openssl/dist/doc/apps/dhparam.pod | 5 +
crypto/external/bsd/openssl/dist/doc/apps/dsa.pod | 12 +-
crypto/external/bsd/openssl/dist/doc/apps/ecparam.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/apps/gendsa.pod | 12 +-
crypto/external/bsd/openssl/dist/doc/apps/genrsa.pod | 18 +-
crypto/external/bsd/openssl/dist/doc/apps/rsa.pod | 12 +-
crypto/external/bsd/openssl/dist/doc/apps/s_client.pod | 34 +
crypto/external/bsd/openssl/dist/doc/apps/s_server.pod | 40 +
crypto/external/bsd/openssl/dist/doc/apps/verify.pod | 1 -
crypto/external/bsd/openssl/dist/doc/apps/x509.pod | 20 +-
crypto/external/bsd/openssl/dist/doc/apps/x509v3_config.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/crypto/ASN1_generate_nconf.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/crypto/BIO_f_base64.pod | 15 +-
crypto/external/bsd/openssl/dist/doc/crypto/BIO_push.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/crypto/ERR_get_error.pod | 4 +-
crypto/external/bsd/openssl/dist/doc/crypto/EVP_DigestInit.pod | 5 +-
crypto/external/bsd/openssl/dist/doc/crypto/EVP_EncryptInit.pod | 5 +-
crypto/external/bsd/openssl/dist/doc/crypto/EVP_SignInit.pod | 8 +-
crypto/external/bsd/openssl/dist/doc/crypto/RSA_set_method.pod | 14 +-
crypto/external/bsd/openssl/dist/doc/crypto/RSA_sign.pod | 4 +
crypto/external/bsd/openssl/dist/doc/crypto/des.pod | 7 +-
crypto/external/bsd/openssl/dist/doc/crypto/err.pod | 1 -
crypto/external/bsd/openssl/dist/doc/crypto/pem.pod | 8 +-
crypto/external/bsd/openssl/dist/doc/crypto/ui.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/fingerprints.txt | 15 +-
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CIPHER_get_name.pod | 15 +-
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_add_extra_chain_cert.pod | 10 +
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_add_session.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_new.pod | 34 +-
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_set_cipher_list.pod | 4 +
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_set_client_cert_cb.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_set_options.pod | 2 +-
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_set_tlsext_ticket_key_cb.pod | 195 +
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod | 6 +-
crypto/external/bsd/openssl/dist/doc/ssl/SSL_CTX_set_verify.pod | 4 +-
crypto/external/bsd/openssl/dist/doc/ssl/SSL_get_version.pod | 14 +-
crypto/external/bsd/openssl/dist/doc/ssl/d2i_SSL_SESSION.pod | 10 +
crypto/external/bsd/openssl/dist/ssl/Makefile | 24 +-
crypto/external/bsd/openssl/dist/ssl/d1_both.c | 82 +-
crypto/external/bsd/openssl/dist/ssl/d1_clnt.c | 31 +-
crypto/external/bsd/openssl/dist/ssl/heartbeat_test.c | 13 +-
crypto/external/bsd/openssl/dist/ssl/s23_lib.c | 7 +
crypto/external/bsd/openssl/dist/ssl/s23_srvr.c | 30 +-
crypto/external/bsd/openssl/dist/ssl/s2_lib.c | 2 +-
crypto/external/bsd/openssl/dist/ssl/ssl_lib.c | 5 +
crypto/external/bsd/openssl/dist/ssl/ssl_stat.c | 5 +-
crypto/external/bsd/openssl/dist/ssl/ssl_utst.c | 73 +
crypto/external/bsd/openssl/dist/ssl/tls_srp.c | 48 +-
crypto/external/bsd/openssl/dist/test/Makefile | 11 +-
crypto/external/bsd/openssl/dist/test/testutil.h | 116 +
crypto/external/bsd/openssl/dist/util/mk1mf.pl | 1 +
crypto/external/bsd/openssl/dist/util/mkdef.pl | 7 +-
crypto/external/bsd/openssl/dist/util/mkerr.pl | 4 +-
crypto/external/bsd/openssl/dist/util/ssleay.num | 1 +
74 files changed, 2910 insertions(+), 2026 deletions(-)
diffs (truncated from 7021 to 300 lines):
diff -r d4f8ef75bf9b -r fd6a49197471 crypto/external/bsd/openssl/dist/crypto/bn/bn_sqr.c
--- a/crypto/external/bsd/openssl/dist/crypto/bn/bn_sqr.c Sun Aug 10 07:33:37 2014 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/bn/bn_sqr.c Sun Aug 10 07:33:40 2014 +0000
@@ -77,6 +77,7 @@
if (al <= 0)
{
r->top=0;
+ r->neg = 0;
return 1;
}
diff -r d4f8ef75bf9b -r fd6a49197471 crypto/external/bsd/openssl/dist/crypto/ec/ec_lib.c
--- a/crypto/external/bsd/openssl/dist/crypto/ec/ec_lib.c Sun Aug 10 07:33:37 2014 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/ec/ec_lib.c Sun Aug 10 07:33:40 2014 +0000
@@ -942,7 +942,7 @@
int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx)
{
- if (group->meth->dbl == 0)
+ if (group->meth->invert == 0)
{
ECerr(EC_F_EC_POINT_INVERT, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
diff -r d4f8ef75bf9b -r fd6a49197471 crypto/external/bsd/openssl/dist/crypto/ec/ecp_smpl.c
--- a/crypto/external/bsd/openssl/dist/crypto/ec/ecp_smpl.c Sun Aug 10 07:33:37 2014 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/ec/ecp_smpl.c Sun Aug 10 07:33:40 2014 +0000
@@ -1181,9 +1181,8 @@
int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
- BIGNUM *tmp0, *tmp1;
- size_t pow2 = 0;
- BIGNUM **heap = NULL;
+ BIGNUM *tmp, *tmp_Z;
+ BIGNUM **prod_Z = NULL;
size_t i;
int ret = 0;
@@ -1198,124 +1197,104 @@
}
BN_CTX_start(ctx);
- tmp0 = BN_CTX_get(ctx);
- tmp1 = BN_CTX_get(ctx);
- if (tmp0 == NULL || tmp1 == NULL) goto err;
+ tmp = BN_CTX_get(ctx);
+ tmp_Z = BN_CTX_get(ctx);
+ if (tmp == NULL || tmp_Z == NULL) goto err;
- /* Before converting the individual points, compute inverses of all Z values.
- * Modular inversion is rather slow, but luckily we can do with a single
- * explicit inversion, plus about 3 multiplications per input value.
- */
+ prod_Z = OPENSSL_malloc(num * sizeof prod_Z[0]);
+ if (prod_Z == NULL) goto err;
+ for (i = 0; i < num; i++)
+ {
+ prod_Z[i] = BN_new();
+ if (prod_Z[i] == NULL) goto err;
+ }
- pow2 = 1;
- while (num > pow2)
- pow2 <<= 1;
- /* Now pow2 is the smallest power of 2 satifsying pow2 >= num.
- * We need twice that. */
- pow2 <<= 1;
+ /* Set each prod_Z[i] to the product of points[0]->Z .. points[i]->Z,
+ * skipping any zero-valued inputs (pretend that they're 1). */
- heap = OPENSSL_malloc(pow2 * sizeof heap[0]);
- if (heap == NULL) goto err;
-
- /* The array is used as a binary tree, exactly as in heapsort:
- *
- * heap[1]
- * heap[2] heap[3]
- * heap[4] heap[5] heap[6] heap[7]
- * heap[8]heap[9] heap[10]heap[11] heap[12]heap[13] heap[14] heap[15]
- *
- * We put the Z's in the last line;
- * then we set each other node to the product of its two child-nodes (where
- * empty or 0 entries are treated as ones);
- * then we invert heap[1];
- * then we invert each other node by replacing it by the product of its
- * parent (after inversion) and its sibling (before inversion).
- */
- heap[0] = NULL;
- for (i = pow2/2 - 1; i > 0; i--)
- heap[i] = NULL;
- for (i = 0; i < num; i++)
- heap[pow2/2 + i] = &points[i]->Z;
- for (i = pow2/2 + num; i < pow2; i++)
- heap[i] = NULL;
-
- /* set each node to the product of its children */
- for (i = pow2/2 - 1; i > 0; i--)
+ if (!BN_is_zero(&points[0]->Z))
+ {
+ if (!BN_copy(prod_Z[0], &points[0]->Z)) goto err;
+ }
+ else
{
- heap[i] = BN_new();
- if (heap[i] == NULL) goto err;
-
- if (heap[2*i] != NULL)
+ if (group->meth->field_set_to_one != 0)
+ {
+ if (!group->meth->field_set_to_one(group, prod_Z[0], ctx)) goto err;
+ }
+ else
{
- if ((heap[2*i + 1] == NULL) || BN_is_zero(heap[2*i + 1]))
- {
- if (!BN_copy(heap[i], heap[2*i])) goto err;
- }
- else
- {
- if (BN_is_zero(heap[2*i]))
- {
- if (!BN_copy(heap[i], heap[2*i + 1])) goto err;
- }
- else
- {
- if (!group->meth->field_mul(group, heap[i],
- heap[2*i], heap[2*i + 1], ctx)) goto err;
- }
- }
+ if (!BN_one(prod_Z[0])) goto err;
+ }
+ }
+
+ for (i = 1; i < num; i++)
+ {
+ if (!BN_is_zero(&points[i]->Z))
+ {
+ if (!group->meth->field_mul(group, prod_Z[i], prod_Z[i - 1], &points[i]->Z, ctx)) goto err;
+ }
+ else
+ {
+ if (!BN_copy(prod_Z[i], prod_Z[i - 1])) goto err;
}
}
- /* invert heap[1] */
- if (!BN_is_zero(heap[1]))
+ /* Now use a single explicit inversion to replace every
+ * non-zero points[i]->Z by its inverse. */
+
+ if (!BN_mod_inverse(tmp, prod_Z[num - 1], &group->field, ctx))
{
- if (!BN_mod_inverse(heap[1], heap[1], &group->field, ctx))
- {
- ECerr(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE, ERR_R_BN_LIB);
- goto err;
- }
+ ECerr(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE, ERR_R_BN_LIB);
+ goto err;
}
if (group->meth->field_encode != 0)
{
- /* in the Montgomery case, we just turned R*H (representing H)
+ /* In the Montgomery case, we just turned R*H (representing H)
* into 1/(R*H), but we need R*(1/H) (representing 1/H);
- * i.e. we have need to multiply by the Montgomery factor twice */
- if (!group->meth->field_encode(group, heap[1], heap[1], ctx)) goto err;
- if (!group->meth->field_encode(group, heap[1], heap[1], ctx)) goto err;
+ * i.e. we need to multiply by the Montgomery factor twice. */
+ if (!group->meth->field_encode(group, tmp, tmp, ctx)) goto err;
+ if (!group->meth->field_encode(group, tmp, tmp, ctx)) goto err;
}
- /* set other heap[i]'s to their inverses */
- for (i = 2; i < pow2/2 + num; i += 2)
+ for (i = num - 1; i > 0; --i)
{
- /* i is even */
- if ((heap[i + 1] != NULL) && !BN_is_zero(heap[i + 1]))
+ /* Loop invariant: tmp is the product of the inverses of
+ * points[0]->Z .. points[i]->Z (zero-valued inputs skipped). */
+ if (!BN_is_zero(&points[i]->Z))
{
- if (!group->meth->field_mul(group, tmp0, heap[i/2], heap[i + 1], ctx)) goto err;
- if (!group->meth->field_mul(group, tmp1, heap[i/2], heap[i], ctx)) goto err;
- if (!BN_copy(heap[i], tmp0)) goto err;
- if (!BN_copy(heap[i + 1], tmp1)) goto err;
- }
- else
- {
- if (!BN_copy(heap[i], heap[i/2])) goto err;
+ /* Set tmp_Z to the inverse of points[i]->Z (as product
+ * of Z inverses 0 .. i, Z values 0 .. i - 1). */
+ if (!group->meth->field_mul(group, tmp_Z, prod_Z[i - 1], tmp, ctx)) goto err;
+ /* Update tmp to satisfy the loop invariant for i - 1. */
+ if (!group->meth->field_mul(group, tmp, tmp, &points[i]->Z, ctx)) goto err;
+ /* Replace points[i]->Z by its inverse. */
+ if (!BN_copy(&points[i]->Z, tmp_Z)) goto err;
}
}
- /* we have replaced all non-zero Z's by their inverses, now fix up all the points */
+ if (!BN_is_zero(&points[0]->Z))
+ {
+ /* Replace points[0]->Z by its inverse. */
+ if (!BN_copy(&points[0]->Z, tmp)) goto err;
+ }
+
+ /* Finally, fix up the X and Y coordinates for all points. */
+
for (i = 0; i < num; i++)
{
EC_POINT *p = points[i];
-
+
if (!BN_is_zero(&p->Z))
{
/* turn (X, Y, 1/Z) into (X/Z^2, Y/Z^3, 1) */
- if (!group->meth->field_sqr(group, tmp1, &p->Z, ctx)) goto err;
- if (!group->meth->field_mul(group, &p->X, &p->X, tmp1, ctx)) goto err;
+ if (!group->meth->field_sqr(group, tmp, &p->Z, ctx)) goto err;
+ if (!group->meth->field_mul(group, &p->X, &p->X, tmp, ctx)) goto err;
- if (!group->meth->field_mul(group, tmp1, tmp1, &p->Z, ctx)) goto err;
- if (!group->meth->field_mul(group, &p->Y, &p->Y, tmp1, ctx)) goto err;
-
+ if (!group->meth->field_mul(group, tmp, tmp, &p->Z, ctx)) goto err;
+ if (!group->meth->field_mul(group, &p->Y, &p->Y, tmp, ctx)) goto err;
+
if (group->meth->field_set_to_one != 0)
{
if (!group->meth->field_set_to_one(group, &p->Z, ctx)) goto err;
@@ -1329,20 +1308,19 @@
}
ret = 1;
-
+
err:
BN_CTX_end(ctx);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
- if (heap != NULL)
+ if (prod_Z != NULL)
{
- /* heap[pow2/2] .. heap[pow2-1] have not been allocated locally! */
- for (i = pow2/2 - 1; i > 0; i--)
+ for (i = 0; i < num; i++)
{
- if (heap[i] != NULL)
- BN_clear_free(heap[i]);
+ if (prod_Z[i] != NULL)
+ BN_clear_free(prod_Z[i]);
}
- OPENSSL_free(heap);
+ OPENSSL_free(prod_Z);
}
return ret;
}
diff -r d4f8ef75bf9b -r fd6a49197471 crypto/external/bsd/openssl/dist/crypto/evp/evp_pbe.c
--- a/crypto/external/bsd/openssl/dist/crypto/evp/evp_pbe.c Sun Aug 10 07:33:37 2014 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/evp/evp_pbe.c Sun Aug 10 07:33:40 2014 +0000
@@ -259,7 +259,7 @@
{
int cipher_nid, md_nid;
if (cipher)
- cipher_nid = EVP_CIPHER_type(cipher);
+ cipher_nid = EVP_CIPHER_nid(cipher);
else
cipher_nid = -1;
if (md)
diff -r d4f8ef75bf9b -r fd6a49197471 crypto/external/bsd/openssl/dist/crypto/objects/obj_dat.c
--- a/crypto/external/bsd/openssl/dist/crypto/objects/obj_dat.c Sun Aug 10 07:33:37 2014 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/objects/obj_dat.c Sun Aug 10 07:33:40 2014 +0000
@@ -471,11 +471,12 @@
const unsigned char *p;
char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2];
- if ((a == NULL) || (a->data == NULL)) {
- buf[0]='\0';
+ /* Ensure that, at every state, |buf| is NUL-terminated. */
+ if (buf && buf_len > 0)
+ buf[0] = '\0';
+
+ if ((a == NULL) || (a->data == NULL))
return(0);
- }
-
if (!no_name && (nid=OBJ_obj2nid(a)) != NID_undef)
{
@@ -554,9 +555,10 @@
i=(int)(l/40);
l-=(long)(i*40);
}
- if (buf && (buf_len > 0))
+ if (buf && (buf_len > 1))
{
*buf++ = i + '0';
Home |
Main Index |
Thread Index |
Old Index