From 2dca4875e7549f13bf25912de0adf50f066d3f68 Mon Sep 17 00:00:00 2001 From: Anthony Hu Date: Thu, 3 Mar 2022 10:41:54 -0500 Subject: [PATCH] Revert back to word16 API. --- certgen/custom_ext_callback.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/certgen/custom_ext_callback.c b/certgen/custom_ext_callback.c index 631ebef8..8d8db325 100644 --- a/certgen/custom_ext_callback.c +++ b/certgen/custom_ext_callback.c @@ -36,16 +36,14 @@ defined(HAVE_OID_DECODING) && defined(WOLFSSL_CUSTOM_OID) && \ defined(WOLFSSL_CERT_EXT) -static int myCustomExtCallback(const byte* oid, word32 oidSz, int crit, +static int myCustomExtCallback(const word16* oid, word32 oidSz, int crit, const unsigned char* der, word32 derSz) { word32 i; - const word16 *out = (word16 *)oid; printf("Custom Extension found!\n"); printf("("); - for (i = 0; i < oidSz; i += 2) { - printf("%d", *out); - out ++; + for (i = 0; i < oidSz; i++) { + printf("%d", oid[i]); if (i < oidSz - 1) { printf("."); } @@ -64,12 +62,13 @@ static int myCustomExtCallback(const byte* oid, word32 oidSz, int crit, } printf("\n"); - /* NOTE: by returning zero, you are accepting this extension and informing + /* NOTE: by returning zero, we are accepting this extension and informing * wolfSSL that it is acceptable. If you find an extension that you * do not find acceptable, you should return an error. The standard * behavior upon encountering an unknown extension with the critical * flag set is to return ASN_CRIT_EXT_E. For the sake of brevity, - * this example is always accepting every extension. */ + * this example is always accepting every extension; you should use + * different logic. */ return 0; }