forked from wolfSSL/wolfssl
Remove manual encoding of OID in txt2oidBuf
This commit is contained in:
31
src/ssl.c
31
src/ssl.c
@ -29370,13 +29370,11 @@ void* wolfSSL_GetHKDFExtractCtx(WOLFSSL* ssl)
|
||||
#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */
|
||||
|
||||
#if defined(OPENSSL_ALL)
|
||||
/* Returns the oid buffer from the short name or long name of an ASN1_object
|
||||
* and NULL on failure */
|
||||
const byte* wolfSSL_OBJ_txt2oidBuf(char* buf, word32* inOutSz, word32 oidType)
|
||||
{
|
||||
char *token;
|
||||
byte* oidBuf = NULL;
|
||||
word32 oid;
|
||||
word16 dotted[ASN1_OID_DOTTED_MAX_SZ];
|
||||
word32 dottedCount = 0;
|
||||
int nid;
|
||||
|
||||
if (buf == NULL)
|
||||
@ -29385,32 +29383,11 @@ const byte* wolfSSL_OBJ_txt2oidBuf(char* buf, word32* inOutSz, word32 oidType)
|
||||
nid = wolfSSL_OBJ_txt2nid(buf);
|
||||
|
||||
if (nid != NID_undef) {
|
||||
/* Handle named OID case */
|
||||
oid = nid2oid(nid, oidType);
|
||||
oidBuf = (byte*)OidFromId(oid, oidType,inOutSz);
|
||||
return OidFromId(oid, oidType,inOutSz);
|
||||
}
|
||||
#if defined(HAVE_OID_ENCODING)
|
||||
else {
|
||||
/* Handle dotted form OID case*/
|
||||
token = XSTRTOK(buf, ".", NULL);
|
||||
|
||||
while (token != NULL) {
|
||||
dotted[dottedCount] = XATOI(token);
|
||||
dottedCount++;
|
||||
token = XSTRTOK(NULL, ".", NULL);
|
||||
}
|
||||
|
||||
if (EncodeObjectId(dotted, dottedCount, oidBuf, inOutSz) != 0) {
|
||||
oidBuf = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)token;
|
||||
(void)dotted;
|
||||
(void)dottedCount;
|
||||
#endif
|
||||
|
||||
return (const byte*)oidBuf;
|
||||
return NULL;
|
||||
}
|
||||
#endif /* OPENSSL_ALL */
|
||||
|
||||
|
@ -2169,7 +2169,7 @@ WOLFSSL_LOCAL int GetInt(mp_int* mpi, const byte* input, word32* inOutIdx,
|
||||
word32 maxIdx);
|
||||
|
||||
#ifdef HAVE_OID_ENCODING
|
||||
WOLFSSL_LOCAL int EncodeObjectId(const word16* in, word32 inSz,
|
||||
WOLFSSL_API int EncodeObjectId(const word16* in, word32 inSz,
|
||||
byte* out, word32* outSz);
|
||||
#endif
|
||||
#if defined(HAVE_OID_DECODING) || defined(WOLFSSL_ASN_PRINT)
|
||||
|
Reference in New Issue
Block a user