diff options
Diffstat (limited to 'modules/mbedtls/packet_peer_mbed_dtls.cpp')
-rw-r--r-- | modules/mbedtls/packet_peer_mbed_dtls.cpp | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp index 37477e1246..210c9877df 100644 --- a/modules/mbedtls/packet_peer_mbed_dtls.cpp +++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp @@ -35,7 +35,6 @@ #include "core/os/file_access.h" int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) { - if (buf == nullptr || len <= 0) return 0; @@ -53,7 +52,6 @@ int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len } int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) { - if (buf == nullptr || len <= 0) return 0; @@ -79,7 +77,6 @@ int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) { } void PacketPeerMbedDTLS::_cleanup() { - ssl_ctx->clear(); base = Ref<PacketPeer>(); status = STATUS_DISCONNECTED; @@ -116,7 +113,6 @@ Error PacketPeerMbedDTLS::_do_handshake() { } Error PacketPeerMbedDTLS::connect_to_peer(Ref<PacketPeerUDP> p_base, bool p_validate_certs, const String &p_for_hostname, Ref<X509Certificate> p_ca_certs) { - ERR_FAIL_COND_V(!p_base.is_valid() || !p_base->is_connected_to_host(), ERR_INVALID_PARAMETER); base = p_base; @@ -141,7 +137,6 @@ Error PacketPeerMbedDTLS::connect_to_peer(Ref<PacketPeerUDP> p_base, bool p_vali } Error PacketPeerMbedDTLS::accept_peer(Ref<PacketPeerUDP> p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert, Ref<X509Certificate> p_ca_chain, Ref<CookieContextMbedTLS> p_cookies) { - Error err = ssl_ctx->init_server(MBEDTLS_SSL_TRANSPORT_DATAGRAM, MBEDTLS_SSL_VERIFY_NONE, p_key, p_cert, p_cookies); ERR_FAIL_COND_V(err != OK, err); @@ -170,7 +165,6 @@ Error PacketPeerMbedDTLS::accept_peer(Ref<PacketPeerUDP> p_base, Ref<CryptoKey> } Error PacketPeerMbedDTLS::put_packet(const uint8_t *p_buffer, int p_bytes) { - ERR_FAIL_COND_V(status != STATUS_CONNECTED, ERR_UNCONFIGURED); if (p_bytes == 0) @@ -189,7 +183,6 @@ Error PacketPeerMbedDTLS::put_packet(const uint8_t *p_buffer, int p_bytes) { } Error PacketPeerMbedDTLS::get_packet(const uint8_t **r_buffer, int &r_bytes) { - ERR_FAIL_COND_V(status != STATUS_CONNECTED, ERR_UNCONFIGURED); r_bytes = 0; @@ -215,7 +208,6 @@ Error PacketPeerMbedDTLS::get_packet(const uint8_t **r_buffer, int &r_bytes) { } void PacketPeerMbedDTLS::poll() { - if (status == STATUS_HANDSHAKING) { _do_handshake(); return; @@ -240,19 +232,16 @@ void PacketPeerMbedDTLS::poll() { } int PacketPeerMbedDTLS::get_available_packet_count() const { - ERR_FAIL_COND_V(status != STATUS_CONNECTED, 0); return mbedtls_ssl_get_bytes_avail(&(ssl_ctx->ssl)) > 0 ? 1 : 0; } int PacketPeerMbedDTLS::get_max_packet_size() const { - return 488; // 512 (UDP in Godot) - 24 (DTLS header) } PacketPeerMbedDTLS::PacketPeerMbedDTLS() { - ssl_ctx.instance(); status = STATUS_DISCONNECTED; } @@ -262,7 +251,6 @@ PacketPeerMbedDTLS::~PacketPeerMbedDTLS() { } void PacketPeerMbedDTLS::disconnect_from_peer() { - if (status != STATUS_CONNECTED && status != STATUS_HANDSHAKING) return; @@ -278,17 +266,14 @@ void PacketPeerMbedDTLS::disconnect_from_peer() { } PacketPeerMbedDTLS::Status PacketPeerMbedDTLS::get_status() const { - return status; } PacketPeerDTLS *PacketPeerMbedDTLS::_create_func() { - return memnew(PacketPeerMbedDTLS); } void PacketPeerMbedDTLS::initialize_dtls() { - _create = _create_func; available = true; } |