Coverage Report

Created: 2025-07-23 07:08

/src/mbedtls/programs/fuzz/fuzz_dtlsserver.c
Line
Count
Source (jump to first uncovered line)
1
#include <string.h>
2
#include <stdlib.h>
3
#include <stdint.h>
4
#include "common.h"
5
#include "mbedtls/ssl.h"
6
#include "test/certs.h"
7
#if defined(MBEDTLS_SSL_PROTO_DTLS)
8
#include "mbedtls/entropy.h"
9
#include "mbedtls/ctr_drbg.h"
10
#include "mbedtls/timing.h"
11
#include "mbedtls/ssl_cookie.h"
12
13
#if defined(MBEDTLS_SSL_SRV_C) && \
14
    defined(MBEDTLS_ENTROPY_C) && \
15
    defined(MBEDTLS_CTR_DRBG_C) && \
16
    defined(MBEDTLS_TIMING_C) && \
17
    (defined(MBEDTLS_MD_CAN_SHA384) || \
18
    defined(MBEDTLS_MD_CAN_SHA256))
19
const char *pers = "fuzz_dtlsserver";
20
const unsigned char client_ip[4] = { 0x7F, 0, 0, 1 };
21
static int initialized = 0;
22
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
23
static mbedtls_x509_crt srvcert;
24
static mbedtls_pk_context pkey;
25
#endif
26
#endif
27
#endif // MBEDTLS_SSL_PROTO_DTLS
28
29
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
30
1.27k
{
31
1.27k
#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
32
1.27k
    defined(MBEDTLS_SSL_SRV_C) && \
33
1.27k
    defined(MBEDTLS_ENTROPY_C) && \
34
1.27k
    defined(MBEDTLS_CTR_DRBG_C) && \
35
1.27k
    defined(MBEDTLS_TIMING_C) && \
36
1.27k
    (defined(MBEDTLS_MD_CAN_SHA384) || \
37
1.27k
    defined(MBEDTLS_MD_CAN_SHA256))
38
1.27k
    int ret;
39
1.27k
    size_t len;
40
1.27k
    mbedtls_ssl_context ssl;
41
1.27k
    mbedtls_ssl_config conf;
42
1.27k
    mbedtls_ctr_drbg_context ctr_drbg;
43
1.27k
    mbedtls_entropy_context entropy;
44
1.27k
    mbedtls_timing_delay_context timer;
45
1.27k
    mbedtls_ssl_cookie_ctx cookie_ctx;
46
1.27k
    unsigned char buf[4096];
47
1.27k
    fuzzBufferOffset_t biomemfuzz;
48
49
1.27k
    mbedtls_ctr_drbg_init(&ctr_drbg);
50
1.27k
    mbedtls_entropy_init(&entropy);
51
1.27k
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
52
1.27k
    mbedtls_x509_crt_init(&srvcert);
53
1.27k
    mbedtls_pk_init(&pkey);
54
1.27k
#endif
55
1.27k
    mbedtls_ssl_init(&ssl);
56
1.27k
    mbedtls_ssl_config_init(&conf);
57
1.27k
    mbedtls_ssl_cookie_init(&cookie_ctx);
58
59
#if defined(MBEDTLS_USE_PSA_CRYPTO)
60
    psa_status_t status = psa_crypto_init();
61
2
    if (status != PSA_SUCCESS) {
62
2
        goto exit;
63
2
    }
64
0
#endif /* MBEDTLS_USE_PSA_CRYPTO */
65
66
1.26k
    if (mbedtls_ctr_drbg_seed(&ctr_drbg, dummy_entropy, &entropy,
67
1.26k
                              (const unsigned char *) pers, strlen(pers)) != 0) {
68
0
        goto exit;
69
0
    }
70
71
1.26k
    if (initialized == 0) {
72
1
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
73
74
1
        if (mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_srv_crt,
75
1
                                   mbedtls_test_srv_crt_len) != 0) {
76
0
            return 1;
77
0
        }
78
1
        if (mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_cas_pem,
79
1
                                   mbedtls_test_cas_pem_len) != 0) {
80
0
            return 1;
81
0
        }
