From a2d29e4c71598b121a5f7b2f02bbe1c2673d805b Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 14 Nov 2016 10:06:20 -0800 Subject: [PATCH] Further improve the "wc_EccPrivateKeyDecode" to use the CheckCurve return code, which is the curve_id in the success case. Fixes scan-build warning. --- wolfcrypt/src/asn.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index cf5a53ed1..a153f3841 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -8940,11 +8940,10 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key, oidSum += input[*inOutIdx]; *inOutIdx += 1; } - if (CheckCurve(oidSum) < 0) + if ((ret = CheckCurve(oidSum)) < 0) { ret = ECC_CURVE_OID_E; - - ret = wc_ecc_get_oid(oidSum, NULL, NULL); - if (ret >= 0) { + } + else { curve_id = ret; ret = 0; }