1 /**
2  * \file ssl_debug_helpers.h
3  *
4  * \brief Automatically generated helper functions for debugging
5  */
6 /*
7  *  Copyright The Mbed TLS Contributors
8  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9  */
10 
11 #ifndef MBEDTLS_SSL_DEBUG_HELPERS_H
12 #define MBEDTLS_SSL_DEBUG_HELPERS_H
13 
14 #include "common.h"
15 
16 #if defined(MBEDTLS_DEBUG_C)
17 
18 #include "mbedtls/ssl.h"
19 #include "ssl_misc.h"
20 
21 
22 const char *mbedtls_ssl_states_str(mbedtls_ssl_states in);
23 
24 #if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_CLI_C)
25 const char *mbedtls_ssl_early_data_status_str(mbedtls_ssl_early_data_status in);
26 const char *mbedtls_ssl_early_data_state_str(mbedtls_ssl_early_data_state in);
27 #endif
28 
29 const char *mbedtls_ssl_protocol_version_str(mbedtls_ssl_protocol_version in);
30 
31 const char *mbedtls_tls_prf_types_str(mbedtls_tls_prf_types in);
32 
33 const char *mbedtls_ssl_key_export_type_str(mbedtls_ssl_key_export_type in);
34 
35 const char *mbedtls_ssl_sig_alg_to_str(uint16_t in);
36 
37 const char *mbedtls_ssl_named_group_to_str(uint16_t in);
38 
39 const char *mbedtls_ssl_get_extension_name(unsigned int extension_type);
40 
41 void mbedtls_ssl_print_extensions(const mbedtls_ssl_context *ssl,
42                                   int level, const char *file, int line,
43                                   int hs_msg_type, uint32_t extensions_mask,
44                                   const char *extra);
45 
46 void mbedtls_ssl_print_extension(const mbedtls_ssl_context *ssl,
47                                  int level, const char *file, int line,
48                                  int hs_msg_type, unsigned int extension_type,
49                                  const char *extra_msg0, const char *extra_msg1);
50 
51 #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
52 void mbedtls_ssl_print_ticket_flags(const mbedtls_ssl_context *ssl,
53                                     int level, const char *file, int line,
54                                     unsigned int flags);
55 #endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */
56 
57 #define MBEDTLS_SSL_PRINT_EXTS(level, hs_msg_type, extensions_mask)            \
58     mbedtls_ssl_print_extensions(ssl, level, __FILE__, __LINE__,       \
59                                  hs_msg_type, extensions_mask, NULL)
60 
61 #define MBEDTLS_SSL_PRINT_EXT(level, hs_msg_type, extension_type, extra)      \
62     mbedtls_ssl_print_extension(ssl, level, __FILE__, __LINE__,        \
63                                 hs_msg_type, extension_type,           \
64                                 extra, NULL)
65 
66 #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
67 #define MBEDTLS_SSL_PRINT_TICKET_FLAGS(level, flags)             \
68     mbedtls_ssl_print_ticket_flags(ssl, level, __FILE__, __LINE__, flags)
69 #endif
70 
71 #else
72 
73 #define MBEDTLS_SSL_PRINT_EXTS(level, hs_msg_type, extension_mask)
74 
75 #define MBEDTLS_SSL_PRINT_EXT(level, hs_msg_type, extension_type, extra)
76 
77 #if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
78 #define MBEDTLS_SSL_PRINT_TICKET_FLAGS(level, flags)
79 #endif
80 
81 #endif /* MBEDTLS_DEBUG_C */
82 
83 #endif /* MBEDTLS_SSL_DEBUG_HELPERS_H */
84