mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Merge remote-tracking branch 'development' into psa_crypto_config-in-full
Conflicts: * tests/scripts/all.sh: component_test_crypto_full_no_cipher was removed in the development branch.
This commit is contained in:
@ -81,11 +81,15 @@ def get_src_files(since: Optional[str]) -> List[str]:
|
||||
universal_newlines=True)
|
||||
src_files = output.split()
|
||||
if since:
|
||||
output = subprocess.check_output(["git", "diff", "--name-only",
|
||||
since, "--"] +
|
||||
src_files,
|
||||
universal_newlines=True)
|
||||
src_files = output.split()
|
||||
# get all files changed in commits since the starting point
|
||||
cmd = ["git", "log", since + "..HEAD", "--name-only", "--pretty=", "--"] + src_files
|
||||
output = subprocess.check_output(cmd, universal_newlines=True)
|
||||
committed_changed_files = output.split()
|
||||
# and also get all files with uncommitted changes
|
||||
cmd = ["git", "diff", "--name-only", "--"] + src_files
|
||||
output = subprocess.check_output(cmd, universal_newlines=True)
|
||||
uncommitted_changed_files = output.split()
|
||||
src_files = list(set(committed_changed_files + uncommitted_changed_files))
|
||||
|
||||
generated_files = list_generated_files()
|
||||
# Don't correct style for third-party files (and, for simplicity,
|
||||
@ -189,9 +193,10 @@ def main() -> int:
|
||||
parser.add_argument('-f', '--fix', action='store_true',
|
||||
help=('modify source files to fix the code style '
|
||||
'(default: print diff, do not modify files)'))
|
||||
parser.add_argument('-s', '--since', metavar='COMMIT',
|
||||
parser.add_argument('-s', '--since', metavar='COMMIT', const='development', nargs='?',
|
||||
help=('only check files modified since the specified commit'
|
||||
' (e.g. --since=HEAD~3 or --since=development)'))
|
||||
' (e.g. --since=HEAD~3 or --since=development). If no'
|
||||
' commit is specified, default to development.'))
|
||||
# --subset is almost useless: it only matters if there are no files
|
||||
# ('code_style.py' without arguments checks all files known to Git,
|
||||
# 'code_style.py --subset' does nothing). In particular,
|
||||
|
@ -195,6 +195,7 @@ EXCLUDE_FROM_FULL = frozenset([
|
||||
'MBEDTLS_DEPRECATED_WARNING', # conflicts with deprecated options
|
||||
'MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED', # influences the use of ECDH in TLS
|
||||
'MBEDTLS_ECP_NO_FALLBACK', # removes internal ECP implementation
|
||||
'MBEDTLS_ECP_WITH_MPI_UINT', # disables the default ECP and is experimental
|
||||
'MBEDTLS_ENTROPY_FORCE_SHA256', # interacts with CTR_DRBG_128_BIT_KEY
|
||||
'MBEDTLS_HAVE_SSE2', # hardware dependency
|
||||
'MBEDTLS_MEMORY_BACKTRACE', # depends on MEMORY_BUFFER_ALLOC_C
|
||||
@ -204,6 +205,7 @@ EXCLUDE_FROM_FULL = frozenset([
|
||||
'MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES', # removes a feature
|
||||
'MBEDTLS_NO_PLATFORM_ENTROPY', # removes a feature
|
||||
'MBEDTLS_NO_UDBL_DIVISION', # influences anything that uses bignum
|
||||
'MBEDTLS_P256M_EXAMPLE_DRIVER_ENABLED', # influences SECP256R1 KeyGen/ECDH/ECDSA
|
||||
'MBEDTLS_PLATFORM_NO_STD_FUNCTIONS', # removes a feature
|
||||
'MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG', # behavior change + build dependency
|
||||
'MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER', # incompatible with USE_PSA_CRYPTO
|
||||
@ -212,11 +214,10 @@ EXCLUDE_FROM_FULL = frozenset([
|
||||
'MBEDTLS_RSA_NO_CRT', # influences the use of RSA in X.509 and TLS
|
||||
'MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY', # interacts with *_USE_A64_CRYPTO_IF_PRESENT
|
||||
'MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY', # interacts with *_USE_A64_CRYPTO_IF_PRESENT
|
||||
'MBEDTLS_SSL_RECORD_SIZE_LIMIT', # in development, currently breaks other tests
|
||||
'MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN', # build dependency (clang+memsan)
|
||||
'MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND', # build dependency (valgrind headers)
|
||||
'MBEDTLS_X509_REMOVE_INFO', # removes a feature
|
||||
'MBEDTLS_SSL_RECORD_SIZE_LIMIT', # in development, currently breaks other tests
|
||||
'MBEDTLS_P256M_EXAMPLE_DRIVER_ENABLED' # influences SECP256R1 KeyGen/ECDH/ECDSA
|
||||
])
|
||||
|
||||
def is_seamless_alt(name):
|
||||
|
@ -7,7 +7,7 @@
|
||||
{
|
||||
"_comment": "The Mbed TLS transparent driver supports import key/export key",
|
||||
"mbedtls/c_condition": "defined(PSA_CRYPTO_DRIVER_TEST)",
|
||||
"entry_points": ["import_key", "export_key"],
|
||||
"entry_points": ["import_key"],
|
||||
"fallback": true
|
||||
},
|
||||
{
|
||||
|
71
scripts/gitignore_patch.sh
Executable file
71
scripts/gitignore_patch.sh
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-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.
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# For adapting gitignore files for releases so generated files can be included.
|
||||
#
|
||||
# Usage: gitignore_add_generated_files.sh [ -h | --help ] etc
|
||||
#
|
||||
|
||||
set -eu
|
||||
|
||||
print_usage()
|
||||
{
|
||||
echo "Usage: $0"
|
||||
echo -e " -h|--help\t\tPrint this help."
|
||||
echo -e " -i|--ignore\t\tAdd generated files to the gitignores."
|
||||
echo -e " -u|--unignore\t\tRemove generated files from the gitignores."
|
||||
}
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
print_usage
|
||||
exit 1
|
||||
elif [[ $# -ge 2 ]]; then
|
||||
echo "Too many arguments!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
-i | --ignore)
|
||||
IGNORE=true
|
||||
;;
|
||||
-u | --uignore)
|
||||
IGNORE=false
|
||||
;;
|
||||
-h | --help | "")
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1"
|
||||
echo "run '$0 --help' for options"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
GITIGNORES=$(find . -name ".gitignore")
|
||||
for GITIGNORE in $GITIGNORES; do
|
||||
if $IGNORE; then
|
||||
sed -i '/###START_COMMENTED_GENERATED_FILES###/,/###END_COMMENTED_GENERATED_FILES###/s/^# //' $GITIGNORE
|
||||
sed -i 's/###START_COMMENTED_GENERATED_FILES###/###START_GENERATED_FILES###/' $GITIGNORE
|
||||
sed -i 's/###END_COMMENTED_GENERATED_FILES###/###END_GENERATED_FILES###/' $GITIGNORE
|
||||
else
|
||||
sed -i '/###START_GENERATED_FILES###/,/###END_GENERATED_FILES###/s/^/# /' $GITIGNORE
|
||||
sed -i 's/###START_GENERATED_FILES###/###START_COMMENTED_GENERATED_FILES###/' $GITIGNORE
|
||||
sed -i 's/###END_GENERATED_FILES###/###END_COMMENTED_GENERATED_FILES###/' $GITIGNORE
|
||||
fi
|
||||
done
|
@ -21,6 +21,7 @@ from typing import Dict, Iterator, List, Tuple
|
||||
from . import test_case
|
||||
from . import test_data_generation
|
||||
from . import bignum_common
|
||||
from .bignum_data import ADD_SUB_DATA
|
||||
|
||||
class BignumCoreTarget(test_data_generation.BaseTarget):
|
||||
#pylint: disable=abstract-method, too-few-public-methods
|
||||
@ -176,6 +177,7 @@ class BignumCoreAddAndAddIf(BignumCoreTarget, bignum_common.OperationCommon):
|
||||
test_function = "mpi_core_add_and_add_if"
|
||||
test_name = "mpi_core_add_and_add_if"
|
||||
input_style = "arch_split"
|
||||
input_values = ADD_SUB_DATA
|
||||
unique_combinations_only = True
|
||||
|
||||
def result(self) -> List[str]:
|
||||
@ -196,6 +198,7 @@ class BignumCoreSub(BignumCoreTarget, bignum_common.OperationCommon):
|
||||
symbol = "-"
|
||||
test_function = "mpi_core_sub"
|
||||
test_name = "mbedtls_mpi_core_sub"
|
||||
input_values = ADD_SUB_DATA
|
||||
|
||||
def result(self) -> List[str]:
|
||||
if self.int_a >= self.int_b:
|
||||
|
@ -106,6 +106,29 @@ INPUTS_DEFAULT = [
|
||||
RANDOM_1024_BIT_SEED_4_NO2, # largest (not a prime)
|
||||
]
|
||||
|
||||
ADD_SUB_DATA = [
|
||||
"0", "1", "3", "f", "fe", "ff", "100", "ff00",
|
||||
"fffe", "ffff", "10000", # 2^16 - 1, 2^16, 2^16 + 1
|
||||
"fffffffe", "ffffffff", "100000000", # 2^32 - 1, 2^32, 2^32 + 1
|
||||
"1f7f7f7f7f7f7f",
|
||||
"8000000000000000", "fefefefefefefefe",
|
||||
"fffffffffffffffe", "ffffffffffffffff", "10000000000000000", # 2^64 - 1, 2^64, 2^64 + 1
|
||||
"1234567890abcdef0",
|
||||
"fffffffffffffffffffffffe",
|
||||
"ffffffffffffffffffffffff",
|
||||
"1000000000000000000000000",
|
||||
"fffffffffffffffffefefefefefefefe",
|
||||
"fffffffffffffffffffffffffffffffe",
|
||||
"ffffffffffffffffffffffffffffffff",
|
||||
"100000000000000000000000000000000",
|
||||
"1234567890abcdef01234567890abcdef0",
|
||||
"fffffffffffffffffffffffffffffffffffffffffffffffffefefefefefefefe",
|
||||
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe",
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"10000000000000000000000000000000000000000000000000000000000000000",
|
||||
"1234567890abcdef01234567890abcdef01234567890abcdef01234567890abcdef0",
|
||||
]
|
||||
|
||||
# Only odd moduli are present as in the new bignum code only odd moduli are
|
||||
# supported for now.
|
||||
MODULI_DEFAULT = [
|
||||
|
@ -34,7 +34,7 @@ def short_expression(original: str, level: int = 0) -> str:
|
||||
unambiguous, but ad hoc way.
|
||||
"""
|
||||
short = original
|
||||
short = re.sub(r'\bPSA_(?:ALG|ECC_FAMILY|KEY_[A-Z]+)_', r'', short)
|
||||
short = re.sub(r'\bPSA_(?:ALG|DH_FAMILY|ECC_FAMILY|KEY_[A-Z]+)_', r'', short)
|
||||
short = re.sub(r' +', r'', short)
|
||||
if level >= 1:
|
||||
short = re.sub(r'PUBLIC_KEY\b', r'PUB', short)
|
||||
@ -138,6 +138,9 @@ class KeyType:
|
||||
"""Whether the key type is for public keys."""
|
||||
return self.name.endswith('_PUBLIC_KEY')
|
||||
|
||||
DH_KEY_SIZES = {
|
||||
'PSA_DH_FAMILY_RFC7919': (2048, 3072, 4096, 6144, 8192),
|
||||
} # type: Dict[str, Tuple[int, ...]]
|
||||
ECC_KEY_SIZES = {
|
||||
'PSA_ECC_FAMILY_SECP_K1': (192, 224, 256),
|
||||
'PSA_ECC_FAMILY_SECP_R1': (225, 256, 384, 521),
|
||||
@ -175,6 +178,9 @@ class KeyType:
|
||||
if self.private_type == 'PSA_KEY_TYPE_ECC_KEY_PAIR':
|
||||
assert self.params is not None
|
||||
return self.ECC_KEY_SIZES[self.params[0]]
|
||||
if self.private_type == 'PSA_KEY_TYPE_DH_KEY_PAIR':
|
||||
assert self.params is not None
|
||||
return self.DH_KEY_SIZES[self.params[0]]
|
||||
return self.KEY_TYPE_SIZES[self.private_type]
|
||||
|
||||
# "48657265006973206b6579a064617461"
|
||||
@ -261,6 +267,8 @@ class KeyType:
|
||||
if alg.head in {'PURE_EDDSA', 'EDDSA_PREHASH'} and \
|
||||
eccc == EllipticCurveCategory.TWISTED_EDWARDS:
|
||||
return True
|
||||
if self.head == 'DH' and alg.head == 'FFDH':
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
@ -105,9 +105,37 @@ echo
|
||||
print_version "gcc" "--version" "" "head -n 1"
|
||||
echo
|
||||
|
||||
if [ -n "${GCC_EARLIEST+set}" ]; then
|
||||
print_version "${GCC_EARLIEST}" "--version" "" "head -n 1"
|
||||
else
|
||||
echo " GCC_EARLIEST : Not configured."
|
||||
fi
|
||||
echo
|
||||
|
||||
if [ -n "${GCC_LATEST+set}" ]; then
|
||||
print_version "${GCC_LATEST}" "--version" "" "head -n 1"
|
||||
else
|
||||
echo " GCC_LATEST : Not configured."
|
||||
fi
|
||||
echo
|
||||
|
||||
print_version "clang" "--version" "" "head -n 2"
|
||||
echo
|
||||
|
||||
if [ -n "${CLANG_EARLIEST+set}" ]; then
|
||||
print_version "${CLANG_EARLIEST}" "--version" "" "head -n 2"
|
||||
else
|
||||
echo " CLANG_EARLIEST : Not configured."
|
||||
fi
|
||||
echo
|
||||
|
||||
if [ -n "${CLANG_LATEST+set}" ]; then
|
||||
print_version "${CLANG_LATEST}" "--version" "" "head -n 2"
|
||||
else
|
||||
echo " CLANG_LATEST : Not configured."
|
||||
fi
|
||||
echo
|
||||
|
||||
print_version "ldd" "--version" "" "head -n 1"
|
||||
echo
|
||||
|
||||
|
Reference in New Issue
Block a user