From 23982e4fb3a9c3da709300f1c2afefd904c58cb4 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 2 Dec 2021 20:15:19 +0100 Subject: [PATCH] Fixed wolfIoT_ecc_keygen when key is stored during generation --- wolfcrypt/src/port/iotsafe/iotsafe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wolfcrypt/src/port/iotsafe/iotsafe.c b/wolfcrypt/src/port/iotsafe/iotsafe.c index dd1ee2efa..0fe68eb61 100644 --- a/wolfcrypt/src/port/iotsafe/iotsafe.c +++ b/wolfcrypt/src/port/iotsafe/iotsafe.c @@ -909,6 +909,9 @@ static int wolfIoT_ecc_keygen(WOLFSSL* ssl, struct ecc_key* key, if (ret == 0) { ret = iotsafe_get_public_key((byte *)&iotsafe->ecdh_keypair_slot, IOTSAFE_ID_SIZE, key); + } else if (ret > 0) { + /* Key has been stored during generation */ + ret = 0; } } else { WC_RNG *rng = wolfSSL_GetRNG(ssl);