forked from wolfSSL/wolfssl
Combined "wc_RNG_GenerateBlock" calls in "SendServerHello".
This commit is contained in:
@@ -12740,20 +12740,32 @@ int DoSessionTicket(WOLFSSL* ssl,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* now write to output */
|
/* now write to output */
|
||||||
/* first version */
|
/* first version */
|
||||||
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;
|
||||||
}
|
|
||||||
|
|
||||||
XMEMCPY(output + idx, ssl->arrays->serverRandom, RAN_LEN);
|
/* store info in SSL context for later */
|
||||||
idx += RAN_LEN;
|
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);
|
||||||
|
idx += RAN_LEN;
|
||||||
|
output[idx++] = sessIdSz;
|
||||||
|
XMEMCPY(output + idx, ssl->arrays->sessionID, sessIdSz);
|
||||||
|
}
|
||||||
|
idx += sessIdSz;
|
||||||
|
|
||||||
#ifdef SHOW_SECRETS
|
#ifdef SHOW_SECRETS
|
||||||
{
|
{
|
||||||
@@ -12764,31 +12776,18 @@ int DoSessionTicket(WOLFSSL* ssl,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* then session id */
|
|
||||||
output[idx++] = sessIdSz;
|
|
||||||
if (sessIdSz) {
|
|
||||||
|
|
||||||
if (!ssl->options.resuming) {
|
/* then cipher suite */
|
||||||
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 */
|
|
||||||
output[idx++] = ssl->options.cipherSuite0;
|
output[idx++] = ssl->options.cipherSuite0;
|
||||||
output[idx++] = ssl->options.cipherSuite;
|
output[idx++] = ssl->options.cipherSuite;
|
||||||
|
|
||||||
/* then compression */
|
/* then compression */
|
||||||
if (ssl->options.usingCompression)
|
if (ssl->options.usingCompression)
|
||||||
output[idx++] = ZLIB_COMPRESSION;
|
output[idx++] = ZLIB_COMPRESSION;
|
||||||
else
|
else
|
||||||
output[idx++] = NO_COMPRESSION;
|
output[idx++] = NO_COMPRESSION;
|
||||||
|
|
||||||
/* last, extensions */
|
/* last, extensions */
|
||||||
#ifdef HAVE_TLS_EXTENSIONS
|
#ifdef HAVE_TLS_EXTENSIONS
|
||||||
TLSX_WriteResponse(ssl, output + idx);
|
TLSX_WriteResponse(ssl, output + idx);
|
||||||
#endif
|
#endif
|
||||||
@@ -12805,13 +12804,13 @@ int DoSessionTicket(WOLFSSL* ssl,
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#ifdef WOLFSSL_CALLBACKS
|
#ifdef WOLFSSL_CALLBACKS
|
||||||
if (ssl->hsInfoOn)
|
if (ssl->hsInfoOn)
|
||||||
AddPacketName("ServerHello", &ssl->handShakeInfo);
|
AddPacketName("ServerHello", &ssl->handShakeInfo);
|
||||||
if (ssl->toInfoOn)
|
if (ssl->toInfoOn)
|
||||||
AddPacketInfo("ServerHello", &ssl->timeoutInfo, output, sendSz,
|
AddPacketInfo("ServerHello", &ssl->timeoutInfo, output, sendSz,
|
||||||
ssl->heap);
|
ssl->heap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ssl->options.serverState = SERVER_HELLO_COMPLETE;
|
ssl->options.serverState = SERVER_HELLO_COMPLETE;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user