Skip to content

Commit

Permalink
OpenSSL: update to 3.0.11
Browse files Browse the repository at this point in the history
OpenSSL 3.0.11 addresses:

    POLY1305 MAC implementation corrupts XMM registers on Windows (CVE-2023-4807)

Relnotes:	Yes
Pull request:	freebsd#852
Sponsored by:	The FreeBSD Foundation
  • Loading branch information
khorben authored and emaste committed Oct 9, 2023
2 parents 8f75390 + 315108b commit 6f1af0d
Show file tree
Hide file tree
Showing 868 changed files with 2,999 additions and 2,665 deletions.
25 changes: 25 additions & 0 deletions crypto/openssl/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ breaking changes, and mappings for the large list of deprecated functions.

[Migration guide]: https://github.com/openssl/openssl/tree/master/doc/man7/migration_guide.pod

### Changes between 3.0.10 and 3.0.11 [19 Sep 2023]

* Fix POLY1305 MAC implementation corrupting XMM registers on Windows.

The POLY1305 MAC (message authentication code) implementation in OpenSSL
does not save the contents of non-volatile XMM registers on Windows 64
platform when calculating the MAC of data larger than 64 bytes. Before
returning to the caller all the XMM registers are set to zero rather than
restoring their previous content. The vulnerable code is used only on newer
x86_64 processors supporting the AVX512-IFMA instructions.

The consequences of this kind of internal application state corruption can
be various - from no consequences, if the calling application does not
depend on the contents of non-volatile XMM registers at all, to the worst
consequences, where the attacker could get complete control of the
application process. However given the contents of the registers are just
zeroized so the attacker cannot put arbitrary values inside, the most likely
consequence, if any, would be an incorrect result of some application
dependent calculations or a crash leading to a denial of service.

([CVE-2023-4807])

*Bernd Edlinger*

### Changes between 3.0.9 and 3.0.10 [1 Aug 2023]

* Fix excessive time spent checking DH q parameter value.
Expand Down Expand Up @@ -19708,6 +19732,7 @@ ndif

<!-- Links -->

[CVE-2023-4807]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-4807
[CVE-2023-3817]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-3817
[CVE-2023-3446]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-3446
[CVE-2023-2975]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-2975
Expand Down
6 changes: 6 additions & 0 deletions crypto/openssl/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ OpenSSL Releases
OpenSSL 3.0
-----------

### Major changes between OpenSSL 3.0.10 and OpenSSL 3.0.11 [19 Sep 2023]

* Fix POLY1305 MAC implementation corrupting XMM registers on Windows
([CVE-2023-4807])

### Major changes between OpenSSL 3.0.9 and OpenSSL 3.0.10 [1 Aug 2023]

* Fix excessive time spent checking DH q parameter value ([CVE-2023-3817])
Expand Down Expand Up @@ -1448,6 +1453,7 @@ OpenSSL 0.9.x

<!-- Links -->

[CVE-2023-4807]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-4807
[CVE-2023-3817]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-3817
[CVE-2023-3446]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-3446
[CVE-2023-2975]: https://www.openssl.org/news/vulnerabilities.html#CVE-2023-2975
Expand Down
2 changes: 1 addition & 1 deletion crypto/openssl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ attempting to develop or distribute cryptographic code.
Copyright
=========

Copyright (c) 1998-2022 The OpenSSL Project
Copyright (c) 1998-2023 The OpenSSL Project

Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson

