Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
...
#define NX_SECURE_SOURCE_CODE
#include "nx_secure_dtls.h"
...
...
_nxe_secure_dtls_session_create(NX_SECURE_DTLS_SESSION *, const NX_SECURE_TLS_CRYPTO *, void *, ULONG, UCHAR *, UINT, UINT, UCHAR *, ULONG)
Files
loading (4/7)...
SourceVuSTM32 Libraries and Samplesnetxduonx_secure/src/nxe_secure_dtls_session_create.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ ... /**************************************************************************/ /**************************************************************************/ /** */ /** NetX Secure Component */ /** */ /** Datagram Transport Layer Security (DTLS) */ /** */... /**************************************************************************/ /**************************************************************************/ #define NX_SECURE_SOURCE_CODE /* Include necessary system files. */ #include "nx_secure_dtls.h" /* Bring in externs for caller checking code. */ NX_SECURE_CALLER_CHECKING_EXTERNS ... /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _nxe_secure_dtls_session_create PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* Timothy Stapko, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function checks for errors in the DTLS session create call. */ /* */ /* INPUT */ /* */ /* session_ptr DTLS session control block */ /* crypto_table Crypto table */ /* metadata_buffer Encryption metadata buffer */ /* metadata_size Encryption metadata size */ /* packet_reassembly_buffer DTLS reassembly buffer */ /* packet_reassembly_buffer_size Size of reassembly buffer */ /* certs_number Number of certs */ /* remote_certificate_buffer Remote certificate buffer */ /* remote_certificate_buffer_size Remote certificate buffer size*/ /* */ /* OUTPUT */ /* */ /* status Completion status */ /* */ /* CALLS */ /* */ /* _nx_secure_dtls_session_create Actual DTLS session create */ /* call */ /* */ /* CALLED BY */ /* */ /* Application Code */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Timothy Stapko Initial Version 6.0 */ /* 09-30-2020 Timothy Stapko Modified comment(s), */ /* resulting in version 6.1 */ /* */... /**************************************************************************/ UINT _nxe_secure_dtls_session_create(NX_SECURE_DTLS_SESSION *session_ptr, const NX_SECURE_TLS_CRYPTO *crypto_table, VOID *metadata_buffer, ULONG metadata_size, UCHAR *packet_reassembly_buffer, UINT packet_reassembly_buffer_size, UINT certs_number, UCHAR *remote_certificate_buffer, ULONG remote_certificate_buffer_size) { #ifdef NX_SECURE_ENABLE_DTLS UINT status; NX_SECURE_DTLS_SESSION *created_dtls_session; ULONG created_count; /* Check pointers. NOTE: Remote certificates number can be zero, so buffer can be NULL! */ if ((session_ptr == NX_NULL) || (crypto_table == NX_NULL) || (metadata_buffer == NX_NULL) || ((packet_reassembly_buffer == NX_NULL) && (packet_reassembly_buffer_size != 0))) { return(NX_PTR_ERROR); }if ((session_ptr == NX_NULL) || (crypto_table == NX_NULL) || (metadata_buffer == NX_NULL) || ((packet_reassembly_buffer == NX_NULL) && (packet_reassembly_buffer_size != 0))) { ... } /* Loop to check for the DTLS session already created. */ created_dtls_session = _nx_secure_dtls_created_ptr; created_count = _nx_secure_dtls_created_count; while (created_count--) { /* Is the new DTLS already created? */ if (session_ptr == created_dtls_session) { /* Duplicate DTLS session created, return an error! */ return(NX_PTR_ERROR); }if (session_ptr == created_dtls_session) { ... } /* Move to next entry. */ created_dtls_session = created_dtls_session -> nx_secure_dtls_created_next; }while (created_count--) { ... } status = _nx_secure_dtls_session_create(session_ptr, crypto_table, metadata_buffer, metadata_size, packet_reassembly_buffer, packet_reassembly_buffer_size, certs_number, remote_certificate_buffer, remote_certificate_buffer_size); /* Return completion status. */ return(status);/* ... */ #else NX_PARAMETER_NOT_USED(session_ptr); NX_PARAMETER_NOT_USED(crypto_table); NX_PARAMETER_NOT_USED(metadata_buffer); NX_PARAMETER_NOT_USED(metadata_size); NX_PARAMETER_NOT_USED(packet_reassembly_buffer); NX_PARAMETER_NOT_USED(packet_reassembly_buffer_size); NX_PARAMETER_NOT_USED(certs_number); NX_PARAMETER_NOT_USED(remote_certificate_buffer); NX_PARAMETER_NOT_USED(remote_certificate_buffer_size); return(NX_NOT_SUPPORTED);/* ... */ #endif /* NX_SECURE_ENABLE_DTLS */ }{ ... }
Details