mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 08:16:33 +01:00
Merge branch 'mbedtls-2.16' into mbedtls-2.16-restricted
* mbedtls-2.16: (32 commits) A different approach of signed-to-unsigned comparison Fix bug in redirection of unit test outputs Don't forget to free G, P, Q, ctr_drbg, and entropy Backport e2k support to mbedtls-2.7 compat.sh: stop using allow_sha1 compat.sh: quit using SHA-1 certificates compat.sh: enable CBC-SHA-2 suites for GnuTLS Fix license header in pre-commit hook Update copyright notices to use Linux Foundation guidance Fix building on NetBSD 9.0 Remove obsolete buildbot reference in compat.sh Fix misuse of printf in shell script Fix added proxy command when IPv6 is used Simplify test syntax Fix logic error in setting client port ssl-opt.sh: include test name in log files ssl-opt.sh: remove old buildbot-specific condition ssl-opt.sh: add proxy to all DTLS tests Log change as bugfix Add changelog entry ...
This commit is contained in:
commit
f0b469e42b
292 changed files with 767 additions and 1045 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# compat.sh
|
||||
#
|
||||
# Copyright (c) 2012-2016, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Test interoperbility with OpenSSL, GnuTLS as well as itself.
|
||||
|
|
@ -936,7 +934,7 @@ setup_arguments()
|
|||
M_SERVER_ARGS="server_port=$PORT server_addr=0.0.0.0 force_version=$MODE arc4=1"
|
||||
O_SERVER_ARGS="-accept $PORT -cipher NULL,ALL -$MODE -dhparam data_files/dhparams.pem"
|
||||
G_SERVER_ARGS="-p $PORT --http $G_MODE"
|
||||
G_SERVER_PRIO="NORMAL:${G_PRIO_CCM}+ARCFOUR-128:+NULL:+MD5:+PSK:+DHE-PSK:+ECDHE-PSK:+RSA-PSK:-VERS-TLS-ALL:$G_PRIO_MODE"
|
||||
G_SERVER_PRIO="NORMAL:${G_PRIO_CCM}+ARCFOUR-128:+NULL:+MD5:+PSK:+DHE-PSK:+ECDHE-PSK:+SHA256:+SHA384:+RSA-PSK:-VERS-TLS-ALL:$G_PRIO_MODE"
|
||||
|
||||
# with OpenSSL 1.0.1h, -www, -WWW and -HTTP break DTLS handshakes
|
||||
if is_dtls "$MODE"; then
|
||||
|
|
@ -985,39 +983,29 @@ setup_arguments()
|
|||
;;
|
||||
|
||||
"RSA")
|
||||
M_SERVER_ARGS="$M_SERVER_ARGS crt_file=data_files/server2.crt key_file=data_files/server2.key"
|
||||
O_SERVER_ARGS="$O_SERVER_ARGS -cert data_files/server2.crt -key data_files/server2.key"
|
||||
G_SERVER_ARGS="$G_SERVER_ARGS --x509certfile data_files/server2.crt --x509keyfile data_files/server2.key"
|
||||
M_SERVER_ARGS="$M_SERVER_ARGS crt_file=data_files/server2-sha256.crt key_file=data_files/server2.key"
|
||||
O_SERVER_ARGS="$O_SERVER_ARGS -cert data_files/server2-sha256.crt -key data_files/server2.key"
|
||||
G_SERVER_ARGS="$G_SERVER_ARGS --x509certfile data_files/server2-sha256.crt --x509keyfile data_files/server2.key"
|
||||
|
||||
if [ "X$VERIFY" = "XYES" ]; then
|
||||
M_CLIENT_ARGS="$M_CLIENT_ARGS crt_file=data_files/server1.crt key_file=data_files/server1.key"
|
||||
O_CLIENT_ARGS="$O_CLIENT_ARGS -cert data_files/server1.crt -key data_files/server1.key"
|
||||
G_CLIENT_ARGS="$G_CLIENT_ARGS --x509certfile data_files/server1.crt --x509keyfile data_files/server1.key"
|
||||
M_CLIENT_ARGS="$M_CLIENT_ARGS crt_file=data_files/cert_sha256.crt key_file=data_files/server1.key"
|
||||
O_CLIENT_ARGS="$O_CLIENT_ARGS -cert data_files/cert_sha256.crt -key data_files/server1.key"
|
||||
G_CLIENT_ARGS="$G_CLIENT_ARGS --x509certfile data_files/cert_sha256.crt --x509keyfile data_files/server1.key"
|
||||
else
|
||||
M_CLIENT_ARGS="$M_CLIENT_ARGS crt_file=none key_file=none"
|
||||
fi
|
||||
|
||||
# Allow SHA-1. It's disabled by default for security reasons but
|
||||
# our tests still use certificates signed with it.
|
||||
M_SERVER_ARGS="$M_SERVER_ARGS allow_sha1=1"
|
||||
M_CLIENT_ARGS="$M_CLIENT_ARGS allow_sha1=1"
|
||||
;;
|
||||
|
||||
"PSK")
|
||||
# give RSA-PSK-capable server a RSA cert
|
||||
# (should be a separate type, but harder to close with openssl)
|
||||
M_SERVER_ARGS="$M_SERVER_ARGS psk=6162636465666768696a6b6c6d6e6f70 ca_file=none crt_file=data_files/server2.crt key_file=data_files/server2.key"
|
||||
M_SERVER_ARGS="$M_SERVER_ARGS psk=6162636465666768696a6b6c6d6e6f70 ca_file=none crt_file=data_files/server2-sha256.crt key_file=data_files/server2.key"
|
||||
O_SERVER_ARGS="$O_SERVER_ARGS -psk 6162636465666768696a6b6c6d6e6f70 -nocert"
|
||||
G_SERVER_ARGS="$G_SERVER_ARGS --x509certfile data_files/server2.crt --x509keyfile data_files/server2.key --pskpasswd data_files/passwd.psk"
|
||||
G_SERVER_ARGS="$G_SERVER_ARGS --x509certfile data_files/server2-sha256.crt --x509keyfile data_files/server2.key --pskpasswd data_files/passwd.psk"
|
||||
|
||||
M_CLIENT_ARGS="$M_CLIENT_ARGS psk=6162636465666768696a6b6c6d6e6f70 crt_file=none key_file=none"
|
||||
O_CLIENT_ARGS="$O_CLIENT_ARGS -psk 6162636465666768696a6b6c6d6e6f70"
|
||||
G_CLIENT_ARGS="$G_CLIENT_ARGS --pskusername Client_identity --pskkey=6162636465666768696a6b6c6d6e6f70"
|
||||
|
||||
# Allow SHA-1. It's disabled by default for security reasons but
|
||||
# our tests still use certificates signed with it.
|
||||
M_SERVER_ARGS="$M_SERVER_ARGS allow_sha1=1"
|
||||
M_CLIENT_ARGS="$M_CLIENT_ARGS allow_sha1=1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
@ -1259,7 +1247,7 @@ run_client() {
|
|||
cp $CLI_OUT c-cli-${TESTS}.log
|
||||
echo " ! outputs saved to c-srv-${TESTS}.log, c-cli-${TESTS}.log"
|
||||
|
||||
if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot -o "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then
|
||||
if [ "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then
|
||||
echo " ! server output:"
|
||||
cat c-srv-${TESTS}.log
|
||||
echo " ! ==================================================="
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Used for testing.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2019, ARM Limited, All Rights Reserved
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*
|
||||
* This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -43,8 +43,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* **********
|
||||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_H
|
||||
|
|
|
|||
|
|
@ -202,6 +202,10 @@ server5-ss-forgeca.crt: server5.key
|
|||
$(FAKETIME) '2015-09-01 14:08:43' $(OPENSSL) req -x509 -new -subj "/C=UK/O=mbed TLS/CN=mbed TLS Test intermediate CA 3" -set_serial 77 -config $(test_ca_config_file) -extensions noext_ca -days 3650 -sha256 -key $< -out $@
|
||||
all_final += server5-ss-forgeca.crt
|
||||
|
||||
server5-tricky-ip-san.crt: server5.key
|
||||
$(OPENSSL) req -x509 -new -subj "/C=UK/O=Mbed TLS/CN=Mbed TLS Tricky IP SAN" -set_serial 77 -config $(test_ca_config_file) -extensions tricky_ip_san -days 3650 -sha256 -key server5.key -out $@
|
||||
all_final += server5-tricky-ip-san.crt
|
||||
|
||||
server10-badsign.crt: server10.crt
|
||||
{ head -n-2 $<; tail -n-2 $< | sed -e '1s/0\(=*\)$$/_\1/' -e '1s/[^_=]\(=*\)$$/0\1/' -e '1s/_/1/'; } > $@
|
||||
all_final += server10-badsign.crt
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2017, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright (C) 2017, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
|
|
|||
11
tests/data_files/server5-tricky-ip-san.crt
Normal file
11
tests/data_files/server5-tricky-ip-san.crt
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIBljCCATygAwIBAgIBTTAKBggqhkjOPQQDAjBBMQswCQYDVQQGEwJVSzERMA8G
|
||||
A1UECgwITWJlZCBUTFMxHzAdBgNVBAMMFk1iZWQgVExTIFRyaWNreSBJUCBTQU4w
|
||||
HhcNMjAwNzIzMTAyNzQ2WhcNMzAwNzIxMTAyNzQ2WjBBMQswCQYDVQQGEwJVSzER
|
||||
MA8GA1UECgwITWJlZCBUTFMxHzAdBgNVBAMMFk1iZWQgVExTIFRyaWNreSBJUCBT
|
||||
QU4wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQ3zFbZdgkeWnI+x1kt/yBu7nz5
|
||||
BpF00K0UtfdoIllikk7lANgjEf/qL9I0XV0WvYqIwmt3DVXNiioO+gHItO3/oyUw
|
||||
IzAhBgNVHREEGjAYhwRhYmNkhxBhYmNkLmV4YW1wbGUuY29tMAoGCCqGSM49BAMC
|
||||
A0gAMEUCIFDc8ZALA/9Zv7dZTWrZOOp/dgPAEJRT+h68nD6KF+XyAiEAs1QqugOo
|
||||
Dwru0DSEmpYkmj1Keunpd0VopM0joC1cc5A=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -26,3 +26,7 @@ issuingDistributionPoint=@idpdata
|
|||
|
||||
[idpdata]
|
||||
fullname=URI:http://pki.example.com/
|
||||
|
||||
# these IPs are the ascii values for 'abcd' and 'abcd.example.com'
|
||||
[tricky_ip_san]
|
||||
subjectAltName=IP:97.98.99.100,IP:6162:6364:2e65:7861:6d70:6c65:2e63:6f6d
|
||||
|
|
|
|||
61
tests/git-scripts/pre-commit.sh
Executable file
61
tests/git-scripts/pre-commit.sh
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/sh
|
||||
|
||||
# pre-commit.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
# GNU General Public License v2.0 or later.
|
||||
#
|
||||
# **********
|
||||
# Apache License 2.0:
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# **********
|
||||
# GNU General Public License v2.0 or later:
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
|
||||
# Purpose
|
||||
#
|
||||
# This script does quick sanity checks before commiting:
|
||||
# - check that generated files are up-to-date.
|
||||
#
|
||||
# It is meant to be called as a git pre-commit hook, see README.md.
|
||||
#
|
||||
# From the git sample pre-commit hook:
|
||||
# Called by "git commit" with no arguments. The hook should
|
||||
# exit with non-zero status after issuing an appropriate message if
|
||||
# it wants to stop the commit.
|
||||
|
||||
set -eu
|
||||
|
||||
tests/scripts/check-generated-files.sh
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
# pre-push.sh
|
||||
#
|
||||
# Copyright (c) 2017, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -43,8 +43,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Called by "git push" after it has checked the remote status, but before anything has been
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# all.sh
|
||||
#
|
||||
# Copyright (c) 2014-2017, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -43,8 +43,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# basic-build-tests.sh
|
||||
#
|
||||
# Copyright (c) 2016, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Executes the basic test suites, captures the results, and generates a simple
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
# but that would warn about any undocumented item, while our goal is to find
|
||||
# items that are documented, but not marked as such by mistake.
|
||||
#
|
||||
# Copyright (C) 2012-2016, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -49,8 +49,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
# Copyright (c) 2018, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -42,19 +42,35 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Check if generated files are up-to-date.
|
||||
|
||||
set -eu
|
||||
|
||||
if [ $# -ne 0 ] && [ "$1" = "--help" ]; then
|
||||
cat <<EOF
|
||||
$0 [-u]
|
||||
This script checks that all generated file are up-to-date. If some aren't, by
|
||||
default the scripts reports it and exits in error; with the -u option, it just
|
||||
updates them instead.
|
||||
|
||||
-u Update the files rather than return an error for out-of-date files.
|
||||
EOF
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -d library -a -d include -a -d tests ]; then :; else
|
||||
echo "Must be run from mbed TLS root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UPDATE=
|
||||
if [ $# -ne 0 ] && [ "$1" = "-u" ]; then
|
||||
shift
|
||||
UPDATE='y'
|
||||
fi
|
||||
|
||||
check()
|
||||
{
|
||||
SCRIPT=$1
|
||||
|
|
@ -80,9 +96,15 @@ check()
|
|||
for FILE in $FILES; do
|
||||
if ! diff $FILE $FILE.bak >/dev/null 2>&1; then
|
||||
echo "'$FILE' was either modified or deleted by '$SCRIPT'"
|
||||
exit 1
|
||||
if [ -z "$UPDATE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [ -z "$UPDATE" ]; then
|
||||
mv $FILE.bak $FILE
|
||||
else
|
||||
rm $FILE.bak
|
||||
fi
|
||||
mv $FILE.bak $FILE
|
||||
|
||||
if [ -d $TO_CHECK ]; then
|
||||
# Create a grep regular expression that we can check against the
|
||||
|
|
@ -99,7 +121,9 @@ check()
|
|||
# Check if there are any new files
|
||||
if ls -1 $TO_CHECK | grep -v "$PATTERN" >/dev/null 2>&1; then
|
||||
echo "Files were created by '$SCRIPT'"
|
||||
exit 1
|
||||
if [ -z "$UPDATE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2015-2019, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
# Copyright (c) 2018, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -42,8 +42,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose:
|
||||
#
|
||||
# Run 'pylint' on Python files for programming errors and helps enforcing
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2018, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
"""
|
||||
This script checks the current state of the source code for minor issues,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# curves.pl
|
||||
#
|
||||
# Copyright (c) 2014-2016, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# To test the code dependencies on individual curves in each test suite. This
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# depends-hashes.pl
|
||||
#
|
||||
# Copyright (c) 2017, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# To test the code dependencies on individual hashes in each test suite. This
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# depends-pkalgs.pl
|
||||
#
|
||||
# Copyright (c) 2017, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# To test the code dependencies on individual PK algs (those that can be used
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Make sure the doxygen documentation builds without warnings
|
||||
#
|
||||
# Copyright (C) 2016, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -43,8 +43,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
# Abort on errors (and uninitiliased variables)
|
||||
set -eu
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# Only uses AES-256-CTR cases that use a Derivation function
|
||||
# and concats nonce and personalization for initialization.
|
||||
#
|
||||
# Copyright (C) 2011, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -45,8 +45,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use strict;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# Based on NIST gcmDecryptxxx.rsp validation files
|
||||
# Only first 3 of every set used for compile time saving
|
||||
#
|
||||
# Copyright (C) 2012-2013, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use strict;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# Based on NIST gcmEncryptIntIVxxx.rsp validation files
|
||||
# Only first 3 of every set used for compile time saving
|
||||
#
|
||||
# Copyright (C) 2012-2013, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use strict;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright (C) 2011-2015, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use strict;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
# <test data file path> - should be the path to one of the test suite files
|
||||
# such as 'test_suite_mpi.data'
|
||||
#
|
||||
# Copyright (C) 2016, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -49,8 +49,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
# Abort on errors
|
||||
set -e
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# Test suites code generator.
|
||||
#
|
||||
# Copyright (C) 2018, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -42,8 +42,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
"""
|
||||
This script is a key part of Mbed TLS test suites framework. For
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# key-exchanges.pl
|
||||
#
|
||||
# Copyright (c) 2015-2017, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# To test the code dependencies on individual key exchanges in the SSL module.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright (C) 2015, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# Usage: list-identifiers.sh [ -i | --internal ]
|
||||
#
|
||||
# Copyright (C) 2015-2019, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -47,8 +47,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2015, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2015-2019, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -41,8 +41,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Greentea host test script for Mbed TLS on-target test suite testing.
|
||||
#
|
||||
# Copyright (C) 2018, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -43,8 +43,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#
|
||||
# Typical usage: scripts/recursion.pl library/*.c
|
||||
#
|
||||
# Copyright (C) 2014-2015, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -49,8 +49,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# run-test-suites.pl
|
||||
#
|
||||
# Copyright (c) 2015-2018, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -43,8 +43,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# DATA: hex-encoded data to send to the server
|
||||
# RESPONSE: regexp that must match the server's response
|
||||
#
|
||||
# Copyright (C) 2017, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -46,8 +46,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# test-ref-configs.pl
|
||||
#
|
||||
# Copyright (c) 2013-2016, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# For each reference configuration file in the configs directory, build the
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# Unit test for generate_test_code.py
|
||||
#
|
||||
# Copyright (C) 2018, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -42,8 +42,6 @@
|
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
|
||||
"""
|
||||
Unit tests for generate_test_code.py
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# test_zeroize.gdb
|
||||
#
|
||||
# Copyright (c) 2018, Arm Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -42,8 +42,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Run a test using the debugger to check that the mbedtls_platform_zeroize()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# travis-log-failure.sh
|
||||
#
|
||||
# Copyright (c) 2016, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# List the server and client logs on failed ssl-opt.sh and compat.sh tests.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# ssl-opt.sh
|
||||
#
|
||||
# Copyright (c) 2016, ARM Limited, All Rights Reserved
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This file is provided under the Apache License 2.0, or the
|
||||
|
|
@ -44,8 +44,6 @@
|
|||
#
|
||||
# **********
|
||||
#
|
||||
# This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Executes tests to prove various TLS/SSL options and extensions.
|
||||
|
|
@ -405,7 +403,7 @@ fail() {
|
|||
fi
|
||||
echo " ! outputs saved to o-XXX-${TESTS}.log"
|
||||
|
||||
if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot -o "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then
|
||||
if [ "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then
|
||||
echo " ! server output:"
|
||||
cat o-srv-${TESTS}.log
|
||||
echo " ! ========================================================"
|
||||
|
|
@ -621,6 +619,19 @@ run_test() {
|
|||
return
|
||||
fi
|
||||
|
||||
# update DTLS variable
|
||||
detect_dtls "$SRV_CMD"
|
||||
|
||||
# if the test uses DTLS but no custom proxy, add a simple proxy
|
||||
# as it provides timing info that's useful to debug failures
|
||||
if [ -z "$PXY_CMD" ] && [ "$DTLS" -eq 1 ]; then
|
||||
PXY_CMD="$P_PXY"
|
||||
case " $SRV_CMD " in
|
||||
*' server_addr=::1 '*)
|
||||
PXY_CMD="$PXY_CMD server_addr=::1 listen_addr=::1";;
|
||||
esac
|
||||
fi
|
||||
|
||||
# fix client port
|
||||
if [ -n "$PXY_CMD" ]; then
|
||||
CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g )
|
||||
|
|
@ -628,9 +639,6 @@ run_test() {
|
|||
CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g )
|
||||
fi
|
||||
|
||||
# update DTLS variable
|
||||
detect_dtls "$SRV_CMD"
|
||||
|
||||
# prepend valgrind to our commands if active
|
||||
if [ "$MEMCHECK" -gt 0 ]; then
|
||||
if is_polar "$SRV_CMD"; then
|
||||
|
|
@ -647,19 +655,19 @@ run_test() {
|
|||
|
||||
# run the commands
|
||||
if [ -n "$PXY_CMD" ]; then
|
||||
echo "$PXY_CMD" > $PXY_OUT
|
||||
printf "# %s\n%s\n" "$NAME" "$PXY_CMD" > $PXY_OUT
|
||||
$PXY_CMD >> $PXY_OUT 2>&1 &
|
||||
PXY_PID=$!
|
||||
wait_proxy_start "$PXY_PORT" "$PXY_PID"
|
||||
fi
|
||||
|
||||
check_osrv_dtls
|
||||
echo "$SRV_CMD" > $SRV_OUT
|
||||
printf "# $NAME\n$SRV_CMD\n" > $SRV_OUT
|
||||
provide_input | $SRV_CMD >> $SRV_OUT 2>&1 &
|
||||
SRV_PID=$!
|
||||
wait_server_start "$SRV_PORT" "$SRV_PID"
|
||||
|
||||
echo "$CLI_CMD" > $CLI_OUT
|
||||
printf "# $NAME\n$CLI_CMD\n" > $CLI_OUT
|
||||
eval "$CLI_CMD" >> $CLI_OUT 2>&1 &
|
||||
wait_client_done
|
||||
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ typedef enum
|
|||
/* A compile-time constant with the value 0. If `const_expr` is not a
|
||||
* compile-time constant with a nonzero value, cause a compile-time error. */
|
||||
#define STATIC_ASSERT_EXPR( const_expr ) \
|
||||
( 0 && sizeof( struct { int STATIC_ASSERT : 1 - 2 * ! ( const_expr ); } ) )
|
||||
( 0 && sizeof( struct { unsigned int STATIC_ASSERT : 1 - 2 * ! ( const_expr ); } ) )
|
||||
/* Return the scalar value `value` (possibly promoted). This is a compile-time
|
||||
* constant if `value` is. `condition` must be a compile-time constant.
|
||||
* If `condition` is false, arrange to cause a compile-time error. */
|
||||
|
|
@ -407,45 +407,52 @@ void mbedtls_param_failed( const char *failure_condition,
|
|||
#endif
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
static int redirect_output( FILE** out_stream, const char* path )
|
||||
static int redirect_output( FILE* out_stream, const char* path )
|
||||
{
|
||||
int stdout_fd = dup( fileno( *out_stream ) );
|
||||
int out_fd, dup_fd;
|
||||
FILE* path_stream;
|
||||
|
||||
if( stdout_fd == -1 )
|
||||
out_fd = fileno( out_stream );
|
||||
dup_fd = dup( out_fd );
|
||||
|
||||
if( dup_fd == -1 )
|
||||
{
|
||||
return -1;
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
fflush( *out_stream );
|
||||
fclose( *out_stream );
|
||||
*out_stream = fopen( path, "w" );
|
||||
|
||||
if( *out_stream == NULL )
|
||||
path_stream = fopen( path, "w" );
|
||||
if( path_stream == NULL )
|
||||
{
|
||||
close( stdout_fd );
|
||||
return -1;
|
||||
close( dup_fd );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
return stdout_fd;
|
||||
fflush( out_stream );
|
||||
if( dup2( fileno( path_stream ), out_fd ) == -1 )
|
||||
{
|
||||
close( dup_fd );
|
||||
fclose( path_stream );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
fclose( path_stream );
|
||||
return( dup_fd );
|
||||
}
|
||||
|
||||
static int restore_output( FILE** out_stream, int old_fd )
|
||||
static int restore_output( FILE* out_stream, int dup_fd )
|
||||
{
|
||||
fflush( *out_stream );
|
||||
fclose( *out_stream );
|
||||
int out_fd = fileno( out_stream );
|
||||
|
||||
*out_stream = fdopen( old_fd, "w" );
|
||||
if( *out_stream == NULL )
|
||||
fflush( out_stream );
|
||||
if( dup2( dup_fd, out_fd ) == -1 )
|
||||
{
|
||||
return -1;
|
||||
close( out_fd );
|
||||
close( dup_fd );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void close_output( FILE* out_stream )
|
||||
{
|
||||
fclose( out_stream );
|
||||
close( dup_fd );
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* __unix__ || __APPLE__ __MACH__ */
|
||||
|
||||
|
|
@ -565,7 +572,7 @@ unsigned char *unhexify_alloc( const char *ibuf, size_t *olen )
|
|||
*/
|
||||
static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
||||
{
|
||||
#if !defined(__OpenBSD__)
|
||||
#if !defined(__OpenBSD__) && !defined(__NetBSD__)
|
||||
size_t i;
|
||||
|
||||
if( rng_state != NULL )
|
||||
|
|
@ -578,7 +585,7 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
|||
rng_state = NULL;
|
||||
|
||||
arc4random_buf( output, len );
|
||||
#endif /* !OpenBSD */
|
||||
#endif /* !OpenBSD && !NetBSD */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -555,7 +555,7 @@ int execute_tests( int argc , const char ** argv )
|
|||
*/
|
||||
if( !option_verbose )
|
||||
{
|
||||
stdout_fd = redirect_output( &stdout, "/dev/null" );
|
||||
stdout_fd = redirect_output( stdout, "/dev/null" );
|
||||
if( stdout_fd == -1 )
|
||||
{
|
||||
/* Redirection has failed with no stdout so exit */
|
||||
|
|
@ -575,7 +575,7 @@ int execute_tests( int argc , const char ** argv )
|
|||
}
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
if( !option_verbose && restore_output( &stdout, stdout_fd ) )
|
||||
if( !option_verbose && restore_output( stdout, stdout_fd ) )
|
||||
{
|
||||
/* Redirection has failed with no stdout so exit */
|
||||
exit( 1 );
|
||||
|
|
@ -667,10 +667,5 @@ int execute_tests( int argc , const char ** argv )
|
|||
mbedtls_memory_buffer_alloc_free();
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
if( stdout_fd != -1 )
|
||||
close_output( stdout );
|
||||
#endif /* __unix__ || __APPLE__ __MACH__ */
|
||||
|
||||
return( total_errors != 0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
* Test suite file : $test_case_file
|
||||
* Test suite data : $test_case_data_file
|
||||
*
|
||||
*
|
||||
* This file is part of Mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
|
|
|
|||
|
|
@ -843,6 +843,14 @@ X509 Certificate verification #97 (next profile Valid Cert SHA256 Digest)
|
|||
depends_on:MBEDTLS_SHA256_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PKCS1_V15:MBEDTLS_ECDSA_C:MBEDTLS_SHA1_C
|
||||
x509_verify:"data_files/cert_sha256.crt":"data_files/test-ca.crt":"data_files/crl-ec-sha256.pem":"NULL":0:0:"next":"NULL"
|
||||
|
||||
X509 Certificate verification: domain identical to IPv4 in SubjectAltName
|
||||
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_RSA_C
|
||||
x509_verify:"data_files/server5-tricky-ip-san.crt":"data_files/server5-tricky-ip-san.crt":"data_files/crl_sha256.pem":"abcd":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:"":"NULL"
|
||||
|
||||
X509 Certificate verification: domain identical to IPv6 in SubjectAltName
|
||||
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_RSA_C
|
||||
x509_verify:"data_files/server5-tricky-ip-san.crt":"data_files/server5-tricky-ip-san.crt":"data_files/crl_sha256.pem":"abcd.example.com":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:MBEDTLS_X509_BADCERT_CN_MISMATCH:"":"NULL"
|
||||
|
||||
X509 Certificate verification callback: bad name
|
||||
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_SHA256_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||
x509_verify_callback:"data_files/server5.crt":"data_files/test-ca2.crt":"globalhost":MBEDTLS_ERR_X509_CERT_VERIFY_FAILED:"depth 1 - serial C1\:43\:E2\:7E\:62\:43\:CC\:E8 - subject C=NL, O=PolarSSL, CN=Polarssl Test EC CA - flags 0x00000000\ndepth 0 - serial 09 - subject C=NL, O=PolarSSL, CN=localhost - flags 0x00000004\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue