Gilles Peskine | 863b96a | 2021-12-16 10:04:58 +0100 | [diff] [blame] | 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 |
| 9 | * |
| 10 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 11 | * not use this file except in compliance with the License. |
| 12 | * You may obtain a copy of the License at |
| 13 | * |
| 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | * |
| 16 | * Unless required by applicable law or agreed to in writing, software |
| 17 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 18 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | * See the License for the specific language governing permissions and |
| 20 | * limitations under the License. |
| 21 | */ |
| 22 | |
Gilles Peskine | 09f1ee6 | 2021-12-15 12:53:34 +0100 | [diff] [blame] | 23 | #ifndef MBEDTLS_SSL_DEBUG_HELPERS_H |
| 24 | #define MBEDTLS_SSL_DEBUG_HELPERS_H |
| 25 | |
| 26 | #include "common.h" |
| 27 | |
| 28 | #if defined(MBEDTLS_DEBUG_C) |
| 29 | |
| 30 | #include "mbedtls/ssl.h" |
| 31 | #include "ssl_misc.h" |
| 32 | |
| 33 | |
| 34 | const char *mbedtls_ssl_states_str( mbedtls_ssl_states in ); |
| 35 | |
Gilles Peskine | 66971f8 | 2022-01-13 13:46:05 +0100 | [diff] [blame] | 36 | const char *mbedtls_ssl_protocol_version_str( mbedtls_ssl_protocol_version in ); |
| 37 | |
Gilles Peskine | 09f1ee6 | 2021-12-15 12:53:34 +0100 | [diff] [blame] | 38 | const char *mbedtls_tls_prf_types_str( mbedtls_tls_prf_types in ); |
| 39 | |
| 40 | const char *mbedtls_ssl_key_export_type_str( mbedtls_ssl_key_export_type in ); |
| 41 | |
Jerry Yu | bfcfe74 | 2022-02-22 16:41:39 +0800 | [diff] [blame] | 42 | const char *mbedtls_ssl_sig_alg_to_str( uint16_t in ); |
Gilles Peskine | 09f1ee6 | 2021-12-15 12:53:34 +0100 | [diff] [blame] | 43 | |
Jerry Yu | fe24d1c | 2022-04-11 21:04:47 +0800 | [diff] [blame] | 44 | const char *mbedtls_ssl_named_group_to_str( uint16_t in ); |
| 45 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 46 | const char *mbedtls_ssl_get_extension_name( unsigned int extension_type ); |
Gilles Peskine | 09f1ee6 | 2021-12-15 12:53:34 +0100 | [diff] [blame] | 47 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 48 | void mbedtls_ssl_print_extensions( const mbedtls_ssl_context *ssl, |
| 49 | int level, const char *file, int line, |
| 50 | int hs_msg_type, uint32_t extensions_mask, |
| 51 | const char *extra ); |
Jerry Yu | 471dee5 | 2022-08-04 16:33:14 +0800 | [diff] [blame] | 52 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 53 | void mbedtls_ssl_print_extension_type( const mbedtls_ssl_context *ssl, |
| 54 | int level, const char *file, int line, |
| 55 | int hs_msg_type, |
| 56 | unsigned int extension_type, |
| 57 | const char *extra_msg0, |
| 58 | const char *extra_msg1 ); |
Jerry Yu | 471dee5 | 2022-08-04 16:33:14 +0800 | [diff] [blame] | 59 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 60 | #define MBEDTLS_SSL_PRINT_SENT_EXTS( level, hs_msg_type ) \ |
| 61 | mbedtls_ssl_print_extensions( ssl, level, __FILE__, __LINE__, \ |
| 62 | hs_msg_type, \ |
| 63 | ssl->handshake->sent_extensions, \ |
| 64 | "sent" ) |
Jerry Yu | 471dee5 | 2022-08-04 16:33:14 +0800 | [diff] [blame] | 65 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 66 | #define MBEDTLS_SSL_PRINT_RECEIVED_EXTS( level, hs_msg_type ) \ |
| 67 | mbedtls_ssl_print_extensions( ssl, level, __FILE__, __LINE__, \ |
| 68 | hs_msg_type, \ |
| 69 | ssl->handshake->received_extensions, \ |
| 70 | "received" ) |
| 71 | |
| 72 | #define MBEDTLS_SSL_PRINT_EXT_TYPE( level, hs_msg_type, extension_type, extra ) \ |
| 73 | mbedtls_ssl_print_extension_type( ssl, level, __FILE__, __LINE__, \ |
| 74 | hs_msg_type, extension_type, extra, NULL ) |
Jerry Yu | 471dee5 | 2022-08-04 16:33:14 +0800 | [diff] [blame] | 75 | #else |
| 76 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 77 | #define MBEDTLS_SSL_PRINT_SENT_EXTS( level, hs_msg_type ) |
Jerry Yu | 471dee5 | 2022-08-04 16:33:14 +0800 | [diff] [blame] | 78 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 79 | #define MBEDTLS_SSL_PRINT_RECEIVED_EXTS( level, hs_msg_type ) |
Jerry Yu | 471dee5 | 2022-08-04 16:33:14 +0800 | [diff] [blame] | 80 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 81 | #define MBEDTLS_SSL_PRINT_EXT_TYPE( level, hs_msg_type, extension_type, extra ) |
Jerry Yu | 471dee5 | 2022-08-04 16:33:14 +0800 | [diff] [blame] | 82 | |
Jerry Yu | d25cab0 | 2022-10-31 12:48:30 +0800 | [diff] [blame] | 83 | #endif /* MBEDTLS_DEBUG_C */ |
| 84 | |
| 85 | #endif /* MBEDTLS_SSL_DEBUG_HELPERS_H */ |