1 /* Automatically generated by generate_ssl_debug_helpers.py. DO NOT EDIT. */
2
3 /**
4 * \file ssl_debug_helpers_generated.c
5 *
6 * \brief Automatically generated helper functions for debugging
7 */
8 /*
9 * Copyright The Mbed TLS Contributors
10 * SPDX-License-Identifier: Apache-2.0
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License"); you may
13 * not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 */
24
25 #include "common.h"
26
27 #if defined(MBEDTLS_DEBUG_C)
28
29 #include "ssl_debug_helpers.h"
30
31
mbedtls_ssl_named_group_to_str(uint16_t in)32 const char *mbedtls_ssl_named_group_to_str( uint16_t in )
33 {
34 switch( in )
35 {
36 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP192K1:
37 return "secp192k1";
38 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP192R1:
39 return "secp192r1";
40 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP224K1:
41 return "secp224k1";
42 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP224R1:
43 return "secp224r1";
44 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP256K1:
45 return "secp256k1";
46 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP256R1:
47 return "secp256r1";
48 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP384R1:
49 return "secp384r1";
50 case MBEDTLS_SSL_IANA_TLS_GROUP_SECP521R1:
51 return "secp521r1";
52 case MBEDTLS_SSL_IANA_TLS_GROUP_BP256R1:
53 return "bp256r1";
54 case MBEDTLS_SSL_IANA_TLS_GROUP_BP384R1:
55 return "bp384r1";
56 case MBEDTLS_SSL_IANA_TLS_GROUP_BP512R1:
57 return "bp512r1";
58 case MBEDTLS_SSL_IANA_TLS_GROUP_X25519:
59 return "x25519";
60 case MBEDTLS_SSL_IANA_TLS_GROUP_X448:
61 return "x448";
62 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE2048:
63 return "ffdhe2048";
64 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE3072:
65 return "ffdhe3072";
66 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE4096:
67 return "ffdhe4096";
68 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE6144:
69 return "ffdhe6144";
70 case MBEDTLS_SSL_IANA_TLS_GROUP_FFDHE8192:
71 return "ffdhe8192";
72 };
73
74 return "UNKOWN";
75 }
mbedtls_ssl_sig_alg_to_str(uint16_t in)76 const char *mbedtls_ssl_sig_alg_to_str( uint16_t in )
77 {
78 switch( in )
79 {
80 case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA256:
81 return "rsa_pkcs1_sha256";
82 case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA384:
83 return "rsa_pkcs1_sha384";
84 case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA512:
85 return "rsa_pkcs1_sha512";
86 case MBEDTLS_TLS1_3_SIG_ECDSA_SECP256R1_SHA256:
87 return "ecdsa_secp256r1_sha256";
88 case MBEDTLS_TLS1_3_SIG_ECDSA_SECP384R1_SHA384:
89 return "ecdsa_secp384r1_sha384";
90 case MBEDTLS_TLS1_3_SIG_ECDSA_SECP521R1_SHA512:
91 return "ecdsa_secp521r1_sha512";
92 case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA256:
93 return "rsa_pss_rsae_sha256";
94 case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA384:
95 return "rsa_pss_rsae_sha384";
96 case MBEDTLS_TLS1_3_SIG_RSA_PSS_RSAE_SHA512:
97 return "rsa_pss_rsae_sha512";
98 case MBEDTLS_TLS1_3_SIG_ED25519:
99 return "ed25519";
100 case MBEDTLS_TLS1_3_SIG_ED448:
101 return "ed448";
102 case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA256:
103 return "rsa_pss_pss_sha256";
104 case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA384:
105 return "rsa_pss_pss_sha384";
106 case MBEDTLS_TLS1_3_SIG_RSA_PSS_PSS_SHA512:
107 return "rsa_pss_pss_sha512";
108 case MBEDTLS_TLS1_3_SIG_RSA_PKCS1_SHA1:
109 return "rsa_pkcs1_sha1";
110 case MBEDTLS_TLS1_3_SIG_ECDSA_SHA1:
111 return "ecdsa_sha1";
112 case MBEDTLS_TLS1_3_SIG_NONE:
113 return "none";
114 };
115
116 return "UNKNOWN";
117 }
mbedtls_ssl_states_str(mbedtls_ssl_states in)118 const char *mbedtls_ssl_states_str( mbedtls_ssl_states in )
119 {
120 const char * in_to_str[]=
121 {
122 [MBEDTLS_SSL_HELLO_REQUEST] = "MBEDTLS_SSL_HELLO_REQUEST",
123 [MBEDTLS_SSL_CLIENT_HELLO] = "MBEDTLS_SSL_CLIENT_HELLO",
124 [MBEDTLS_SSL_SERVER_HELLO] = "MBEDTLS_SSL_SERVER_HELLO",
125 [MBEDTLS_SSL_SERVER_CERTIFICATE] = "MBEDTLS_SSL_SERVER_CERTIFICATE",
126 [MBEDTLS_SSL_SERVER_KEY_EXCHANGE] = "MBEDTLS_SSL_SERVER_KEY_EXCHANGE",
127 [MBEDTLS_SSL_CERTIFICATE_REQUEST] = "MBEDTLS_SSL_CERTIFICATE_REQUEST",
128 [MBEDTLS_SSL_SERVER_HELLO_DONE] = "MBEDTLS_SSL_SERVER_HELLO_DONE",
129 [MBEDTLS_SSL_CLIENT_CERTIFICATE] = "MBEDTLS_SSL_CLIENT_CERTIFICATE",
130 [MBEDTLS_SSL_CLIENT_KEY_EXCHANGE] = "MBEDTLS_SSL_CLIENT_KEY_EXCHANGE",
131 [MBEDTLS_SSL_CERTIFICATE_VERIFY] = "MBEDTLS_SSL_CERTIFICATE_VERIFY",
132 [MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC] = "MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC",
133 [MBEDTLS_SSL_CLIENT_FINISHED] = "MBEDTLS_SSL_CLIENT_FINISHED",
134 [MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC] = "MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC",
135 [MBEDTLS_SSL_SERVER_FINISHED] = "MBEDTLS_SSL_SERVER_FINISHED",
136 [MBEDTLS_SSL_FLUSH_BUFFERS] = "MBEDTLS_SSL_FLUSH_BUFFERS",
137 [MBEDTLS_SSL_HANDSHAKE_WRAPUP] = "MBEDTLS_SSL_HANDSHAKE_WRAPUP",
138 [MBEDTLS_SSL_NEW_SESSION_TICKET] = "MBEDTLS_SSL_NEW_SESSION_TICKET",
139 [MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT] = "MBEDTLS_SSL_SERVER_HELLO_VERIFY_REQUEST_SENT",
140 [MBEDTLS_SSL_HELLO_RETRY_REQUEST] = "MBEDTLS_SSL_HELLO_RETRY_REQUEST",
141 [MBEDTLS_SSL_ENCRYPTED_EXTENSIONS] = "MBEDTLS_SSL_ENCRYPTED_EXTENSIONS",
142 [MBEDTLS_SSL_END_OF_EARLY_DATA] = "MBEDTLS_SSL_END_OF_EARLY_DATA",
143 [MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY] = "MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY",
144 [MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED] = "MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED",
145 [MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO] = "MBEDTLS_SSL_CLIENT_CCS_BEFORE_2ND_CLIENT_HELLO",
146 [MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO] = "MBEDTLS_SSL_SERVER_CCS_AFTER_SERVER_HELLO",
147 [MBEDTLS_SSL_CLIENT_CCS_AFTER_CLIENT_HELLO] = "MBEDTLS_SSL_CLIENT_CCS_AFTER_CLIENT_HELLO",
148 [MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST] = "MBEDTLS_SSL_SERVER_CCS_AFTER_HELLO_RETRY_REQUEST",
149 [MBEDTLS_SSL_HANDSHAKE_OVER] = "MBEDTLS_SSL_HANDSHAKE_OVER",
150 [MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET] = "MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET",
151 [MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH] = "MBEDTLS_SSL_TLS1_3_NEW_SESSION_TICKET_FLUSH",
152 };
153
154 if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
155 in_to_str[ in ] == NULL )
156 {
157 return "UNKNOWN_VALUE";
158 }
159 return in_to_str[ in ];
160 }
161
mbedtls_ssl_protocol_version_str(mbedtls_ssl_protocol_version in)162 const char *mbedtls_ssl_protocol_version_str( mbedtls_ssl_protocol_version in )
163 {
164 const char * in_to_str[]=
165 {
166 [MBEDTLS_SSL_VERSION_UNKNOWN] = "MBEDTLS_SSL_VERSION_UNKNOWN",
167 [MBEDTLS_SSL_VERSION_TLS1_2] = "MBEDTLS_SSL_VERSION_TLS1_2",
168 [MBEDTLS_SSL_VERSION_TLS1_3] = "MBEDTLS_SSL_VERSION_TLS1_3",
169 };
170
171 if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
172 in_to_str[ in ] == NULL )
173 {
174 return "UNKNOWN_VALUE";
175 }
176 return in_to_str[ in ];
177 }
178
mbedtls_tls_prf_types_str(mbedtls_tls_prf_types in)179 const char *mbedtls_tls_prf_types_str( mbedtls_tls_prf_types in )
180 {
181 const char * in_to_str[]=
182 {
183 [MBEDTLS_SSL_TLS_PRF_NONE] = "MBEDTLS_SSL_TLS_PRF_NONE",
184 [MBEDTLS_SSL_TLS_PRF_SHA384] = "MBEDTLS_SSL_TLS_PRF_SHA384",
185 [MBEDTLS_SSL_TLS_PRF_SHA256] = "MBEDTLS_SSL_TLS_PRF_SHA256",
186 [MBEDTLS_SSL_HKDF_EXPAND_SHA384] = "MBEDTLS_SSL_HKDF_EXPAND_SHA384",
187 [MBEDTLS_SSL_HKDF_EXPAND_SHA256] = "MBEDTLS_SSL_HKDF_EXPAND_SHA256",
188 };
189
190 if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
191 in_to_str[ in ] == NULL )
192 {
193 return "UNKNOWN_VALUE";
194 }
195 return in_to_str[ in ];
196 }
197
mbedtls_ssl_key_export_type_str(mbedtls_ssl_key_export_type in)198 const char *mbedtls_ssl_key_export_type_str( mbedtls_ssl_key_export_type in )
199 {
200 const char * in_to_str[]=
201 {
202 [MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET",
203 #if defined(MBEDTLS_SSL_PROTO_TLS1_3)
204 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_EARLY_SECRET",
205 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_EARLY_EXPORTER_SECRET",
206 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_HANDSHAKE_TRAFFIC_SECRET",
207 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_HANDSHAKE_TRAFFIC_SECRET",
208 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_CLIENT_APPLICATION_TRAFFIC_SECRET",
209 [MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET] = "MBEDTLS_SSL_KEY_EXPORT_TLS1_3_SERVER_APPLICATION_TRAFFIC_SECRET",
210 #endif
211 };
212
213 if( in > ( sizeof( in_to_str )/sizeof( in_to_str[0]) - 1 ) ||
214 in_to_str[ in ] == NULL )
215 {
216 return "UNKNOWN_VALUE";
217 }
218 return in_to_str[ in ];
219 }
220
221
222
223 #endif /* MBEDTLS_DEBUG_C */
224 /* End of automatically generated file. */
225
226