From 5ba579397dea7ffae39ef0bfeb8113563e65c47c Mon Sep 17 00:00:00 2001 From: Lealem Amedie Date: Fri, 30 Jun 2023 14:14:27 -0600 Subject: [PATCH] Make public wc_ api for EncodeObjectId --- wolfcrypt/src/asn.c | 7 ++++++- wolfssl/wolfcrypt/asn.h | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 1d0aadfe2..b6051bfc9 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -5438,13 +5438,18 @@ static int CheckCurve(word32 oid) * @return BAD_FUNC_ARG when in or outSz is NULL. * @return BUFFER_E when buffer too small. */ +int wc_EncodeObjectId(const word16* in, word32 inSz, byte* out, word32* outSz) +{ + return EncodeObjectId(in, inSz, out, outSz); +} + int EncodeObjectId(const word16* in, word32 inSz, byte* out, word32* outSz) { int i, x, len; word32 d, t; /* check args */ - if (in == NULL || outSz == NULL) { + if (in == NULL || outSz == NULL || inSz <= 0) { return BAD_FUNC_ARG; } diff --git a/wolfssl/wolfcrypt/asn.h b/wolfssl/wolfcrypt/asn.h index a768d6671..d4e0ee9c8 100644 --- a/wolfssl/wolfcrypt/asn.h +++ b/wolfssl/wolfcrypt/asn.h @@ -2169,7 +2169,9 @@ WOLFSSL_LOCAL int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx, word32 maxIdx); #ifdef HAVE_OID_ENCODING - WOLFSSL_API int EncodeObjectId(const word16* in, word32 inSz, + WOLFSSL_API int wc_EncodeObjectId(const word16* in, word32 inSz, + byte* out, word32* outSz); + WOLFSSL_LOCAL int EncodeObjectId(const word16* in, word32 inSz, byte* out, word32* outSz); #endif #if defined(HAVE_OID_DECODING) || defined(WOLFSSL_ASN_PRINT) || \