Skip to content

Commit 63f7298

Browse files
author
Lealem Amedie
committed
Default to ASN TEMPLATE library
1 parent f9bf96d commit 63f7298

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# wolfSSL Release X.Y.Z (TBD)
2+
3+
NOTE: This release switches the default ASN.1 parser to the new ASN template code. If the original ASN.1 code is preferred define `WOLFSSL_ASN_ORIGINAL` to use it. See PR #7199.
4+
15
# wolfSSL Release 5.6.6 (Dec 19, 2023)
26

37
Release 5.6.6 has been developed according to wolfSSL's development and QA

wolfcrypt/src/asn.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,9 +1384,8 @@ int GetASN_Items(const ASNItem* asn, ASNGetData *data, int count, int complete,
13841384
int len;
13851385
/* Current index into buffer. */
13861386
word32 idx = *inOutIdx;
1387-
/* Initialize the end index at each depth to be the length. */
1388-
word32 endIdx[GET_ASN_MAX_DEPTH] = { length, length, length, length, length,
1389-
length, length };
1387+
/* Declare the end index array. */
1388+
word32 endIdx[GET_ASN_MAX_DEPTH];
13901389
/* Set choices to -1 to indicate they haven't been seen or found. */
13911390
signed char choiceMet[GET_ASN_MAX_CHOICES] = { -1, -1 };
13921391
/* Not matching a choice right now. */
@@ -1402,6 +1401,11 @@ int GetASN_Items(const ASNItem* asn, ASNGetData *data, int count, int complete,
14021401
WOLFSSL_ENTER("GetASN_Items");
14031402
#endif
14041403

1404+
/* Set the end index at each depth to be the length. */
1405+
for (i=0; i<GET_ASN_MAX_DEPTH; i++) {
1406+
endIdx[i] = length;
1407+
}
1408+
14051409
/* Start depth at first items depth. */
14061410
minDepth = depth = asn[0].depth;
14071411
/* Check every ASN.1 item. */
@@ -19551,7 +19555,7 @@ enum {
1955119555
static int DecodeSubtreeGeneralName(const byte* input, word32 sz, byte tag,
1955219556
Base_entry** head, void* heap)
1955319557
{
19554-
Base_entry* entry;
19558+
Base_entry* entry = NULL;
1955519559
word32 nameIdx = 0;
1955619560
word32 len = sz;
1955719561
int strLen;

wolfssl/wolfcrypt/settings.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,6 +2735,14 @@ extern void uITRON4_free(void *p) ;
27352735
#define WOLFSSL_IPV6
27362736
#endif
27372737

2738+
/* ---------------------------------------------------------------------------
2739+
* ASN Library Selection (default to ASN_TEMPLATE)
2740+
* ---------------------------------------------------------------------------
2741+
*/
2742+
#if !defined(WOLFSSL_ASN_TEMPLATE) && !defined(WOLFSSL_ASN_ORIGINAL) && \
2743+
!defined(NO_ASN)
2744+
#define WOLFSSL_ASN_TEMPLATE
2745+
#endif
27382746

27392747
#ifdef WOLFSSL_LINUXKM
27402748
#ifdef HAVE_CONFIG_H

0 commit comments

Comments
 (0)