Skip to content

Commit 396b553

Browse files
authored
Merge pull request #9872 from SparkiDev/asn_improvements_1
ASN: improve handling of ASN.1 parsing/encoding
2 parents e880f59 + 34916c8 commit 396b553

5 files changed

Lines changed: 253 additions & 186 deletions

File tree

src/pk_ec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3581,7 +3581,7 @@ int wolfSSL_EC_KEY_LoadDer_ex(WOLFSSL_EC_KEY* key, const unsigned char* derBuf,
35813581
* have a PKCS8 header then do not error out.
35823582
*/
35833583
if ((ret = ToTraditionalInline_ex((const byte*)derBuf, &idx,
3584-
(word32)derSz, &algId)) > 0) {
3584+
(word32)derSz, &algId)) >= 0) {
35853585
WOLFSSL_MSG("Found PKCS8 header");
35863586
key->pkcs8HeaderSz = (word16)idx;
35873587
res = 1;

src/pk_rsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ int wolfSSL_RSA_LoadDer_ex(WOLFSSL_RSA* rsa, const unsigned char* derBuf,
924924
* have a PKCS8 header then do not error out. */
925925
res = ToTraditionalInline_ex((const byte*)derBuf, &idx, (word32)derSz,
926926
&algId);
927-
if (res > 0) {
927+
if (res >= 0) {
928928
/* Store size of PKCS#8 header for encoding. */
929929
WOLFSSL_MSG("Found PKCS8 header");
930930
rsa->pkcs8HeaderSz = (word16)idx;

0 commit comments

Comments
 (0)