From a9b31fc3e41be3c67d2c1842383ea3e676fe7942 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Mon, 4 May 2020 11:56:28 +0900 Subject: [PATCH] ecc-sos: Fix parsing key for EdDSA/ECDH. * g10/parse-packet.c (parse_key): Read by sos_read. Signed-off-by: NIIBE Yutaka --- g10/parse-packet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 041db2cae..003143768 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -2591,7 +2591,11 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen, else { unsigned int n = pktlen; - pk->pkey[i] = mpi_read (inp, &n, 0); + if (algorithm == PUBKEY_ALGO_EDDSA + || algorithm == PUBKEY_ALGO_ECDH) + pk->pkey[i] = sos_read (inp, &n, 0); + else + pk->pkey[i] = mpi_read (inp, &n, 0); pktlen -= n; if (!pk->pkey[i]) err = gpg_error (GPG_ERR_INV_PACKET);