blob: 8ed957147b4f5f4b6337098aa3d14b9070480537 [file] [log] [blame]
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +01001#!/bin/sh
Bence Szépkúti700ee442020-05-26 00:33:31 +02002#
Bence Szépkúti1e148272020-08-07 13:07:28 +02003# Copyright The Mbed TLS Contributors
Bence Szépkútic7da1fe2020-05-26 01:54:15 +02004# SPDX-License-Identifier: Apache-2.0
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010017
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +020018set -eu
19
20if [ -d include/mbedtls ]; then :; else
21 echo "$0: must be run from root" >&2
22 exit 1
23fi
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010024
Ronald Cronc4bc12e2021-04-13 12:41:34 +020025HEADERS=$( ls include/mbedtls/*.h include/psa/*.h tests/include/test/drivers/*.h | egrep -v 'compat-1\.3\.h' )
Manuel Pégourié-Gonnard65a6fa32020-07-09 09:52:17 +020026HEADERS="$HEADERS library/*.h"
Christoph M. Wintersteiger8a0f5bb2018-12-14 15:46:34 +000027HEADERS="$HEADERS 3rdparty/everest/include/everest/everest.h 3rdparty/everest/include/everest/x25519.h"
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010028
Gilles Peskine9d28c422020-02-26 19:00:46 +010029sed -n -e 's/.*#define \([a-zA-Z0-9_]*\).*/\1/p' $HEADERS \
30 | egrep -v '^(asm|inline|EMIT|_CRT_SECURE_NO_DEPRECATE)$|^MULADDC_' \
31 | sort -u > macros
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010032
John Durkop7b453132020-10-12 21:56:26 -070033# For include/mbedtls/config_psa.h need to ignore the MBEDTLS_xxx define
34# in that file since they may not be defined in include/psa/crypto_config.h
35# This line renames the potentially missing defines to ones that should
36# be present.
37sed -ne 's/^MBEDTLS_PSA_BUILTIN_/MBEDTLS_PSA_ACCEL_/p' <macros >>macros
38
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010039wc -l macros