mbedtls/tests/data_files/test_certs.h.jinja2

43 lines
1.3 KiB
Text
Raw Normal View History

/*
* X.509 test certificates
*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/* THIS FILE is generated by `tests/scripts/generate_test_cert_macros.py` */
/* *INDENT-OFF* */
{% for mode, name, value in macros %}
{% if mode == 'string' %}
/* This is taken from {{value}}. */
/* BEGIN FILE string macro {{name}} {{value}} */
#define {{name}}{{ '\\' | put_to_column(position=80-9-name|length)}}
{% for line in value | read_lines %}
"{{line}}\r\n"{% if not loop.last %}{{ '\\' | put_to_column(position=80-10-1-line|length)}}
{% endif %}
{% endfor %}
/* END FILE */
{% endif %}
{% if mode == 'binary' %}
/* This is generated from {{value}}. */
/* BEGIN FILE binary macro {{name}} {{value}} */
#define {{name}} {% raw -%} { {%- endraw %} {{ '\\' | put_to_column(position=80-11-name|length)}}
{% for line in value | read_as_c_array %}
{% if not loop.last %}
{{line}},{{ '\\' | put_to_column(position=80-9-line|length)}}
{% else %}
{{line}}{{ '\\' | put_to_column(position=80-8-line|length)}}
{% endif %}
{% endfor %}
{% raw -%} } {%- endraw %}
/* END FILE */
{% endif %}
{% if mode == 'password' %}
#define {{name}} "{{value}}"
{% endif %}
{% endfor %}