drogue-iot / embedded-tls

An Rust TLS 1.3 implementation for embedded devices.
Apache License 2.0
172 stars 22 forks source link

Fix recommended read buffer size #126

Closed bugadani closed 1 year ago

bugadani commented 1 year ago

This PR corrects a documentation issue which may lead to users providing a smaller read buffer than required. This may cause reading data to fail. After this PR, providing a small buffer will trigger a warning.

I've also added a bunch of new logging, which may be useful in the future. At least for defmt, the logs are opt-in, but I believe it is the case with env_logger, too.

From RFC 8446, Section 5.2

length: The length (in bytes) of the following TLSCiphertext.encrypted_record, which is the sum of the lengths of the content and the padding, plus one for the inner content type, plus any expansion added by the AEAD algorithm. The length MUST NOT exceed 2^14 + 256 bytes