Remove wc_EccPublicKeyDecode_ex

This commit is contained in:
TakayukiMatsuo
2021-03-19 14:48:46 +09:00
parent 1c81afcc0a
commit 62304411dd

View File

@@ -16169,70 +16169,6 @@ static int EccKeyParamCopy(char** dst, char* src)
return ret;
}
#endif /* WOLFSSL_CUSTOM_CURVES */
/* wc_EccPublicKeyDecode_ex gets ECC public key data in DER format via "input"
* and returns the curve id to "curveId" and the point position to "pointIdx".
* Returns 0 on success, negative values on failure.
*/
int wc_EccPublicKeyDecode_ex(const byte* input,
word32* inOutIdx, int* curveId,
word32* pointIdx, int* pointSz, word32 inSz)
{
int ret;
int version, length;
word32 oidSum, localIdx;
byte tag;
if (input == NULL || inOutIdx == NULL || curveId == NULL ||
pointIdx == NULL || pointSz == NULL || inSz == 0)
return BAD_FUNC_ARG;
if (GetSequence(input, inOutIdx, &length, inSz) < 0)
return ASN_PARSE_E;
if (GetMyVersion(input, inOutIdx, &version, inSz) >= 0)
return ASN_PARSE_E;
if (GetSequence(input, inOutIdx, &length, inSz) < 0)
return ASN_PARSE_E;
ret = SkipObjectId(input, inOutIdx, inSz);
if (ret != 0)
return ret;
if (*inOutIdx >= inSz) {
return BUFFER_E;
}
localIdx = *inOutIdx;
if (GetASNTag(input, &localIdx, &tag, inSz) == 0 &&
tag == (ASN_SEQUENCE | ASN_CONSTRUCTED)) {
return BAD_FUNC_ARG; /* given key is not a public key*/
}
/* ecc params information */
ret = GetObjectId(input, inOutIdx, &oidSum, oidIgnoreType, inSz);
if (ret != 0)
return ret;
/* get curve id */
if ((ret = CheckCurve(oidSum)) < 0)
return ECC_CURVE_OID_E;
else {
*curveId = ret;
}
/* key header */
ret = CheckBitString(input, inOutIdx, &length, inSz, 1, NULL);
if (ret != 0)
return ret;
*pointIdx = *inOutIdx;
*pointSz = length;
*inOutIdx += length;
return 0;
}
int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
ecc_key* key, word32 inSz)