mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 20:24:39 +02:00
Fix RNG with writedup
This commit is contained in:
12
src/ssl.c
12
src/ssl.c
@@ -1547,6 +1547,8 @@ void FreeWriteDup(WOLFSSL* ssl)
|
|||||||
*/
|
*/
|
||||||
static int DupSSL(WOLFSSL* dup, WOLFSSL* ssl)
|
static int DupSSL(WOLFSSL* dup, WOLFSSL* ssl)
|
||||||
{
|
{
|
||||||
|
word16 tmp_weOwnRng;
|
||||||
|
|
||||||
/* shared dupWrite setup */
|
/* shared dupWrite setup */
|
||||||
ssl->dupWrite = (WriteDup*)XMALLOC(sizeof(WriteDup), ssl->heap,
|
ssl->dupWrite = (WriteDup*)XMALLOC(sizeof(WriteDup), ssl->heap,
|
||||||
DYNAMIC_TYPE_WRITEDUP);
|
DYNAMIC_TYPE_WRITEDUP);
|
||||||
@@ -1563,12 +1565,7 @@ static int DupSSL(WOLFSSL* dup, WOLFSSL* ssl)
|
|||||||
ssl->dupWrite->dupCount = 2; /* both sides have a count to start */
|
ssl->dupWrite->dupCount = 2; /* both sides have a count to start */
|
||||||
dup->dupWrite = ssl->dupWrite; /* each side uses */
|
dup->dupWrite = ssl->dupWrite; /* each side uses */
|
||||||
|
|
||||||
if (dup->options.weOwnRng) {
|
tmp_weOwnRng = dup->options.weOwnRng;
|
||||||
wc_FreeRng(dup->rng);
|
|
||||||
XFREE(dup->rng, dup->heap, DYNAMIC_TYPE_RNG);
|
|
||||||
dup->rng = NULL;
|
|
||||||
dup->options.weOwnRng = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy write parts over to dup writer */
|
/* copy write parts over to dup writer */
|
||||||
XMEMCPY(&dup->specs, &ssl->specs, sizeof(CipherSpecs));
|
XMEMCPY(&dup->specs, &ssl->specs, sizeof(CipherSpecs));
|
||||||
@@ -1595,6 +1592,9 @@ static int DupSSL(WOLFSSL* dup, WOLFSSL* ssl)
|
|||||||
dup->truncated_hmac = ssl->truncated_hmac;
|
dup->truncated_hmac = ssl->truncated_hmac;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Restore rng option */
|
||||||
|
dup->options.weOwnRng = tmp_weOwnRng;
|
||||||
|
|
||||||
/* unique side dup setup */
|
/* unique side dup setup */
|
||||||
dup->dupSide = WRITE_DUP_SIDE;
|
dup->dupSide = WRITE_DUP_SIDE;
|
||||||
ssl->dupSide = READ_DUP_SIDE;
|
ssl->dupSide = READ_DUP_SIDE;
|
||||||
|
Reference in New Issue
Block a user