Skip to contentSkip to conversation

tls: Use l_put_be64 for IV creation in case of AEAD ciphers

PATCH New Marcel Holtmann 1 participant 1 message Jan 3, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tls: Use l_put_be64 for IV creation in case of AEAD ciphers

The usage of l_put_le64 for encryption ciphers seems weird since normally all its input is big endian. So change this here to also use big endian version to store the sequence number.

---
 ell/tls-record.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ell/tls-record.c +1 -1
index cdbd0b8040bb..6ac095629abe 100644
@@ -177,7 +177,7 @@ static void tls_tx_record_plaintext(struct l_tls *tls,
 		 * be used to build the IV.
 		 */
 		memcpy(iv, tls->fixed_iv[1], tls->fixed_iv_length[1]);
-		l_put_le64(tls->seq_num[1], iv + tls->fixed_iv_length[1]);
+		l_put_be64(tls->seq_num[1], iv + tls->fixed_iv_length[1]);
 
 		if (tls->record_iv_length[1] > 8)
 			memset(iv + tls->fixed_iv_length[1] + 8, 42,
Signature · 1 line
2.39.0