Expand Down
4 changes: 2 additions & 2 deletions crypto/openssl/VERSION.dat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MAJOR=3
MINOR=0
PATCH=10
PATCH=11
PRE_RELEASE_TAG=
BUILD_METADATA=
RELEASE_DATE="1 Aug 2023"
RELEASE_DATE="19 Sep 2023"
SHLIB_VERSION=3
2 changes: 1 addition & 1 deletion crypto/openssl/apps/cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2512,7 +2512,7 @@ static int get_opts(int argc, char **argv)
}
break;
case OPT_CSR:
opt_csr = opt_arg();
opt_csr = opt_str();
break;
case OPT_OUT_TRUSTED:
opt_out_trusted = opt_str();
Expand Down
13 changes: 6 additions & 7 deletions crypto/openssl/apps/lib/apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ int load_key_certs_crls_suppress(const char *uri, int format, int maybe_stdin,
BIO *bio;

if (!maybe_stdin) {
BIO_printf(bio_err, "No filename or uri specified for loading");
BIO_printf(bio_err, "No filename or uri specified for loading\n");
goto end;
}
uri = "<stdin>";
Expand All @@ -960,10 +960,8 @@ int load_key_certs_crls_suppress(const char *uri, int format, int maybe_stdin,
ctx = OSSL_STORE_open_ex(uri, libctx, propq, get_ui_method(), &uidata,
params, NULL, NULL);
}
if (ctx == NULL) {
BIO_printf(bio_err, "Could not open file or uri for loading");
if (ctx == NULL)
goto end;
}
if (expect > 0 && !OSSL_STORE_expect(ctx, expect))
goto end;

Expand Down Expand Up @@ -1948,16 +1946,17 @@ X509_NAME *parse_name(const char *cp, int chtype, int canmulti,
nid = OBJ_txt2nid(typestr);
if (nid == NID_undef) {
BIO_printf(bio_err,
"%s: Skipping unknown %s name attribute \"%s\"\n",
"%s warning: Skipping unknown %s name attribute \"%s\"\n",
opt_getprog(), desc, typestr);
if (ismulti)
BIO_printf(bio_err,
"Hint: a '+' in a value string needs be escaped using '\\' else a new member of a multi-valued RDN is expected\n");
"%s hint: a '+' in a value string needs be escaped using '\\' else a new member of a multi-valued RDN is expected\n",
opt_getprog());
continue;
}
if (*valstr == '\0') {
BIO_printf(bio_err,
"%s: No value provided for %s name attribute \"%s\", skipped\n",
"%s warning: No value provided for %s name attribute \"%s\", skipped\n",
opt_getprog(), desc, typestr);
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions crypto/openssl/apps/req.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,10 +990,10 @@ int req_main(int argc, char **argv)
else
tpubkey = X509_REQ_get0_pubkey(req);
if (tpubkey == NULL) {
fprintf(stdout, "Modulus is unavailable\n");
BIO_puts(bio_err, "Modulus is unavailable\n");
goto end;
}
fprintf(stdout, "Modulus=");
BIO_puts(out, "Modulus=");
if (EVP_PKEY_is_a(tpubkey, "RSA") || EVP_PKEY_is_a(tpubkey, "RSA-PSS")) {
BIGNUM *n = NULL;

Expand All @@ -1002,9 +1002,9 @@ int req_main(int argc, char **argv)
BN_print(out, n);
BN_free(n);
} else {
fprintf(stdout, "Wrong Algorithm type");
BIO_puts(out, "Wrong Algorithm type");
}
fprintf(stdout, "\n");
BIO_puts(out, "\n");
}

if (!noout && !gen_x509) {
Expand Down
2 changes: 1 addition & 1 deletion crypto/openssl/apps/s_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ const OPTIONS s_server_options[] = {
"second server certificate chain file in PEM format"},
{"dkey", OPT_DKEY, '<',
"Second private key file to use (usually for DSA)"},
{"dkeyform", OPT_DKEYFORM, 'F',
{"dkeyform", OPT_DKEYFORM, 'f',
"Second key file format (ENGINE, other values ignored)"},
{"dpass", OPT_DPASS, 's',
"Second private key and cert file pass phrase source"},
Expand Down
4 changes: 3 additions & 1 deletion crypto/openssl/crypto/asn1/a_strnid.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1999-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -129,8 +129,10 @@ ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
int idx;
ASN1_STRING_TABLE fnd;

#ifndef OPENSSL_NO_AUTOLOAD_CONFIG
/* "stable" can be impacted by config, so load the config file first */
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
#endif

fnd.nid = nid;
if (stable) {
Expand Down
11 changes: 7 additions & 4 deletions crypto/openssl/crypto/asn1/asn1_gen.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -698,9 +698,12 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
atmp->value.asn1_string->data = rdata;
atmp->value.asn1_string->length = rdlen;
atmp->value.asn1_string->type = utype;
} else if (format == ASN1_GEN_FORMAT_ASCII)
ASN1_STRING_set(atmp->value.asn1_string, str, -1);
else if ((format == ASN1_GEN_FORMAT_BITLIST)
} else if (format == ASN1_GEN_FORMAT_ASCII) {
if (!ASN1_STRING_set(atmp->value.asn1_string, str, -1)) {
ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
goto bad_str;
}
} else if ((format == ASN1_GEN_FORMAT_BITLIST)
&& (utype == V_ASN1_BIT_STRING)) {
if (!CONF_parse_list
(str, ',', 1, bitstr_cb, atmp->value.bit_string)) {
Expand Down
2 changes: 2 additions & 0 deletions crypto/openssl/crypto/chacha/asm/chacha-ia64.pl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
ADDP @k[11]=4,$key
.save ar.lc,r3
mov r3=ar.lc }
{ .mmi; ADDP $out=0,$out
ADDP $inp=0,$inp }
{ .mmi; ADDP $key=0,$key
ADDP $counter=0,$counter
.save pr,r14
Expand Down
10 changes: 5 additions & 5 deletions crypto/openssl/crypto/cmp/cmp_asn.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright Nokia 2007-2019
* Copyright Siemens AG 2015-2019
*
Expand Down Expand Up @@ -188,22 +188,22 @@ int OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **itav_sk_p,
return 0;
}

/* get ASN.1 encoded integer, return -1 on error */
/* get ASN.1 encoded integer, return -2 on error; -1 is valid for certReqId */
int ossl_cmp_asn1_get_int(const ASN1_INTEGER *a)
{
int64_t res;

if (!ASN1_INTEGER_get_int64(&res, a)) {
ERR_raise(ERR_LIB_CMP, ASN1_R_INVALID_NUMBER);
return -1;
return -2;
}
if (res < INT_MIN) {
ERR_raise(ERR_LIB_CMP, ASN1_R_TOO_SMALL);
return -1;
return -2;
}
if (res > INT_MAX) {
ERR_raise(ERR_LIB_CMP, ASN1_R_TOO_LARGE);
return -1;
return -2;
}
return (int)res;
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/openssl/crypto/cmp/cmp_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ static int cert_response(OSSL_CMP_CTX *ctx, int sleep, int rid,
return 0;
if (rid == OSSL_CMP_CERTREQID_NONE) { /* used for OSSL_CMP_PKIBODY_P10CR */
rid = ossl_cmp_asn1_get_int(crep->certReqId);
if (rid != OSSL_CMP_CERTREQID_NONE) {
if (rid < OSSL_CMP_CERTREQID_NONE) {
ERR_raise(ERR_LIB_CMP, CMP_R_BAD_REQUEST_ID);
return 0;
}
Expand Down
7 changes: 5 additions & 2 deletions crypto/openssl/crypto/cmp/cmp_status.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.
* Copyright Nokia 2007-2019
* Copyright Siemens AG 2015-2019
*
Expand Down Expand Up @@ -30,9 +30,12 @@

int ossl_cmp_pkisi_get_status(const OSSL_CMP_PKISI *si)
{
int res ;

if (!ossl_assert(si != NULL && si->status != NULL))
return -1;
return ossl_cmp_asn1_get_int(si->status);
res = ossl_cmp_asn1_get_int(si->status);
return res == -2 ? -1 : res;
}

const char *ossl_cmp_PKIStatus_to_string(int status)
Expand Down
21 changes: 19 additions & 2 deletions crypto/openssl/crypto/cms/cms_env.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void cms_env_set_version(CMS_EnvelopedData *env);
#define CMS_ENVELOPED_STANDARD 1
#define CMS_ENVELOPED_AUTH 2

static int cms_get_enveloped_type(const CMS_ContentInfo *cms)
static int cms_get_enveloped_type_simple(const CMS_ContentInfo *cms)
{
int nid = OBJ_obj2nid(cms->contentType);

Expand All @@ -38,11 +38,28 @@ static int cms_get_enveloped_type(const CMS_ContentInfo *cms)
return CMS_ENVELOPED_AUTH;

default:
ERR_raise(ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA);
return 0;
}
}

static int cms_get_enveloped_type(const CMS_ContentInfo *cms)
{
int ret = cms_get_enveloped_type_simple(cms);

if (ret == 0)
ERR_raise(ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA);
return ret;
}

void ossl_cms_env_enc_content_free(const CMS_ContentInfo *cinf)
{
if (cms_get_enveloped_type_simple(cinf) != 0) {
CMS_EncryptedContentInfo *ec = ossl_cms_get0_env_enc_content(cinf);
if (ec != NULL)
OPENSSL_clear_free(ec->key, ec->keylen);
}
}

CMS_EnvelopedData *ossl_cms_get0_enveloped(CMS_ContentInfo *cms)
{
if (OBJ_obj2nid(cms->contentType) != NID_pkcs7_enveloped) {
Expand Down
5 changes: 1 addition & 4 deletions crypto/openssl/crypto/cms/cms_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ CMS_ContentInfo *CMS_ContentInfo_new(void)
void CMS_ContentInfo_free(CMS_ContentInfo *cms)
{
if (cms != NULL) {
CMS_EncryptedContentInfo *ec = ossl_cms_get0_env_enc_content(cms);

if (ec != NULL)
OPENSSL_clear_free(ec->key, ec->keylen);
ossl_cms_env_enc_content_free(cms);
OPENSSL_free(cms->ctx.propq);
ASN1_item_free((ASN1_VALUE *)cms, ASN1_ITEM_rptr(CMS_ContentInfo));
}
Expand Down
3 changes: 2 additions & 1 deletion crypto/openssl/crypto/cms/cms_local.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -444,6 +444,7 @@ BIO *ossl_cms_EnvelopedData_init_bio(CMS_ContentInfo *cms);
int ossl_cms_EnvelopedData_final(CMS_ContentInfo *cms, BIO *chain);
BIO *ossl_cms_AuthEnvelopedData_init_bio(CMS_ContentInfo *cms);
int ossl_cms_AuthEnvelopedData_final(CMS_ContentInfo *cms, BIO *cmsbio);
void ossl_cms_env_enc_content_free(const CMS_ContentInfo *cinf);
CMS_EnvelopedData *ossl_cms_get0_enveloped(CMS_ContentInfo *cms);
CMS_AuthEnvelopedData *ossl_cms_get0_auth_enveloped(CMS_ContentInfo *cms);
CMS_EncryptedContentInfo *ossl_cms_get0_env_enc_content(const CMS_ContentInfo *cms);
Expand Down
6 changes: 3 additions & 3 deletions crypto/openssl/crypto/cms/cms_sd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -233,9 +233,9 @@ static int cms_sd_asn1_ctrl(CMS_SignerInfo *si, int cmd)
int i;

if (EVP_PKEY_is_a(pkey, "DSA") || EVP_PKEY_is_a(pkey, "EC"))
return ossl_cms_ecdsa_dsa_sign(si, cmd);
return ossl_cms_ecdsa_dsa_sign(si, cmd) > 0;
else if (EVP_PKEY_is_a(pkey, "RSA") || EVP_PKEY_is_a(pkey, "RSA-PSS"))
return ossl_cms_rsa_sign(si, cmd);
return ossl_cms_rsa_sign(si, cmd) > 0;

/* Something else? We'll give engines etc a chance to handle this */
if (pkey->ameth == NULL || pkey->ameth->pkey_ctrl == NULL)
Expand Down
3 changes: 2 additions & 1 deletion crypto/openssl/crypto/conf/conf_sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ int ossl_config_int(const OPENSSL_INIT_SETTINGS *settings)
#endif

#ifndef OPENSSL_SYS_UEFI
ret = CONF_modules_load_file(filename, appname, flags);
ret = CONF_modules_load_file_ex(OSSL_LIB_CTX_get0_global_default(),
filename, appname, flags);
#else
ret = 1;
#endif
Expand Down
7 changes: 4 additions & 3 deletions crypto/openssl/crypto/encode_decode/decoder_lib.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -743,10 +743,11 @@ static int decoder_process(const OSSL_PARAM params[], void *arg)
(void *)new_data.ctx, LEVEL, rv);
} OSSL_TRACE_END(DECODER);

data->flag_construct_called = 1;
ok = (rv > 0);
if (ok)
if (ok) {
data->flag_construct_called = 1;
goto end;
}
}

/* The constructor didn't return success */
Expand Down
Loading

0 comments on commit 6f1af0d

Please sign in to comment.