Skip to content

Commit 8b8d087

Browse files
committed
reorder calls and simplify
1 parent a49fc09 commit 8b8d087

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/internal.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33252,15 +33252,13 @@ static int AddPSKtoPreMasterSecret(WOLFSSL* ssl)
3325233252
#if (defined(HAVE_ECC) || defined(HAVE_CURVE25519) || defined(HAVE_CURVE448) \
3325333253
|| !defined(NO_DH))\
3325433254
&& !defined(NO_PSK)
33255-
static int MakeDhePSKPreMasterSecret(WOLFSSL* ssl, byte addPSKtoPreMasterSecret)
33255+
static void MakeDhePSKPreMasterSecret(WOLFSSL* ssl)
3325633256
{
3325733257
Arrays* arrays = ssl->arrays;
3325833258
byte* pms = arrays->preMasterSecret;
3325933259
c16toa((word16)arrays->preMasterSz, pms);
3326033260
arrays->preMasterSz += OPAQUE16_LEN;
3326133261
pms += arrays->preMasterSz;
33262-
if (addPSKtoPreMasterSecret && AddPSKtoPreMasterSecret(ssl))
33263-
return 1;
3326433262
if ((int)arrays->psk_keySz > 0) {
3326533263
c16toa((word16)arrays->psk_keySz, pms);
3326633264
pms += OPAQUE16_LEN;
@@ -33269,7 +33267,6 @@ static int MakeDhePSKPreMasterSecret(WOLFSSL* ssl, byte addPSKtoPreMasterSecret)
3326933267
ForceZero(arrays->psk_key, arrays->psk_keySz);
3327033268
}
3327133269
arrays->psk_keySz = 0; /* No further need */
33272-
return 0;
3327333270
}
3327433271
#endif
3327533272

@@ -34250,7 +34247,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
3425034247
c16toa((word16)args->length, args->output);
3425134248
args->encSz += args->length + OPAQUE16_LEN;
3425234249

34253-
(void)MakeDhePSKPreMasterSecret(ssl, 0);
34250+
MakeDhePSKPreMasterSecret(ssl);
3425434251
break;
3425534252
}
3425634253
#endif /* !NO_DH && !NO_PSK */
@@ -34269,7 +34266,7 @@ int SendClientKeyExchange(WOLFSSL* ssl)
3426934266

3427034267
/* Create pre master secret is the concatenation of
3427134268
* eccSize + eccSharedKey + pskSize + pskKey */
34272-
(void)MakeDhePSKPreMasterSecret(ssl, 0);
34269+
MakeDhePSKPreMasterSecret(ssl);
3427334270
break;
3427434271
}
3427534272
#endif /* (HAVE_ECC || HAVE_CURVE25519 || HAVE_CURVE448) && !NO_PSK */
@@ -41902,8 +41899,9 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ],
4190241899

4190341900
/* Use the PSK hint to look up the PSK and add it to the
4190441901
* preMasterSecret here. */
41905-
if (MakeDhePSKPreMasterSecret(ssl, 1))
41902+
if (AddPSKtoPreMasterSecret(ssl))
4190641903
ERROR_OUT(PSK_KEY_ERROR, exit_dcke);
41904+
MakeDhePSKPreMasterSecret(ssl);
4190741905
break;
4190841906
}
4190941907
#endif /* !NO_DH && !NO_PSK */
@@ -41921,8 +41919,9 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ],
4192141919

4192241920
/* Use the PSK hint to look up the PSK and add it to the
4192341921
* preMasterSecret here. */
41924-
if (MakeDhePSKPreMasterSecret(ssl, 1))
41922+
if (AddPSKtoPreMasterSecret(ssl))
4192541923
ERROR_OUT(PSK_KEY_ERROR, exit_dcke);
41924+
MakeDhePSKPreMasterSecret(ssl);
4192641925
break;
4192741926
}
4192841927
#endif /* (HAVE_ECC || CURVE25519 || CURVE448) && !NO_PSK */

0 commit comments

Comments
 (0)