98 Commits

Author SHA1 Message Date
b8af24b26d tls: add async processing support
Adds support for tls async processing using OpenSSL.
Adds new CLI command to configure OpenSSL TLS configurations used by
OpenSSL context and session. New CLI format is:
tls openssl set-tls [record-size <size>]
                    [record-split-size <size>]
                    [max-pipelines <size>]
Sets default values to below TLS configuration parameters:
 - first_seg_size: 32MB
 - add_seg_size:   256MB

Type: feature

Signed-off-by: Varun Rapelly <vrapelly@marvell.com>
Change-Id: I990be31fced9e258fdb036f5751cd67594b0bce7
2024-12-07 21:18:54 +00:00
d0e8bd75f6 tls: cleanup engine hs cb and improve ctx formatting
Handshake completion is now tracked via a ctx flag so we no longer need
ctx_handshake_is_over.

Also, as we no longer prealloc application sessions, improve ctx state
formatting.

Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: If48588ecde13e56fb99d1a46238bda53ed4eae1b
2024-09-26 20:44:34 +00:00
c4b5d10115 session: add Source Deny List
With this feature, session enable is now modified to have 3 modes of operation
session enable -- only enable session
session enable rt-backend sdl -- enable session with sdl
session enable rt-backend rule-table -- enable session with rule-table

session rule tables are now created on demand, upon adding first rule
to the rule table.

refactor session table to remove depenency from sesssion rules table. Now
session rules table APIs take srtg_handle and transport
proto instead of srt pointer.

Type: feature

Change-Id: Idde6a9b2f46b29bb931f9039636562575572aa14
Signed-off-by: Steven Luong <sluong@cisco.com>
2024-09-06 18:26:56 +00:00
c0580f91a1 tls: don't upper-case cipher string
Change-Id: Ic8308046610aa5d49d9595bcd450f9651b9915e4
Signed-off-by: Brian Morris <bmorris2@cisco.com>
The string is allowed to contain lower case characters, for example "TLSv1.2"
Type: fix
2024-04-23 20:17:10 +00:00
7a18b0f0a5 tls: fix rescheduling when no data available
Don't force tx rescheduling of tls session if no forward progress is
made. The session will still be rescheduled by the session infra if
there's pending tx data.

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ic57b6ee79969055cec782938668c054bcc39f206
2024-03-30 18:25:24 +00:00
e565902654 tls: avoid app session preallocation
Since async rx event infra decouples notification event generation from
delivery we no longer run the risk of having tls realloc session pools
while session layer still holds a pointer to the accepted/connected tcp
session.

Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1bb429a058707aba1d4f32ea33615a2367e66969
2024-03-20 20:07:05 +00:00
ac60efd523 tls: handle attepts to renegotiate hs
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I549d0c8715e5c06bfc22be26ca1dc78ec3c29a61
2024-03-18 19:20:38 +00:00
c3148b1be8 misc: remove GNU Indent directives
Type: refactor
Change-Id: I5235bf3e9aff58af6ba2c14e8c6529c4fc9ec86c
Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-03-12 19:29:56 +00:00
ea158d64a0 tls: pass reset ntf to engines
Type: improvement

Change-Id: Ie042605e50656229874b7a93638f0f04c894410f
Signed-off-by: Florin Coras <fcoras@cisco.com>
2024-02-27 18:49:20 +00:00
d7f17a2393 tls: set app closed flag in framework
Set the flag in tls framework as opposed to tls engines. This is similar
to passive close.

Type: improvement

Change-Id: I0c2a774b1ef9d7ec6ba74daf1678ea449815184f
Signed-off-by: Florin Coras <fcoras@cisco.com>
2024-01-31 17:08:18 -08:00
4a98b9360e tls: convert ctx fields to connection flags
Type: refactor

Change-Id: I527bbc1cf2e7b6d06fd0c88b7563fb59ed28bc40
Signed-off-by: Florin Coras <fcoras@cisco.com>
2024-01-31 22:01:57 +00:00
733e093e70 tls: Fix SSL_CTX leak on every client session
Type: fix

Change-Id: I35b3920288269073cdd35f79c938396128d169c9
Signed-off-by: Brian Morris <bmorris2@cisco.com>
2023-10-11 20:12:50 +00:00
aa7b88120a tls: propagate reads to app irrespective of state
Session input node handles rx notifications even if session not fully
accepted/connected

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I6560c45db8f8e0b7f0dc3bdd0939f13ca2f43f15
2023-10-08 00:16:56 +00:00
c1b038001e tls: limit openssl engine max read burst
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ic7a8fd37d79fc9c09c8b1539d630f3b8983b8bb3
2023-10-02 20:23:06 +00:00
d35c71c2f1 tls: flag no app session on handshake failure
If openssl tls server handshake fails, track the fact that the context
does not have an app session.

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I5f493059a3610067b59caffbbe441ce9e0868252
2023-05-19 20:46:06 +00:00
905ec87977 tls: openssl: fix SSL_read partial read scenario
When application performs SSL_read from the app rx-fifo, it can
pre-allocate multiple segments, but there is an issue if the OpenSSL
manages to partially fill in the first segment, in this case, since
data is assumed to be copied over by OpenSSL to the pre-allocated
segments(s), vpp uses svm_fifo_enqueue_nocopy API which performs
zero copy by passing the pre-allocated segment to SSL_read.

