1
10
13
14
20
21
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
114
115
116
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
180
181
182
183
185
186
187
188
189
190
191
193
194
195
196
197
198
199
200
...
...
...
#define NX_SECURE_SOURCE_CODE
#include "nx_secure_tls.h"
...
...
UINT _nx_secure_tls_session_reset(NX_SECURE_TLS_SESSION *session_ptr)
{
UINT status;
UINT temp_status;
status = NX_SUCCESS;
tx_mutex_get(&_nx_secure_tls_protection, TX_WAIT_FOREVER);
/* ... */
if (session_ptr -> nx_secure_tls_remote_session_active)
{
if (session_ptr -> nx_secure_tls_session_ciphersuite != NX_NULL)
{
if (session_ptr -> nx_secure_tls_session_ciphersuite -> nx_secure_tls_session_cipher -> nx_crypto_cleanup)
{
temp_status = session_ptr -> nx_secure_tls_session_ciphersuite -> nx_secure_tls_session_cipher -> nx_crypto_cleanup(session_ptr -> nx_secure_session_cipher_metadata_area_client);
if(temp_status != NX_CRYPTO_SUCCESS)
{
status = temp_status;
}if (temp_status != NX_CRYPTO_SUCCESS) { ... }
temp_status = session_ptr -> nx_secure_tls_session_ciphersuite -> nx_secure_tls_session_cipher -> nx_crypto_cleanup(session_ptr -> nx_secure_session_cipher_metadata_area_server);
if(temp_status != NX_CRYPTO_SUCCESS)
{
status = temp_status;
}if (temp_status != NX_CRYPTO_SUCCESS) { ... }
}if (session_ptr -> nx_secure_tls_session_ciphersuite -> nx_secure_tls_session_cipher -> nx_crypto_cleanup) { ... }
}if (session_ptr -> nx_secure_tls_session_ciphersuite != NX_NULL) { ... }
}if (session_ptr -> nx_secure_tls_remote_session_active) { ... }
session_ptr -> nx_secure_tls_socket_type = NX_SECURE_TLS_SESSION_TYPE_NONE;
session_ptr -> nx_secure_tls_protocol_version = 0;
session_ptr -> nx_secure_tls_remote_session_active = 0;
session_ptr -> nx_secure_tls_local_session_active = 0;
session_ptr -> nx_secure_tls_session_cipher_client_initialized = 0;
session_ptr -> nx_secure_tls_session_cipher_server_initialized = 0;
/* ... */
session_ptr -> nx_secure_tls_session_ciphersuite = NX_NULL;
_nx_secure_tls_key_material_init(&session_ptr -> nx_secure_tls_key_material);
session_ptr -> nx_secure_tls_session_id_length = 0;
NX_SECURE_MEMSET(session_ptr -> nx_secure_tls_session_id, 0, NX_SECURE_TLS_SESSION_ID_SIZE);
NX_SECURE_MEMSET(session_ptr -> nx_secure_tls_local_sequence_number, 0, sizeof(session_ptr -> nx_secure_tls_local_sequence_number));
NX_SECURE_MEMSET(session_ptr -> nx_secure_tls_remote_sequence_number, 0, sizeof(session_ptr -> nx_secure_tls_remote_sequence_number));
status = _nx_secure_tls_remote_certificate_free_all(session_ptr);
session_ptr -> nx_secure_tls_credentials.nx_secure_tls_active_certificate = NX_NULL;
#ifndef NX_SECURE_TLS_DISABLE_SECURE_RENEGOTIATION
session_ptr -> nx_secure_tls_secure_renegotiation = NX_FALSE;
NX_SECURE_MEMSET(session_ptr -> nx_secure_tls_remote_verify_data, 0, NX_SECURE_TLS_FINISHED_HASH_SIZE);
NX_SECURE_MEMSET(session_ptr -> nx_secure_tls_local_verify_data, 0, NX_SECURE_TLS_FINISHED_HASH_SIZE);
session_ptr -> nx_secure_tls_renegotiation_handshake = NX_FALSE;
session_ptr -> nx_secure_tls_secure_renegotiation_verified = NX_FALSE;
session_ptr -> nx_secure_tls_server_renegotiation_requested = NX_FALSE;/* ... */
#endif
session_ptr -> nx_secure_tls_received_remote_credentials = NX_FALSE;
#ifndef NX_SECURE_TLS_SERVER_DISABLED
session_ptr -> nx_secure_tls_server_state = NX_SECURE_TLS_SERVER_STATE_IDLE;/* ... */
#endif
#ifndef NX_SECURE_TLS_CLIENT_DISABLED
session_ptr -> nx_secure_tls_client_state = NX_SECURE_TLS_CLIENT_STATE_IDLE;/* ... */
#endif
session_ptr -> nx_secure_tls_key_material.nx_secure_tls_handshake_cache_length = 0;
#if (NX_SECURE_TLS_TLS_1_3_ENABLED)
session_ptr -> nx_secure_tls_1_3 = session_ptr -> nx_secure_tls_1_3_supported;/* ... */
#endif
tx_mutex_put(&_nx_secure_tls_protection);
return(status);
}{ ... }