In the internet SSL/TLS is a widely adopted standard. Almost any time sensitive information is transmitted the technology is being used.
However when it comes to small and resource constrained devices it always seems a bit to heavy for cost sensitive devices to implement it. Mainly because of these factors:
- Computational effort: Establishing a TLS connection can take seconds depending on the platform. However, maintaining one is cheap for most Microcontrollers.
- Binary size: A small SSL/TLS library can still use 30-40 kByte of the devices Memory, large ones use up a couple of hundred kBytes.
- RAM size: TLS specifies a maximum fragment length of 16 kByte. So the internal receive buffer of any device must be at least this size, otherwise will not be able to receive large messages from the other party. Because encryption can only be done if a complete fragment has been received.
Especially the large buffer is a huge waste of RAM for most devices. They usually send and receive only smaller messages. Still they have reserve all the memory.
To overcome this limitation the IETF wrote RFC 6066, an extension to TLS. In there a maximum fragment length negotiation has been introduced, allowing constrained devices to choose buffers as small as 512 bytes. This would allow most applications to choose a buffer closer to the size of their transmission sizes, and save precious RAM.
This puts a lot of developers in a tough spot. If they don't want to waste all the unused RAM they have the following option:
- Find/write RFC 6066 compliant libraries for the devices and server.
- Hack the receiving TLS library to use a smaller buffer and drop all fragments that don't fit.
Clearly both are not perfect. While the first is the clean way it might be a lot work to do it properly. The second hack could maybe be done easier. But it would not only break compliance with the standard, even worse it could mean losing connection to the devices if the sending party does not take care of the size of the fragments it sends.
So there is no silver bullet. But I hope strongly for adoption of RFC 6066 to finally get TLS into the internet of things!