Skip to content

Commit

Permalink
fix for sig fault harden build
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Dec 13, 2024
1 parent 79d9b2d commit a22176a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
27 changes: 24 additions & 3 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -34079,13 +34079,20 @@ int SendCertificateVerify(WOLFSSL* ssl)

#if defined(WOLFSSL_SM2) && defined(WOLFSSL_SM3)
if (ssl->buffers.keyType == sm2_sa_algo) {
#ifdef HAVE_PK_CALLBACKS
buffer tmp;

tmp.length = ssl->buffers.key->length;
tmp.buffer = ssl->buffers.key->buffer;
#endif

ret = Sm3wSm2Verify(ssl,
TLS12_SM2_SIG_ID, TLS12_SM2_SIG_ID_SZ,
ssl->buffers.sig.buffer, ssl->buffers.sig.length,
ssl->buffers.digest.buffer,
ssl->buffers.digest.length, key,
#ifdef HAVE_PK_CALLBACKS
ssl->buffers.key
&tmp
#else
NULL
#endif
Expand All @@ -34094,12 +34101,19 @@ int SendCertificateVerify(WOLFSSL* ssl)
else
#endif
{
#ifdef HAVE_PK_CALLBACKS
buffer tmp;

tmp.length = ssl->buffers.key->length;
tmp.buffer = ssl->buffers.key->buffer;
#endif

ret = EccVerify(ssl,
ssl->buffers.sig.buffer, ssl->buffers.sig.length,
ssl->buffers.digest.buffer,
ssl->buffers.digest.length, key,
#ifdef HAVE_PK_CALLBACKS
ssl->buffers.key
&tmp
#else
NULL
#endif
Expand Down Expand Up @@ -36287,14 +36301,21 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
else
#endif /* WOLFSSL_SM2 */
{
#ifdef HAVE_PK_CALLBACKS
buffer tmp;

tmp.length = ssl->buffers.key->length;
tmp.buffer = ssl->buffers.key->buffer;
#endif

ret = EccVerify(ssl,
args->output + LENGTH_SZ + args->idx,
args->sigSz,
ssl->buffers.digest.buffer,
ssl->buffers.digest.length,
key,
#ifdef HAVE_PK_CALLBACKS
ssl->buffers.key
&tmp
#else
NULL
#endif
Expand Down
8 changes: 7 additions & 1 deletion src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -9592,11 +9592,17 @@ static int SendTls13CertificateVerify(WOLFSSL* ssl)
else
#endif
{
#ifdef HAVE_PK_CALLBACKS
buffer tmp;

tmp.length = ssl->buffers.key->length;
tmp.buffer = ssl->buffers.key->buffer;
#endif
ret = EccVerify(ssl, sigOut, args->sigLen,
args->sigData, args->sigDataSz,
(ecc_key*)ssl->hsKey,
#ifdef HAVE_PK_CALLBACKS
ssl->buffers.key
&tmp
#else
NULL
#endif
Expand Down

0 comments on commit a22176a

Please sign in to comment.