From 39f34ef88ba69ee0f3ae3dfcae1f5f05602f32ea Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 25 Mar 2021 23:32:17 +0700 Subject: [PATCH] check return values --- wolfcrypt/src/eccsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/eccsi.c b/wolfcrypt/src/eccsi.c index 555020c35..ca58c893b 100644 --- a/wolfcrypt/src/eccsi.c +++ b/wolfcrypt/src/eccsi.c @@ -1666,6 +1666,7 @@ int wc_SetEccsiHash(EccsiKey* key, const byte* hash, byte hashSz) * @param [in] pvt Public Validation Token (PVT) as an ECC point. * @return 0 on success. * @return BAD_FUNC_ARG when key, ssk or pvt is NULL. + * @return MP math errors when copy fails */ int wc_SetEccsiPair(EccsiKey* key, const mp_int* ssk, const ecc_point* pvt) { @@ -1674,9 +1675,13 @@ int wc_SetEccsiPair(EccsiKey* key, const mp_int* ssk, const ecc_point* pvt) if ((key == NULL) || (ssk == NULL) || (pvt == NULL)) { err = BAD_FUNC_ARG; } + if (err == 0) { - mp_copy(ssk, &key->ssk); - wc_ecc_copy_point(pvt, key->pvt); + err = mp_copy(ssk, &key->ssk); + } + + if (err == 0) { + err = wc_ecc_copy_point(pvt, key->pvt); } return err;