[OE-core] [PATCH] libgcrypt: CVE-2017-9526

Ovidiu Panait ovpanait at gmail.com
Thu Jun 22 08:23:36 UTC 2017


In Libgcrypt before 1.7.7, an attacker who learns the EdDSA session key 
(from side-channel observation during the signing process) can easily
recover the long-term secret key. 1.7.7 makes a cipher/ecc-eddsa.c change
to store this session key in secure memory, to ensure that constant-time
point operations are used in the MPI library.

References:
https://nvd.nist.gov/vuln/detail/CVE-2017-9526

Upstream patch:
https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=5a22de904a0a366ae79f03ff1e13a1232a89e26b

Signed-off-by: Ovidiu Panait <ovpanait at gmail.com>
---
 .../libgcrypt/files/CVE-2017-9526.patch            | 36 ++++++++++++++++++++++
 meta/recipes-support/libgcrypt/libgcrypt.inc       |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta/recipes-support/libgcrypt/files/CVE-2017-9526.patch

diff --git a/meta/recipes-support/libgcrypt/files/CVE-2017-9526.patch b/meta/recipes-support/libgcrypt/files/CVE-2017-9526.patch
new file mode 100644
index 0000000..26b570f
--- /dev/null
+++ b/meta/recipes-support/libgcrypt/files/CVE-2017-9526.patch
@@ -0,0 +1,36 @@
+From 5a22de904a0a366ae79f03ff1e13a1232a89e26b Mon Sep 17 00:00:00 2001
+From: Jo Van Bulck <jo.vanbulck at cs.kuleuven.be>
+Date: Thu, 19 Jan 2017 17:00:15 +0100
+Subject: [PATCH] ecc: Store EdDSA session key in secure memory.
+
+* cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): use mpi_snew to allocate
+session key.
+--
+
+An attacker who learns the EdDSA session key from side-channel
+observation during the signing process, can easily revover the long-
+term secret key. Storing the session key in secure memory ensures that
+constant time point operations are used in the MPI library.
+
+Upstream-Status: Backport
+CVE: CVE-2017-9526
+
+Signed-off-by: Jo Van Bulck <jo.vanbulck at cs.kuleuven.be>
+Signed-off-by: Ovidiu Panait <ovpanait at gmail.com>
+---
+ cipher/ecc-eddsa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cipher/ecc-eddsa.c b/cipher/ecc-eddsa.c
+index f91f848..813e030 100644
+--- a/cipher/ecc-eddsa.c
++++ b/cipher/ecc-eddsa.c
+@@ -603,7 +603,7 @@ _gcry_ecc_eddsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
+   a = mpi_snew (0);
+   x = mpi_new (0);
+   y = mpi_new (0);
+-  r = mpi_new (0);
++  r = mpi_snew (0);
+   ctx = _gcry_mpi_ec_p_internal_new (skey->E.model, skey->E.dialect, 0,
+                                      skey->E.p, skey->E.a, skey->E.b);
+   b = (ctx->nbits+7)/8;
+-- 
+2.7.4
+
diff --git a/meta/recipes-support/libgcrypt/libgcrypt.inc b/meta/recipes-support/libgcrypt/libgcrypt.inc
index 3c7e89a..d6d5bd9 100644
--- a/meta/recipes-support/libgcrypt/libgcrypt.inc
+++ b/meta/recipes-support/libgcrypt/libgcrypt.inc
@@ -20,6 +20,7 @@ SRC_URI = "${GNUPG_MIRROR}/libgcrypt/libgcrypt-${PV}.tar.gz \
            file://libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch \
            file://fix-ICE-failure-on-mips-with-option-O-and-g.patch \
            file://fix-undefined-reference-to-pthread.patch \
+            file://CVE-2017-9526.patch \
 "
 
 BINCONFIG = "${bindir}/libgcrypt-config"
-- 
2.7.4




More information about the Openembedded-core mailing list