diff mbox series

[kirkstone] openssl: Backport fix CVE-2023-2975

Message ID 20230814161637.4700-1-asharma@mvista.com
State New, archived
Headers show
Series [kirkstone] openssl: Backport fix CVE-2023-2975 | expand

Commit Message

Ashish Sharma Aug. 14, 2023, 4:16 p.m. UTC
Signed-off-by: Ashish Sharma <asharma@mvista.com>
---
 .../openssl/openssl/CVE-2023-2975.patch       | 61 +++++++++++++++++++
 .../openssl/openssl_3.0.9.bb                  |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch

Comments

Steve Sakoman Aug. 14, 2023, 5:19 p.m. UTC | #1
Hi Ashish,

This CVE and a couple of others were previously fixed with a
bug/security fix version bump:

https://git.openembedded.org/openembedded-core/commit/?h=kirkstone&id=94ce10791ce10aa30d3a3bdef53f9b2f3c1b331a

Steve

On Mon, Aug 14, 2023 at 6:19 AM Ashish Sharma <asharma@mvista.com> wrote:
>
> Signed-off-by: Ashish Sharma <asharma@mvista.com>
> ---
>  .../openssl/openssl/CVE-2023-2975.patch       | 61 +++++++++++++++++++
>  .../openssl/openssl_3.0.9.bb                  |  1 +
>  2 files changed, 62 insertions(+)
>  create mode 100644 meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch
>
> diff --git a/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch b/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch
> new file mode 100644
> index 00000000000..fe78e87a831
> --- /dev/null
> +++ b/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch
> @@ -0,0 +1,61 @@
> +From 00e2f5eea29994d19293ec4e8c8775ba73678598 Mon Sep 17 00:00:00 2001
> +From: Tomas Mraz <tomas@openssl.org>
> +Date: Tue, 4 Jul 2023 17:30:35 +0200
> +Subject: [PATCH] Do not ignore empty associated data with AES-SIV mode
> +
> +The AES-SIV mode allows for multiple associated data items
> +authenticated separately with any of these being 0 length.
> +
> +The provided implementation ignores such empty associated data
> +which is incorrect in regards to the RFC 5297 and is also
> +a security issue because such empty associated data then become
> +unauthenticated if an application expects to authenticate them.
> +
> +Fixes CVE-2023-2975
> +
> +Reviewed-by: Matt Caswell <matt@openssl.org>
> +Reviewed-by: Paul Dale <pauli@openssl.org>
> +(Merged from https://github.com/openssl/openssl/pull/21384)
> +
> +(cherry picked from commit c426c281cfc23ab182f7d7d7a35229e7db1494d9)
> +
> +Upstream-Status: Backport [https://git.openssl.org/gitweb/?p=openssl.git;a=patch;h=00e2f5eea29994d19293ec4e8c8775ba73678598]
> +CVE: CVE-2023-2975
> +Signed-off-by: Ashish Sharma <asharma@mvista.com>
> +
> + .../implementations/ciphers/cipher_aes_siv.c   | 18 +++++++++++-------
> + 1 file changed, 11 insertions(+), 7 deletions(-)
> +
> +diff --git a/providers/implementations/ciphers/cipher_aes_siv.c b/providers/implementations/ciphers/cipher_aes_siv.c
> +index 45010b90db..b396c8651a 100644
> +--- a/providers/implementations/ciphers/cipher_aes_siv.c
> ++++ b/providers/implementations/ciphers/cipher_aes_siv.c
> +@@ -120,14 +120,18 @@ static int siv_cipher(void *vctx, unsigned char *out, size_t *outl,
> +     if (!ossl_prov_is_running())
> +         return 0;
> +
> +-    if (inl == 0) {
> +-        *outl = 0;
> +-        return 1;
> +-    }
> ++    /* Ignore just empty encryption/decryption call and not AAD. */
> ++    if (out != NULL) {
> ++        if (inl == 0) {
> ++            if (outl != NULL)
> ++                *outl = 0;
> ++            return 1;
> ++        }
> +
> +-    if (outsize < inl) {
> +-        ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
> +-        return 0;
> ++        if (outsize < inl) {
> ++            ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
> ++            return 0;
> ++        }
> +     }
> +
> +     if (ctx->hw->cipher(ctx, out, in, inl) <= 0)
> +--
> +2.34.1
> +
> diff --git a/meta/recipes-connectivity/openssl/openssl_3.0.9.bb b/meta/recipes-connectivity/openssl/openssl_3.0.9.bb
> index 849bd7e5a69..61e81cfa09d 100644
> --- a/meta/recipes-connectivity/openssl/openssl_3.0.9.bb
> +++ b/meta/recipes-connectivity/openssl/openssl_3.0.9.bb
> @@ -12,6 +12,7 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
>             file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
>             file://afalg.patch \
>             file://0001-Configure-do-not-tweak-mips-cflags.patch \
> +           file://CVE-2023-2975.patch \
>             "
>
>  SRC_URI:append:class-nativesdk = " \
> --
> 2.35.7
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#185938): https://lists.openembedded.org/g/openembedded-core/message/185938
> Mute This Topic: https://lists.openembedded.org/mt/100740204/3620601
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [steve@sakoman.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch b/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch
new file mode 100644
index 00000000000..fe78e87a831
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl/CVE-2023-2975.patch
@@ -0,0 +1,61 @@ 
+From 00e2f5eea29994d19293ec4e8c8775ba73678598 Mon Sep 17 00:00:00 2001
+From: Tomas Mraz <tomas@openssl.org>
+Date: Tue, 4 Jul 2023 17:30:35 +0200
+Subject: [PATCH] Do not ignore empty associated data with AES-SIV mode
+
+The AES-SIV mode allows for multiple associated data items
+authenticated separately with any of these being 0 length.
+
+The provided implementation ignores such empty associated data
+which is incorrect in regards to the RFC 5297 and is also
+a security issue because such empty associated data then become
+unauthenticated if an application expects to authenticate them.
+
+Fixes CVE-2023-2975
+
+Reviewed-by: Matt Caswell <matt@openssl.org>
+Reviewed-by: Paul Dale <pauli@openssl.org>
+(Merged from https://github.com/openssl/openssl/pull/21384)
+
+(cherry picked from commit c426c281cfc23ab182f7d7d7a35229e7db1494d9)
+
+Upstream-Status: Backport [https://git.openssl.org/gitweb/?p=openssl.git;a=patch;h=00e2f5eea29994d19293ec4e8c8775ba73678598]
+CVE: CVE-2023-2975
+Signed-off-by: Ashish Sharma <asharma@mvista.com>
+
+ .../implementations/ciphers/cipher_aes_siv.c   | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/providers/implementations/ciphers/cipher_aes_siv.c b/providers/implementations/ciphers/cipher_aes_siv.c
+index 45010b90db..b396c8651a 100644
+--- a/providers/implementations/ciphers/cipher_aes_siv.c
++++ b/providers/implementations/ciphers/cipher_aes_siv.c
+@@ -120,14 +120,18 @@ static int siv_cipher(void *vctx, unsigned char *out, size_t *outl,
+     if (!ossl_prov_is_running())
+         return 0;
+ 
+-    if (inl == 0) {
+-        *outl = 0;
+-        return 1;
+-    }
++    /* Ignore just empty encryption/decryption call and not AAD. */
++    if (out != NULL) {
++        if (inl == 0) {
++            if (outl != NULL)
++                *outl = 0;
++            return 1;
++        }
+ 
+-    if (outsize < inl) {
+-        ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
+-        return 0;
++        if (outsize < inl) {
++            ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
++            return 0;
++        }
+     }
+ 
+     if (ctx->hw->cipher(ctx, out, in, inl) <= 0)
+-- 
+2.34.1
+
diff --git a/meta/recipes-connectivity/openssl/openssl_3.0.9.bb b/meta/recipes-connectivity/openssl/openssl_3.0.9.bb
index 849bd7e5a69..61e81cfa09d 100644
--- a/meta/recipes-connectivity/openssl/openssl_3.0.9.bb
+++ b/meta/recipes-connectivity/openssl/openssl_3.0.9.bb
@@ -12,6 +12,7 @@  SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
            file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
            file://afalg.patch \
            file://0001-Configure-do-not-tweak-mips-cflags.patch \
+           file://CVE-2023-2975.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \