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/bash
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) 2012-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 # Sets the version numbers in the source code to those given.
Jasper Wallace 1:9ebc941037d5 10 #
Jasper Wallace 1:9ebc941037d5 11 # Usage: bump_version.sh [ --version <version> ] [ --so-crypto <version>]
Jasper Wallace 1:9ebc941037d5 12 # [ --so-x509 <version> ] [ --so-tls <version> ]
Jasper Wallace 1:9ebc941037d5 13 # [ -v | --verbose ] [ -h | --help ]
Jasper Wallace 1:9ebc941037d5 14 #
Jasper Wallace 1:9ebc941037d5 15
Jasper Wallace 1:9ebc941037d5 16 VERSION=""
Jasper Wallace 1:9ebc941037d5 17 SOVERSION=""
Jasper Wallace 1:9ebc941037d5 18
Jasper Wallace 1:9ebc941037d5 19 # Parse arguments
Jasper Wallace 1:9ebc941037d5 20 #
Jasper Wallace 1:9ebc941037d5 21 until [ -z "$1" ]
Jasper Wallace 1:9ebc941037d5 22 do
Jasper Wallace 1:9ebc941037d5 23 case "$1" in
Jasper Wallace 1:9ebc941037d5 24 --version)
Jasper Wallace 1:9ebc941037d5 25 # Version to use
Jasper Wallace 1:9ebc941037d5 26 shift
Jasper Wallace 1:9ebc941037d5 27 VERSION=$1
Jasper Wallace 1:9ebc941037d5 28 ;;
Jasper Wallace 1:9ebc941037d5 29 --so-crypto)
Jasper Wallace 1:9ebc941037d5 30 shift
Jasper Wallace 1:9ebc941037d5 31 SO_CRYPTO=$1
Jasper Wallace 1:9ebc941037d5 32 ;;
Jasper Wallace 1:9ebc941037d5 33 --so-x509)
Jasper Wallace 1:9ebc941037d5 34 shift
Jasper Wallace 1:9ebc941037d5 35 SO_X509=$1
Jasper Wallace 1:9ebc941037d5 36 ;;
Jasper Wallace 1:9ebc941037d5 37 --so-tls)
Jasper Wallace 1:9ebc941037d5 38 shift
Jasper Wallace 1:9ebc941037d5 39 SO_TLS=$1
Jasper Wallace 1:9ebc941037d5 40 ;;
Jasper Wallace 1:9ebc941037d5 41 -v|--verbose)
Jasper Wallace 1:9ebc941037d5 42 # Be verbose
Jasper Wallace 1:9ebc941037d5 43 VERBOSE="1"
Jasper Wallace 1:9ebc941037d5 44 ;;
Jasper Wallace 1:9ebc941037d5 45 -h|--help)
Jasper Wallace 1:9ebc941037d5 46 # print help
Jasper Wallace 1:9ebc941037d5 47 echo "Usage: $0"
Jasper Wallace 1:9ebc941037d5 48 echo -e " -h|--help\t\tPrint this help."
Jasper Wallace 1:9ebc941037d5 49 echo -e " --version <version>\tVersion to bump to."
Jasper Wallace 1:9ebc941037d5 50 echo -e " --so-crypto <version>\tSO version to bump libmbedcrypto to."
Jasper Wallace 1:9ebc941037d5 51 echo -e " --so-x509 <version>\tSO version to bump libmbedx509 to."
Jasper Wallace 1:9ebc941037d5 52 echo -e " --so-tls <version>\tSO version to bump libmbedtls to."
Jasper Wallace 1:9ebc941037d5 53 echo -e " -v|--verbose\t\tVerbose."
Jasper Wallace 1:9ebc941037d5 54 exit 1
Jasper Wallace 1:9ebc941037d5 55 ;;
Jasper Wallace 1:9ebc941037d5 56 *)
Jasper Wallace 1:9ebc941037d5 57 # print error
Jasper Wallace 1:9ebc941037d5 58 echo "Unknown argument: '$1'"
Jasper Wallace 1:9ebc941037d5 59 exit 1
Jasper Wallace 1:9ebc941037d5 60 ;;
Jasper Wallace 1:9ebc941037d5 61 esac
Jasper Wallace 1:9ebc941037d5 62 shift
Jasper Wallace 1:9ebc941037d5 63 done
Jasper Wallace 1:9ebc941037d5 64
Jasper Wallace 1:9ebc941037d5 65 if [ "X" = "X$VERSION" ];
Jasper Wallace 1:9ebc941037d5 66 then
Jasper Wallace 1:9ebc941037d5 67 echo "No version specified. Unable to continue."
Jasper Wallace 1:9ebc941037d5 68 exit 1
Jasper Wallace 1:9ebc941037d5 69 fi
Jasper Wallace 1:9ebc941037d5 70
Jasper Wallace 1:9ebc941037d5 71 [ $VERBOSE ] && echo "Bumping VERSION in library/CMakeLists.txt"
Jasper Wallace 1:9ebc941037d5 72 sed -e "s/ VERSION [0-9.]\{1,\}/ VERSION $VERSION/g" < library/CMakeLists.txt > tmp
Jasper Wallace 1:9ebc941037d5 73 mv tmp library/CMakeLists.txt
Jasper Wallace 1:9ebc941037d5 74
Jasper Wallace 1:9ebc941037d5 75 if [ "X" != "X$SO_CRYPTO" ];
Jasper Wallace 1:9ebc941037d5 76 then
Jasper Wallace 1:9ebc941037d5 77 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/CMakeLists.txt"
Jasper Wallace 1:9ebc941037d5 78 sed -e "/mbedcrypto/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_CRYPTO/g" < library/CMakeLists.txt > tmp
Jasper Wallace 1:9ebc941037d5 79 mv tmp library/CMakeLists.txt
Jasper Wallace 1:9ebc941037d5 80
Jasper Wallace 1:9ebc941037d5 81 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedcrypto in library/Makefile"
Jasper Wallace 1:9ebc941037d5 82 sed -e "s/SOEXT_CRYPTO=so.[0-9]\{1,\}/SOEXT_CRYPTO=so.$SO_CRYPTO/g" < library/Makefile > tmp
Jasper Wallace 1:9ebc941037d5 83 mv tmp library/Makefile
Jasper Wallace 1:9ebc941037d5 84 fi
Jasper Wallace 1:9ebc941037d5 85
Jasper Wallace 1:9ebc941037d5 86 if [ "X" != "X$SO_X509" ];
Jasper Wallace 1:9ebc941037d5 87 then
Jasper Wallace 1:9ebc941037d5 88 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedx509 in library/CMakeLists.txt"
Jasper Wallace 1:9ebc941037d5 89 sed -e "/mbedx509/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_X509/g" < library/CMakeLists.txt > tmp
Jasper Wallace 1:9ebc941037d5 90 mv tmp library/CMakeLists.txt
Jasper Wallace 1:9ebc941037d5 91
Jasper Wallace 1:9ebc941037d5 92 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedx509 in library/Makefile"
Jasper Wallace 1:9ebc941037d5 93 sed -e "s/SOEXT_X509=so.[0-9]\{1,\}/SOEXT_X509=so.$SO_X509/g" < library/Makefile > tmp
Jasper Wallace 1:9ebc941037d5 94 mv tmp library/Makefile
Jasper Wallace 1:9ebc941037d5 95 fi
Jasper Wallace 1:9ebc941037d5 96
Jasper Wallace 1:9ebc941037d5 97 if [ "X" != "X$SO_TLS" ];
Jasper Wallace 1:9ebc941037d5 98 then
Jasper Wallace 1:9ebc941037d5 99 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedtls in library/CMakeLists.txt"
Jasper Wallace 1:9ebc941037d5 100 sed -e "/mbedtls/ s/ SOVERSION [0-9]\{1,\}/ SOVERSION $SO_TLS/g" < library/CMakeLists.txt > tmp
Jasper Wallace 1:9ebc941037d5 101 mv tmp library/CMakeLists.txt
Jasper Wallace 1:9ebc941037d5 102
Jasper Wallace 1:9ebc941037d5 103 [ $VERBOSE ] && echo "Bumping SOVERSION for libmbedtls in library/Makefile"
Jasper Wallace 1:9ebc941037d5 104 sed -e "s/SOEXT_TLS=so.[0-9]\{1,\}/SOEXT_TLS=so.$SO_TLS/g" < library/Makefile > tmp
Jasper Wallace 1:9ebc941037d5 105 mv tmp library/Makefile
Jasper Wallace 1:9ebc941037d5 106 fi
Jasper Wallace 1:9ebc941037d5 107
Jasper Wallace 1:9ebc941037d5 108 [ $VERBOSE ] && echo "Bumping VERSION in include/mbedtls/version.h"
Jasper Wallace 1:9ebc941037d5 109 read MAJOR MINOR PATCH <<<$(IFS="."; echo $VERSION)
Jasper Wallace 1:9ebc941037d5 110 VERSION_NR="$( printf "0x%02X%02X%02X00" $MAJOR $MINOR $PATCH )"
Jasper Wallace 1:9ebc941037d5 111 cat include/mbedtls/version.h | \
Jasper Wallace 1:9ebc941037d5 112 sed -e "s/_VERSION_MAJOR .\{1,\}/_VERSION_MAJOR $MAJOR/" | \
Jasper Wallace 1:9ebc941037d5 113 sed -e "s/_VERSION_MINOR .\{1,\}/_VERSION_MINOR $MINOR/" | \
Jasper Wallace 1:9ebc941037d5 114 sed -e "s/_VERSION_PATCH .\{1,\}/_VERSION_PATCH $PATCH/" | \
Jasper Wallace 1:9ebc941037d5 115 sed -e "s/_VERSION_NUMBER .\{1,\}/_VERSION_NUMBER $VERSION_NR/" | \
Jasper Wallace 1:9ebc941037d5 116 sed -e "s/_VERSION_STRING .\{1,\}/_VERSION_STRING \"$VERSION\"/" | \
Jasper Wallace 1:9ebc941037d5 117 sed -e "s/_VERSION_STRING_FULL .\{1,\}/_VERSION_STRING_FULL \"mbed TLS $VERSION\"/" \
Jasper Wallace 1:9ebc941037d5 118 > tmp
Jasper Wallace 1:9ebc941037d5 119 mv tmp include/mbedtls/version.h
Jasper Wallace 1:9ebc941037d5 120
Jasper Wallace 1:9ebc941037d5 121 [ $VERBOSE ] && echo "Bumping version in tests/suites/test_suite_version.data"
Jasper Wallace 1:9ebc941037d5 122 sed -e "s/version:\".\{1,\}/version:\"$VERSION\"/g" < tests/suites/test_suite_version.data > tmp
Jasper Wallace 1:9ebc941037d5 123 mv tmp tests/suites/test_suite_version.data
Jasper Wallace 1:9ebc941037d5 124
Jasper Wallace 1:9ebc941037d5 125 [ $VERBOSE ] && echo "Bumping PROJECT_NAME in doxygen/mbedtls.doxyfile and doxygen/input/doc_mainpage.h"
Jasper Wallace 1:9ebc941037d5 126 for i in doxygen/mbedtls.doxyfile doxygen/input/doc_mainpage.h;
Jasper Wallace 1:9ebc941037d5 127 do
Jasper Wallace 1:9ebc941037d5 128 sed -e "s/mbed TLS v[0-9\.]\{1,\}/mbed TLS v$VERSION/g" < $i > tmp
Jasper Wallace 1:9ebc941037d5 129 mv tmp $i
Jasper Wallace 1:9ebc941037d5 130 done
Jasper Wallace 1:9ebc941037d5 131
Jasper Wallace 1:9ebc941037d5 132 [ $VERBOSE ] && echo "Re-generating library/error.c"
Jasper Wallace 1:9ebc941037d5 133 scripts/generate_errors.pl
Jasper Wallace 1:9ebc941037d5 134
Jasper Wallace 1:9ebc941037d5 135 [ $VERBOSE ] && echo "Re-generating library/version_features.c"
Jasper Wallace 1:9ebc941037d5 136 scripts/generate_features.pl
Jasper Wallace 1:9ebc941037d5 137
Jasper Wallace 1:9ebc941037d5 138 [ $VERBOSE ] && echo "Re-generating visualc files"
Jasper Wallace 1:9ebc941037d5 139 scripts/generate_visualc_files.pl
Jasper Wallace 1:9ebc941037d5 140