If the decrypted data size is smaller than the pre-allocated fifo
segment buffer size, application will fetch buffers including zero
in the area not filled in by SSL_read.

Type: fix

Signed-off-by: Ofer Heifetz <oferh@marvell.com>
Change-Id: I941a89b17d567d86e5bd2c35785f1df043c33f38
2023-02-02 18:36:29 +00:00
009303dc06 tls: use safe pool reallocs
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ia2c771cbf826526d2d06b6da022509ab02917350
2022-10-31 15:24:18 +00:00
fe45f8f5af api: replace print functions wth format
Type: improvement
Change-Id: I7f7050c19453a69a7fb6c5e62f8f57db847d9144
Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-09-26 08:14:29 +00:00
179711d869 tls: fix connected notifications with no app wrk
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I805131b4e3d0cb2fab1d3bf76db659c67522c2e8
2022-04-11 10:07:31 +00:00
e0c0280d9b tls: fix session pool realloc on accept
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I68ada775810bb4a4f280962a979605b211562a52
2022-04-07 14:44:28 +00:00
86aabbbeee tls: set client ckpair only for non-test ckp
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I7287e40ad95dfe061fd8a7b0e99921d5540e030d
2022-04-04 22:28:56 +00:00
13f34ba4ab tls: null terminate openssl chiphers
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I5d4e68730a75337a2e532e72f366b62d6973235e
2022-04-04 21:24:45 +00:00
9a485d01fa tls: enable host verification by hostname
Type: improvement

Signed-off-by: satna <satbeervarma9596@gmail.com>
Change-Id: I1b1db60fa1a0e47fce273bc07b01887813fd3c48
2022-04-01 06:45:40 +00:00
d918cc54eb tls: support to reinitialise ca_chain wo restart
Type: improvement

Signed-off-by: Saravanan Murugesan <sarmurug@cisco.com>
Change-Id: I90e90678ae6586019cc842f9d504d53991cfabe4
2022-03-30 21:20:32 +00:00
8f63d38e99 tls: Support for client certificate-key pair
Type: improvement

Signed-off-by: sarmurug <sarmurug@cisco.com>
Change-Id: Ibbfe827b9c4c603a6fe7cc49970a46bd683194ce
2022-03-29 17:13:59 +00:00
8c5e5f6402 tls: handle read write ssl errors
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: If5eed7dac4951f0510a4b4b092f66f44d0d3cacd
2022-02-28 21:04:14 +00:00
76b86b033e tls: Handle transport disconnect during client HS failures
Type: fix

Signed-off-by: Saravanan Murugesan <sarmurug@cisco.com>
Change-Id: I5f7f4b925b3d250c5b8616d1fb35edbde50a7a23
2022-02-28 06:05:59 +00:00
1fd912c8dd build: fix compilation on OpenSSL 3.0
So far by suppressing depreciation messages, as there was no transition
period.

Type: make
Change-Id: I9887613fd71a22bf11bf22a04c129aca4a16867f
Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-01-27 20:35:57 +00:00
b85de19145 svm: update number of segments in svm_fifo_segments
In addition to returning the number of bytes also update the number of
segments to reflect the number used.

Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ia87dc2aa62cea38b18dfa83df94dc2abe29d5121
2022-01-19 15:58:20 +00:00
0cef5f5d71 tls: ssl close only after all data drained
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ia77b26db61b6f58b4ff659f09192b4ea93ed50b4
2022-01-11 17:05:18 +00:00
6fff5ef8a9 tls: shutdown openssl context on app close
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ie0fde16fb4e41637169474628808fddf343884f3
2021-10-08 20:39:54 +00:00
18599c5861 tls: use default OpenSSL built-in DH parameters
Type: improvement

Motivation for this addition is to add support for cipher suites
that use Diffie-Hellman Ephemeral (DHE) for key exchange.

Using ephemeral DH key exchange yields forward secrecy as the
connection can only be decrypted when the DH key is known.
Configure OpenSSL to use the default built-in DH parameters for the
SSL_CTX object.

Change-Id: I31aadad047a6394ddf8bfa08471c239e0d1cd63c
Signed-off-by: Ofer Heifetz <oferh@marvell.com>
2021-08-30 14:05:05 +00:00
8c7f5c809f tls: add start_listen openssl API return value check
Type: improvement