82
1
        if (mbedtls_pk_parse_key(&pkey, (const unsigned char *) mbedtls_test_srv_key,
83
1
                                 mbedtls_test_srv_key_len, NULL, 0,
84
1
                                 dummy_random, &ctr_drbg) != 0) {
85
0
            return 1;
86
0
        }
87
1
#endif
88
1
        dummy_init();
89
90
1
        initialized = 1;
91
1
    }
92
93
1.26k
    if (mbedtls_ssl_config_defaults(&conf,
94
1.26k
                                    MBEDTLS_SSL_IS_SERVER,
95
1.26k
                                    MBEDTLS_SSL_TRANSPORT_DATAGRAM,
96
1.26k
                                    MBEDTLS_SSL_PRESET_DEFAULT) != 0) {
97
0
        goto exit;
98
0
    }
99
100
101
1.26k
    srand(1);
102
1.26k
    mbedtls_ssl_conf_rng(&conf, dummy_random, &ctr_drbg);
103
104
1.26k
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
105
1.26k
    mbedtls_ssl_conf_ca_chain(&conf, srvcert.next, NULL);
106
1.26k
    if (mbedtls_ssl_conf_own_cert(&conf, &srvcert, &pkey) != 0) {
107
0
        goto exit;
108
0
    }
109
1.26k
#endif
110
111
1.26k
    if (mbedtls_ssl_cookie_setup(&cookie_ctx, dummy_random, &ctr_drbg) != 0) {
112
0
        goto exit;
113
0
    }
114
115
1.26k
    mbedtls_ssl_conf_dtls_cookies(&conf,
116
1.26k
                                  mbedtls_ssl_cookie_write,
117
1.26k
                                  mbedtls_ssl_cookie_check,
118
1.26k
                                  &cookie_ctx);
119
120
1.26k
    if (mbedtls_ssl_setup(&ssl, &conf) != 0) {
121
0
        goto exit;
122
0
    }
123
124
1.26k
    mbedtls_ssl_set_timer_cb(&ssl, &timer, mbedtls_timing_set_delay,
125
1.26k
                             mbedtls_timing_get_delay);
126
127
1.26k
    biomemfuzz.Data = Data;
128
1.26k
    biomemfuzz.Size = Size;
129
1.26k
    biomemfuzz.Offset = 0;
130
1.26k
    mbedtls_ssl_set_bio(&ssl, &biomemfuzz, dummy_send, fuzz_recv, fuzz_recv_timeout);
131
1.26k
    if (mbedtls_ssl_set_client_transport_id(&ssl, client_ip, sizeof(client_ip)) != 0) {
132
0
        goto exit;
133
0
    }
134
135
1.26k
    ret = mbedtls_ssl_handshake(&ssl);
136
137
1.26k
    if (ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED) {
138
0
        biomemfuzz.Offset = ssl.MBEDTLS_PRIVATE(next_record_offset);
139
0
        mbedtls_ssl_session_reset(&ssl);
140
0
        mbedtls_ssl_set_bio(&ssl, &biomemfuzz, dummy_send, fuzz_recv, fuzz_recv_timeout);
141
0
        if (mbedtls_ssl_set_client_transport_id(&ssl, client_ip, sizeof(client_ip)) != 0) {
142
0
            goto exit;
143
0
        }
144
145
0
        ret = mbedtls_ssl_handshake(&ssl);
146
147
0
        if (ret == 0) {
148
            //keep reading data from server until the end
149
0
            do {
150
0
                len = sizeof(buf) - 1;
151
0
                ret = mbedtls_ssl_read(&ssl, buf, len);
152
0
                if (ret == MBEDTLS_ERR_SSL_WANT_READ) {
153
0
                    continue;
154
0
                } else if (ret <= 0) {
155
                    //EOF or error
156
0
                    break;
157
0
                }
158
0
            } while (1);
159
0
        }
160
0
    }
