forked from wolfSSL/wolfssl
This fixes a make check error.
The flags activated code that didn't account for the new oid encoding. This code fixes that.
This commit is contained in:
@ -4047,17 +4047,37 @@ int wc_ecc_get_curve_id_from_dp_params(const ecc_set_type* dp)
|
|||||||
int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len)
|
int wc_ecc_get_curve_id_from_oid(const byte* oid, word32 len)
|
||||||
{
|
{
|
||||||
int curve_idx;
|
int curve_idx;
|
||||||
|
#ifdef HAVE_OID_DECODING
|
||||||
|
int ret;
|
||||||
|
word16 decOid[16];
|
||||||
|
word32 decOidSz = sizeof(decOid);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (oid == NULL)
|
if (oid == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
|
#ifdef HAVE_OID_DECODING
|
||||||
|
ret = DecodeObjectId(oid, len, decOid, &decOidSz);
|
||||||
|
if (ret != 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (curve_idx = 0; ecc_sets[curve_idx].size != 0; curve_idx++) {
|
for (curve_idx = 0; ecc_sets[curve_idx].size != 0; curve_idx++) {
|
||||||
if (
|
if (
|
||||||
#ifndef WOLFSSL_ECC_CURVE_STATIC
|
#ifndef WOLFSSL_ECC_CURVE_STATIC
|
||||||
ecc_sets[curve_idx].oid &&
|
ecc_sets[curve_idx].oid &&
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_OID_DECODING
|
||||||
|
/* We double because decOidSz is a count of word16 elements. */
|
||||||
|
ecc_sets[curve_idx].oidSz == decOidSz &&
|
||||||
|
XMEMCMP(ecc_sets[curve_idx].oid, decOid,
|
||||||
|
decOidSz * 2) == 0
|
||||||
|
#else
|
||||||
ecc_sets[curve_idx].oidSz == len &&
|
ecc_sets[curve_idx].oidSz == len &&
|
||||||
XMEMCMP(ecc_sets[curve_idx].oid, oid, len) == 0) {
|
XMEMCMP(ecc_sets[curve_idx].oid, oid, len) == 0
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user