Merge branch 'development'
This commit is contained in:
commit
1cabdd573d
4 changed files with 193 additions and 42 deletions
|
@ -19,6 +19,8 @@ script:
|
||||||
- tests/scripts/test-ref-configs.pl
|
- tests/scripts/test-ref-configs.pl
|
||||||
- tests/scripts/curves.pl
|
- tests/scripts/curves.pl
|
||||||
- tests/scripts/key-exchanges.pl
|
- tests/scripts/key-exchanges.pl
|
||||||
|
after_failure:
|
||||||
|
- tests/scripts/travis-log-failure.sh
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
secure: "barHldniAfXyoWOD/vcO+E6/Xm4fmcaUoC9BeKW+LwsHqlDMLvugaJnmLXkSpkbYhVL61Hzf3bo0KPJn88AFc5Rkf8oYHPjH4adMnVXkf3B9ghHCgznqHsAH3choo6tnPxaFgOwOYmLGb382nQxfE5lUdvnM/W/psQjWt66A1+k="
|
secure: "barHldniAfXyoWOD/vcO+E6/Xm4fmcaUoC9BeKW+LwsHqlDMLvugaJnmLXkSpkbYhVL61Hzf3bo0KPJn88AFc5Rkf8oYHPjH4adMnVXkf3B9ghHCgznqHsAH3choo6tnPxaFgOwOYmLGb382nQxfE5lUdvnM/W/psQjWt66A1+k="
|
||||||
|
|
|
@ -1,22 +1,73 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
# Tune the configuration file
|
# This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014-2016, ARM Limited, All Rights Reserved
|
||||||
|
#
|
||||||
|
# Purpose
|
||||||
|
#
|
||||||
|
# Comments and uncomments #define lines in the given header file and optionally
|
||||||
|
# sets their value. This is to provide scripting control of what preprocessor
|
||||||
|
# symbols, and therefore what build time configuration flags are set in the
|
||||||
|
# 'config.h' file.
|
||||||
|
#
|
||||||
|
# Usage: config.pl [-f <file> | --file <file>] [-o | --force]
|
||||||
|
# [set <symbol> <value> | unset <symbol> | full | realfull]
|
||||||
|
#
|
||||||
|
# Full usage description provided below.
|
||||||
|
#
|
||||||
|
# Things that shouldn't be enabled with "full".
|
||||||
|
#
|
||||||
|
# MBEDTLS_DEPRECATED_REMOVED
|
||||||
|
# MBEDTLS_HAVE_SSE2
|
||||||
|
# MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
|
||||||
|
# MBEDTLS_ECP_DP_M221_ENABLED
|
||||||
|
# MBEDTLS_ECP_DP_M383_ENABLED
|
||||||
|
# MBEDTLS_ECP_DP_M511_ENABLED
|
||||||
|
# MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
|
||||||
|
# MBEDTLS_NO_PLATFORM_ENTROPY
|
||||||
|
# MBEDTLS_REMOVE_ARC4_CIPHERSUITES
|
||||||
|
# MBEDTLS_SSL_HW_RECORD_ACCEL
|
||||||
|
# MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
|
||||||
|
# MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
|
||||||
|
# - this could be enabled if the respective tests were adapted
|
||||||
|
# MBEDTLS_ZLIB_SUPPORT
|
||||||
|
# MBEDTLS_PKCS11_C
|
||||||
|
# and any symbol beginning _ALT
|
||||||
|
#
|
||||||
|
|
||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
my $config_file = "include/mbedtls/config.h";
|
||||||
my $usage = <<EOU;
|
my $usage = <<EOU;
|
||||||
$0 [-f <file>] unset <name>
|
$0 [-f <file> | --file <file>] [-o | --force]
|
||||||
$0 [-f <file>] set <name> [<value>]
|
[set <symbol> <value> | unset <symbol> | full | realfull]
|
||||||
EOU
|
|
||||||
# for our eyes only:
|
Commands
|
||||||
# $0 [-f <file>] full|realfull
|
set <symbol> [<value] - Uncomments or adds a #define for the <symnol> to
|
||||||
|
the configuration file, and optionally making it
|
||||||
|
of <value>.
|
||||||
|
If the symbol isn't present in the file an error
|
||||||
|
is returned.
|
||||||
|
unset <symbol> - Comments out any #define present in the
|
||||||
|
configuration file.
|
||||||
|
full - Uncomments all #define's in the configuration file
|
||||||
|
excluding some reserved symbols, until the
|
||||||
|
'Module configuration options' section
|
||||||
|
realfull - Uncomments all #define's with no exclusions
|
||||||
|
|
||||||
|
Options
|
||||||
|
-f | --file <filename> - The file or file path for the configuration file
|
||||||
|
to edit. When omitted, the following default is
|
||||||
|
used:
|
||||||
|
$config_file
|
||||||
|
-o | --force - If the symbol isn't present in the configuration
|
||||||
|
file when setting it's value, a #define is
|
||||||
|
appended to the end of the file.
|
||||||
|
|
||||||
|
EOU
|
||||||
|
|
||||||
# Things that shouldn't be enabled with "full".
|
|
||||||
# Notes:
|
|
||||||
# - MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 and
|
|
||||||
# MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION could be enabled if the
|
|
||||||
# respective tests were adapted
|
|
||||||
my @excluded = qw(
|
my @excluded = qw(
|
||||||
MBEDTLS_DEPRECATED_REMOVED
|
MBEDTLS_DEPRECATED_REMOVED
|
||||||
MBEDTLS_HAVE_SSE2
|
MBEDTLS_HAVE_SSE2
|
||||||
|
@ -40,40 +91,65 @@ my @non_excluded = qw(
|
||||||
PLATFORM_[A-Z0-9]+_ALT
|
PLATFORM_[A-Z0-9]+_ALT
|
||||||
);
|
);
|
||||||
|
|
||||||
my $config_file = "include/mbedtls/config.h";
|
# Process the command line arguments
|
||||||
|
|
||||||
# get -f option
|
my $force_option = 0;
|
||||||
if (@ARGV >= 2 && $ARGV[0] eq "-f") {
|
|
||||||
shift; # -f
|
|
||||||
$config_file = shift;
|
|
||||||
|
|
||||||
-f $config_file or die "No such file: $config_file\n";
|
my ($arg, $name, $value, $action);
|
||||||
} else {
|
|
||||||
if (! -f $config_file) {
|
while ($arg = shift) {
|
||||||
chdir '..' or die;
|
|
||||||
-f $config_file
|
# Check if the argument is an option
|
||||||
or die "Without -f, must be run from root or scripts\n"
|
if ($arg eq "-f" || $arg eq "--file") {
|
||||||
|
$config_file = shift;
|
||||||
|
|
||||||
|
-f $config_file or die "No such file: $config_file\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
elsif ($arg eq "-o" || $arg eq "--force") {
|
||||||
|
$force_option = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# ...else assume it's a command
|
||||||
|
$action = $arg;
|
||||||
|
|
||||||
|
if ($action eq "full" || $action eq "realfull") {
|
||||||
|
# No additional parameters
|
||||||
|
die $usage if @ARGV;
|
||||||
|
|
||||||
|
}
|
||||||
|
elsif ($action eq "unset") {
|
||||||
|
die $usage unless @ARGV;
|
||||||
|
$name = shift;
|
||||||
|
|
||||||
|
}
|
||||||
|
elsif ($action eq "set") {
|
||||||
|
die $usage unless @ARGV;
|
||||||
|
$name = shift;
|
||||||
|
$value = shift if @ARGV;
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
die "Command '$action' not recognised.\n\n".$usage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# get action
|
# Check the config file is present
|
||||||
die $usage unless @ARGV;
|
if (! -f $config_file) {
|
||||||
my $action = shift;
|
|
||||||
|
|
||||||
my ($name, $value);
|
chdir '..' or die;
|
||||||
if ($action eq "full" || $action eq "realfull") {
|
|
||||||
# nothing to do
|
# Confirm this is the project root directory and try again
|
||||||
} elsif ($action eq "unset") {
|
if ( !(-d 'scripts' && -d 'include' && -d 'library' && -f $config_file) ) {
|
||||||
die $usage unless @ARGV;
|
die "If no file specified, must be run from the project root or scripts directory.\n";
|
||||||
$name = shift;
|
}
|
||||||
} elsif ($action eq "set") {
|
|
||||||
die $usage unless @ARGV;
|
|
||||||
$name = shift;
|
|
||||||
$value = shift if @ARGV;
|
|
||||||
} else {
|
|
||||||
die $usage;
|
|
||||||
}
|
}
|
||||||
die $usage if @ARGV;
|
|
||||||
|
|
||||||
|
# Now read the file and process the contents
|
||||||
|
|
||||||
open my $config_read, '<', $config_file or die "read $config_file: $!\n";
|
open my $config_read, '<', $config_file or die "read $config_file: $!\n";
|
||||||
my @config_lines = <$config_read>;
|
my @config_lines = <$config_read>;
|
||||||
|
@ -122,9 +198,27 @@ for my $line (@config_lines) {
|
||||||
print $config_write $line;
|
print $config_write $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Did the set command work?
|
||||||
|
if ($action eq "set"&& $force_option && !$done) {
|
||||||
|
|
||||||
|
# If the force option was set, append the symbol to the end of the file
|
||||||
|
my $line = "#define $name";
|
||||||
|
$line .= " $value" if defined $value && $value ne "";
|
||||||
|
$line .= "\n";
|
||||||
|
$done = 1;
|
||||||
|
|
||||||
|
print $config_write $line;
|
||||||
|
}
|
||||||
|
|
||||||
close $config_write;
|
close $config_write;
|
||||||
|
|
||||||
die "configuration section not found" if ($action eq "full" && !$done);
|
if ($action eq "full" && !$done) {
|
||||||
die "$name not found" if ($action ne "full" && !$done);
|
die "Configuration section was not found in $config_file\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action ne "full" && $action ne "unset" && !$done) {
|
||||||
|
die "A #define for the symbol $name was not found in $config_file\n";
|
||||||
|
}
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
|
|
@ -1,5 +1,23 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||||
|
#
|
||||||
|
# Purpose
|
||||||
|
#
|
||||||
|
# This script determines ROM size (or code size) for the standard mbed TLS
|
||||||
|
# configurations, when built for a Cortex M3/M4 target.
|
||||||
|
#
|
||||||
|
# Configurations included:
|
||||||
|
# default include/mbedtls/config.h
|
||||||
|
# yotta yotta/module/mbedtls/config.h
|
||||||
|
# thread configs/config-thread.h
|
||||||
|
# suite-b configs/config-suite-b.h
|
||||||
|
# psk configs/config-ccm-psk-tls1_2.h
|
||||||
|
#
|
||||||
|
# Usage: footprint.sh
|
||||||
|
#
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
CONFIG_H='include/mbedtls/config.h'
|
CONFIG_H='include/mbedtls/config.h'
|
||||||
|
@ -48,6 +66,7 @@ doit()
|
||||||
scripts/config.pl unset MBEDTLS_NET_C || true
|
scripts/config.pl unset MBEDTLS_NET_C || true
|
||||||
scripts/config.pl unset MBEDTLS_TIMING_C || true
|
scripts/config.pl unset MBEDTLS_TIMING_C || true
|
||||||
scripts/config.pl unset MBEDTLS_FS_IO || true
|
scripts/config.pl unset MBEDTLS_FS_IO || true
|
||||||
|
scripts/config.pl --force set MBEDTLS_NO_PLATFORM_ENTROPY || true
|
||||||
} >/dev/null 2>&1
|
} >/dev/null 2>&1
|
||||||
|
|
||||||
CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld \
|
CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld \
|
||||||
|
|
36
tests/scripts/travis-log-failure.sh
Executable file
36
tests/scripts/travis-log-failure.sh
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# travis-log-failure.sh
|
||||||
|
#
|
||||||
|
# This file is part of mbed TLS (https://tls.mbed.org)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016, ARM Limited, All Rights Reserved
|
||||||
|
#
|
||||||
|
# Purpose
|
||||||
|
#
|
||||||
|
# List the server and client logs on failed ssl-opt.sh and compat.sh tests.
|
||||||
|
# This script is used to make the logs show up in the Travis test results.
|
||||||
|
#
|
||||||
|
# Some of the logs can be very long: this means usually a couple of megabytes
|
||||||
|
# but it can be much more. For example, the client log of test 273 in ssl-opt.sh
|
||||||
|
# is more than 630 Megabytes long.
|
||||||
|
|
||||||
|
if [ -d include/mbedtls ]; then :; else
|
||||||
|
echo "$0: must be run from root" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILES="o-srv-*.log o-cli-*.log c-srv-*.log c-cli-*.log o-pxy-*.log"
|
||||||
|
MAX_LOG_SIZE=1048576
|
||||||
|
|
||||||
|
for PATTERN in $FILES; do
|
||||||
|
for LOG in $( ls tests/$PATTERN 2>/dev/null ); do
|
||||||
|
echo
|
||||||
|
echo "****** BEGIN file: $LOG ******"
|
||||||
|
echo
|
||||||
|
tail -c $MAX_LOG_SIZE $LOG
|
||||||
|
echo "****** END file: $LOG ******"
|
||||||
|
echo
|
||||||
|
rm $LOG
|
||||||
|
done
|
||||||
|
done
|
Loading…
Reference in a new issue