1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** NetX Secure Component                                                 */
16 /**                                                                       */
17 /**    Datagram Transport Layer Security (DTLS)                           */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define NX_SECURE_SOURCE_CODE
23 
24 #include "nx_secure_dtls.h"
25 
26 /**************************************************************************/
27 /*                                                                        */
28 /*  FUNCTION                                               RELEASE        */
29 /*                                                                        */
30 /*    _nxe_secure_dtls_server_trusted_certificate_remove  PORTABLE C      */
31 /*                                                           6.1          */
32 /*  AUTHOR                                                                */
33 /*                                                                        */
34 /*    Timothy Stapko, Microsoft Corporation                               */
35 /*                                                                        */
36 /*  DESCRIPTION                                                           */
37 /*                                                                        */
38 /*    This function checks for errors when removing a trusted certificate */
39 /*    from a DTLS server.                                                 */
40 /*                                                                        */
41 /*  INPUT                                                                 */
42 /*                                                                        */
43 /*    server_ptr                            DTLS server control block     */
44 /*    common_name                           Common name of certificate    */
45 /*    common_name_length                    Length of common name         */
46 /*    cert_id                               Numeric id of certificate     */
47 /*                                                                        */
48 /*  OUTPUT                                                                */
49 /*                                                                        */
50 /*    status                                Completion status             */
51 /*                                                                        */
52 /*  CALLS                                                                 */
53 /*                                                                        */
54 /*    _nx_secure_dtls_server_trusted_certificate_remove                   */
55 /*                                          Actual function call          */
56 /*                                                                        */
57 /*  CALLED BY                                                             */
58 /*                                                                        */
59 /*    Application Code                                                    */
60 /*                                                                        */
61 /*  RELEASE HISTORY                                                       */
62 /*                                                                        */
63 /*    DATE              NAME                      DESCRIPTION             */
64 /*                                                                        */
65 /*  05-19-2020     Timothy Stapko           Initial Version 6.0           */
66 /*  09-30-2020     Timothy Stapko           Modified comment(s),          */
67 /*                                            resulting in version 6.1    */
68 /*                                                                        */
69 /**************************************************************************/
_nxe_secure_dtls_server_trusted_certificate_remove(NX_SECURE_DTLS_SERVER * server_ptr,UCHAR * common_name,UINT common_name_length,UINT cert_id)70 UINT _nxe_secure_dtls_server_trusted_certificate_remove(NX_SECURE_DTLS_SERVER *server_ptr,
71                                                         UCHAR *common_name, UINT common_name_length, UINT cert_id)
72 {
73 #ifdef NX_SECURE_ENABLE_DTLS
74 UINT status;
75 
76     if(server_ptr == NX_NULL || common_name == NX_NULL || common_name_length == NX_NULL)
77     {
78         return(NX_PTR_ERROR);
79     }
80 
81     /* Call the actual function. */
82     status = _nx_secure_dtls_server_trusted_certificate_remove(server_ptr, common_name, common_name_length, cert_id);
83 
84     return(status);
85 #else
86     NX_PARAMETER_NOT_USED(server_ptr);
87     NX_PARAMETER_NOT_USED(common_name);
88     NX_PARAMETER_NOT_USED(common_name_length);
89     NX_PARAMETER_NOT_USED(cert_id);
90 
91     return(NX_NOT_SUPPORTED);
92 #endif /* NX_SECURE_ENABLE_DTLS */
93 }
94 
95