Check SSL_CTX_use_* API return value and exit on error.
Check BIO_new return code.
Release allocated BIO on error cases.

Change-Id: I9c48e91727e0eeba5d7d74d06fc37634e3c20978
Signed-off-by: Ofer Heifetz <oferh@marvell.com>
2021-08-12 14:26:22 +00:00
b6fe52f3da tls: fix handling of failed accepts
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I34b53dcaf4f049157b538ea40a39033d43e525a5
2021-05-28 18:48:22 -07:00
af073546e1 tls: prealloc chunks for dtls dgram enq
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ib25598f72f6539c07de1acee1e6049ecd28f35cc
2021-05-22 16:45:00 +00:00
e3c6a54995 tls svm: prealloc tcp fifo chunks before ssl write
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I7c47b55ec6f0c83f2d13e0e737d0559a32f7c837
2021-05-20 10:03:57 +00:00
72afc4feb7 tls: fix signed unsigned comparison
On error, the signed value is cast to unsigned.

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I0f94422f47e40d7c358118b2df8ab96cf4116dd0
2021-05-19 18:33:29 -07:00
88dd3cf603 tls: cleanup dtls migrated context
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I433cc1b7a29f785a431618641317bbfbbe2cf2f4
2021-05-02 16:52:50 +00:00
adef691a6f tls: honor tcp deq notification request
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ic24516a7242ef4193c5d751a2d5424918c390759
2021-04-20 16:48:49 +00:00
27d87d3244 tls: fix coverity warning
Type: fix

Avoid complaint that we're potentially incrementing ii which could be
null.

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I8511c07b1c2f260cc0e526d9aefeb4a051d98edf
2021-04-14 10:26:48 +00:00
92ccf9bcd2 vlib: convert foreach_vlib_main macro to be more gdb and clang-format friendly
Type: improvement
Change-Id: I1152e58d7bfcb3c4347147f87a834d45ad51cdfe
Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-03-26 16:35:22 +01:00
da282b5d08 tls: fix cleanup on app close with data
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I35b5ae5a58ab38cc4328f9f438938fab4fbd7942
2021-03-24 15:15:34 +00:00
04161c8f20 tls: fix tlsopenssl for remaining buffer
Type: fix

1. added additional checks for pending data in
   openssl_ctx_read_tls().
2. fixed read/write typo issues.

Signed-off-by: Sivaprasad Tummala <Sivaprasad.Tummala@intel.com>
Change-Id: Id018c62bb9e02bf0d5f9abf929b6030b965a5d61
2021-03-22 21:24:48 +05:30
1e6a0f6465 session tls: deq notifications for custom tx
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I6ed2104e9d79c367ca36460047586f9b632c3315
2021-03-11 19:30:48 +00:00
4b47ee26cb tls: dtls initial implementation
Type: feature

Basic dtls transport protocol implementation that relies on openssl
wire protocol implementation. Retries/timeouts not yet supported.

To test using vcl test apps, first ensure all arp entries are properly
resolved and subsequently:

server: vcl_server -p dtls 1234
client: vcl_client -p dtls <server-ip> 1234 -U -N 2000000 -T 1460 -X

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I04b4516a8fe9ce85ba230bcdd891f33a900046ed
2021-02-09 21:33:19 +00:00
40a5da8e96 tls: use fifo segments instead of chunks
Type: refactor

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Id67cf8a3e1c5c9b4160689fde5de9ce7ed8a2ee3
2020-12-20 20:04:17 +00:00
5b8b1aec21 tls: add custom openssl bio
The bio interacts directly with the session so it avoids using an
intermediary mem bio and, implicitly, higher memory consumption and an
extra memcpy.

Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ifb675cfd12df86396a7a738a6cd4d0882c69ad2f
2020-12-18 22:28:03 +00:00
4a856f9593 tls: fix passed argument in openssl plugin
Thread index used in qat_init_thread() is passed via a pointer
to a variable located on a stack that does not exist
when qat_init_thread is actually executed.

Type: fix
Fixes: f4a92f6a1c

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Change-Id: I65dd4e604b78fcb1cf0452d707f47f9785e6371d
2020-12-03 18:07:46 +00:00
9f86d225ab session tls: support tls descheduling
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ieb8bb9c6deb92479fdd3e045778fe5ae4782d1ea
2020-04-04 17:34:13 +00:00
ed8db52539 session tls: improve app transports tx scheduling
Type: improvement

- allow apps to request rescheduling of tx events via
SESSION_F_CUSTOM_TX flag
- limit max burst per session custom tx dispatch

In tls
- use the new infra to reschedule tx events
- use max burst bytes as upper limit to number of bytes to be encrypted

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I544a5a3337af7ebdff3406b776adf30cf96ebf3c
2020-04-04 17:34:13 +00:00