1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** NetX Secure Component */ 17 /** */ 18 /** Datagram Transport Layer Security (DTLS) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 #define NX_SECURE_SOURCE_CODE 24 25 #include "nx_secure_dtls.h" 26 27 /**************************************************************************/ 28 /* */ 29 /* FUNCTION RELEASE */ 30 /* */ 31 /* _nx_secure_dtls_server_x509_client_verify_disable PORTABLE C */ 32 /* 6.1 */ 33 /* AUTHOR */ 34 /* */ 35 /* Timothy Stapko, Microsoft Corporation */ 36 /* */ 37 /* DESCRIPTION */ 38 /* */ 39 /* This function disables X.509 Client certificate verification and */ 40 /* authentication for a DTLS server instance. */ 41 /* */ 42 /* INPUT */ 43 /* */ 44 /* server_ptr DTLS server control block */ 45 /* */ 46 /* OUTPUT */ 47 /* */ 48 /* status Completion status */ 49 /* */ 50 /* CALLS */ 51 /* */ 52 /* _nx_secure_tls_session_client_verify_disable */ 53 /* Configure individual session */ 54 /* */ 55 /* CALLED BY */ 56 /* */ 57 /* Application Code */ 58 /* */ 59 /* RELEASE HISTORY */ 60 /* */ 61 /* DATE NAME DESCRIPTION */ 62 /* */ 63 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */ 64 /* 09-30-2020 Timothy Stapko Modified comment(s), */ 65 /* resulting in version 6.1 */ 66 /* */ 67 /**************************************************************************/ _nx_secure_dtls_server_x509_client_verify_disable(NX_SECURE_DTLS_SERVER * server_ptr)68UINT _nx_secure_dtls_server_x509_client_verify_disable(NX_SECURE_DTLS_SERVER *server_ptr) 69 { 70 #ifdef NX_SECURE_ENABLE_DTLS 71 UINT status; 72 UINT i; 73 NX_SECURE_DTLS_SESSION *current_session; 74 NX_SECURE_TLS_SESSION *tls_session; 75 UINT num_sessions; 76 77 78 /* Figure out number of sessions. */ 79 num_sessions = server_ptr->nx_dtls_server_sessions_count; 80 81 /* Disable check for all sessions. */ 82 for(i = 0; i < num_sessions; ++i) 83 { 84 /* Get the current session. */ 85 current_session = &(server_ptr->nx_dtls_server_sessions[i]); 86 87 /* Get the internal TLS session instance. */ 88 tls_session = &(current_session -> nx_secure_dtls_tls_session); 89 90 /* Disable client verification for this session. */ 91 status = _nx_secure_tls_session_client_verify_disable(tls_session); 92 93 if(status != NX_SUCCESS) 94 { 95 return(status); 96 } 97 } 98 99 return(NX_SUCCESS); 100 #else 101 NX_PARAMETER_NOT_USED(server_ptr); 102 103 return(NX_NOT_SUPPORTED); 104 #endif /* NX_SECURE_ENABLE_DTLS */ 105 } 106 107