Understanding TLS on non-standard sockets
Standard Berkeley network sockets are supported by most OSes. But there are some OSes, especially embedded ones, that only support their own non-standard sockets or connection handlers. How can we use OpenSSL on these kinds of OSes? It is possible with the help of OpenSSL memory BIOs. OpenSSL can establish TLS connections purely in memory.
The following diagram shows how the data flows to and from the non-standard socket via memory BIOs:
Figure 11.1 – The TLS data flow to and from the non-standard socket via memory BIOs
This way, when a program wants to receive plaintext from the TLS connection, the following happens:
- The program receives some ciphertext from the non-standard socket to the ciphertext input buffer.
- The program writes the ciphertext into the reading memory BIO.
- OpenSSL decrypts the ciphertext from the reading memory BIO and puts the resulting plaintext into the plaintext input...