forked from wolfSSL/wolfssl
Fix for private key only ECC key.
This commit is contained in:
@ -9956,14 +9956,7 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key,
|
||||
XMEMCPY(priv, &input[*inOutIdx], privSz);
|
||||
*inOutIdx += length;
|
||||
|
||||
if ((*inOutIdx + 1) > inSz) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(priv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return BUFFER_E;
|
||||
}
|
||||
|
||||
if (ret == 0 && (*inOutIdx + 1) < inSz) {
|
||||
/* prefix 0, may have */
|
||||
b = input[*inOutIdx];
|
||||
if (b == ECC_PREFIX_0) {
|
||||
@ -9972,7 +9965,8 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key,
|
||||
if (GetLength(input, inOutIdx, &length, inSz) <= 0)
|
||||
ret = ASN_PARSE_E;
|
||||
else {
|
||||
ret = GetObjectId(input, inOutIdx, &oidSum, oidIgnoreType, inSz);
|
||||
ret = GetObjectId(input, inOutIdx, &oidSum, oidIgnoreType,
|
||||
inSz);
|
||||
if (ret == 0) {
|
||||
if ((ret = CheckCurve(oidSum)) < 0)
|
||||
ret = ECC_CURVE_OID_E;
|
||||
@ -9983,6 +9977,7 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 0 && (*inOutIdx + 1) < inSz) {
|
||||
/* prefix 1 */
|
||||
|
Reference in New Issue
Block a user