mbedtls/tests/data_files/test_certs.h.jinja2

55 lines
1.8 KiB
Text
Raw Normal View History

/*
* X.509 test certificates
*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* 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 %}