mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 11:45:39 +01:00
Update Makefiles and revert changes to config.pl
-Add comments to Makefiles about test env auto-detection -Fix indentation -Remove parent folder from include dirs -Do not use environment variable for defining config file because env variable usage is not fully implemented -Revert changes to config.pl
This commit is contained in:
parent
5e639ed026
commit
c0d2fa7f0b
6
Makefile
6
Makefile
@ -11,9 +11,11 @@ DIR_FOR_MBED_TLS_ENV=./library
|
|||||||
ifneq "$(wildcard $(DIR_FOR_MBED_TLS_ENV) )" ""
|
ifneq "$(wildcard $(DIR_FOR_MBED_TLS_ENV) )" ""
|
||||||
LIBRARY_DIR=./library
|
LIBRARY_DIR=./library
|
||||||
INCLUDE_DIR=./include
|
INCLUDE_DIR=./include
|
||||||
|
CONFIG_FILE=./include/mbedtls/config.h
|
||||||
else
|
else
|
||||||
LIBRARY_DIR=./src
|
LIBRARY_DIR=./src
|
||||||
INCLUDE_DIR=./inc
|
INCLUDE_DIR=./inc
|
||||||
|
CONFIG_FILE=./inc/mbedtls/test_config.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.SILENT:
|
.SILENT:
|
||||||
@ -87,11 +89,11 @@ post_build:
|
|||||||
ifndef WINDOWS
|
ifndef WINDOWS
|
||||||
|
|
||||||
# If 128-bit keys are configured for CTR_DRBG, display an appropriate warning
|
# If 128-bit keys are configured for CTR_DRBG, display an appropriate warning
|
||||||
-scripts/config.pl get MBEDTLS_CTR_DRBG_USE_128_BIT_KEY && ([ $$? -eq 0 ]) && \
|
-scripts/config.pl -f $(CONFIG_FILE) get MBEDTLS_CTR_DRBG_USE_128_BIT_KEY && ([ $$? -eq 0 ]) && \
|
||||||
echo '$(CTR_DRBG_128_BIT_KEY_WARNING)'
|
echo '$(CTR_DRBG_128_BIT_KEY_WARNING)'
|
||||||
|
|
||||||
# If NULL Entropy is configured, display an appropriate warning
|
# If NULL Entropy is configured, display an appropriate warning
|
||||||
-scripts/config.pl get MBEDTLS_TEST_NULL_ENTROPY && ([ $$? -eq 0 ]) && \
|
-scripts/config.pl -f $(CONFIG_FILE) get MBEDTLS_TEST_NULL_ENTROPY && ([ $$? -eq 0 ]) && \
|
||||||
echo '$(NULL_ENTROPY_WARNING)'
|
echo '$(NULL_ENTROPY_WARNING)'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -13,13 +13,11 @@ ifneq "$(wildcard $(DIR_FOR_MBED_TLS_ENV) )" ""
|
|||||||
INCLUDE_DIRS=-I../include
|
INCLUDE_DIRS=-I../include
|
||||||
else
|
else
|
||||||
# Set include dirs for Mbed OS test environment
|
# Set include dirs for Mbed OS test environment
|
||||||
INCLUDE_DIRS=-I.. -I../inc
|
INCLUDE_DIRS=-I../inc
|
||||||
|
CFLAGS += "-DMBEDTLS_CONFIG_FILE=\"mbedtls/test_config.h\""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LOCAL_CFLAGS = $(WARNING_CFLAGS) $(INCLUDE_DIRS) -D_FILE_OFFSET_BITS=64
|
LOCAL_CFLAGS = $(WARNING_CFLAGS) $(INCLUDE_DIRS) -D_FILE_OFFSET_BITS=64
|
||||||
ifdef MBEDTLS_CONFIG_FILE
|
|
||||||
LOCAL_CFLAGS += "-DMBEDTLS_CONFIG_FILE=\"${MBEDTLS_CONFIG_FILE}\""
|
|
||||||
endif
|
|
||||||
|
|
||||||
LOCAL_LDFLAGS =
|
LOCAL_LDFLAGS =
|
||||||
|
|
||||||
|
@ -15,13 +15,11 @@ ifneq "$(wildcard $(DIR_FOR_MBED_TLS_ENV) )" ""
|
|||||||
INCLUDE_DIR=-I../include
|
INCLUDE_DIR=-I../include
|
||||||
else
|
else
|
||||||
LIBRARY_DIR=../src
|
LIBRARY_DIR=../src
|
||||||
INCLUDE_DIR=-I.. -I../inc
|
INCLUDE_DIR=-I../inc
|
||||||
|
CFLAGS += "-DMBEDTLS_CONFIG_FILE=\"mbedtls/test_config.h\""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LOCAL_CFLAGS = $(WARNING_CFLAGS) $(INCLUDE_DIR) -D_FILE_OFFSET_BITS=64
|
LOCAL_CFLAGS = $(WARNING_CFLAGS) $(INCLUDE_DIR) -D_FILE_OFFSET_BITS=64
|
||||||
ifdef MBEDTLS_CONFIG_FILE
|
|
||||||
LOCAL_CFLAGS += "-DMBEDTLS_CONFIG_FILE=\"${MBEDTLS_CONFIG_FILE}\""
|
|
||||||
endif
|
|
||||||
|
|
||||||
LOCAL_CXXFLAGS = $(WARNING_CXXFLAGS) $(INCLUDE_DIR) -D_FILE_OFFSET_BITS=64
|
LOCAL_CXXFLAGS = $(WARNING_CXXFLAGS) $(INCLUDE_DIR) -D_FILE_OFFSET_BITS=64
|
||||||
LOCAL_LDFLAGS = -L$(LIBRARY_DIR) \
|
LOCAL_LDFLAGS = -L$(LIBRARY_DIR) \
|
||||||
|
@ -53,28 +53,7 @@
|
|||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my $config_file;
|
my $config_file = "include/mbedtls/config.h";
|
||||||
my $include_dir;
|
|
||||||
my $library_dir;
|
|
||||||
my $mbedtls_config_file = $ENV{"MBEDTLS_CONFIG_FILE"};
|
|
||||||
|
|
||||||
if ( ( -d "../library") || ( -d "./library") ) {
|
|
||||||
# library directory is present, we are using Mbed TLS namespace
|
|
||||||
$config_file = "include/mbedtls/config.h";
|
|
||||||
$include_dir = "include";
|
|
||||||
$library_dir = "library";
|
|
||||||
} else {
|
|
||||||
# library directory is not present, we are using Mbed OS namespace
|
|
||||||
$config_file = "inc/mbedtls/config.h";
|
|
||||||
$include_dir = "inc";
|
|
||||||
$library_dir = "src";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( length $mbedtls_config_file ) {
|
|
||||||
$mbedtls_config_file = substr $mbedtls_config_file, 1, -1;
|
|
||||||
$config_file = $include_dir . "/" . $mbedtls_config_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $usage = <<EOU;
|
my $usage = <<EOU;
|
||||||
$0 [-f <file> | --file <file>] [-o | --force]
|
$0 [-f <file> | --file <file>] [-o | --force]
|
||||||
[set <symbol> <value> | unset <symbol> | get <symbol> |
|
[set <symbol> <value> | unset <symbol> | get <symbol> |
|
||||||
@ -226,7 +205,7 @@ if (! -f $config_file) {
|
|||||||
chdir '..' or die;
|
chdir '..' or die;
|
||||||
|
|
||||||
# Confirm this is the project root directory and try again
|
# Confirm this is the project root directory and try again
|
||||||
if ( !(-d 'scripts' && -d $include_dir && -d $library_dir && -f $config_file) ) {
|
if ( !(-d 'scripts' && -d 'include' && -d 'library' && -f $config_file) ) {
|
||||||
die "If no file specified, must be run from the project root or scripts directory.\n";
|
die "If no file specified, must be run from the project root or scripts directory.\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,11 @@ ifneq "$(wildcard $(DIR_FOR_MBED_TLS_ENV) )" ""
|
|||||||
INCLUDE_DIR=-I../include
|
INCLUDE_DIR=-I../include
|
||||||
else
|
else
|
||||||
LIBRARY_DIR=../src
|
LIBRARY_DIR=../src
|
||||||
INCLUDE_DIR=-I.. -I../inc
|
INCLUDE_DIR=-I../inc
|
||||||
|
CFLAGS += "-DMBEDTLS_CONFIG_FILE=\"mbedtls/test_config.h\""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LOCAL_CFLAGS = $(WARNING_CFLAGS) $(INCLUDE_DIR) -D_FILE_OFFSET_BITS=64
|
LOCAL_CFLAGS = $(WARNING_CFLAGS) $(INCLUDE_DIR) -D_FILE_OFFSET_BITS=64
|
||||||
ifdef MBEDTLS_CONFIG_FILE
|
|
||||||
LOCAL_CFLAGS += "-DMBEDTLS_CONFIG_FILE=\"${MBEDTLS_CONFIG_FILE}\""
|
|
||||||
endif
|
|
||||||
|
|
||||||
LOCAL_LDFLAGS = -L$(LIBRARY_DIR) \
|
LOCAL_LDFLAGS = -L$(LIBRARY_DIR) \
|
||||||
-lmbedtls$(SHARED_SUFFIX) \
|
-lmbedtls$(SHARED_SUFFIX) \
|
||||||
|
@ -21,6 +21,18 @@
|
|||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
|
# Detect used test environment: Mbed TLS or Mbed OS
|
||||||
|
if [ -f "../include/mbedtls/config.h" ]
|
||||||
|
then
|
||||||
|
CONFIG_FILE=../include/mbedtls/config.h
|
||||||
|
elif [ -f "../inc/mbedtls/test_config.h" ]
|
||||||
|
then
|
||||||
|
CONFIG_FILE=../inc/mbedtls/test_config.h
|
||||||
|
else
|
||||||
|
echo "Can't locate config file, must be run from mbed TLS root" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Limit the size of each log to 10 GiB, in case of failures with this script
|
# Limit the size of each log to 10 GiB, in case of failures with this script
|
||||||
# where it may output seemingly unlimited length error logs.
|
# where it may output seemingly unlimited length error logs.
|
||||||
ulimit -f 20971520
|
ulimit -f 20971520
|
||||||
@ -297,9 +309,9 @@ requires_not_i686() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Calculate the input & output maximum content lengths set in the config
|
# Calculate the input & output maximum content lengths set in the config
|
||||||
MAX_CONTENT_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_MAX_CONTENT_LEN || echo "16384")
|
MAX_CONTENT_LEN=$( ../scripts/config.pl -f $CONFIG_FILE get MBEDTLS_SSL_MAX_CONTENT_LEN || echo "16384")
|
||||||
MAX_IN_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_IN_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
|
MAX_IN_LEN=$( ../scripts/config.pl -f $CONFIG_FILE get MBEDTLS_SSL_IN_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
|
||||||
MAX_OUT_LEN=$( ../scripts/config.pl get MBEDTLS_SSL_OUT_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
|
MAX_OUT_LEN=$( ../scripts/config.pl -f $CONFIG_FILE get MBEDTLS_SSL_OUT_CONTENT_LEN || echo "$MAX_CONTENT_LEN")
|
||||||
|
|
||||||
if [ "$MAX_IN_LEN" -lt "$MAX_CONTENT_LEN" ]; then
|
if [ "$MAX_IN_LEN" -lt "$MAX_CONTENT_LEN" ]; then
|
||||||
MAX_CONTENT_LEN="$MAX_IN_LEN"
|
MAX_CONTENT_LEN="$MAX_IN_LEN"
|
||||||
|
Loading…
Reference in New Issue
Block a user