161
162
1.27k
exit:
163
1.27k
    mbedtls_ssl_cookie_free(&cookie_ctx);
164
1.27k
    mbedtls_entropy_free(&entropy);
165
1.27k
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
166
1.27k
    mbedtls_pk_free(&pkey);
167
1.27k
    mbedtls_x509_crt_free(&srvcert);
168
1.27k
#endif
169
1.27k
    mbedtls_ctr_drbg_free(&ctr_drbg);
170
1.27k
    mbedtls_ssl_config_free(&conf);
171
1.27k
    mbedtls_ssl_free(&ssl);
172
#if defined(MBEDTLS_USE_PSA_CRYPTO)
173
    mbedtls_psa_crypto_free();
174
#endif /* MBEDTLS_USE_PSA_CRYPTO */
175
176
#else
177
    (void) Data;
178
    (void) Size;
179
#endif
180
1.27k
    return 0;
181
1.26k
}
LLVMFuzzerTestOneInput
Line
Count
Source
30
1.26k
{
31
1.26k
#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
32
1.26k
    defined(MBEDTLS_SSL_SRV_C) && \
33
1.26k
    defined(MBEDTLS_ENTROPY_C) && \
34
1.26k
    defined(MBEDTLS_CTR_DRBG_C) && \
35
1.26k
    defined(MBEDTLS_TIMING_C) && \
36
1.26k
    (defined(MBEDTLS_MD_CAN_SHA384) || \
37
1.26k
    defined(MBEDTLS_MD_CAN_SHA256))
38
1.26k
    int ret;
39
1.26k
    size_t len;
40
1.26k
    mbedtls_ssl_context ssl;
41
1.26k
    mbedtls_ssl_config conf;
42
1.26k
    mbedtls_ctr_drbg_context ctr_drbg;
43
1.26k
    mbedtls_entropy_context entropy;
44
1.26k
    mbedtls_timing_delay_context timer;
45
1.26k
    mbedtls_ssl_cookie_ctx cookie_ctx;
46
1.26k
    unsigned char buf[4096];
47
1.26k
    fuzzBufferOffset_t biomemfuzz;
48
49
1.26k
    mbedtls_ctr_drbg_init(&ctr_drbg);
50
1.26k
    mbedtls_entropy_init(&entropy);
51
1.26k
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
52
1.26k
    mbedtls_x509_crt_init(&srvcert);
53
1.26k
    mbedtls_pk_init(&pkey);
54
1.26k
#endif
55
1.26k
    mbedtls_ssl_init(&ssl);
56
1.26k
    mbedtls_ssl_config_init(&conf);
57
1.26k
    mbedtls_ssl_cookie_init(&cookie_ctx);
58
59
#if defined(MBEDTLS_USE_PSA_CRYPTO)
60
    psa_status_t status = psa_crypto_init();
61
    if (status != PSA_SUCCESS) {
62
        goto exit;
63
    }
64
#endif /* MBEDTLS_USE_PSA_CRYPTO */
65
66
1.26k
    if (mbedtls_ctr_drbg_seed(&ctr_drbg, dummy_entropy, &entropy,
67
1.26k
                              (const unsigned char *) pers, strlen(pers)) != 0) {
68
0
        goto exit;
69
0
    }
70
71
1.26k
    if (initialized == 0) {
72
1
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
73
74
1
        if (mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_srv_crt,
75
1
                                   mbedtls_test_srv_crt_len) != 0) {
76
0
            return 1;
77
0
        }
78
1
        if (mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_cas_pem,
79
1
                                   mbedtls_test_cas_pem_len) != 0) {
80
0
            return 1;
81
0
        }
