Skip to contentSkip to conversation

libgcrypt: CVE-2017-9526

PATCH In review Ovidiu Panait 2 participants 2 messages Jun 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libgcrypt: CVE-2017-9526

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

---
 .../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
meta/recipes-support/libgcrypt/files/CVE-2017-9526.patch new file +36 -0
new file mode 100644
index 0000000..26b570f
@@ -0,0 +1,36 @@
+From 5a22de904a0a366ae79f03ff1e13a1232a89e26b Mon Sep 17 00:00:00 2001
+From: Jo Van Bulck <[email protected]>
+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 <[email protected]>
+Signed-off-by: Ovidiu Panait <[email protected]>
+---
+ 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
+

meta/recipes-support/libgcrypt/libgcrypt.inc +1 -0
index 3c7e89a..d6d5bd9 100644
@@ -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"
Signature · 1 line
2.7.4
#1 lore raw
Quoted 6 lines · Ovidiu Panait

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.

An upgrade to 1.7.7 is preferred as we're not upgrade-frozen right now.

Ross