Skip to content

Commit e3b5576

Browse files
committed
WL#15154 patch #8 TLS key rotation
In the TCP Transporter, request a TLS key rotation after each 2^32 bytes are sent. Note that there is no visibility into whether this has occured. Change-Id: I70e1fff8b20305d565efc5a44e7ecb827da22dca
1 parent bdf0094 commit e3b5576

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

storage/ndb/src/common/transporter/TCP_Transporter.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ Uint32 overload_limit(const TransporterConfiguration* conf)
9696
conf->tcp.sendBufferSize*4/5);
9797
}
9898

99+
/* Request a TLS key rotation after this number of bytes are sent
100+
by a transporter, as described in WL#15130 and in RFC 8446 sec. 5.5.
101+
The number here should have just one bit set.
102+
*/
103+
static constexpr Uint64 keyRotateBit = 0x0000000100000000;
99104

100105
TCP_Transporter::TCP_Transporter(TransporterRegistry &t_reg,
101106
const TransporterConfiguration* conf)
@@ -525,7 +530,15 @@ TCP_Transporter::doSend(bool need_wakeup)
525530
}
526531
sendCount += send_cnt;
527532
sendSize += sum_sent;
533+
bool rotateBitPre = ((m_bytes_sent & keyRotateBit) == keyRotateBit);
528534
m_bytes_sent += sum_sent;
535+
bool rotateBitPost = ((m_bytes_sent & keyRotateBit) == keyRotateBit);
536+
537+
if(rotateBitPost != rotateBitPre)
538+
{
539+
theSocket.update_keys();
540+
}
541+
529542
if(sendCount >= reportFreq)
530543
{
531544
get_callback_obj()->reportSendLen(remoteNodeId, sendCount, sendSize);

0 commit comments

Comments
 (0)