Add configuration options to enable CMAC in mbedtls by default

pull/7171/head
Krzysztof Stachowiak 2018-06-06 13:22:53 +02:00 committed by adbridge
parent 4aa2bf6aec
commit 4b3f8d5869
3 changed files with 42 additions and 1 deletions

View File

@ -68,8 +68,9 @@ deploy: rsync
# Adjusting the default mbed TLS config file to mbed purposes # Adjusting the default mbed TLS config file to mbed purposes
./adjust-config.sh $(MBED_TLS_DIR)/scripts/config.pl $(TARGET_INC)/mbedtls/config.h ./adjust-config.sh $(MBED_TLS_DIR)/scripts/config.pl $(TARGET_INC)/mbedtls/config.h
# #
# Copy the trimmed config that does not require entropy source # Copy and adjust the trimmed config that does not require entropy source
cp $(MBED_TLS_DIR)/configs/config-no-entropy.h $(TARGET_INC)/mbedtls/. cp $(MBED_TLS_DIR)/configs/config-no-entropy.h $(TARGET_INC)/mbedtls/.
./adjust-no-entropy-config.sh $(MBED_TLS_DIR)/scripts/config.pl $(TARGET_INC)/mbedtls/config-no-entropy.h
deploy-tests: deploy deploy-tests: deploy
# #

View File

@ -112,6 +112,8 @@ conf unset MBEDTLS_RIPEMD160_C
conf unset MBEDTLS_SHA1_C conf unset MBEDTLS_SHA1_C
conf unset MBEDTLS_XTEA_C conf unset MBEDTLS_XTEA_C
conf set MBEDTLS_CMAC_C
conf set MBEDTLS_AES_ROM_TABLES conf set MBEDTLS_AES_ROM_TABLES
conf unset MBEDTLS_X509_RSASSA_PSS_SUPPORT conf unset MBEDTLS_X509_RSASSA_PSS_SUPPORT

View File

@ -0,0 +1,38 @@
#!/bin/sh
#
# This file is part of mbed TLS (https://tls.mbed.org)
#
# Copyright (c) 2015-2018, ARM Limited, All Rights Reserved
#
# Purpose
#
# Comments and uncomments #define lines in the given configuration header file
# to configure the file for use in mbed OS.
#
# Usage: adjust-config.sh [path to config script] [path to no-entropy config file]
#
set -eu
if [ $# -ne 2 ]; then
echo "Usage: $0 path/to/config.pl path/to/config.h" >&2
exit 1
fi
SCRIPT=$1
FILE=$2
conf() {
$SCRIPT -o -f $FILE $@
}
add_code() {
MATCH_PATTERN="$1"
shift
CODE=$(IFS=""; printf "%s" "$*")
perl -i -pe \
"s/$MATCH_PATTERN/$MATCH_PATTERN$CODE/igs" \
"$FILE"
}
conf set MBEDTLS_CMAC_C