From 5bd5f36dffc04033ea265412f31a53eab243fcfc Mon Sep 17 00:00:00 2001 From: Anthony Hu Date: Fri, 27 Mar 2026 09:15:27 -0400 Subject: [PATCH] Fix RSA exponent printing (ZD 21426) Increase buff size from 8 to 24 bytes in PrintPubKeyRSA and related EVP PKEY print functions. --- wolfcrypt/src/evp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/src/evp.c b/wolfcrypt/src/evp.c index e7a87d249b..e74b9202fb 100644 --- a/wolfcrypt/src/evp.c +++ b/wolfcrypt/src/evp.c @@ -11877,7 +11877,7 @@ static int PrintHexWithColon(WOLFSSL_BIO* out, const byte* input, static int PrintPubKeyRSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz, int indent, int bitlen, WOLFSSL_ASN1_PCTX* pctx) { - byte buff[8] = { 0 }; + byte buff[24] = { 0 }; int res = WC_NO_ERR_TRACE(WOLFSSL_FAILURE); word32 inOutIdx = 0; word32 nSz; /* size of modulus */ @@ -12021,7 +12021,7 @@ static int PrintPubKeyEC(WOLFSSL_BIO* out, const byte* pkey, int pkeySz, { byte* pub = NULL; word32 pubSz = 0; - byte buff[8] = { 0 }; + byte buff[24] = { 0 }; int res = WOLFSSL_SUCCESS; word32 inOutIdx = 0; int curveId = 0; @@ -12210,7 +12210,7 @@ static int PrintPubKeyDSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz, int indent, int bitlen, WOLFSSL_ASN1_PCTX* pctx) { - byte buff[8] = { 0 }; + byte buff[24] = { 0 }; int length; int res = WC_NO_ERR_TRACE(WOLFSSL_FAILURE); word32 inOutIdx = 0; @@ -12417,7 +12417,7 @@ static int PrintPubKeyDH(WOLFSSL_BIO* out, const byte* pkey, int pkeySz, int indent, int bitlen, WOLFSSL_ASN1_PCTX* pctx) { - byte buff[8] = { 0 }; + byte buff[24] = { 0 }; int res = WC_NO_ERR_TRACE(WOLFSSL_FAILURE); word32 length; word32 inOutIdx;