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