summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2025-06-05 15:32:38 +1000
committerDamien George <damien@micropython.org>2025-07-23 15:47:16 +1000
commit9b7d85227e67a7edd608aab4ff7eb4a838651f75 (patch)
tree4a4681d5567f3782771c7c68367890b66fc56059 /tests
parent41e0ec96cb10580c8d77156ed51c2e34bc2fc0ac (diff)
extmod/mbedtls: Implement recommended DTLS features, make optional.
- DTLS spec recommends HelloVerify and Anti Replay protection be enabled, and these are enabled in the default mbedTLS config. Implement them here. - To help compensate for the possible increase in code size, add a MICROPY_PY_SSL_DTLS build config macro that's enabled for EXTRA and above by default. This allows bare metal mbedTLS ports to use DTLS with HelloVerify support. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/tls_dtls.py12
-rw-r--r--tests/extmod/tls_dtls.py.exp1
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/extmod/tls_dtls.py b/tests/extmod/tls_dtls.py
index b2d716769..a475cce8c 100644
--- a/tests/extmod/tls_dtls.py
+++ b/tests/extmod/tls_dtls.py
@@ -34,9 +34,19 @@ client_socket = DummySocket()
# Wrap the DTLS Server
dtls_server_ctx = SSLContext(PROTOCOL_DTLS_SERVER)
dtls_server_ctx.verify_mode = CERT_NONE
-dtls_server = dtls_server_ctx.wrap_socket(server_socket, do_handshake_on_connect=False)
+dtls_server = dtls_server_ctx.wrap_socket(
+ server_socket, do_handshake_on_connect=False, client_id=b'dummy_client_id'
+)
print("Wrapped DTLS Server")
+# wrap DTLS server with invalid client_id
+try:
+ dtls_server = dtls_server_ctx.wrap_socket(
+ server_socket, do_handshake_on_connect=False, client_id=4
+ )
+except OSError:
+ print("Failed to wrap DTLS Server with invalid client_id")
+
# Wrap the DTLS Client
dtls_client_ctx = SSLContext(PROTOCOL_DTLS_CLIENT)
dtls_client_ctx.verify_mode = CERT_NONE
diff --git a/tests/extmod/tls_dtls.py.exp b/tests/extmod/tls_dtls.py.exp
index 78d72bff1..dbd005d0e 100644
--- a/tests/extmod/tls_dtls.py.exp
+++ b/tests/extmod/tls_dtls.py.exp
@@ -1,3 +1,4 @@
Wrapped DTLS Server
+Failed to wrap DTLS Server with invalid client_id
Wrapped DTLS Client
OK