@@ -28314,12 +28314,7 @@ int wc_EncodeNameCanonical(EncodedName* name, const char* nameStr,
2831428314int ParseKeyUsageStr(const char* value, word16* keyUsage, void* heap)
2831528315{
2831628316 int ret = 0;
28317- #ifdef WOLFSSL_NO_MALLOC
28318- char str[1024];
28319- #else
28320- char *str;
28321- #endif
28322- char *token, *ptr;
28317+ char *token, *str, *ptr;
2832328318 word32 len = 0;
2832428319 word16 usage = 0;
2832528320
@@ -28329,15 +28324,10 @@ int ParseKeyUsageStr(const char* value, word16* keyUsage, void* heap)
2832928324
2833028325 /* duplicate string (including terminator) */
2833128326 len = (word32)XSTRLEN(value);
28332- #ifdef WOLFSSL_NO_MALLOC
28333- if (len >= sizeof(str))
28334- return MEMORY_E;
28335- #else
2833628327 str = (char*)XMALLOC(len + 1, heap, DYNAMIC_TYPE_TMP_BUFFER);
2833728328 if (str == NULL) {
2833828329 return MEMORY_E;
2833928330 }
28340- #endif
2834128331 XMEMCPY(str, value, len + 1);
2834228332
2834328333 /* parse value, and set corresponding Key Usage value */
@@ -32312,11 +32302,7 @@ static int SetKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey,
3231232302 dilithium_key* dilithiumKey,
3231332303 sphincs_key *sphincsKey, int kid_type)
3231432304{
32315- #ifdef WOLFSSL_NO_MALLOC
32316- byte buf[MAX_PUBLIC_KEY_SZ];
32317- #else
3231832305 byte *buf;
32319- #endif
3232032306 int bufferSz, ret;
3232132307
3232232308 if (cert == NULL ||
@@ -32326,12 +32312,10 @@ static int SetKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey,
3232632312 (kid_type != SKID_TYPE && kid_type != AKID_TYPE))
3232732313 return BAD_FUNC_ARG;
3232832314
32329- #ifndef WOLFSSL_NO_MALLOC
3233032315 buf = (byte *)XMALLOC(MAX_PUBLIC_KEY_SZ, cert->heap,
3233132316 DYNAMIC_TYPE_TMP_BUFFER);
3233232317 if (buf == NULL)
3233332318 return MEMORY_E;
32334- #endif
3233532319
3233632320 /* Public Key */
3233732321 bufferSz = -1;
@@ -33338,12 +33322,7 @@ int wc_SetDatesBuffer(Cert* cert, const byte* der, int derSz)
3333833322int EncodePolicyOID(byte *out, word32 *outSz, const char *in, void* heap)
3333933323{
3334033324 word32 idx = 0, nb_val;
33341- #ifdef WOLFSSL_NO_MALLOC
33342- char str[1024];
33343- #else
33344- char *str;
33345- #endif
33346- char *token, *ptr;
33325+ char *token, *str, *ptr;
3334733326 word32 len;
3334833327
3334933328 (void)heap;
@@ -33353,14 +33332,9 @@ int EncodePolicyOID(byte *out, word32 *outSz, const char *in, void* heap)
3335333332
3335433333 /* duplicate string (including terminator) */
3335533334 len = (word32)XSTRLEN(in);
33356- #ifdef WOLFSSL_NO_MALLOC
33357- if (len >= sizeof(str))
33358- return MEMORY_E;
33359- #else
3336033335 str = (char *)XMALLOC(len+1, heap, DYNAMIC_TYPE_TMP_BUFFER);
3336133336 if (str == NULL)
3336233337 return MEMORY_E;
33363- #endif
3336433338 XMEMCPY(str, in, len+1);
3336533339
3336633340 nb_val = 0;
0 commit comments