Skip to content

Commit fd6f3cd

Browse files
author
Cruz Monrreal
authored
Merge pull request #7144 from k-stachowiak/add-cmac-to-mbedtls
Add configuration options to enable CMAC in mbedtls by default
2 parents d216602 + 8c9a967 commit fd6f3cd

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

features/mbedtls/importer/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ deploy: rsync
6868
# Adjusting the default mbed TLS config file to mbed purposes
6969
./adjust-config.sh $(MBED_TLS_DIR)/scripts/config.pl $(TARGET_INC)/mbedtls/config.h
7070
#
71-
# Copy the trimmed config that does not require entropy source
71+
# Copy and adjust the trimmed config that does not require entropy source
7272
cp $(MBED_TLS_DIR)/configs/config-no-entropy.h $(TARGET_INC)/mbedtls/.
73+
./adjust-no-entropy-config.sh $(MBED_TLS_DIR)/scripts/config.pl $(TARGET_INC)/mbedtls/config-no-entropy.h
7374

7475
deploy-tests: deploy
7576
#

features/mbedtls/importer/adjust-config.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ conf unset MBEDTLS_RIPEMD160_C
112112
conf unset MBEDTLS_SHA1_C
113113
conf unset MBEDTLS_XTEA_C
114114

115+
conf set MBEDTLS_CMAC_C
116+
115117
conf set MBEDTLS_AES_ROM_TABLES
116118

117119
conf unset MBEDTLS_X509_RSASSA_PSS_SUPPORT
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
#
3+
# This file is part of mbed TLS (https://tls.mbed.org)
4+
#
5+
# Copyright (c) 2018, ARM Limited, All Rights Reserved
6+
#
7+
# Purpose
8+
#
9+
# Comments and uncomments #define lines in the given configuration header file
10+
# to configure the file for use in mbed OS.
11+
#
12+
# Usage: adjust-no-entropy-config.sh [path to config script] [path to no-entropy config file]
13+
#
14+
set -eu
15+
16+
if [ $# -ne 2 ]; then
17+
echo "Usage: $0 path/to/config.pl path/to/config.h" >&2
18+
exit 1
19+
fi
20+
21+
SCRIPT=$1
22+
FILE=$2
23+
24+
conf() {
25+
$SCRIPT -o -f $FILE $@
26+
}
27+
28+
add_code() {
29+
MATCH_PATTERN="$1"
30+
shift
31+
CODE=$(IFS=""; printf "%s" "$*")
32+
33+
perl -i -pe \
34+
"s/$MATCH_PATTERN/$MATCH_PATTERN$CODE/igs" \
35+
"$FILE"
36+
}
37+
38+
conf set MBEDTLS_CMAC_C

0 commit comments

Comments
 (0)