forked from wolfSSL/wolfssl
Combined "wc_RNG_GenerateBlock" calls in "SendServerHello".
This commit is contained in:
@@ -12744,16 +12744,28 @@ int DoSessionTicket(WOLFSSL* ssl,
|
|||||||
output[idx++] = ssl->version.major;
|
output[idx++] = ssl->version.major;
|
||||||
output[idx++] = ssl->version.minor;
|
output[idx++] = ssl->version.minor;
|
||||||
|
|
||||||
/* then random */
|
/* then random and session id */
|
||||||
if (!ssl->options.resuming) {
|
if (!ssl->options.resuming) {
|
||||||
ret = wc_RNG_GenerateBlock(ssl->rng, ssl->arrays->serverRandom,
|
/* generate random part and session id */
|
||||||
RAN_LEN);
|
ret = wc_RNG_GenerateBlock(ssl->rng, output + idx,
|
||||||
|
RAN_LEN + sizeof(sessIdSz) + sessIdSz);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
|
/* store info in SSL context for later */
|
||||||
|
XMEMCPY(ssl->arrays->serverRandom, output + idx, RAN_LEN);
|
||||||
|
idx += RAN_LEN;
|
||||||
|
output[idx++] = sessIdSz;
|
||||||
|
XMEMCPY(ssl->arrays->sessionID, output + idx, sessIdSz);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* If resuming, use info from SSL context */
|
||||||
XMEMCPY(output + idx, ssl->arrays->serverRandom, RAN_LEN);
|
XMEMCPY(output + idx, ssl->arrays->serverRandom, RAN_LEN);
|
||||||
idx += RAN_LEN;
|
idx += RAN_LEN;
|
||||||
|
output[idx++] = sessIdSz;
|
||||||
|
XMEMCPY(output + idx, ssl->arrays->sessionID, sessIdSz);
|
||||||
|
}
|
||||||
|
idx += sessIdSz;
|
||||||
|
|
||||||
#ifdef SHOW_SECRETS
|
#ifdef SHOW_SECRETS
|
||||||
{
|
{
|
||||||
@@ -12764,19 +12776,6 @@ int DoSessionTicket(WOLFSSL* ssl,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* then session id */
|
|
||||||
output[idx++] = sessIdSz;
|
|
||||||
if (sessIdSz) {
|
|
||||||
|
|
||||||
if (!ssl->options.resuming) {
|
|
||||||
ret = wc_RNG_GenerateBlock(ssl->rng, ssl->arrays->sessionID,
|
|
||||||
sessIdSz);
|
|
||||||
if (ret != 0) return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
XMEMCPY(output + idx, ssl->arrays->sessionID, sessIdSz);
|
|
||||||
idx += sessIdSz;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* then cipher suite */
|
/* then cipher suite */
|
||||||
output[idx++] = ssl->options.cipherSuite0;
|
output[idx++] = ssl->options.cipherSuite0;
|
||||||
|
Reference in New Issue
Block a user