82
1
        if (mbedtls_pk_parse_key(&pkey, (const unsigned char *) mbedtls_test_srv_key,
83
1
                                 mbedtls_test_srv_key_len, NULL, 0,
84
1
                                 dummy_random, &ctr_drbg) != 0) {
85
0
            return 1;
86
0
        }
87
1
#endif
88
1
        dummy_init();
89
90
1
        initialized = 1;
91
1
    }
92
93
1.26k
    if (mbedtls_ssl_config_defaults(&conf,
94
1.26k
                                    MBEDTLS_SSL_IS_SERVER,
95
1.26k
                                    MBEDTLS_SSL_TRANSPORT_DATAGRAM,
96
1.26k
                                    MBEDTLS_SSL_PRESET_DEFAULT) != 0) {
97
0
        goto exit;
98
0
    }
99
100
101
1.26k
    srand(1);
102
1.26k
    mbedtls_ssl_conf_rng(&conf, dummy_random, &ctr_drbg);
103
104
1.26k
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
105
1.26k
    mbedtls_ssl_conf_ca_chain(&conf, srvcert.next, NULL);
106
1.26k
    if (mbedtls_ssl_conf_own_cert(&conf, &srvcert, &pkey) != 0) {
107
0
        goto exit;
108
0
    }
109
1.26k
#endif
110
111
1.26k
    if (mbedtls_ssl_cookie_setup(&cookie_ctx, dummy_random, &ctr_drbg) != 0) {
112
0
        goto exit;
113
0
    }
114
115
1.26k
    mbedtls_ssl_conf_dtls_cookies(&conf,
116
1.26k
                                  mbedtls_ssl_cookie_write,
117
1.26k
                                  mbedtls_ssl_cookie_check,
118
1.26k
                                  &cookie_ctx);
119
120
1.26k
    if (mbedtls_ssl_setup(&ssl, &conf) != 0) {
121
0
        goto exit;
122
0
    }
123
124
1.26k
    mbedtls_ssl_set_timer_cb(&ssl, &timer, mbedtls_timing_set_delay,
125
1.26k
                             mbedtls_timing_get_delay);
126
127
1.26k
    biomemfuzz.Data = Data;
128
1.26k
    biomemfuzz.Size = Size;
129
1.26k
    biomemfuzz.Offset = 0;
130
1.26k
    mbedtls_ssl_set_bio(&ssl, &biomemfuzz, dummy_send, fuzz_recv, fuzz_recv_timeout);
131
1.26k
    if (mbedtls_ssl_set_client_transport_id(&ssl, client_ip, sizeof(client_ip)) != 0) {
132
0
        goto exit;
133
0
    }
134
135
1.26k
    ret = mbedtls_ssl_handshake(&ssl);
136
137
1.26k
    if (ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED) {
138
0
        biomemfuzz.Offset = ssl.MBEDTLS_PRIVATE(next_record_offset);
139
0
        mbedtls_ssl_session_reset(&ssl);
140
0
        mbedtls_ssl_set_bio(&ssl, &biomemfuzz, dummy_send, fuzz_recv, fuzz_recv_timeout);
141
0
        if (mbedtls_ssl_set_client_transport_id(&ssl, client_ip, sizeof(client_ip)) != 0) {
142
0
            goto exit;
143
0
        }
144
145
0
        ret = mbedtls_ssl_handshake(&ssl);
146
147
0
        if (ret == 0) {
148
            //keep reading data from server until the end
149
0
            do {
150
0
                len = sizeof(buf) - 1;
151
0
                ret = mbedtls_ssl_read(&ssl, buf, len);
152
0
                if (ret == MBEDTLS_ERR_SSL_WANT_READ) {
153
0
                    continue;
154
0
                } else if (ret <= 0) {
155
                    //EOF or error
156
0
                    break;
157
0
                }
158
0
            } while (1);
159
0
        }
160
0
    }
161
162
1.26k
exit:
163
1.26k
    mbedtls_ssl_cookie_free(&cookie_ctx);
164
1.26k
    mbedtls_entropy_free(&entropy);
