# Performance of the Transport Layer Security Handshake Over 6 TiSCH
## 3 Handshake Performance Measurements
### Network Stack Configuration  
#### 3.2.1 Maximum Transmission Unit and Handshake Message Size  
We start investigating the impact of the handshake message size. Sizeable handshake messages lead to large IPv6 packets which are then fragmented in several 6 LoWPAN fragments. Both the TLS/TCP and DTLS/UDP stack can set an upper bound for the handshake message size by activating the MFL extension. TLS can also use the MSS option provided by TCP to limit the TCP segment size. IPv6-compliant IoT devices should support an MTU of 1280 B [15]. However, the tight memory constraints on low-power IoT devices make this a challenging requirement. For the OpenMote platform, the combined RAM usage of OpenWSN, TCP, and mbedTLS only allows IPv6 packets with a maximum payload size of 864 B. When we use UDP instead of TCP, the software stack can support IPv6 packets with a maximum payload of 1377 B. Table 2 shows the handshake duration and the total number of exchanged bytes between both endpoints to establish a secure connection. We count all the incoming and outgoing bytes on the physical layer that are part of the handshake, i.e., IEEE802.15.4 frames containing handshake data and TCP control packets. Comparing the TLS handshake with the IPv6 MTUs at 864 bytes and 356 bytes indicates that larger MTU values result in fewer transmitted bytes. When more TLS data fits in a TCP segment, it reduces the overhead of the TCP header. Besides, there are fewer TCP acknowledgments necessary. Activating [PERSON]'s algorithm further reduces the header overhead and thus the number of transmitted bytes. A DTLS client can use the MFL extension to inform the server of the maximum record fragment size it supports. With an IPv6 MTU of 1377 B, the node can use two MFL sizes: 512 B or 1024 B. The MFL sizes indicate the size of the record fragment. To derive the IPv6 payload size, we add 13 B for the DTLS record header and 4 B for the 6 LoWPAN compressed UDP header. Similarly to TCP, a higher IPv6 MTU results in fewer datagrams to complete the handshake and less overhead caused by headers. Compared to TLS, DTLS uses fewer bytes to complete the handshake. Several factors contribute to this difference. UDP does not use acknowledgment packets, and UDP has a significantly smaller header size. The UDP header is even further compressed from the standard 8 B down to 4 B through 6 LoWPAN header compression, while TCP uses an uncompressed header of 20 B. A varying maximum handshake message size also influences the handshake duration. To time the duration of TLS, we start the clock when the client sends its \(syn\) segment to open the TCP connection. While timing the DTLS handshake latency, we start the clock when the client sends the initial ClientHello, triggering DoS protection on the server endpoint. To prevent spurious DTLS retransmissions, we set the DTLS timeout value to a conservative 3 s. We observe that the MTU only slightly impacts the overall duration of both the TLS and DTLS handshake. When we activate [PERSON]'s algorithm in TCP, it incurs an additional delay. Without Nagle, TCP can pipeline the segments, having multiple unacknowledged \begin{table}
\begin{tabular}{l c c c c c c c c} \hline \hline \multirow{2}{*}{**SSL**} & \multicolumn{2}{c}{**Negotiated [B]**} & \multicolumn{2}{c}{**MTU [B]**} & \multicolumn{2}{c}{**Latency [s]**} & \multicolumn{2}{c}{**Bytes [B]**} & \multirow{2}{*}{**Nagle**} \\  & **MSS** & **MFL** & & \(\mu\) & \(\sigma\) & \(\mu\) & \(\sigma\) & \\ \hline \multirow{4}{*}{TLS} & 844 & - & 864 & 4.495 & 0.096 & 3102 & 5.49 & ✓ \\  & 844 & - & 864 & 4.285 & 0.076 & 3358 & 0.60 & - \\ \cline{1-1}  & 336 & - & 356 & 4.539 & 0.089 & 3345 & 1.25 & ✓ \\ \cline{1-1}  & 336 & - & 356 & 4.241 & 0.118 & 3671 & 3.74 & - \\ \cline{1-1}  & - & 1024 & 1041 & 3.795 & 0.064 & 2680 & 1.00 & - \\ \cline{1-1}  & - & 512 & 529 & 3.891 & 0.090 & 2841 & 0.83 & - \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Impact of the Maximum Transmission Unit (MTU) on the (D)/TLS handshake. segments in transit.