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 /**    Transport Layer Security (TLS)                                     */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define NX_SECURE_SOURCE_CODE
24 
25 #include "nx_secure_tls.h"
26 
27 
28 /**************************************************************************/
29 /*                                                                        */
30 /*  FUNCTION                                               RELEASE        */
31 /*                                                                        */
32 /*    _nx_secure_tls_send_hellorequest                    PORTABLE C      */
33 /*                                                           6.1          */
34 /*  AUTHOR                                                                */
35 /*                                                                        */
36 /*    Timothy Stapko, Microsoft Corporation                               */
37 /*                                                                        */
38 /*  DESCRIPTION                                                           */
39 /*                                                                        */
40 /*    This function generates a HelloRequest message, which is used by a  */
41 /*    TLS server to indicate to the remote TLS client host that it wishes */
42 /*    to perform a re-negotiation handshake. The client should respond    */
43 /*    with a ClientHello as long as the active TLS session is valid.      */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    tls_session                           TLS control block             */
48 /*    send_packet                           Packet used to send message   */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    status                                Completion status             */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    None                                                                */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    _nx_secure_tls_session_renegotiate    Renegotiate TLS session       */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  05-19-2020     Timothy Stapko           Initial Version 6.0           */
67 /*  09-30-2020     Timothy Stapko           Modified comment(s),          */
68 /*                                            fixed renegotiation bug,    */
69 /*                                            resulting in version 6.1    */
70 /*                                                                        */
71 /**************************************************************************/
72 #ifndef NX_SECURE_TLS_DISABLE_SECURE_RENEGOTIATION
_nx_secure_tls_send_hellorequest(NX_SECURE_TLS_SESSION * tls_session,NX_PACKET * send_packet)73 UINT _nx_secure_tls_send_hellorequest(NX_SECURE_TLS_SESSION *tls_session, NX_PACKET *send_packet)
74 {
75     NX_PARAMETER_NOT_USED(tls_session);
76     NX_PARAMETER_NOT_USED(send_packet);
77 
78 #ifndef NX_SECURE_TLS_SERVER_DISABLED
79     /* Indicate that we have initiated a renegotiation by sending a HelloRequest to the remote client. */
80     tls_session -> nx_secure_tls_server_state = NX_SECURE_TLS_SERVER_STATE_HELLO_REQUEST;
81 #endif
82 
83     return(NX_SECURE_TLS_SUCCESS);
84 }
85 #endif /* NX_SECURE_TLS_DISABLE_SECURE_RENEGOTIATION */
86