Fix for private key only ECC key.

This commit is contained in:
Sean Parkinson
2017-06-14 09:33:27 +10:00
parent 1d2b4226a4
commit 62ae1d3023

View File

@ -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 */