Spdk/module
Boris Glimcher 2fb5ff4985 sock: Add support for SSL
Added new `ssl` based socket implementation.
For now we are using hard-coded PSK and only support TLS 1.3

One can use it via sock_set_default_impl RPCs

Nvme/TCP published secure channel specification (TP 8011)
Which is based on TLS 1.3 and PSK.
So this is a primary but not the oly use case.

Before any SSL connection can be established
we need to create SSL context.
The context should be client/server aware.

Similar to regular sockets, to establish connection
server must call SSL_accept and client must call SSL_connect.

For now I'm using PSK and not certificates since
we aim this for NVMe/TCP TP-8011 which supports only PSK.

Adding certificates later on will be very easy.

The complication with SSL state machine during accep and connect
comes with returned SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE.
According to documentation, call have to be repeated in this case.

Using openssl here for TLS from user space.
openssl also has support for kTLS.
Will be part of the next changes.

openssl doesn't have implemetation for iovec
only basic SSL_read and SSL_write.
So adding here SSL_readv and SSL_writev wrappers.

Tested using:
  ./build/examples/hello_sock -N ssl -H 127.0.0.1 -P 12345
  ./build/examples/hello_sock -N ssl -H 127.0.0.1 -P 12345 -S

Also tested using:
  nvmf_tgt + sock_set_default_impl + perf

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
Change-Id: Ie730077c5c581b7e112c18f5f9e1b683015e7b4b
Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12327
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2022-06-20 14:59:47 +00:00
..
accel Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
bdev bdev/nvme: replace nn with mnan in ana_log size calculation 2022-06-15 08:10:48 +00:00
blob Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
blobfs Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
env_dpdk Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
event lib/event: do not set default scheduling period during init 2022-06-20 09:56:09 +00:00
scheduler lib/event: do not set default scheduling period during init 2022-06-20 09:56:09 +00:00
sock sock: Add support for SSL 2022-06-20 14:59:47 +00:00
Makefile Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00