@@ -232,46 +232,43 @@ def generate_tranlation_function(self):
232232 body = body .format (translation_table = '\n ' .join (translation_table ),
233233 name = self ._name ,
234234 prototype = self ._prototype )
235- prototype = 'const char *{name}_str( {prototype} in );\n '
236- prototype = prototype .format (name = self ._name ,
237- prototype = self ._prototype )
238- return body , prototype
235+ return body
239236
240237
241238OUTPUT_C_TEMPLATE = '''\
242239 /* Automatically generated by generate_ssl_debug_helpers.py. DO NOT EDIT. */
243240
244- #include "common.h"
245-
246- #if defined(MBEDTLS_DEBUG_C)
247-
248- #include "ssl_debug_helpers_generated.h"
249-
250- {functions}
251-
252- #endif /* MBEDTLS_DEBUG_C */
253- /* End of automatically generated file. */
254-
255- '''
256-
257- OUTPUT_H_TEMPLATE = '''\
258- /* Automatically generated by generate_ssl_debug_helpers.py. DO NOT EDIT. */
259- #ifndef MBEDTLS_SSL_DEBUG_HELPERS_H
260- #define MBEDTLS_SSL_DEBUG_HELPERS_H
241+ /**
242+ * \f ile ssl_debug_helpers_generated.c
243+ *
244+ * \b rief Automatically generated helper functions for debugging
245+ */
246+ /*
247+ * Copyright The Mbed TLS Contributors
248+ * SPDX-License-Identifier: Apache-2.0
249+ *
250+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
251+ * not use this file except in compliance with the License.
252+ * You may obtain a copy of the License at
253+ *
254+ * http://www.apache.org/licenses/LICENSE-2.0
255+ *
256+ * Unless required by applicable law or agreed to in writing, software
257+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
258+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
259+ * See the License for the specific language governing permissions and
260+ * limitations under the License.
261+ */
261262
262263#include "common.h"
263264
264265#if defined(MBEDTLS_DEBUG_C)
265266
266- #include "mbedtls/ssl.h"
267- #include "ssl_misc.h"
267+ #include "ssl_debug_helpers.h"
268268
269269{functions}
270270
271271#endif /* MBEDTLS_DEBUG_C */
272-
273- #endif /* SSL_DEBUG_HELPERS_H */
274-
275272/* End of automatically generated file. */
276273
277274'''
@@ -286,34 +283,24 @@ def generate_ssl_debug_helpers(output_directory, mbedtls_root):
286283 source_code = remove_c_comments (f .read ())
287284
288285 definitions = dict ()
289- prototypes = dict ()
290286 for start , instance in preprocess_c_source_code (source_code , EnumDefinition ):
291287 if start in definitions :
292288 continue
293289 if isinstance (instance , EnumDefinition ):
294- definition , prototype = instance .generate_tranlation_function ()
290+ definition = instance .generate_tranlation_function ()
295291 else :
296292 definition = instance
297- prototype = instance
298293 definitions [start ] = definition
299- prototypes [start ] = prototype
300294
301295 function_definitions = [str (v ) for _ , v in sorted (definitions .items ())]
302- function_prototypes = [str (v ) for _ , v in sorted (prototypes .items ())]
303296 if output_directory == sys .stdout :
304- sys .stdout .write (OUTPUT_H_TEMPLATE .format (
305- functions = '\n ' .join (function_prototypes )))
306297 sys .stdout .write (OUTPUT_C_TEMPLATE .format (
307298 functions = '\n ' .join (function_definitions )))
308299 else :
309300 with open (os .path .join (output_directory , 'ssl_debug_helpers_generated.c' ), 'w' ) as f :
310301 f .write (OUTPUT_C_TEMPLATE .format (
311302 functions = '\n ' .join (function_definitions )))
312303
313- with open (os .path .join (output_directory , 'ssl_debug_helpers_generated.h' ), 'w' ) as f :
314- f .write (OUTPUT_H_TEMPLATE .format (
315- functions = '\n ' .join (function_prototypes )))
316-
317304
318305def main ():
319306 """
0 commit comments