Skip to content

Commit

Permalink
Refactor unneeded PickHashSigAlgo_ex function.
Browse files Browse the repository at this point in the history
  • Loading branch information
philljj committed Jun 28, 2024
1 parent 107cc82 commit 7dfef18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
17 changes: 6 additions & 11 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -27400,13 +27400,8 @@ static int SupportedHashSigAlgo(WOLFSSL* ssl, const byte * hashSigAlgo)
return 0;
}

int PickHashSigAlgo(WOLFSSL* ssl, const byte* hashSigAlgo, word32 hashSigAlgoSz)
{
return PickHashSigAlgo_ex(ssl, hashSigAlgo, hashSigAlgoSz, 0);
}

int PickHashSigAlgo_ex(WOLFSSL* ssl, const byte* hashSigAlgo, word32 hashSigAlgoSz,
int matchSuites)
int PickHashSigAlgo(WOLFSSL* ssl, const byte* hashSigAlgo, word32 hashSigAlgoSz,
int matchSuites)
{
word32 i;
int ret = WC_NO_ERR_TRACE(MATCH_SUITE_ERROR);
Expand Down Expand Up @@ -30074,7 +30069,7 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType,
if ((len > size) || ((*inOutIdx - begin) + len > size))
return BUFFER_ERROR;

if (PickHashSigAlgo(ssl, input + *inOutIdx, len) != 0 &&
if (PickHashSigAlgo(ssl, input + *inOutIdx, len, 0) != 0 &&
ssl->buffers.certificate &&
ssl->buffers.certificate->buffer) {
#ifdef HAVE_PK_CALLBACKS
Expand Down Expand Up @@ -35959,8 +35954,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
ret = SetCipherSpecs(ssl);
if (ret != 0)
return ret;
ret = PickHashSigAlgo_ex(ssl, peerSuites->hashSigAlgo,
peerSuites->hashSigAlgoSz, 1);
ret = PickHashSigAlgo(ssl, peerSuites->hashSigAlgo,
peerSuites->hashSigAlgoSz, 1);
if (ret != 0)
return ret;

Expand Down Expand Up @@ -36323,7 +36318,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
ret = SetCipherSpecs(ssl);
if (ret == 0) {
ret = PickHashSigAlgo(ssl, clSuites->hashSigAlgo,
clSuites->hashSigAlgoSz);
clSuites->hashSigAlgoSz, 0);
}
}
else if (ret == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -5740,7 +5740,7 @@ static int DoTls13CertificateRequest(WOLFSSL* ssl, const byte* input,
#endif
) {
if (PickHashSigAlgo(ssl, peerSuites.hashSigAlgo,
peerSuites.hashSigAlgoSz) != 0) {
peerSuites.hashSigAlgoSz, 0) != 0) {
WOLFSSL_ERROR_VERBOSE(INVALID_PARAMETER);
return INVALID_PARAMETER;
}
Expand Down
4 changes: 1 addition & 3 deletions wolfssl/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2180,9 +2180,7 @@ WOLFSSL_LOCAL int DoServerHello(WOLFSSL* ssl, const byte* input, word32* inOutI
WOLFSSL_LOCAL int CompleteServerHello(WOLFSSL *ssl);
WOLFSSL_LOCAL int CheckVersion(WOLFSSL *ssl, ProtocolVersion pv);
WOLFSSL_LOCAL int PickHashSigAlgo(WOLFSSL* ssl, const byte* hashSigAlgo,
word32 hashSigAlgoSz);
WOLFSSL_LOCAL int PickHashSigAlgo_ex(WOLFSSL* ssl, const byte* hashSigAlgo,
word32 hashSigAlgoSz, int matchSuites);
word32 hashSigAlgoSz, int matchSuites);
#if defined(WOLF_PRIVATE_KEY_ID) && !defined(NO_CHECK_PRIVATE_KEY)
WOLFSSL_LOCAL int CreateDevPrivateKey(void** pkey, byte* data, word32 length,
int hsType, int label, int id,
Expand Down

0 comments on commit 7dfef18

Please sign in to comment.