165
1.26k
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
166
1.26k
    mbedtls_pk_free(&pkey);
167
1.26k
    mbedtls_x509_crt_free(&srvcert);
168
1.26k
#endif
169
1.26k
    mbedtls_ctr_drbg_free(&ctr_drbg);
170
1.26k
    mbedtls_ssl_config_free(&conf);
171
1.26k
    mbedtls_ssl_free(&ssl);
172
#if defined(MBEDTLS_USE_PSA_CRYPTO)
173
    mbedtls_psa_crypto_free();
174
#endif /* MBEDTLS_USE_PSA_CRYPTO */
175
176
#else
177
    (void) Data;
178
    (void) Size;
179
#endif
180
1.26k
    return 0;
181
1.26k
}
LLVMFuzzerTestOneInput
Line
Count
Source
30
2
{
31
2
#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
32
2
    defined(MBEDTLS_SSL_SRV_C) && \
33
2
    defined(MBEDTLS_ENTROPY_C) && \
34
2
    defined(MBEDTLS_CTR_DRBG_C) && \
35
2
    defined(MBEDTLS_TIMING_C) && \
36
2
    (defined(MBEDTLS_MD_CAN_SHA384) || \
37
2
    defined(MBEDTLS_MD_CAN_SHA256))
38
2
    int ret;
39
2
    size_t len;
40
2
    mbedtls_ssl_context ssl;
41
2
    mbedtls_ssl_config conf;
42
2
    mbedtls_ctr_drbg_context ctr_drbg;
43
2
    mbedtls_entropy_context entropy;
44
2
    mbedtls_timing_delay_context timer;
45
2
    mbedtls_ssl_cookie_ctx cookie_ctx;
46
2
    unsigned char buf[4096];
47
2
    fuzzBufferOffset_t biomemfuzz;
48
49
2
    mbedtls_ctr_drbg_init(&ctr_drbg);
50
2
    mbedtls_entropy_init(&entropy);
51
2
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
52
2
    mbedtls_x509_crt_init(&srvcert);
53
2
    mbedtls_pk_init(&pkey);
54
2
#endif
55
2
    mbedtls_ssl_init(&ssl);
56
2
    mbedtls_ssl_config_init(&conf);
57
2
    mbedtls_ssl_cookie_init(&cookie_ctx);
58
59
2
#if defined(MBEDTLS_USE_PSA_CRYPTO)
60
2
    psa_status_t status = psa_crypto_init();
61
2
    if (status != PSA_SUCCESS) {
62
2
        goto exit;
63
2
    }
64
0
#endif /* MBEDTLS_USE_PSA_CRYPTO */
65
66
0
    if (mbedtls_ctr_drbg_seed(&ctr_drbg, dummy_entropy, &entropy,
67
0
                              (const unsigned char *) pers, strlen(pers)) != 0) {
68
0
        goto exit;
69
0
    }
70
71
0
    if (initialized == 0) {
72
0
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
73
74
0
        if (mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_srv_crt,
75
0
                                   mbedtls_test_srv_crt_len) != 0) {
76
0
            return 1;
77
0
        }
78
0
        if (mbedtls_x509_crt_parse(&srvcert, (const unsigned char *) mbedtls_test_cas_pem,
79
0
                                   mbedtls_test_cas_pem_len) != 0) {
80
0
            return 1;
81
0
        }
82
0
        if (mbedtls_pk_parse_key(&pkey, (const unsigned char *) mbedtls_test_srv_key,
83
0
                                 mbedtls_test_srv_key_len, NULL, 0,
84
0
                                 dummy_random, &ctr_drbg) != 0) {
85
0
            return 1;
86
0
        }
87
0
#endif
88
0
        dummy_init();
89
90
0
        initialized = 1;
91
0
    }
92
93
0
    if (mbedtls_ssl_config_defaults(&conf,
94
0
                                    MBEDTLS_SSL_IS_SERVER,
95
0
                                    MBEDTLS_SSL_TRANSPORT_DATAGRAM,
96
0
                                    MBEDTLS_SSL_PRESET_DEFAULT) != 0) {
97
0
        goto exit;
98
0
    }
