Revert back to word16 API.

This commit is contained in:
Anthony Hu
2022-03-03 10:41:05 -05:00
parent a54045113a
commit 949f8b5be1
2 changed files with 10 additions and 12 deletions

View File

@@ -5119,16 +5119,14 @@ static int DumpOID(const byte* oidData, word32 oidSz, word32 oid,
#ifdef HAVE_OID_DECODING #ifdef HAVE_OID_DECODING
{ {
byte decOid[MAX_OID_SZ]; word16 decOid[16];
word16 *out = decOid; word32 decOidSz = sizeof(decOid);
word32 decOidSz = sizeof(decOid) / 2;
/* Decode the OID into dotted form. */ /* Decode the OID into dotted form. */
ret = DecodeObjectId(oidData, oidSz, (word16*)decOid, &decOidSz); ret = DecodeObjectId(oidData, oidSz, decOid, &decOidSz);
if (ret == 0) { if (ret == 0) {
printf(" Decoded (Sz %d): ", decOidSz); printf(" Decoded (Sz %d): ", decOidSz);
for (i=0; i<decOidSz; i += 2) { for (i=0; i<decOidSz; i++) {
printf("%d.", *out); printf("%d.", decOid[i]);
out ++;
} }
printf("\n"); printf("\n");
} }
@@ -16981,12 +16979,12 @@ end:
#if defined(WOLFSSL_CUSTOM_OID) && defined(WOLFSSL_ASN_TEMPLATE) \ #if defined(WOLFSSL_CUSTOM_OID) && defined(WOLFSSL_ASN_TEMPLATE) \
&& defined(HAVE_OID_DECODING) && defined(HAVE_OID_DECODING)
if (isUnknownExt && (cert->unknownExtCallback != NULL)) { if (isUnknownExt && (cert->unknownExtCallback != NULL)) {
byte decOid[MAX_OID_SZ]; word16 decOid[16];
word32 decOidSz = sizeof(decOid) / 2; word32 decOidSz = sizeof(decOid);
ret = DecodeObjectId( ret = DecodeObjectId(
dataASN[CERTEXTASN_IDX_OID].data.oid.data, dataASN[CERTEXTASN_IDX_OID].data.oid.data,
dataASN[CERTEXTASN_IDX_OID].data.oid.length, dataASN[CERTEXTASN_IDX_OID].data.oid.length,
(word16*)decOid, &decOidSz); decOid, &decOidSz);
if (ret != 0) { if (ret != 0) {
/* Should never get here as the extension was successfully /* Should never get here as the extension was successfully
* decoded earlier. Something might be corrupted. */ * decoded earlier. Something might be corrupted. */
@@ -16994,7 +16992,7 @@ end:
WOLFSSL_ERROR(ret); WOLFSSL_ERROR(ret);
} }
ret = cert->unknownExtCallback(decOid, decOidSz * 2, critical, ret = cert->unknownExtCallback(decOid, decOidSz, critical,
dataASN[CERTEXTASN_IDX_VAL].data.buffer.data, dataASN[CERTEXTASN_IDX_VAL].data.buffer.data,
dataASN[CERTEXTASN_IDX_VAL].length); dataASN[CERTEXTASN_IDX_VAL].length);
} }

View File

@@ -1461,7 +1461,7 @@ typedef struct CertSignCtx CertSignCtx;
#if defined(WOLFSSL_CUSTOM_OID) && defined(WOLFSSL_ASN_TEMPLATE) \ #if defined(WOLFSSL_CUSTOM_OID) && defined(WOLFSSL_ASN_TEMPLATE) \
&& defined(HAVE_OID_DECODING) && defined(HAVE_OID_DECODING)
typedef int (*wc_UnknownExtCallback)(const byte* oid, word32 oidSz, int crit, typedef int (*wc_UnknownExtCallback)(const word16* oid, word32 oidSz, int crit,
const unsigned char* der, word32 derSz); const unsigned char* der, word32 derSz);
#endif #endif