mbed TLS upgraded to 2.6.0

Fork of mbedtls by Mark Radbourne

Committer:
Jasper Wallace
Date:
Fri Sep 29 19:50:30 2017 +0100
Revision:
2:bbdeda018a3c
Parent:
1:9ebc941037d5
Update to mbedtls 2.6.0, many changes.

Changes to mbedtls sources made:

in include/mbedtls/config.h comment out:

#define MBEDTLS_FS_IO
#define MBEDTLS_NET_C
#define MBEDTLS_TIMING_C

uncomment:

#define MBEDTLS_NO_PLATFORM_ENTROPY

remove the following directorys:

programs
yotta
visualc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jasper Wallace 1:9ebc941037d5 1 #!/bin/sh
Jasper Wallace 1:9ebc941037d5 2 #
Jasper Wallace 1:9ebc941037d5 3 # This file is part of mbed TLS (https://tls.mbed.org)
Jasper Wallace 1:9ebc941037d5 4 #
Jasper Wallace 1:9ebc941037d5 5 # Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
Jasper Wallace 1:9ebc941037d5 6 #
Jasper Wallace 1:9ebc941037d5 7 # Purpose
Jasper Wallace 1:9ebc941037d5 8 #
Jasper Wallace 1:9ebc941037d5 9 # This script determines ROM size (or code size) for the standard mbed TLS
Jasper Wallace 1:9ebc941037d5 10 # configurations, when built for a Cortex M3/M4 target.
Jasper Wallace 1:9ebc941037d5 11 #
Jasper Wallace 1:9ebc941037d5 12 # Configurations included:
Jasper Wallace 1:9ebc941037d5 13 # default include/mbedtls/config.h
Jasper Wallace 1:9ebc941037d5 14 # yotta yotta/module/mbedtls/config.h
Jasper Wallace 1:9ebc941037d5 15 # thread configs/config-thread.h
Jasper Wallace 1:9ebc941037d5 16 # suite-b configs/config-suite-b.h
Jasper Wallace 1:9ebc941037d5 17 # psk configs/config-ccm-psk-tls1_2.h
Jasper Wallace 1:9ebc941037d5 18 #
Jasper Wallace 1:9ebc941037d5 19 # Usage: footprint.sh
Jasper Wallace 1:9ebc941037d5 20 #
Jasper Wallace 1:9ebc941037d5 21 set -eu
Jasper Wallace 1:9ebc941037d5 22
Jasper Wallace 1:9ebc941037d5 23 CONFIG_H='include/mbedtls/config.h'
Jasper Wallace 1:9ebc941037d5 24
Jasper Wallace 1:9ebc941037d5 25 if [ -r $CONFIG_H ]; then :; else
Jasper Wallace 1:9ebc941037d5 26 echo "$CONFIG_H not found" >&2
Jasper Wallace 1:9ebc941037d5 27 echo "This script needs to be run from the root of" >&2
Jasper Wallace 1:9ebc941037d5 28 echo "a git checkout or uncompressed tarball" >&2
Jasper Wallace 1:9ebc941037d5 29 exit 1
Jasper Wallace 1:9ebc941037d5 30 fi
Jasper Wallace 1:9ebc941037d5 31
Jasper Wallace 1:9ebc941037d5 32 if grep -i cmake Makefile >/dev/null; then
Jasper Wallace 1:9ebc941037d5 33 echo "Not compatible with CMake" >&2
Jasper Wallace 1:9ebc941037d5 34 exit 1
Jasper Wallace 1:9ebc941037d5 35 fi
Jasper Wallace 1:9ebc941037d5 36
Jasper Wallace 1:9ebc941037d5 37 if which arm-none-eabi-gcc >/dev/null 2>&1; then :; else
Jasper Wallace 1:9ebc941037d5 38 echo "You need the ARM-GCC toolchain in your path" >&2
Jasper Wallace 1:9ebc941037d5 39 echo "See https://launchpad.net/gcc-arm-embedded/" >&2
Jasper Wallace 1:9ebc941037d5 40 exit 1
Jasper Wallace 1:9ebc941037d5 41 fi
Jasper Wallace 1:9ebc941037d5 42
Jasper Wallace 1:9ebc941037d5 43 ARMGCC_FLAGS='-Os -march=armv7-m -mthumb'
Jasper Wallace 1:9ebc941037d5 44 OUTFILE='00-footprint-summary.txt'
Jasper Wallace 1:9ebc941037d5 45
Jasper Wallace 1:9ebc941037d5 46 log()
Jasper Wallace 1:9ebc941037d5 47 {
Jasper Wallace 1:9ebc941037d5 48 echo "$@"
Jasper Wallace 1:9ebc941037d5 49 echo "$@" >> "$OUTFILE"
Jasper Wallace 1:9ebc941037d5 50 }
Jasper Wallace 1:9ebc941037d5 51
Jasper Wallace 1:9ebc941037d5 52 doit()
Jasper Wallace 1:9ebc941037d5 53 {
Jasper Wallace 1:9ebc941037d5 54 NAME="$1"
Jasper Wallace 1:9ebc941037d5 55 FILE="$2"
Jasper Wallace 1:9ebc941037d5 56
Jasper Wallace 1:9ebc941037d5 57 log ""
Jasper Wallace 1:9ebc941037d5 58 log "$NAME ($FILE):"
Jasper Wallace 1:9ebc941037d5 59
Jasper Wallace 1:9ebc941037d5 60 cp $CONFIG_H ${CONFIG_H}.bak
Jasper Wallace 1:9ebc941037d5 61 if [ "$FILE" != $CONFIG_H ]; then
Jasper Wallace 1:9ebc941037d5 62 cp "$FILE" $CONFIG_H
Jasper Wallace 1:9ebc941037d5 63 fi
Jasper Wallace 1:9ebc941037d5 64
Jasper Wallace 1:9ebc941037d5 65 {
Jasper Wallace 1:9ebc941037d5 66 scripts/config.pl unset MBEDTLS_NET_C || true
Jasper Wallace 1:9ebc941037d5 67 scripts/config.pl unset MBEDTLS_TIMING_C || true
Jasper Wallace 1:9ebc941037d5 68 scripts/config.pl unset MBEDTLS_FS_IO || true
Jasper Wallace 1:9ebc941037d5 69 scripts/config.pl --force set MBEDTLS_NO_PLATFORM_ENTROPY || true
Jasper Wallace 1:9ebc941037d5 70 } >/dev/null 2>&1
Jasper Wallace 1:9ebc941037d5 71
Jasper Wallace 1:9ebc941037d5 72 make clean >/dev/null
Jasper Wallace 1:9ebc941037d5 73 CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld \
Jasper Wallace 1:9ebc941037d5 74 CFLAGS="$ARMGCC_FLAGS" make lib >/dev/null
Jasper Wallace 1:9ebc941037d5 75
Jasper Wallace 1:9ebc941037d5 76 OUT="size-${NAME}.txt"
Jasper Wallace 1:9ebc941037d5 77 arm-none-eabi-size -t library/libmbed*.a > "$OUT"
Jasper Wallace 1:9ebc941037d5 78 log "$( head -n1 "$OUT" )"
Jasper Wallace 1:9ebc941037d5 79 log "$( tail -n1 "$OUT" )"
Jasper Wallace 1:9ebc941037d5 80
Jasper Wallace 1:9ebc941037d5 81 cp ${CONFIG_H}.bak $CONFIG_H
Jasper Wallace 1:9ebc941037d5 82 }
Jasper Wallace 1:9ebc941037d5 83
Jasper Wallace 1:9ebc941037d5 84 # truncate the file just this time
Jasper Wallace 1:9ebc941037d5 85 echo "(generated by $0)" > "$OUTFILE"
Jasper Wallace 1:9ebc941037d5 86 echo "" >> "$OUTFILE"
Jasper Wallace 1:9ebc941037d5 87
Jasper Wallace 1:9ebc941037d5 88 log "Footprint of standard configurations (minus net_sockets.c, timing.c, fs_io)"
Jasper Wallace 1:9ebc941037d5 89 log "for bare-metal ARM Cortex-M3/M4 microcontrollers."
Jasper Wallace 1:9ebc941037d5 90
Jasper Wallace 1:9ebc941037d5 91 VERSION_H="include/mbedtls/version.h"
Jasper Wallace 1:9ebc941037d5 92 MBEDTLS_VERSION=$( sed -n 's/.*VERSION_STRING *"\(.*\)"/\1/p' $VERSION_H )
Jasper Wallace 1:9ebc941037d5 93 if git rev-parse HEAD >/dev/null; then
Jasper Wallace 1:9ebc941037d5 94 GIT_HEAD=$( git rev-parse HEAD | head -c 10 )
Jasper Wallace 1:9ebc941037d5 95 GIT_VERSION=" (git head: $GIT_HEAD)"
Jasper Wallace 1:9ebc941037d5 96 else
Jasper Wallace 1:9ebc941037d5 97 GIT_VERSION=""
Jasper Wallace 1:9ebc941037d5 98 fi
Jasper Wallace 1:9ebc941037d5 99
Jasper Wallace 1:9ebc941037d5 100 log ""
Jasper Wallace 1:9ebc941037d5 101 log "mbed TLS $MBEDTLS_VERSION$GIT_VERSION"
Jasper Wallace 1:9ebc941037d5 102 log "$( arm-none-eabi-gcc --version | head -n1 )"
Jasper Wallace 1:9ebc941037d5 103 log "CFLAGS=$ARMGCC_FLAGS"
Jasper Wallace 1:9ebc941037d5 104
Jasper Wallace 1:9ebc941037d5 105 # creates the yotta config
Jasper Wallace 1:9ebc941037d5 106 yotta/create-module.sh >/dev/null
Jasper Wallace 1:9ebc941037d5 107
Jasper Wallace 1:9ebc941037d5 108 doit default include/mbedtls/config.h
Jasper Wallace 1:9ebc941037d5 109 doit yotta yotta/module/mbedtls/config.h
Jasper Wallace 1:9ebc941037d5 110 doit thread configs/config-thread.h
Jasper Wallace 1:9ebc941037d5 111 doit suite-b configs/config-suite-b.h
Jasper Wallace 1:9ebc941037d5 112 doit psk configs/config-ccm-psk-tls1_2.h
Jasper Wallace 1:9ebc941037d5 113
Jasper Wallace 1:9ebc941037d5 114 zip mbedtls-footprint.zip "$OUTFILE" size-*.txt >/dev/null