99
100
101
0
    srand(1);
102
0
    mbedtls_ssl_conf_rng(&conf, dummy_random, &ctr_drbg);
103
104
0
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
105
0
    mbedtls_ssl_conf_ca_chain(&conf, srvcert.next, NULL);
106
0
    if (mbedtls_ssl_conf_own_cert(&conf, &srvcert, &pkey) != 0) {
107
0
        goto exit;
108
0
    }
109
0
#endif
110
111
0
    if (mbedtls_ssl_cookie_setup(&cookie_ctx, dummy_random, &ctr_drbg) != 0) {
112
0
        goto exit;
113
0
    }
114
115
0
    mbedtls_ssl_conf_dtls_cookies(&conf,
116
0
                                  mbedtls_ssl_cookie_write,
117
0
                                  mbedtls_ssl_cookie_check,
118
0
                                  &cookie_ctx);
119
120
0
    if (mbedtls_ssl_setup(&ssl, &conf) != 0) {
121
0
        goto exit;
122
0
    }
123
124
0
    mbedtls_ssl_set_timer_cb(&ssl, &timer, mbedtls_timing_set_delay,
125
0
                             mbedtls_timing_get_delay);
126
127
0
    biomemfuzz.Data = Data;
128
0
    biomemfuzz.Size = Size;
129
0
    biomemfuzz.Offset = 0;
130
0
    mbedtls_ssl_set_bio(&ssl, &biomemfuzz, dummy_send, fuzz_recv, fuzz_recv_timeout);
131
0
    if (mbedtls_ssl_set_client_transport_id(&ssl, client_ip, sizeof(client_ip)) != 0) {
132
0
        goto exit;
133
0
    }
134
135
0
    ret = mbedtls_ssl_handshake(&ssl);
136
137
0
    if (ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED) {
138
0
        biomemfuzz.Offset = ssl.MBEDTLS_PRIVATE(next_record_offset);
139
0
        mbedtls_ssl_session_reset(&ssl);
140
0
        mbedtls_ssl_set_bio(&ssl, &biomemfuzz, dummy_send, fuzz_recv, fuzz_recv_timeout);
141
0
        if (mbedtls_ssl_set_client_transport_id(&ssl, client_ip, sizeof(client_ip)) != 0) {
142
0
            goto exit;
143
0
        }
144
145
0
        ret = mbedtls_ssl_handshake(&ssl);
146
147
0
        if (ret == 0) {
148
            //keep reading data from server until the end
149
0
            do {
150
0
                len = sizeof(buf) - 1;
151
0
                ret = mbedtls_ssl_read(&ssl, buf, len);
152
0
                if (ret == MBEDTLS_ERR_SSL_WANT_READ) {
153
0
                    continue;
154
0
                } else if (ret <= 0) {
155
                    //EOF or error
156
0
                    break;
157
0
                }
158
0
            } while (1);
159
0
        }
160
0
    }
161
162
2
exit:
163
2
    mbedtls_ssl_cookie_free(&cookie_ctx);
164
2
    mbedtls_entropy_free(&entropy);
165
2
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
166
2
    mbedtls_pk_free(&pkey);
167
2
    mbedtls_x509_crt_free(&srvcert);
168
2
#endif
169
2
    mbedtls_ctr_drbg_free(&ctr_drbg);
170
2
    mbedtls_ssl_config_free(&conf);
171
2
    mbedtls_ssl_free(&ssl);
172
2
#if defined(MBEDTLS_USE_PSA_CRYPTO)
173
2
    mbedtls_psa_crypto_free();
174
2
#endif /* MBEDTLS_USE_PSA_CRYPTO */
175
176
#else
177
    (void) Data;
178
    (void) Size;
179
#endif
180
2
    return 0;
181
0
}