mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34: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)
|
||||
{
|
||||
word16 tmp_weOwnRng;
|
||||
|
||||
/* shared dupWrite setup */
|
||||
ssl->dupWrite = (WriteDup*)XMALLOC(sizeof(WriteDup), ssl->heap,
|
||||
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 */
|
||||
dup->dupWrite = ssl->dupWrite; /* each side uses */
|
||||
|
||||
if (dup->options.weOwnRng) {
|
||||
wc_FreeRng(dup->rng);
|
||||
XFREE(dup->rng, dup->heap, DYNAMIC_TYPE_RNG);
|
||||
dup->rng = NULL;
|
||||
dup->options.weOwnRng = 0;
|
||||
}
|
||||
tmp_weOwnRng = dup->options.weOwnRng;
|
||||
|
||||
/* copy write parts over to dup writer */
|
||||
XMEMCPY(&dup->specs, &ssl->specs, sizeof(CipherSpecs));
|
||||
@@ -1595,6 +1592,9 @@ static int DupSSL(WOLFSSL* dup, WOLFSSL* ssl)
|
||||
dup->truncated_hmac = ssl->truncated_hmac;
|
||||
#endif
|
||||
|
||||
/* Restore rng option */
|
||||
dup->options.weOwnRng = tmp_weOwnRng;
|
||||
|
||||
/* unique side dup setup */
|
||||
dup->dupSide = WRITE_DUP_SIDE;
|
||||
ssl->dupSide = READ_DUP_SIDE;
|
||||
|
Reference in New Issue
Block a user