From a46fff931d631a176f56547692b16ae32c89299b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 28 May 2018 13:04:11 +0200 Subject: add patch from Niibe Yutaka for #5328 --- src/util/crypto_ecc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index 1abf0fddc1..8d9091b23d 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c @@ -1281,6 +1281,16 @@ eddsa_d_to_a (gcry_mpi_t d) gcry_mpi_print (GCRYMPI_FMT_USG, rawmpi, rawmpilen, &rawmpilen, d)); + if (rawmpilen < 32) + { + memmove (rawmpi + 32 - rawmpilen, + rawmpi, + rawmpilen); + memset (rawmpi, + 0, + 32 - rawmpilen); + rawmpilen = 32; + } hvec[0].data = digest; hvec[0].off = 0; hvec[0].len = b > rawmpilen ? (b - rawmpilen) : 0; -- cgit v1.2.3-18-g5258