@@ -145,3 +145,43 @@ or by an exeption, for example using try/finally::
145145 # Use sock
146146 finally:
147147 sock.close()
148+
149+
150+ SSL/TLS limitations
151+ ~~~~~~~~~~~~~~~~~~~
152+
153+ ESP8266 uses `axTLS <http://axtls.sourceforge.net/ >`_ library, which is one
154+ of the smallest TLS libraries with the compatible licensing. However, it
155+ also has some known issues/limitations:
156+
157+ 1. No support for Diffie-Hellman (DH) key exchange and Elliptic-curve
158+ cryptography (ECC). This means it can't work with sites which force
159+ the use of these features (it works ok with classic RSA certifactes).
160+ 2. Half-duplex communication nature. axTLS uses a single buffer for both
161+ sending and receiving, which leads to considerable memory saving and
162+ works well with protocols like HTTP. But there may be problems with
163+ protocols which don't follow classic request-response model.
164+
165+ Besides axTLS own limitations, the configuration used for MicroPython is
166+ highly optimized for code size, which leads to additional limitations
167+ (these may be lifted in the future):
168+
169+ 3. Optimized RSA algorithms are not enabled, which may lead to slow
170+ SSL handshakes.
171+ 4. Stored sessions are not supported (may allow faster repeated connections
172+ to the same site in some circumstances).
173+
174+ Besides axTLS specific limitations described above, there's another generic
175+ limitation with usage of TLS on the low-memory devices:
176+
177+ 5. The TLS standard specifies the maximum length of the TLS record (unit
178+ of TLS communication, the entire record must be buffered before it can
179+ be processed) as 16KB. That's almost half of the available ESP8266 memory,
180+ and inside a more or less advanced application would be hard to allocate
181+ due to memory fragmentation issues. As a compromise, a smaller buffer is
182+ used, with the idea that the most interesting usage for SSL would be
183+ accessing various REST APIs, which usually require much smaller messages.
184+ The buffers size is on the order of 5KB, and is adjusted from time to
185+ time, taking as a reference being able to access https://google.com .
186+ The smaller buffer hower means that some sites can't be accessed using
187+ it, and it's not possible to stream large amounts of data.
0 commit comments