summaryrefslogtreecommitdiff
path: root/modules/mbedtls/dtls_server_mbedtls.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-30 13:28:31 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-30 13:28:31 +0100
commitbde3310f02196c5a0962153426fd0209020af5a6 (patch)
tree2bf302ea12ecc3834bdacfde0369437469fcf92e /modules/mbedtls/dtls_server_mbedtls.cpp
parent6c19a619adbcafd33603b6993e7a8b2452269b68 (diff)
parent7cd80e6a6dd48019fb292e49eab10eefff293132 (diff)
Merge pull request #71995 from Faless/net/4.x_tls_verify
[NET] Refactor TLS configuration.
Diffstat (limited to 'modules/mbedtls/dtls_server_mbedtls.cpp')
-rw-r--r--modules/mbedtls/dtls_server_mbedtls.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/mbedtls/dtls_server_mbedtls.cpp b/modules/mbedtls/dtls_server_mbedtls.cpp
index c54ab8ef6e..62513929ea 100644
--- a/modules/mbedtls/dtls_server_mbedtls.cpp
+++ b/modules/mbedtls/dtls_server_mbedtls.cpp
@@ -31,25 +31,25 @@
#include "dtls_server_mbedtls.h"
#include "packet_peer_mbed_dtls.h"
-Error DTLSServerMbedTLS::setup(Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain) {
- ERR_FAIL_COND_V(_cookies->setup() != OK, ERR_ALREADY_IN_USE);
- _key = p_key;
- _cert = p_cert;
- _ca_chain = p_ca_chain;
+Error DTLSServerMbedTLS::setup(Ref<TLSOptions> p_options) {
+ ERR_FAIL_COND_V(p_options.is_null() || !p_options->is_server(), ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(cookies->setup() != OK, ERR_ALREADY_IN_USE);
+ tls_options = p_options;
return OK;
}
void DTLSServerMbedTLS::stop() {
- _cookies->clear();
+ cookies->clear();
}
Ref<PacketPeerDTLS> DTLSServerMbedTLS::take_connection(Ref<PacketPeerUDP> p_udp_peer) {
Ref<PacketPeerMbedDTLS> out;
- out.instantiate();
- ERR_FAIL_COND_V(!out.is_valid(), out);
+ ERR_FAIL_COND_V(tls_options.is_null(), out);
ERR_FAIL_COND_V(!p_udp_peer.is_valid(), out);
- out->accept_peer(p_udp_peer, _key, _cert, _ca_chain, _cookies);
+
+ out.instantiate();
+ out->accept_peer(p_udp_peer, tls_options, cookies);
return out;
}
@@ -68,7 +68,7 @@ void DTLSServerMbedTLS::finalize() {
}
DTLSServerMbedTLS::DTLSServerMbedTLS() {
- _cookies.instantiate();
+ cookies.instantiate();
}
DTLSServerMbedTLS::~DTLSServerMbedTLS() {