Skip to content

Commit 47350fa

Browse files
author
Lealem Amedie
committed
Remove manual encoding of OID in txt2oidBuf
1 parent ee63d73 commit 47350fa

2 files changed

Lines changed: 5 additions & 28 deletions

File tree

src/ssl.c

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29370,13 +29370,11 @@ void* wolfSSL_GetHKDFExtractCtx(WOLFSSL* ssl)
2937029370
#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */
2937129371

2937229372
#if defined(OPENSSL_ALL)
29373+
/* Returns the oid buffer from the short name or long name of an ASN1_object
29374+
* and NULL on failure */
2937329375
const byte* wolfSSL_OBJ_txt2oidBuf(char* buf, word32* inOutSz, word32 oidType)
2937429376
{
29375-
char *token;
29376-
byte* oidBuf = NULL;
2937729377
word32 oid;
29378-
word16 dotted[ASN1_OID_DOTTED_MAX_SZ];
29379-
word32 dottedCount = 0;
2938029378
int nid;
2938129379

2938229380
if (buf == NULL)
@@ -29385,32 +29383,11 @@ const byte* wolfSSL_OBJ_txt2oidBuf(char* buf, word32* inOutSz, word32 oidType)
2938529383
nid = wolfSSL_OBJ_txt2nid(buf);
2938629384

2938729385
if (nid != NID_undef) {
29388-
/* Handle named OID case */
2938929386
oid = nid2oid(nid, oidType);
29390-
oidBuf = (byte*)OidFromId(oid, oidType,inOutSz);
29387+
return OidFromId(oid, oidType,inOutSz);
2939129388
}
29392-
#if defined(HAVE_OID_ENCODING)
29393-
else {
29394-
/* Handle dotted form OID case*/
29395-
token = XSTRTOK(buf, ".", NULL);
29396-
29397-
while (token != NULL) {
29398-
dotted[dottedCount] = XATOI(token);
29399-
dottedCount++;
29400-
token = XSTRTOK(NULL, ".", NULL);
29401-
}
2940229389

29403-
if (EncodeObjectId(dotted, dottedCount, oidBuf, inOutSz) != 0) {
29404-
oidBuf = NULL;
29405-
}
29406-
}
29407-
#else
29408-
(void)token;
29409-
(void)dotted;
29410-
(void)dottedCount;
29411-
#endif
29412-
29413-
return (const byte*)oidBuf;
29390+
return NULL;
2941429391
}
2941529392
#endif /* OPENSSL_ALL */
2941629393

wolfssl/wolfcrypt/asn.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,7 +2169,7 @@ WOLFSSL_LOCAL int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx,
21692169
word32 maxIdx);
21702170

21712171
#ifdef HAVE_OID_ENCODING
2172-
WOLFSSL_LOCAL int EncodeObjectId(const word16* in, word32 inSz,
2172+
WOLFSSL_API int EncodeObjectId(const word16* in, word32 inSz,
21732173
byte* out, word32* outSz);
21742174
#endif
21752175
#if defined(HAVE_OID_DECODING) || defined(WOLFSSL_ASN_PRINT)

0 commit comments

Comments
 (0)