初始提交:terminalX 可运行态(M0/M1/M1.5 已真机验证)
- M0: libghostty SSH 终端(渲染/输入/连接)+ 白屏修复(OutputGate) + 会话状态机/自动重连 - M1: tsnet 用户态组网 + SSH-over-tsnet(fd 桥),shell 级真机验证;R5(Go+gvisor+C+++Swift 同进程) retire - M1.5: tmux -CC 原生 tab(MVP) - 结构: packages/(TXCore·TXTransport), apps/TerminalX, vendor/(libghostty-spm/libssh2/mbedtls/tsnet-bridge), artifacts/ - 文档: CLAUDE.md + docs/HANDOFF.md(新会话入口) - 环境: 认证代理→依赖 vendor 本地化;Go 在 ~/.local/go;仅模拟器/未签名 - 待续: M2 mosh, tmux 多 pane, M4 安全(host key/SE) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
32
vendor/mbedtls/tests/.gitignore
vendored
Normal file
32
vendor/mbedtls/tests/.gitignore
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
*.sln
|
||||
*.vcxproj
|
||||
|
||||
*.log
|
||||
/test_suite*
|
||||
/data_files/mpi_write
|
||||
/data_files/hmac_drbg_seed
|
||||
/data_files/ctr_drbg_seed
|
||||
/data_files/entropy_seed
|
||||
|
||||
/include/alt-extra/psa/crypto_platform_alt.h
|
||||
/include/alt-extra/psa/crypto_struct_alt.h
|
||||
/include/test/instrument_record_status.h
|
||||
|
||||
/src/libmbed*
|
||||
|
||||
/libtestdriver1/*
|
||||
|
||||
####START_COMMENTED_GENERATED_FILES###
|
||||
## Generated source files
|
||||
#/opt-testcases/handshake-generated.sh
|
||||
#/opt-testcases/tls13-compat.sh
|
||||
#/src/psa_test_wrappers.c
|
||||
#/suites/*.generated.data
|
||||
#/suites/test_suite_config.mbedtls_boolean.data
|
||||
#/suites/test_suite_config.psa_boolean.data
|
||||
#/suites/test_suite_psa_crypto_storage_format.v[0-9]*.data
|
||||
#/suites/test_suite_psa_crypto_storage_format.current.data
|
||||
#/include/test/psa_test_wrappers.h
|
||||
#/include/test/test_keys.h
|
||||
#/include/test/test_certs.h
|
||||
####END_COMMENTED_GENERATED_FILES###
|
||||
1
vendor/mbedtls/tests/.jenkins/Jenkinsfile
vendored
Normal file
1
vendor/mbedtls/tests/.jenkins/Jenkinsfile
vendored
Normal file
@@ -0,0 +1 @@
|
||||
mbedtls.run_job()
|
||||
395
vendor/mbedtls/tests/CMakeLists.txt
vendored
Normal file
395
vendor/mbedtls/tests/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,395 @@
|
||||
set(libs
|
||||
${mbedtls_target}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
# Set the project root directory if it's not already defined, as may happen if
|
||||
# the tests folder is included directly by a parent project, without including
|
||||
# the top level CMakeLists.txt.
|
||||
if(NOT DEFINED MBEDTLS_DIR)
|
||||
set(MBEDTLS_DIR ${CMAKE_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
if(NOT MBEDTLS_PYTHON_EXECUTABLE)
|
||||
message(FATAL_ERROR "Cannot build test suites without Python 3")
|
||||
endif()
|
||||
|
||||
# generated .data files will go there
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/suites)
|
||||
|
||||
# Get base names for generated files
|
||||
execute_process(
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_bignum_tests.py
|
||||
--list-for-cmake
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
OUTPUT_VARIABLE
|
||||
base_bignum_generated_data_files)
|
||||
string(REGEX REPLACE "[^;]*/" ""
|
||||
base_bignum_generated_data_files "${base_bignum_generated_data_files}")
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_config_tests.py
|
||||
--list-for-cmake
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
OUTPUT_VARIABLE
|
||||
base_config_generated_data_files)
|
||||
string(REGEX REPLACE "[^;]*/" ""
|
||||
base_config_generated_data_files "${base_config_generated_data_files}")
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_ecp_tests.py
|
||||
--list-for-cmake
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
OUTPUT_VARIABLE
|
||||
base_ecp_generated_data_files)
|
||||
string(REGEX REPLACE "[^;]*/" ""
|
||||
base_ecp_generated_data_files "${base_ecp_generated_data_files}")
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_psa_tests.py
|
||||
--list-for-cmake
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
OUTPUT_VARIABLE
|
||||
base_psa_generated_data_files)
|
||||
string(REGEX REPLACE "[^;]*/" ""
|
||||
base_psa_generated_data_files "${base_psa_generated_data_files}")
|
||||
|
||||
# Derive generated file paths in the build directory. The generated data
|
||||
# files go into the suites/ subdirectory.
|
||||
set(base_generated_data_files
|
||||
${base_bignum_generated_data_files} ${base_config_generated_data_files}
|
||||
${base_ecp_generated_data_files} ${base_psa_generated_data_files})
|
||||
string(REGEX REPLACE "([^;]+)" "suites/\\1"
|
||||
all_generated_data_files "${base_generated_data_files}")
|
||||
set(bignum_generated_data_files "")
|
||||
set(config_generated_data_files "")
|
||||
set(ecp_generated_data_files "")
|
||||
set(psa_generated_data_files "")
|
||||
foreach(file ${base_bignum_generated_data_files})
|
||||
list(APPEND bignum_generated_data_files ${CMAKE_CURRENT_BINARY_DIR}/suites/${file})
|
||||
endforeach()
|
||||
foreach(file ${base_config_generated_data_files})
|
||||
list(APPEND config_generated_data_files ${CMAKE_CURRENT_BINARY_DIR}/suites/${file})
|
||||
endforeach()
|
||||
foreach(file ${base_ecp_generated_data_files})
|
||||
list(APPEND ecp_generated_data_files ${CMAKE_CURRENT_BINARY_DIR}/suites/${file})
|
||||
endforeach()
|
||||
foreach(file ${base_psa_generated_data_files})
|
||||
list(APPEND psa_generated_data_files ${CMAKE_CURRENT_BINARY_DIR}/suites/${file})
|
||||
endforeach()
|
||||
|
||||
if(GEN_FILES)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${bignum_generated_data_files}
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_bignum_tests.py
|
||||
--directory ${CMAKE_CURRENT_BINARY_DIR}/suites
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_bignum_tests.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_common.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_core.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_mod_raw.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_mod.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_case.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_data_generation.py
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${config_generated_data_files}
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_config_tests.py
|
||||
--directory ${CMAKE_CURRENT_BINARY_DIR}/suites
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_config_tests.py
|
||||
# Do not declare the configuration files as dependencies: they
|
||||
# change too often in ways that don't affect the result
|
||||
# ((un)commenting some options).
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/handshake-generated.sh
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
COMMAND
|
||||
"${MBEDTLS_PYTHON_EXECUTABLE}"
|
||||
"${PROJECT_SOURCE_DIR}/scripts/generate_tls_handshake_tests.py"
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/tls_test_case.py
|
||||
${PROJECT_SOURCE_DIR}/scripts/generate_tls_handshake_tests.py
|
||||
)
|
||||
add_custom_target(handshake-generated.sh
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/handshake-generated.sh)
|
||||
set_target_properties(handshake-generated.sh PROPERTIES EXCLUDE_FROM_ALL NO)
|
||||
add_dependencies(${ssl_opt_target} handshake-generated.sh)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${ecp_generated_data_files}
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_ecp_tests.py
|
||||
--directory ${CMAKE_CURRENT_BINARY_DIR}/suites
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_ecp_tests.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_common.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/ecp.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_case.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_data_generation.py
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${psa_generated_data_files}
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_psa_tests.py
|
||||
--directory ${CMAKE_CURRENT_BINARY_DIR}/suites
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_psa_tests.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/crypto_data_tests.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/crypto_knowledge.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/macro_collector.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/psa_information.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/psa_storage.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/psa_test_case.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_case.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_data_generation.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_config.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_values.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_extra.h
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/tls13-compat.sh
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
COMMAND
|
||||
"${MBEDTLS_PYTHON_EXECUTABLE}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_tls13_compat_tests.py"
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_tls13_compat_tests.py
|
||||
)
|
||||
add_custom_target(tls13-compat.sh
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/opt-testcases/tls13-compat.sh)
|
||||
set_target_properties(tls13-compat.sh PROPERTIES EXCLUDE_FROM_ALL NO)
|
||||
add_dependencies(${ssl_opt_target} tls13-compat.sh)
|
||||
|
||||
else()
|
||||
foreach(file ${all_generated_data_files})
|
||||
link_to_source(${file})
|
||||
endforeach()
|
||||
endif()
|
||||
# CMake generates sub-makefiles for each target and calls them in subprocesses.
|
||||
# Without this command, cmake will generate rules in each sub-makefile. As a result,
|
||||
# they can cause race conditions in parallel builds.
|
||||
# With this line, only 4 sub-makefiles include the above command, that reduces
|
||||
# the risk of a race.
|
||||
add_custom_target(test_suite_bignum_generated_data DEPENDS ${bignum_generated_data_files})
|
||||
add_custom_target(test_suite_config_generated_data DEPENDS ${config_generated_data_files})
|
||||
add_custom_target(test_suite_ecp_generated_data DEPENDS ${ecp_generated_data_files})
|
||||
add_custom_target(test_suite_psa_generated_data DEPENDS ${psa_generated_data_files})
|
||||
# If SKIP_TEST_SUITES is not defined with -D, get it from the environment.
|
||||
if((NOT DEFINED SKIP_TEST_SUITES) AND (DEFINED ENV{SKIP_TEST_SUITES}))
|
||||
set(SKIP_TEST_SUITES $ENV{SKIP_TEST_SUITES})
|
||||
endif()
|
||||
# Test suites caught by SKIP_TEST_SUITES are built but not executed.
|
||||
# "foo" as a skip pattern skips "test_suite_foo" and "test_suite_foo.bar"
|
||||
# but not "test_suite_foobar".
|
||||
string(REGEX REPLACE "[ ,;]" "|" SKIP_TEST_SUITES_REGEX "${SKIP_TEST_SUITES}")
|
||||
string(REPLACE "." "\\." SKIP_TEST_SUITES_REGEX "${SKIP_TEST_SUITES_REGEX}")
|
||||
set(SKIP_TEST_SUITES_REGEX "^(${SKIP_TEST_SUITES_REGEX})(\$|\\.)")
|
||||
|
||||
function(add_test_suite suite_name)
|
||||
if(ARGV1)
|
||||
set(data_name ${ARGV1})
|
||||
else()
|
||||
set(data_name ${suite_name})
|
||||
endif()
|
||||
|
||||
# Get the test names of the tests with generated .data files
|
||||
# from the generated_data_files list in parent scope.
|
||||
set(bignum_generated_data_names "")
|
||||
set(config_generated_data_names "")
|
||||
set(ecp_generated_data_names "")
|
||||
set(psa_generated_data_names "")
|
||||
foreach(generated_data_file ${bignum_generated_data_files})
|
||||
# Get the plain filename
|
||||
get_filename_component(generated_data_name ${generated_data_file} NAME)
|
||||
# Remove the ".data" extension
|
||||
get_name_without_last_ext(generated_data_name ${generated_data_name})
|
||||
# Remove leading "test_suite_"
|
||||
string(SUBSTRING ${generated_data_name} 11 -1 generated_data_name)
|
||||
list(APPEND bignum_generated_data_names ${generated_data_name})
|
||||
endforeach()
|
||||
foreach(generated_data_file ${config_generated_data_files})
|
||||
# Get the plain filename
|
||||
get_filename_component(generated_data_name ${generated_data_file} NAME)
|
||||
# Remove the ".data" extension
|
||||
get_name_without_last_ext(generated_data_name ${generated_data_name})
|
||||
# Remove leading "test_suite_"
|
||||
string(SUBSTRING ${generated_data_name} 11 -1 generated_data_name)
|
||||
list(APPEND config_generated_data_names ${generated_data_name})
|
||||
endforeach()
|
||||
foreach(generated_data_file ${ecp_generated_data_files})
|
||||
# Get the plain filename
|
||||
get_filename_component(generated_data_name ${generated_data_file} NAME)
|
||||
# Remove the ".data" extension
|
||||
get_name_without_last_ext(generated_data_name ${generated_data_name})
|
||||
# Remove leading "test_suite_"
|
||||
string(SUBSTRING ${generated_data_name} 11 -1 generated_data_name)
|
||||
list(APPEND ecp_generated_data_names ${generated_data_name})
|
||||
endforeach()
|
||||
foreach(generated_data_file ${psa_generated_data_files})
|
||||
# Get the plain filename
|
||||
get_filename_component(generated_data_name ${generated_data_file} NAME)
|
||||
# Remove the ".data" extension
|
||||
get_name_without_last_ext(generated_data_name ${generated_data_name})
|
||||
# Remove leading "test_suite_"
|
||||
string(SUBSTRING ${generated_data_name} 11 -1 generated_data_name)
|
||||
list(APPEND psa_generated_data_names ${generated_data_name})
|
||||
endforeach()
|
||||
|
||||
if(";${bignum_generated_data_names};" MATCHES ";${data_name};")
|
||||
set(data_file
|
||||
${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_${data_name}.data)
|
||||
set(dependency test_suite_bignum_generated_data)
|
||||
elseif(";${config_generated_data_names};" MATCHES ";${data_name};")
|
||||
set(data_file
|
||||
${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_${data_name}.data)
|
||||
set(dependency test_suite_config_generated_data)
|
||||
elseif(";${ecp_generated_data_names};" MATCHES ";${data_name};")
|
||||
set(data_file
|
||||
${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_${data_name}.data)
|
||||
set(dependency test_suite_ecp_generated_data)
|
||||
elseif(";${psa_generated_data_names};" MATCHES ";${data_name};")
|
||||
set(data_file
|
||||
${CMAKE_CURRENT_BINARY_DIR}/suites/test_suite_${data_name}.data)
|
||||
set(dependency test_suite_psa_generated_data)
|
||||
else()
|
||||
set(data_file
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data)
|
||||
set(dependency
|
||||
test_suite_bignum_generated_data
|
||||
test_suite_config_generated_data
|
||||
test_suite_ecp_generated_data
|
||||
test_suite_psa_generated_data)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
# The output filename of generate_test_code.py is derived from the -d
|
||||
# input argument.
|
||||
test_suite_${data_name}.c
|
||||
COMMAND
|
||||
${MBEDTLS_PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_test_code.py
|
||||
-f ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function
|
||||
-d ${data_file}
|
||||
-t ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function
|
||||
-p ${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function
|
||||
-s ${CMAKE_CURRENT_SOURCE_DIR}/suites
|
||||
--helpers-file ${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function
|
||||
-o .
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/generate_test_code.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function
|
||||
${data_file}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function
|
||||
${mbedtls_target}
|
||||
BYPRODUCTS
|
||||
test_suite_${data_name}.datax
|
||||
)
|
||||
|
||||
add_executable(test_suite_${data_name} test_suite_${data_name}.c
|
||||
$<TARGET_OBJECTS:mbedtls_test>
|
||||
$<TARGET_OBJECTS:mbedtls_test_helpers>)
|
||||
add_dependencies(test_suite_${data_name} ${dependency})
|
||||
target_link_libraries(test_suite_${data_name} ${libs})
|
||||
# Include test-specific header files from ./include and private header
|
||||
# files (used by some invasive tests) from ../library. Public header
|
||||
# files are automatically included because the library targets declare
|
||||
# them as PUBLIC.
|
||||
target_include_directories(test_suite_${data_name}
|
||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../framework/tests/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../library)
|
||||
# Request C11, which is needed for memory poisoning tests
|
||||
set_target_properties(test_suite_${data_name} PROPERTIES C_STANDARD 11)
|
||||
|
||||
if(${data_name} MATCHES ${SKIP_TEST_SUITES_REGEX})
|
||||
message(STATUS "The test suite ${data_name} will not be executed.")
|
||||
else()
|
||||
add_test(${data_name}-suite test_suite_${data_name} --verbose)
|
||||
endif()
|
||||
endfunction(add_test_suite)
|
||||
|
||||
# Enable definition of various functions used throughout the testsuite
|
||||
# (gethostname, strdup, fileno...) even when compiling with -std=c99. Harmless
|
||||
# on non-POSIX platforms.
|
||||
add_definitions("-D_POSIX_C_SOURCE=200809L")
|
||||
|
||||
if(CMAKE_COMPILER_IS_CLANG)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code")
|
||||
endif(CMAKE_COMPILER_IS_CLANG)
|
||||
|
||||
if(MSVC)
|
||||
# If a warning level has been defined, suppress all warnings for test code
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX-")
|
||||
endif(MSVC)
|
||||
|
||||
file(GLOB test_suites RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" suites/*.data)
|
||||
list(APPEND test_suites ${all_generated_data_files})
|
||||
# If the generated .data files are present in the source tree, we just added
|
||||
# them twice, both through GLOB and through ${all_generated_data_files}.
|
||||
list(REMOVE_DUPLICATES test_suites)
|
||||
list(SORT test_suites)
|
||||
foreach(test_suite ${test_suites})
|
||||
get_filename_component(data_name ${test_suite} NAME)
|
||||
string(REGEX REPLACE "\\.data\$" "" data_name "${data_name}")
|
||||
string(REPLACE "test_suite_" "" data_name "${data_name}")
|
||||
string(REGEX MATCH "[^.]*" function_name "${data_name}")
|
||||
add_test_suite(${function_name} ${data_name})
|
||||
endforeach(test_suite)
|
||||
|
||||
# Make scripts and data files needed for testing available in an
|
||||
# out-of-source build.
|
||||
if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/seedfile")
|
||||
link_to_source(seedfile)
|
||||
endif()
|
||||
link_to_source(Descriptions.txt)
|
||||
link_to_source(compat.sh)
|
||||
link_to_source(context-info.sh)
|
||||
link_to_source(../framework/data_files)
|
||||
link_to_source(scripts)
|
||||
link_to_source(ssl-opt.sh)
|
||||
link_to_source(opt-testcases)
|
||||
endif()
|
||||
22
vendor/mbedtls/tests/Descriptions.txt
vendored
Normal file
22
vendor/mbedtls/tests/Descriptions.txt
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
test_suites
|
||||
The various 'test_suite_XXX' programs from the 'tests' directory, executed
|
||||
using 'make check' (Unix make) or 'make test' (Cmake), include test cases
|
||||
(reference test vectors, sanity checks, malformed input for parsing
|
||||
functions, etc.) for all modules except the SSL modules.
|
||||
|
||||
selftests
|
||||
The 'programs/test/selftest' program runs the 'XXX_self_test()' functions
|
||||
of each individual module. Most of them are included in the respective
|
||||
test suite, but some slower ones are only included here.
|
||||
|
||||
compat
|
||||
The 'tests/compat.sh' script checks interoperability with OpenSSL and
|
||||
GnuTLS (and ourselves!) for every common ciphersuite, in every TLS
|
||||
version, both ways (client/server), using client authentication or not.
|
||||
For each ciphersuite/version/side/authmode it performs a full handshake
|
||||
and a small data exchange.
|
||||
|
||||
ssl_opt
|
||||
The 'tests/ssl-opt.sh' script checks various options and/or operations not
|
||||
covered by compat.sh: session resumption (using session cache or tickets),
|
||||
renegotiation, SNI, other extensions, etc.
|
||||
323
vendor/mbedtls/tests/Makefile
vendored
Normal file
323
vendor/mbedtls/tests/Makefile
vendored
Normal file
@@ -0,0 +1,323 @@
|
||||
MBEDTLS_TEST_PATH = .
|
||||
include ../scripts/common.make
|
||||
|
||||
# Set this to -v to see the details of failing test cases
|
||||
TEST_FLAGS ?= $(if $(filter-out 0 OFF Off off NO No no FALSE False false N n,$(CTEST_OUTPUT_ON_FAILURE)),-v,)
|
||||
|
||||
# Also include library headers, for the sake of invasive tests.
|
||||
LOCAL_CFLAGS += -I../library
|
||||
|
||||
# Enable definition of various functions used throughout the testsuite
|
||||
# (gethostname, strdup, fileno...) even when compiling with -std=c99. Harmless
|
||||
# on non-POSIX platforms.
|
||||
LOCAL_CFLAGS += -D_POSIX_C_SOURCE=200809L
|
||||
|
||||
ifdef RECORD_PSA_STATUS_COVERAGE_LOG
|
||||
LOCAL_CFLAGS += -Werror -DRECORD_PSA_STATUS_COVERAGE_LOG
|
||||
endif
|
||||
|
||||
GENERATED_BIGNUM_DATA_FILES := $(patsubst tests/%,%,$(shell \
|
||||
$(PYTHON) ../framework/scripts/generate_bignum_tests.py --list || \
|
||||
echo FAILED \
|
||||
))
|
||||
ifeq ($(GENERATED_BIGNUM_DATA_FILES),FAILED)
|
||||
$(error "$(PYTHON) ../framework/scripts/generate_bignum_tests.py --list" failed)
|
||||
endif
|
||||
GENERATED_DATA_FILES += $(GENERATED_BIGNUM_DATA_FILES)
|
||||
|
||||
GENERATED_CONFIG_DATA_FILES := $(patsubst tests/%,%,$(shell \
|
||||
$(PYTHON) ../framework/scripts/generate_config_tests.py --list || \
|
||||
echo FAILED \
|
||||
))
|
||||
ifeq ($(GENERATED_CONFIG_DATA_FILES),FAILED)
|
||||
$(error "$(PYTHON) ../framework/scripts/generate_config_tests.py --list" failed)
|
||||
endif
|
||||
GENERATED_DATA_FILES += $(GENERATED_CONFIG_DATA_FILES)
|
||||
|
||||
GENERATED_ECP_DATA_FILES := $(patsubst tests/%,%,$(shell \
|
||||
$(PYTHON) ../framework/scripts/generate_ecp_tests.py --list || \
|
||||
echo FAILED \
|
||||
))
|
||||
ifeq ($(GENERATED_ECP_DATA_FILES),FAILED)
|
||||
$(error "$(PYTHON) ../framework/scripts/generate_ecp_tests.py --list" failed)
|
||||
endif
|
||||
GENERATED_DATA_FILES += $(GENERATED_ECP_DATA_FILES)
|
||||
|
||||
GENERATED_PSA_DATA_FILES := $(patsubst tests/%,%,$(shell \
|
||||
$(PYTHON) ../framework/scripts/generate_psa_tests.py --list || \
|
||||
echo FAILED \
|
||||
))
|
||||
ifeq ($(GENERATED_PSA_DATA_FILES),FAILED)
|
||||
$(error "$(PYTHON) ../framework/scripts/generate_psa_tests.py --list" failed)
|
||||
endif
|
||||
GENERATED_DATA_FILES += $(GENERATED_PSA_DATA_FILES)
|
||||
|
||||
GENERATED_FILES = $(GENERATED_DATA_FILES)
|
||||
GENERATED_FILES += include/test/test_keys.h include/test/test_certs.h
|
||||
GENERATED_FILES += include/test/psa_test_wrappers.h src/psa_test_wrappers.c
|
||||
|
||||
# Generated files needed to (fully) run ssl-opt.sh
|
||||
.PHONY: ssl-opt
|
||||
|
||||
opt-testcases/handshake-generated.sh: ../framework/scripts/mbedtls_framework/tls_test_case.py
|
||||
opt-testcases/handshake-generated.sh: ../scripts/generate_tls_handshake_tests.py
|
||||
echo " Gen $@"
|
||||
$(PYTHON) ../scripts/generate_tls_handshake_tests.py -o $@
|
||||
GENERATED_FILES += opt-testcases/handshake-generated.sh
|
||||
ssl-opt: opt-testcases/handshake-generated.sh
|
||||
|
||||
opt-testcases/tls13-compat.sh: ../framework/scripts/generate_tls13_compat_tests.py
|
||||
echo " Gen $@"
|
||||
$(PYTHON) ../framework/scripts/generate_tls13_compat_tests.py -o $@
|
||||
GENERATED_FILES += opt-testcases/tls13-compat.sh
|
||||
ssl-opt: opt-testcases/tls13-compat.sh
|
||||
|
||||
.PHONY: generated_files
|
||||
generated_files: $(GENERATED_FILES)
|
||||
|
||||
# generate_bignum_tests.py and generate_psa_tests.py spend more time analyzing
|
||||
# inputs than generating outputs. Its inputs are the same no matter which files
|
||||
# are being generated.
|
||||
# It's rare not to want all the outputs. So always generate all of its outputs.
|
||||
# Use an intermediate phony dependency so that parallel builds don't run
|
||||
# a separate instance of the recipe for each output file.
|
||||
$(GENERATED_BIGNUM_DATA_FILES): $(gen_file_dep) generated_bignum_test_data
|
||||
generated_bignum_test_data: ../framework/scripts/generate_bignum_tests.py
|
||||
generated_bignum_test_data: ../framework/scripts/mbedtls_framework/bignum_common.py
|
||||
generated_bignum_test_data: ../framework/scripts/mbedtls_framework/bignum_core.py
|
||||
generated_bignum_test_data: ../framework/scripts/mbedtls_framework/bignum_mod_raw.py
|
||||
generated_bignum_test_data: ../framework/scripts/mbedtls_framework/bignum_mod.py
|
||||
generated_bignum_test_data: ../framework/scripts/mbedtls_framework/test_case.py
|
||||
generated_bignum_test_data: ../framework/scripts/mbedtls_framework/test_data_generation.py
|
||||
generated_bignum_test_data:
|
||||
echo " Gen $(GENERATED_BIGNUM_DATA_FILES)"
|
||||
$(PYTHON) ../framework/scripts/generate_bignum_tests.py
|
||||
.SECONDARY: generated_bignum_test_data
|
||||
|
||||
# We deliberately omit the configuration files (mbedtls_config.h,
|
||||
# crypto_config.h) from the depenency list because during development
|
||||
# and on the CI, we often edit those in a way that doesn't change the
|
||||
# output, to comment out certain options, or even to remove certain
|
||||
# lines which do affect the output negatively (it will miss the
|
||||
# corresponding test cases).
|
||||
$(GENERATED_CONFIG_DATA_FILES): $(gen_file_dep) generated_config_test_data
|
||||
generated_config_test_data: ../framework/scripts/generate_config_tests.py
|
||||
generated_config_test_data: ../scripts/config.py
|
||||
generated_config_test_data: ../framework/scripts/mbedtls_framework/test_case.py
|
||||
generated_config_test_data: ../framework/scripts/mbedtls_framework/test_data_generation.py
|
||||
generated_config_test_data:
|
||||
echo " Gen $(GENERATED_CONFIG_DATA_FILES)"
|
||||
$(PYTHON) ../framework/scripts/generate_config_tests.py
|
||||
.SECONDARY: generated_config_test_data
|
||||
|
||||
$(GENERATED_ECP_DATA_FILES): $(gen_file_dep) generated_ecp_test_data
|
||||
generated_ecp_test_data: ../framework/scripts/generate_ecp_tests.py
|
||||
generated_ecp_test_data: ../framework/scripts/mbedtls_framework/bignum_common.py
|
||||
generated_ecp_test_data: ../framework/scripts/mbedtls_framework/ecp.py
|
||||
generated_ecp_test_data: ../framework/scripts/mbedtls_framework/test_case.py
|
||||
generated_ecp_test_data: ../framework/scripts/mbedtls_framework/test_data_generation.py
|
||||
generated_ecp_test_data:
|
||||
echo " Gen $(GENERATED_ECP_DATA_FILES)"
|
||||
$(PYTHON) ../framework/scripts/generate_ecp_tests.py
|
||||
.SECONDARY: generated_ecp_test_data
|
||||
|
||||
$(GENERATED_PSA_DATA_FILES): $(gen_file_dep) generated_psa_test_data
|
||||
generated_psa_test_data: ../framework/scripts/generate_psa_tests.py
|
||||
generated_psa_test_data: ../framework/scripts/mbedtls_framework/crypto_data_tests.py
|
||||
generated_psa_test_data: ../framework/scripts/mbedtls_framework/crypto_knowledge.py
|
||||
generated_psa_test_data: ../framework/scripts/mbedtls_framework/macro_collector.py
|
||||
generated_psa_test_data: ../framework/scripts/mbedtls_framework/psa_information.py
|
||||
generated_psa_test_data: ../framework/scripts/mbedtls_framework/psa_storage.py
|
||||
generated_psa_test_data: ../framework/scripts/mbedtls_framework/psa_test_case.py
|
||||
generated_psa_test_data: ../framework/scripts/mbedtls_framework/test_case.py
|
||||
generated_psa_test_data: ../framework/scripts/mbedtls_framework/test_data_generation.py
|
||||
## The generated file only depends on the options that are present in
|
||||
## crypto_config.h, not on which options are set. To avoid regenerating this
|
||||
## file all the time when switching between configurations, don't declare
|
||||
## crypto_config.h as a dependency. Remove this file from your working tree
|
||||
## if you've just added or removed an option in crypto_config.h.
|
||||
#generated_psa_test_data: ../include/psa/crypto_config.h
|
||||
generated_psa_test_data: ../include/psa/crypto_values.h
|
||||
generated_psa_test_data: ../include/psa/crypto_extra.h
|
||||
generated_psa_test_data: suites/test_suite_psa_crypto_metadata.data
|
||||
generated_psa_test_data:
|
||||
echo " Gen $(GENERATED_PSA_DATA_FILES) ..."
|
||||
$(PYTHON) ../framework/scripts/generate_psa_tests.py
|
||||
.SECONDARY: generated_psa_test_data
|
||||
|
||||
# A test application is built for each suites/test_suite_*.data file.
|
||||
# Application name is same as .data file's base name and can be
|
||||
# constructed by stripping path 'suites/' and extension .data.
|
||||
DATA_FILES := $(wildcard suites/test_suite_*.data)
|
||||
# Make sure that generated data files are included even if they don't
|
||||
# exist yet when the makefile is parsed.
|
||||
DATA_FILES += $(filter-out $(DATA_FILES),$(GENERATED_DATA_FILES))
|
||||
APPS = $(basename $(subst suites/,,$(DATA_FILES)))
|
||||
|
||||
# Construct executable name by adding OS specific suffix $(EXEXT).
|
||||
BINARIES := $(addsuffix $(EXEXT),$(APPS))
|
||||
|
||||
.SILENT:
|
||||
|
||||
.PHONY: all check test clean
|
||||
|
||||
all: $(BINARIES)
|
||||
|
||||
mbedtls_test: $(MBEDTLS_TEST_OBJS)
|
||||
|
||||
include/test/psa_test_wrappers.h src/psa_test_wrappers.c: ../framework/scripts/generate_psa_wrappers.py
|
||||
echo " Gen $@"
|
||||
cd .. && $(PYTHON) framework/scripts/generate_psa_wrappers.py
|
||||
|
||||
include/test/test_certs.h: ../framework/scripts/generate_test_cert_macros.py \
|
||||
$($(PYTHON) ../framework/scripts/generate_test_cert_macros.py --list-dependencies)
|
||||
echo " Gen $@"
|
||||
$(PYTHON) ../framework/scripts/generate_test_cert_macros.py --output $@
|
||||
|
||||
include/test/test_keys.h: ../framework/scripts/generate_test_keys.py
|
||||
echo " Gen $@"
|
||||
$(PYTHON) ../framework/scripts/generate_test_keys.py --output $@
|
||||
|
||||
TEST_OBJS_DEPS = $(wildcard include/test/*.h include/test/*/*.h)
|
||||
ifdef RECORD_PSA_STATUS_COVERAGE_LOG
|
||||
# Explicitly depend on this header because on a clean copy of the source tree,
|
||||
# it doesn't exist yet and must be generated as part of the build, and
|
||||
# therefore the wildcard enumeration above doesn't include it.
|
||||
TEST_OBJS_DEPS += ../framework/tests/include/test/instrument_record_status.h
|
||||
endif
|
||||
TEST_OBJS_DEPS += include/test/psa_test_wrappers.h
|
||||
TEST_OBJS_DEPS += include/test/test_certs.h include/test/test_keys.h
|
||||
|
||||
# Rule to compile common test C files in framework
|
||||
../framework/tests/src/%.o : ../framework/tests/src/%.c $(TEST_OBJS_DEPS)
|
||||
echo " CC $<"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
../framework/tests/src/drivers/%.o : ../framework/tests/src/drivers/%.c
|
||||
echo " CC $<"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
# Rule to compile common test C files in src folder
|
||||
src/%.o : src/%.c $(TEST_OBJS_DEPS)
|
||||
echo " CC $<"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
src/test_helpers/%.o : src/test_helpers/%.c
|
||||
echo " CC $<"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
C_FILES := $(addsuffix .c,$(APPS))
|
||||
c: $(C_FILES)
|
||||
|
||||
# Wildcard target for test code generation:
|
||||
# A .c file is generated for each .data file in the suites/ directory. Each .c
|
||||
# file depends on a .data and .function file from suites/ directory. Following
|
||||
# nameing convention is followed:
|
||||
#
|
||||
# C file | Depends on
|
||||
#-----------------------------------------------------------------------------
|
||||
# foo.c | suites/foo.function suites/foo.data
|
||||
# foo.bar.c | suites/foo.function suites/foo.bar.data
|
||||
#
|
||||
# Note above that .c and .data files have same base name.
|
||||
# However, corresponding .function file's base name is the word before first
|
||||
# dot in .c file's base name.
|
||||
#
|
||||
.SECONDEXPANSION:
|
||||
%.c: suites/$$(firstword $$(subst ., ,$$*)).function suites/%.data ../framework/scripts/generate_test_code.py suites/helpers.function suites/main_test.function suites/host_test.function
|
||||
echo " Gen $@"
|
||||
$(PYTHON) ../framework/scripts/generate_test_code.py -f suites/$(firstword $(subst ., ,$*)).function \
|
||||
-d suites/$*.data \
|
||||
-t suites/main_test.function \
|
||||
-p suites/host_test.function \
|
||||
-s suites \
|
||||
--helpers-file suites/helpers.function \
|
||||
-o .
|
||||
|
||||
|
||||
$(BINARIES): %$(EXEXT): %.c $(MBEDLIBS) $(TEST_OBJS_DEPS) $(MBEDTLS_TEST_OBJS)
|
||||
echo " CC $<"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
clean:
|
||||
ifndef WINDOWS
|
||||
rm -rf $(BINARIES) *.c *.datax
|
||||
rm -f src/*.o src/test_helpers/*.o src/libmbed*
|
||||
rm -f ../framework/tests/src/*.o ../framework/tests/src/drivers/*.o
|
||||
rm -f ../framework/tests/include/test/instrument_record_status.h
|
||||
rm -f ../framework/tests/include/alt-extra/*/*_alt.h
|
||||
rm -rf libtestdriver1
|
||||
rm -f ../library/libtestdriver1.a
|
||||
else
|
||||
if exist *.c del /Q /F *.c
|
||||
if exist *.exe del /Q /F *.exe
|
||||
if exist *.datax del /Q /F *.datax
|
||||
if exist src/*.o del /Q /F src/*.o
|
||||
if exist src/test_helpers/*.o del /Q /F src/test_helpers/*.o
|
||||
if exist src/libmbed* del /Q /F src/libmbed*
|
||||
if exist ../framework/tests/src/*.o del /Q /F ../framework/tests/src/*.o
|
||||
if exist ../framework/tests/src/drivers/*.o del /Q /F ../framework/tests/src/drivers/*.o
|
||||
if exist ../framework/tests/include/test/instrument_record_status.h del /Q /F ../framework/tests/include/test/instrument_record_status.h
|
||||
endif
|
||||
|
||||
# Test suites caught by SKIP_TEST_SUITES are built but not executed.
|
||||
check: $(BINARIES)
|
||||
perl scripts/run-test-suites.pl $(TEST_FLAGS) --skip=$(SKIP_TEST_SUITES)
|
||||
|
||||
test: check
|
||||
|
||||
# Generate variants of some headers for testing
|
||||
../framework/tests/include/alt-extra/%_alt.h: ../include/%.h
|
||||
perl -p -e 's/^(# *(define|ifndef) +\w+_)H\b/$${1}ALT_H/' $< >$@
|
||||
|
||||
# Generate test library
|
||||
|
||||
# Perl code that is executed to transform each original line from a library
|
||||
# source file into the corresponding line in the test driver copy of the
|
||||
# library. Add a LIBTESTDRIVER1_/libtestdriver1_ to mbedtls_xxx and psa_xxx
|
||||
# symbols.
|
||||
define libtestdriver1_rewrite :=
|
||||
s!^(\s*#\s*include\s*[\"<])(mbedtls|psa)/!$${1}libtestdriver1/include/$${2}/!; \
|
||||
next if /^\s*#\s*include/; \
|
||||
s/\b(?=MBEDTLS_|PSA_)/LIBTESTDRIVER1_/g; \
|
||||
s/\b(?=mbedtls_|psa_)/libtestdriver1_/g;
|
||||
endef
|
||||
|
||||
libtestdriver1.a: export MBEDTLS_PATH := $(patsubst ../..//%,/%,../../$(MBEDTLS_PATH))
|
||||
libtestdriver1.a:
|
||||
# Copy the library and fake a 3rdparty Makefile include.
|
||||
rm -Rf ./libtestdriver1
|
||||
mkdir ./libtestdriver1
|
||||
cp -Rf ../library ./libtestdriver1
|
||||
cp -Rf ../include ./libtestdriver1
|
||||
cp -Rf ../scripts ./libtestdriver1
|
||||
mkdir ./libtestdriver1/3rdparty
|
||||
touch ./libtestdriver1/3rdparty/Makefile.inc
|
||||
|
||||
# Set the test driver base (minimal) configuration.
|
||||
cp configs/config_test_driver.h ./libtestdriver1/include/mbedtls/mbedtls_config.h
|
||||
|
||||
# Set the PSA cryptography configuration for the test library.
|
||||
# It is set from the copied include/psa/crypto_config.h of the Mbed TLS
|
||||
# library the test library is intended to be linked with extended by
|
||||
# configs/crypto_config_test_driver_extension.h to mirror the PSA_ACCEL_*
|
||||
# macros.
|
||||
mv ./libtestdriver1/include/psa/crypto_config.h ./libtestdriver1/include/psa/crypto_config.h.bak
|
||||
head -n -1 ./libtestdriver1/include/psa/crypto_config.h.bak > ./libtestdriver1/include/psa/crypto_config.h
|
||||
cat configs/crypto_config_test_driver_extension.h >> ./libtestdriver1/include/psa/crypto_config.h
|
||||
echo "#endif /* PSA_CRYPTO_CONFIG_H */" >> ./libtestdriver1/include/psa/crypto_config.h
|
||||
|
||||
# Prefix MBEDTLS_* PSA_* symbols with LIBTESTDRIVER1_ as well as
|
||||
# mbedtls_* psa_* symbols with libtestdriver1_ to avoid symbol clash
|
||||
# when this test driver library is linked with the Mbed TLS library.
|
||||
perl -pi -e '$(libtestdriver1_rewrite)' ./libtestdriver1/library/*.[ch]
|
||||
perl -pi -e '$(libtestdriver1_rewrite)' ./libtestdriver1/include/*/*.h
|
||||
|
||||
$(MAKE) -C ./libtestdriver1/library CFLAGS="-I../../ $(CFLAGS)" LDFLAGS="$(LDFLAGS)" libmbedcrypto.a
|
||||
cp ./libtestdriver1/library/libmbedcrypto.a ../library/libtestdriver1.a
|
||||
|
||||
ifdef RECORD_PSA_STATUS_COVERAGE_LOG
|
||||
../framework/tests/include/test/instrument_record_status.h: ../include/psa/crypto.h Makefile
|
||||
echo " Gen $@"
|
||||
sed <../include/psa/crypto.h >$@ -n 's/^psa_status_t \([A-Za-z0-9_]*\)(.*/#define \1(...) RECORD_STATUS("\1", \1(__VA_ARGS__))/p'
|
||||
endif
|
||||
55
vendor/mbedtls/tests/compat-in-docker.sh
vendored
Executable file
55
vendor/mbedtls/tests/compat-in-docker.sh
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
# compat-in-docker.sh
|
||||
#
|
||||
# Purpose
|
||||
# -------
|
||||
# This runs compat.sh in a Docker container.
|
||||
#
|
||||
# WARNING: the Dockerfile used by this script is no longer maintained! See
|
||||
# https://github.com/Mbed-TLS/mbedtls-test/blob/master/README.md#quick-start
|
||||
# for the set of Docker images we use on the CI.
|
||||
#
|
||||
# Notes for users
|
||||
# ---------------
|
||||
# If OPENSSL, GNUTLS_CLI, or GNUTLS_SERV are specified the path must
|
||||
# correspond to an executable inside the Docker container. The special
|
||||
# values "next" (OpenSSL only) and "legacy" are also allowed as shorthand
|
||||
# for the installations inside the container.
|
||||
#
|
||||
# See also:
|
||||
# - scripts/docker_env.sh for general Docker prerequisites and other information.
|
||||
# - compat.sh for notes about invocation of that script.
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
source tests/scripts/docker_env.sh
|
||||
|
||||
case "${OPENSSL:-default}" in
|
||||
"legacy") export OPENSSL="/usr/local/openssl-1.0.1j/bin/openssl";;
|
||||
"next") export OPENSSL="/usr/local/openssl-1.1.1a/bin/openssl";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
case "${GNUTLS_CLI:-default}" in
|
||||
"legacy") export GNUTLS_CLI="/usr/local/gnutls-3.3.8/bin/gnutls-cli";;
|
||||
"next") export GNUTLS_CLI="/usr/local/gnutls-3.7.2/bin/gnutls-cli";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
case "${GNUTLS_SERV:-default}" in
|
||||
"legacy") export GNUTLS_SERV="/usr/local/gnutls-3.3.8/bin/gnutls-serv";;
|
||||
"next") export GNUTLS_SERV="/usr/local/gnutls-3.7.2/bin/gnutls-serv";;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
run_in_docker \
|
||||
-e M_CLI \
|
||||
-e M_SRV \
|
||||
-e GNUTLS_CLI \
|
||||
-e GNUTLS_SERV \
|
||||
-e OPENSSL \
|
||||
-e OSSL_NO_DTLS \
|
||||
tests/compat.sh \
|
||||
$@
|
||||
1264
vendor/mbedtls/tests/compat.sh
vendored
Executable file
1264
vendor/mbedtls/tests/compat.sh
vendored
Executable file
File diff suppressed because it is too large
Load Diff
46
vendor/mbedtls/tests/configs/config_test_driver.h
vendored
Normal file
46
vendor/mbedtls/tests/configs/config_test_driver.h
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Mbed TLS configuration for PSA test driver libraries. It includes:
|
||||
* . the minimum set of modules needed by the PSA core.
|
||||
* . the Mbed TLS configuration options that may need to be additionally
|
||||
* enabled for the purpose of a specific test.
|
||||
* . the PSA configuration file for the Mbed TLS library and its test drivers.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_CONFIG_H
|
||||
#define MBEDTLS_CONFIG_H
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_PSA_CRYPTO_C
|
||||
#define MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
|
||||
/* PSA core mandatory configuration options */
|
||||
#define MBEDTLS_CIPHER_C
|
||||
#define MBEDTLS_AES_C
|
||||
#define MBEDTLS_SHA256_C
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
|
||||
#define MBEDTLS_CTR_DRBG_C
|
||||
#define MBEDTLS_ENTROPY_C
|
||||
#define MBEDTLS_ENTROPY_FORCE_SHA256
|
||||
|
||||
/*
|
||||
* Configuration options that may need to be additionally enabled for the
|
||||
* purpose of a specific set of tests.
|
||||
*/
|
||||
//#define MBEDTLS_SHA1_C
|
||||
//#define MBEDTLS_SHA224_C
|
||||
//#define MBEDTLS_SHA384_C
|
||||
//#define MBEDTLS_SHA512_C
|
||||
//#define MBEDTLS_MD_C
|
||||
//#define MBEDTLS_PEM_PARSE_C
|
||||
//#define MBEDTLS_BASE64_C
|
||||
//#define MBEDTLS_THREADING_C
|
||||
//#define MBEDTLS_THREADING_PTHREAD
|
||||
|
||||
#endif /* MBEDTLS_CONFIG_H */
|
||||
665
vendor/mbedtls/tests/configs/crypto_config_test_driver_extension.h
vendored
Normal file
665
vendor/mbedtls/tests/configs/crypto_config_test_driver_extension.h
vendored
Normal file
@@ -0,0 +1,665 @@
|
||||
/**
|
||||
* This file is intended to be used to build PSA external test driver
|
||||
* libraries (libtestdriver1).
|
||||
*
|
||||
* It is intended to be appended by the test build system to the
|
||||
* crypto_config.h file of the Mbed TLS library the test library will be
|
||||
* linked to (see `tests/Makefile` libtestdriver1 target). This is done in
|
||||
* order to insert it at the right time: after the main configuration
|
||||
* (PSA_WANT) but before the logic that determines what built-ins to enable
|
||||
* based on PSA_WANT and MBEDTLS_PSA_ACCEL macros.
|
||||
*
|
||||
* It reverses the PSA_ACCEL_* macros defining the cryptographic operations
|
||||
* that will be accelerated in the main library:
|
||||
* - When something is accelerated in the main library, we need it supported
|
||||
* in libtestdriver1, so we disable the accel macro in order to the built-in
|
||||
* to be enabled.
|
||||
* - When something is NOT accelerated in the main library, we don't need it
|
||||
* in libtestdriver1, so we enable its accel macro in order to the built-in
|
||||
* to be disabled, to keep libtestdriver1 minimal. (We can't adjust the
|
||||
* PSA_WANT macros as they need to be the same between libtestdriver1 and
|
||||
* the main library, since they determine the ABI between the two.)
|
||||
*/
|
||||
|
||||
#include "psa/crypto_legacy.h"
|
||||
|
||||
#if defined(PSA_WANT_ALG_CBC_NO_PADDING)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CBC_PKCS7)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CFB)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CFB)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CFB
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CFB 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CMAC)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CMAC)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CMAC
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CMAC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CTR)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CTR)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CTR
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CTR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_STREAM_CIPHER)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_STREAM_CIPHER)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_STREAM_CIPHER
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_STREAM_CIPHER 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_ECB_NO_PADDING)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_256)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_384)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_BRAINPOOL_P_R1_512)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_MONTGOMERY_255)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_MONTGOMERY_448)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_K1_192)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_K1_256)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_192)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_224)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_256)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_384)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ECC_SECP_R1_521)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521)
|
||||
#undef MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_ECDSA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_ECDSA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECDSA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_ECDH)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_ECDH)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_ECDH
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECDH 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_2048)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_2048)
|
||||
#undef MBEDTLS_PSA_ACCEL_DH_RFC7919_2048
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_DH_RFC7919_2048
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_3072)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_3072)
|
||||
#undef MBEDTLS_PSA_ACCEL_DH_RFC7919_3072
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_DH_RFC7919_3072
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_4096)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_4096)
|
||||
#undef MBEDTLS_PSA_ACCEL_DH_RFC7919_4096
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_DH_RFC7919_4096
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_6144)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_6144)
|
||||
#undef MBEDTLS_PSA_ACCEL_DH_RFC7919_6144
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_DH_RFC7919_6144
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_DH_RFC7919_8192)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_DH_RFC7919_8192)
|
||||
#undef MBEDTLS_PSA_ACCEL_DH_RFC7919_8192
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_DH_RFC7919_8192
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_FFDH)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_FFDH)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_FFDH
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_FFDH 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_MD5)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_MD5
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_MD5 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_OFB)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_OFB)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_OFB
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_OFB 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RIPEMD160)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_RIPEMD160
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_PSS)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_RSA_PSS
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PSS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_1)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_1
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_1 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_224)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_224
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_224 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_256)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_256
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_256 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_384)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_384
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_384 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_512)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_512
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_512 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_224)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_224)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA3_224
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA3_224 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_256)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_256)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA3_256
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA3_256 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_384)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_384)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA3_384
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA3_384 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA3_512)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_512)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA3_512
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA3_512 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CHACHA20_POLY1305)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_JPAKE)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_JPAKE)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_JPAKE
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_JPAKE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_AES)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ARIA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_DERIVE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_BASIC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_KEY_PAIR_GENERATE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DH_PUBLIC_KEY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_CHACHA20)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(PSA_WANT_ALG_TLS12_PRF)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_TLS12_ECJPAKE_TO_PMS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_GCM)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_GCM)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_GCM
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_GCM 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CCM)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CCM)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CCM
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CCM 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CCM_STAR_NO_TAG)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CCM_STAR_NO_TAG)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CCM_STAR_NO_TAG
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CCM_STAR_NO_TAG 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_HMAC)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_HMAC)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_HMAC
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HMAC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_HKDF)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_HKDF
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HKDF 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_HKDF_EXTRACT)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_HKDF_EXPAND)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_OAEP)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DERIVE)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DERIVE)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DERIVE
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DERIVE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_HMAC)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_HMAC)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_HMAC
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_HMAC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_DES)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DES)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_DES
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DES 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RAW_DATA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RAW_DATA)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RAW_DATA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RAW_DATA 1
|
||||
#endif
|
||||
#endif
|
||||
31
vendor/mbedtls/tests/configs/tls13-only.h
vendored
Normal file
31
vendor/mbedtls/tests/configs/tls13-only.h
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/* MBEDTLS_USER_CONFIG_FILE for testing.
|
||||
* Only used for a few test configurations.
|
||||
*
|
||||
* Typical usage (note multiple levels of quoting):
|
||||
* make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
/* Enable TLS 1.3 and core 1.3 features */
|
||||
#define MBEDTLS_SSL_PROTO_TLS1_3
|
||||
#define MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
|
||||
/* Disable TLS 1.2 and 1.2-specific features */
|
||||
#undef MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
#undef MBEDTLS_SSL_EXTENDED_MASTER_SECRET
|
||||
#undef MBEDTLS_SSL_RENEGOTIATION
|
||||
#undef MBEDTLS_SSL_PROTO_TLS1_2
|
||||
#undef MBEDTLS_SSL_PROTO_DTLS
|
||||
#undef MBEDTLS_SSL_DTLS_ANTI_REPLAY
|
||||
#undef MBEDTLS_SSL_DTLS_HELLO_VERIFY
|
||||
#undef MBEDTLS_SSL_DTLS_SRTP
|
||||
#undef MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
|
||||
#undef MBEDTLS_SSL_DTLS_CONNECTION_ID
|
||||
#undef MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT
|
||||
|
||||
/* Enable some invasive tests */
|
||||
#define MBEDTLS_TEST_HOOKS
|
||||
90
vendor/mbedtls/tests/configs/user-config-for-test.h
vendored
Normal file
90
vendor/mbedtls/tests/configs/user-config-for-test.h
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/* MBEDTLS_USER_CONFIG_FILE for testing.
|
||||
* Only used for a few test configurations.
|
||||
*
|
||||
* Typical usage (note multiple levels of quoting):
|
||||
* make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'"
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST_ALL)
|
||||
/* PSA_CRYPTO_DRIVER_TEST_ALL activates test drivers while keeping the
|
||||
* built-in implementations active. Normally setting MBEDTLS_PSA_ACCEL_xxx
|
||||
* would disable MBEDTLS_PSA_BUILTIN_xxx unless fallback is activated, but
|
||||
* here we arrange to have both active so that psa_crypto_*.c includes
|
||||
* the built-in implementations and the driver code can call the built-in
|
||||
* implementations.
|
||||
*
|
||||
* The point of this test mode is to verify that the
|
||||
* driver entry points are called when they should be in a lightweight
|
||||
* way, without requiring an actual driver. This is different from builds
|
||||
* with libtestdriver1, where we make a copy of the library source code
|
||||
* and use that as an external driver.
|
||||
*/
|
||||
|
||||
/* Enable the use of the test driver in the library, and build the generic
|
||||
* part of the test driver. */
|
||||
#define PSA_CRYPTO_DRIVER_TEST
|
||||
|
||||
/* With MBEDTLS_PSA_CRYPTO_CONFIG, if we set up the acceleration, the
|
||||
* built-in implementations won't be enabled. */
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
|
||||
#error \
|
||||
"PSA_CRYPTO_DRIVER_TEST_ALL sets up a nonstandard configuration that is incompatible with MBEDTLS_PSA_CRYPTO_CONFIG"
|
||||
#endif
|
||||
|
||||
/* Use the accelerator driver for all cryptographic mechanisms for which
|
||||
* the test driver implemented. */
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_BASIC
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_IMPORT
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_EXPORT
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR_GENERATE
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CTR
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CFB
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECDSA
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_MD5
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_OFB
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PSS
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_224
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_256
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_384
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_512
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_XTS
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CMAC
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HMAC
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST_ALL */
|
||||
|
||||
|
||||
|
||||
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
|
||||
/* The #MBEDTLS_PSA_INJECT_ENTROPY feature requires two extra platform
|
||||
* functions, which must be configured as #MBEDTLS_PLATFORM_NV_SEED_READ_MACRO
|
||||
* and #MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO. The job of these functions
|
||||
* is to read and write from the entropy seed file, which is located
|
||||
* in the PSA ITS file whose uid is #PSA_CRYPTO_ITS_RANDOM_SEED_UID.
|
||||
* (These could have been provided as library functions, but for historical
|
||||
* reasons, they weren't, and so each integrator has to provide a copy
|
||||
* of these functions.)
|
||||
*
|
||||
* Provide implementations of these functions for testing. */
|
||||
#include <stddef.h>
|
||||
int mbedtls_test_inject_entropy_seed_read(unsigned char *buf, size_t len);
|
||||
int mbedtls_test_inject_entropy_seed_write(unsigned char *buf, size_t len);
|
||||
#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_test_inject_entropy_seed_read
|
||||
#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_test_inject_entropy_seed_write
|
||||
#endif /* MBEDTLS_PSA_INJECT_ENTROPY */
|
||||
22
vendor/mbedtls/tests/configs/user-config-malloc-0-null.h
vendored
Normal file
22
vendor/mbedtls/tests/configs/user-config-malloc-0-null.h
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* mbedtls_config.h modifier that forces calloc(0) to return NULL.
|
||||
* Used for testing.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef MBEDTLS_PLATFORM_STD_CALLOC
|
||||
static inline void *custom_calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
if (nmemb == 0 || size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return calloc(nmemb, size);
|
||||
}
|
||||
|
||||
#define MBEDTLS_PLATFORM_MEMORY
|
||||
#define MBEDTLS_PLATFORM_STD_CALLOC custom_calloc
|
||||
#endif
|
||||
17
vendor/mbedtls/tests/configs/user-config-zeroize-memset.h
vendored
Normal file
17
vendor/mbedtls/tests/configs/user-config-zeroize-memset.h
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/* mbedtls_config.h modifier that defines mbedtls_platform_zeroize() to be
|
||||
* memset(), so that the compile can check arguments for us.
|
||||
* Used for testing.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Define _ALT so we don't get the built-in implementation. The test code will
|
||||
* also need to define MBEDTLS_TEST_DEFINES_ZEROIZE so we don't get the
|
||||
* declaration. */
|
||||
#define MBEDTLS_PLATFORM_ZEROIZE_ALT
|
||||
|
||||
#define mbedtls_platform_zeroize(buf, len) memset(buf, 0, len)
|
||||
428
vendor/mbedtls/tests/context-info.sh
vendored
Executable file
428
vendor/mbedtls/tests/context-info.sh
vendored
Executable file
@@ -0,0 +1,428 @@
|
||||
#!/bin/sh
|
||||
|
||||
# context-info.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# This program is intended for testing the ssl_context_info program
|
||||
#
|
||||
|
||||
set -eu
|
||||
|
||||
if ! cd "$(dirname "$0")"; then
|
||||
exit 125
|
||||
fi
|
||||
|
||||
# Variables
|
||||
|
||||
THIS_SCRIPT_NAME=$(basename "$0")
|
||||
PROG_PATH="../programs/ssl/ssl_context_info"
|
||||
OUT_FILE="ssl_context_info.log"
|
||||
IN_DIR="../framework/data_files/base64"
|
||||
|
||||
USE_VALGRIND=0
|
||||
|
||||
T_COUNT=0
|
||||
T_PASSED=0
|
||||
T_FAILED=0
|
||||
|
||||
|
||||
# Functions
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: $0 [options]"
|
||||
printf " -h|--help\tPrint this help.\n"
|
||||
printf " -m|--memcheck\tUse valgrind to check the memory.\n"
|
||||
}
|
||||
|
||||
# Print test name <name>
|
||||
print_name() {
|
||||
printf "%s %.*s " "$1" $(( 71 - ${#1} )) \
|
||||
"........................................................................"
|
||||
}
|
||||
|
||||
# Print header to the test output file <test name> <file path> <test command>
|
||||
print_header()
|
||||
{
|
||||
date="$(date)"
|
||||
echo "******************************************************************" > $2
|
||||
echo "* File created by: $THIS_SCRIPT_NAME" >> $2
|
||||
echo "* Test name: $1" >> $2
|
||||
echo "* Date: $date" >> $2
|
||||
echo "* Command: $3" >> $2
|
||||
echo "******************************************************************" >> $2
|
||||
echo "" >> $2
|
||||
}
|
||||
|
||||
# Print footer at the end of file <file path>
|
||||
print_footer()
|
||||
{
|
||||
echo "" >> $1
|
||||
echo "******************************************************************" >> $1
|
||||
echo "* End command" >> $1
|
||||
echo "******************************************************************" >> $1
|
||||
echo "" >> $1
|
||||
}
|
||||
|
||||
# Use the arguments of this script
|
||||
get_options() {
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
-m|--memcheck)
|
||||
USE_VALGRIND=1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: '$1'"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
# Current test failed
|
||||
fail()
|
||||
{
|
||||
T_FAILED=$(( $T_FAILED + 1))
|
||||
FAIL_OUT="Fail.$T_FAILED""_$OUT_FILE"
|
||||
|
||||
echo "FAIL"
|
||||
echo " Error: $1"
|
||||
|
||||
cp -f "$OUT_FILE" "$FAIL_OUT"
|
||||
echo "Error: $1" >> "$FAIL_OUT"
|
||||
}
|
||||
|
||||
# Current test passed
|
||||
pass()
|
||||
{
|
||||
T_PASSED=$(( $T_PASSED + 1))
|
||||
echo "PASS"
|
||||
}
|
||||
|
||||
# Usage: run_test <name> <input file with b64 code> [ -arg <extra arguments for tested program> ] [option [...]]
|
||||
# Options: -m <pattern that MUST be present in the output of tested program>
|
||||
# -n <pattern that must NOT be present in the output of tested program>
|
||||
# -u <pattern that must be UNIQUE in the output of tested program>
|
||||
run_test()
|
||||
{
|
||||
TEST_NAME="$1"
|
||||
RUN_CMD="$PROG_PATH -f $IN_DIR/$2"
|
||||
|
||||
if [ "-arg" = "$3" ]; then
|
||||
RUN_CMD="$RUN_CMD $4"
|
||||
shift 4
|
||||
else
|
||||
shift 2
|
||||
fi
|
||||
|
||||
# prepend valgrind to our commands if active
|
||||
if [ "$USE_VALGRIND" -gt 0 ]; then
|
||||
RUN_CMD="valgrind --leak-check=full $RUN_CMD"
|
||||
fi
|
||||
|
||||
T_COUNT=$(( $T_COUNT + 1))
|
||||
print_name "$TEST_NAME"
|
||||
|
||||
# run tested program
|
||||
print_header "$TEST_NAME" "$OUT_FILE" "$RUN_CMD"
|
||||
eval "$RUN_CMD" >> "$OUT_FILE" 2>&1
|
||||
print_footer "$OUT_FILE"
|
||||
|
||||
# check valgrind's results
|
||||
if [ "$USE_VALGRIND" -gt 0 ]; then
|
||||
if ! ( grep -F 'All heap blocks were freed -- no leaks are possible' "$OUT_FILE" &&
|
||||
grep -F 'ERROR SUMMARY: 0 errors from 0 contexts' "$OUT_FILE" ) > /dev/null
|
||||
then
|
||||
fail "Memory error detected"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# check other assertions
|
||||
# lines beginning with == are added by valgrind, ignore them, because we already checked them before
|
||||
# lines with 'Serious error when reading debug info', are valgrind issues as well
|
||||
# lines beginning with * are added by this script, ignore too
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case $1 in
|
||||
"-m")
|
||||
if grep -v '^==' "$OUT_FILE" | grep -v 'Serious error when reading debug info' | grep -v "^*" | grep "$2" >/dev/null; then :; else
|
||||
fail "pattern '$2' MUST be present in the output"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
|
||||
"-n")
|
||||
if grep -v '^==' "$OUT_FILE" | grep -v 'Serious error when reading debug info' | grep -v "^*" | grep "$2" >/dev/null; then
|
||||
fail "pattern '$2' MUST NOT be present in the output"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
|
||||
"-u")
|
||||
if [ $(grep -v '^==' "$OUT_FILE"| grep -v 'Serious error when reading debug info' | grep -v "^*" | grep "$2" | wc -l) -ne 1 ]; then
|
||||
fail "lines following pattern '$2' must be once in the output"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown test: $1" >&2
|
||||
exit 1
|
||||
esac
|
||||
shift 2
|
||||
done
|
||||
|
||||
rm -f "$OUT_FILE"
|
||||
|
||||
pass
|
||||
}
|
||||
|
||||
get_options "$@"
|
||||
|
||||
# Tests
|
||||
|
||||
run_test "Default configuration, server" \
|
||||
"srv_def.txt" \
|
||||
-n "ERROR" \
|
||||
-u "major.* 2$" \
|
||||
-u "minor.* 21$" \
|
||||
-u "path.* 0$" \
|
||||
-u "MBEDTLS_HAVE_TIME$" \
|
||||
-u "MBEDTLS_X509_CRT_PARSE_C$" \
|
||||
-u "MBEDTLS_SSL_MAX_FRAGMENT_LENGTH$" \
|
||||
-u "MBEDTLS_SSL_ENCRYPT_THEN_MAC$" \
|
||||
-u "MBEDTLS_SSL_SESSION_TICKETS$" \
|
||||
-u "MBEDTLS_SSL_SESSION_TICKETS and client$" \
|
||||
-u "MBEDTLS_SSL_DTLS_ANTI_REPLAY$" \
|
||||
-u "MBEDTLS_SSL_ALPN$" \
|
||||
-u "ciphersuite.* TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256$" \
|
||||
-u "cipher flags.* 0x00$" \
|
||||
-u "Message-Digest.* SHA256$" \
|
||||
-u "compression.* disabled$" \
|
||||
-u "DTLS datagram packing.* enabled$" \
|
||||
-n "Certificate" \
|
||||
-n "bytes left to analyze from context"
|
||||
|
||||
run_test "Default configuration, client" \
|
||||
"cli_def.txt" \
|
||||
-n "ERROR" \
|
||||
-u "major.* 2$" \
|
||||
-u "minor.* 21$" \
|
||||
-u "path.* 0$" \
|
||||
-u "MBEDTLS_HAVE_TIME$" \
|
||||
-u "MBEDTLS_X509_CRT_PARSE_C$" \
|
||||
-u "MBEDTLS_SSL_MAX_FRAGMENT_LENGTH$" \
|
||||
-u "MBEDTLS_SSL_ENCRYPT_THEN_MAC$" \
|
||||
-u "MBEDTLS_SSL_SESSION_TICKETS$" \
|
||||
-u "MBEDTLS_SSL_SESSION_TICKETS and client$" \
|
||||
-u "MBEDTLS_SSL_DTLS_ANTI_REPLAY$" \
|
||||
-u "MBEDTLS_SSL_ALPN$" \
|
||||
-u "ciphersuite.* TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256$" \
|
||||
-u "cipher flags.* 0x00$" \
|
||||
-u "Message-Digest.* SHA256$" \
|
||||
-u "compression.* disabled$" \
|
||||
-u "DTLS datagram packing.* enabled$" \
|
||||
-u "cert. version .* 3$" \
|
||||
-u "serial number.* 02$" \
|
||||
-u "issuer name.* C=NL, O=PolarSSL, CN=PolarSSL Test CA$" \
|
||||
-u "subject name.* C=NL, O=PolarSSL, CN=localhost$" \
|
||||
-u "issued on.* 2019-02-10 14:44:06$" \
|
||||
-u "expires on.* 2029-02-10 14:44:06$" \
|
||||
-u "signed using.* RSA with SHA-256$" \
|
||||
-u "RSA key size.* 2048 bits$" \
|
||||
-u "basic constraints.* CA=false$" \
|
||||
-n "bytes left to analyze from context"
|
||||
|
||||
run_test "Ciphersuite TLS-RSA-WITH-AES-256-CCM-8, server" \
|
||||
"srv_ciphersuite.txt" \
|
||||
-n "ERROR" \
|
||||
-u "ciphersuite.* TLS-RSA-WITH-AES-256-CCM-8$" \
|
||||
|
||||
run_test "Ciphersuite TLS-RSA-WITH-AES-256-CCM-8, client" \
|
||||
"cli_ciphersuite.txt" \
|
||||
-n "ERROR" \
|
||||
-u "ciphersuite.* TLS-RSA-WITH-AES-256-CCM-8$" \
|
||||
|
||||
run_test "No packing, server" \
|
||||
"srv_no_packing.txt" \
|
||||
-n "ERROR" \
|
||||
-u "DTLS datagram packing.* disabled"
|
||||
|
||||
run_test "No packing, client" \
|
||||
"cli_no_packing.txt" \
|
||||
-n "ERROR" \
|
||||
-u "DTLS datagram packing.* disabled"
|
||||
|
||||
run_test "DTLS CID, server" \
|
||||
"srv_cid.txt" \
|
||||
-n "ERROR" \
|
||||
-u "in CID.* DE AD" \
|
||||
-u "out CID.* BE EF"
|
||||
|
||||
run_test "DTLS CID, client" \
|
||||
"cli_cid.txt" \
|
||||
-n "ERROR" \
|
||||
-u "in CID.* BE EF" \
|
||||
-u "out CID.* DE AD"
|
||||
|
||||
run_test "No MBEDTLS_SSL_MAX_FRAGMENT_LENGTH, server" \
|
||||
"srv_no_mfl.txt" \
|
||||
-n "ERROR" \
|
||||
-n "MBEDTLS_SSL_MAX_FRAGMENT_LENGTH"
|
||||
|
||||
run_test "No MBEDTLS_SSL_MAX_FRAGMENT_LENGTH, client" \
|
||||
"cli_no_mfl.txt" \
|
||||
-n "ERROR" \
|
||||
-n "MBEDTLS_SSL_MAX_FRAGMENT_LENGTH"
|
||||
|
||||
run_test "No MBEDTLS_SSL_ALPN, server" \
|
||||
"srv_no_alpn.txt" \
|
||||
-n "ERROR" \
|
||||
-n "MBEDTLS_SSL_ALPN"
|
||||
|
||||
run_test "No MBEDTLS_SSL_ALPN, client" \
|
||||
"cli_no_alpn.txt" \
|
||||
-n "ERROR" \
|
||||
-n "MBEDTLS_SSL_ALPN"
|
||||
|
||||
run_test "No MBEDTLS_SSL_KEEP_PEER_CERTIFICATE, server" \
|
||||
"srv_no_keep_cert.txt" \
|
||||
-arg "--keep-peer-cert=0" \
|
||||
-u "ciphersuite.* TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256$" \
|
||||
-u "cipher flags.* 0x00" \
|
||||
-u "compression.* disabled" \
|
||||
-u "DTLS datagram packing.* enabled" \
|
||||
-n "ERROR"
|
||||
|
||||
run_test "No MBEDTLS_SSL_KEEP_PEER_CERTIFICATE, client" \
|
||||
"cli_no_keep_cert.txt" \
|
||||
-arg "--keep-peer-cert=0" \
|
||||
-u "ciphersuite.* TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256$" \
|
||||
-u "cipher flags.* 0x00" \
|
||||
-u "compression.* disabled" \
|
||||
-u "DTLS datagram packing.* enabled" \
|
||||
-n "ERROR"
|
||||
|
||||
run_test "No MBEDTLS_SSL_KEEP_PEER_CERTIFICATE, negative, server" \
|
||||
"srv_no_keep_cert.txt" \
|
||||
-m "Deserializing" \
|
||||
-m "ERROR"
|
||||
|
||||
run_test "No MBEDTLS_SSL_KEEP_PEER_CERTIFICATE, negative, client" \
|
||||
"cli_no_keep_cert.txt" \
|
||||
-m "Deserializing" \
|
||||
-m "ERROR"
|
||||
|
||||
run_test "Minimal configuration, server" \
|
||||
"srv_min_cfg.txt" \
|
||||
-n "ERROR" \
|
||||
-n "MBEDTLS_SSL_MAX_FRAGMENT_LENGTH$" \
|
||||
-n "MBEDTLS_SSL_ENCRYPT_THEN_MAC$" \
|
||||
-n "MBEDTLS_SSL_SESSION_TICKETS$" \
|
||||
-n "MBEDTLS_SSL_SESSION_TICKETS and client$" \
|
||||
-n "MBEDTLS_SSL_DTLS_ANTI_REPLAY$" \
|
||||
-n "MBEDTLS_SSL_ALPN$" \
|
||||
|
||||
run_test "Minimal configuration, client" \
|
||||
"cli_min_cfg.txt" \
|
||||
-n "ERROR" \
|
||||
-n "MBEDTLS_SSL_MAX_FRAGMENT_LENGTH$" \
|
||||
-n "MBEDTLS_SSL_ENCRYPT_THEN_MAC$" \
|
||||
-n "MBEDTLS_SSL_SESSION_TICKETS$" \
|
||||
-n "MBEDTLS_SSL_SESSION_TICKETS and client$" \
|
||||
-n "MBEDTLS_SSL_DTLS_ANTI_REPLAY$" \
|
||||
-n "MBEDTLS_SSL_ALPN$" \
|
||||
|
||||
run_test "MTU=10000" \
|
||||
"mtu_10000.txt" \
|
||||
-n "ERROR" \
|
||||
-u "MTU.* 10000$"
|
||||
|
||||
run_test "MFL=1024" \
|
||||
"mfl_1024.txt" \
|
||||
-n "ERROR" \
|
||||
-u "MFL.* 1024$"
|
||||
|
||||
run_test "Older version (v2.19.1)" \
|
||||
"v2.19.1.txt" \
|
||||
-n "ERROR" \
|
||||
-u "major.* 2$" \
|
||||
-u "minor.* 19$" \
|
||||
-u "path.* 1$" \
|
||||
-u "ciphersuite.* TLS-ECDHE-ECDSA-WITH-AES-128-CCM-8$" \
|
||||
-u "Message-Digest.* SHA256$" \
|
||||
-u "compression.* disabled$" \
|
||||
-u "serial number.* 01:70:AF:40:B4:E6$" \
|
||||
-u "issuer name.* CN=ca$" \
|
||||
-u "subject name.* L=160001, OU=acc1, CN=device01$" \
|
||||
-u "issued on.* 2020-03-06 09:50:18$" \
|
||||
-u "expires on.* 2056-02-26 09:50:18$" \
|
||||
-u "signed using.* ECDSA with SHA256$" \
|
||||
-u "lifetime.* 0 sec.$" \
|
||||
-u "MFL.* none$" \
|
||||
-u "negotiate truncated HMAC.* disabled$" \
|
||||
-u "Encrypt-then-MAC.* enabled$" \
|
||||
-u "DTLS datagram packing.* enabled$" \
|
||||
-u "verify result.* 0x00000000$" \
|
||||
-n "bytes left to analyze from context"
|
||||
|
||||
run_test "Wrong base64 format" \
|
||||
"def_bad_b64.txt" \
|
||||
-m "ERROR" \
|
||||
-u "The length of the base64 code found should be a multiple of 4" \
|
||||
-n "bytes left to analyze from context"
|
||||
|
||||
run_test "Too much data at the beginning of base64 code" \
|
||||
"def_b64_too_big_1.txt" \
|
||||
-m "ERROR" \
|
||||
-n "The length of the base64 code found should be a multiple of 4" \
|
||||
|
||||
run_test "Too much data in the middle of base64 code" \
|
||||
"def_b64_too_big_2.txt" \
|
||||
-m "ERROR" \
|
||||
-n "The length of the base64 code found should be a multiple of 4" \
|
||||
|
||||
run_test "Too much data at the end of base64 code" \
|
||||
"def_b64_too_big_3.txt" \
|
||||
-m "ERROR" \
|
||||
-n "The length of the base64 code found should be a multiple of 4" \
|
||||
-u "bytes left to analyze from context"
|
||||
|
||||
run_test "Empty file as input" \
|
||||
"empty.txt" \
|
||||
-u "Finished. No valid base64 code found"
|
||||
|
||||
run_test "Not empty file without base64 code" \
|
||||
"../../../tests/context-info.sh" \
|
||||
-n "Deserializing"
|
||||
|
||||
run_test "Binary file instead of text file" \
|
||||
"../../../programs/ssl/ssl_context_info" \
|
||||
-m "ERROR" \
|
||||
-u "Too many bad symbols detected. File check aborted" \
|
||||
-n "Deserializing"
|
||||
|
||||
run_test "Decoder continues past 0xff character" \
|
||||
"def_b64_ff.bin" \
|
||||
-n "No valid base64" \
|
||||
-u "ciphersuite.* TLS-"
|
||||
|
||||
|
||||
# End of tests
|
||||
|
||||
echo
|
||||
if [ $T_FAILED -eq 0 ]; then
|
||||
echo "PASSED ( $T_COUNT tests )"
|
||||
else
|
||||
echo "FAILED ( $T_FAILED / $T_COUNT tests )"
|
||||
fi
|
||||
|
||||
exit $T_FAILED
|
||||
16
vendor/mbedtls/tests/git-scripts/README.md
vendored
Normal file
16
vendor/mbedtls/tests/git-scripts/README.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
README for git hooks script
|
||||
===========================
|
||||
git has a way to run scripts, which are invoked by specific git commands.
|
||||
The git hooks are located in `<Mbed TLS root>/.git/hooks`, and as such are not under version control
|
||||
for more information, see the [git documentation](https://git-scm.com/docs/githooks).
|
||||
|
||||
The Mbed TLS git hooks are located in `<Mbed TLS root>/tests/git-scripts` directory, and one must create a soft link from `<Mbed TLS root>/.git/hooks` to `<Mbed TLS root>/tests/git-scripts`, in order to make the hook scripts successfully work.
|
||||
|
||||
Example:
|
||||
|
||||
Execute the following command to create a link on Linux from the Mbed TLS `.git/hooks` directory:
|
||||
`ln -s ../../tests/git-scripts/pre-push.sh pre-push`
|
||||
|
||||
**Note: Currently the Mbed TLS git hooks work only on a GNU platform. If using a non-GNU platform, don't enable these hooks!**
|
||||
|
||||
These scripts can also be used independently.
|
||||
34
vendor/mbedtls/tests/git-scripts/pre-push.sh
vendored
Executable file
34
vendor/mbedtls/tests/git-scripts/pre-push.sh
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# pre-push.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Called by "git push" after it has checked the remote status, but before anything has been
|
||||
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
||||
# This script can also be used independently, not using git.
|
||||
#
|
||||
# This hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- Name of the remote to which the push is being done
|
||||
# $2 -- URL to which the push is being done
|
||||
#
|
||||
# If pushing without using a named remote those arguments will be equal.
|
||||
#
|
||||
# Information about the commits which are being pushed is supplied as lines to
|
||||
# the standard input in the form:
|
||||
#
|
||||
# <local ref> <local sha1> <remote ref> <remote sha1>
|
||||
#
|
||||
|
||||
REMOTE="$1"
|
||||
URL="$2"
|
||||
|
||||
echo "REMOTE is $REMOTE"
|
||||
echo "URL is $URL"
|
||||
|
||||
set -eu
|
||||
|
||||
tests/scripts/all.sh -q -k 'check_*'
|
||||
23
vendor/mbedtls/tests/include/alt-dummy/aes_alt.h
vendored
Normal file
23
vendor/mbedtls/tests/include/alt-dummy/aes_alt.h
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/* aes_alt.h with dummy types for MBEDTLS_AES_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef AES_ALT_H
|
||||
#define AES_ALT_H
|
||||
|
||||
typedef struct mbedtls_aes_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_aes_context;
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||
|
||||
typedef struct mbedtls_aes_xts_context {
|
||||
int dummy;
|
||||
} mbedtls_aes_xts_context;
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* aes_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/aria_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/aria_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* aria_alt.h with dummy types for MBEDTLS_ARIA_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef ARIA_ALT_H
|
||||
#define ARIA_ALT_H
|
||||
|
||||
typedef struct mbedtls_aria_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_aria_context;
|
||||
|
||||
|
||||
#endif /* aria_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/camellia_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/camellia_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* camellia_alt.h with dummy types for MBEDTLS_CAMELLIA_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef CAMELLIA_ALT_H
|
||||
#define CAMELLIA_ALT_H
|
||||
|
||||
typedef struct mbedtls_camellia_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_camellia_context;
|
||||
|
||||
|
||||
#endif /* camellia_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/ccm_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/ccm_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* ccm_alt.h with dummy types for MBEDTLS_CCM_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef CCM_ALT_H
|
||||
#define CCM_ALT_H
|
||||
|
||||
typedef struct mbedtls_ccm_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_ccm_context;
|
||||
|
||||
|
||||
#endif /* ccm_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/chacha20_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/chacha20_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* chacha20_alt.h with dummy types for MBEDTLS_CHACHA20_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef CHACHA20_ALT_H
|
||||
#define CHACHA20_ALT_H
|
||||
|
||||
typedef struct mbedtls_chacha20_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_chacha20_context;
|
||||
|
||||
|
||||
#endif /* chacha20_alt.h */
|
||||
18
vendor/mbedtls/tests/include/alt-dummy/chachapoly_alt.h
vendored
Normal file
18
vendor/mbedtls/tests/include/alt-dummy/chachapoly_alt.h
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/* chachapoly_alt.h with dummy types for MBEDTLS_CHACHAPOLY_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef CHACHAPOLY_ALT_H
|
||||
#define CHACHAPOLY_ALT_H
|
||||
|
||||
#include "mbedtls/chacha20.h"
|
||||
|
||||
typedef struct mbedtls_chachapoly_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_chachapoly_context;
|
||||
|
||||
|
||||
#endif /* chachapoly_alt.h */
|
||||
15
vendor/mbedtls/tests/include/alt-dummy/cmac_alt.h
vendored
Normal file
15
vendor/mbedtls/tests/include/alt-dummy/cmac_alt.h
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/* cmac_alt.h with dummy types for MBEDTLS_CMAC_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef CMAC_ALT_H
|
||||
#define CMAC_ALT_H
|
||||
|
||||
struct mbedtls_cmac_context_t {
|
||||
int dummy;
|
||||
};
|
||||
|
||||
|
||||
#endif /* cmac_alt.h */
|
||||
22
vendor/mbedtls/tests/include/alt-dummy/des_alt.h
vendored
Normal file
22
vendor/mbedtls/tests/include/alt-dummy/des_alt.h
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* des_alt.h with dummy types for MBEDTLS_DES_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DES_ALT_H
|
||||
#define DES_ALT_H
|
||||
|
||||
typedef struct mbedtls_des_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_des_context;
|
||||
|
||||
typedef struct mbedtls_des3_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_des3_context;
|
||||
|
||||
|
||||
#endif /* des_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/dhm_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/dhm_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* dhm_alt.h with dummy types for MBEDTLS_DHM_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef DHM_ALT_H
|
||||
#define DHM_ALT_H
|
||||
|
||||
typedef struct mbedtls_dhm_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_dhm_context;
|
||||
|
||||
|
||||
#endif /* dhm_alt.h */
|
||||
15
vendor/mbedtls/tests/include/alt-dummy/ecjpake_alt.h
vendored
Normal file
15
vendor/mbedtls/tests/include/alt-dummy/ecjpake_alt.h
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/* ecjpake_alt.h with dummy types for MBEDTLS_ECJPAKE_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef ECJPAKE_ALT_H
|
||||
#define ECJPAKE_ALT_H
|
||||
|
||||
typedef struct mbedtls_ecjpake_context {
|
||||
int dummy;
|
||||
} mbedtls_ecjpake_context;
|
||||
|
||||
|
||||
#endif /* ecjpake_alt.h */
|
||||
22
vendor/mbedtls/tests/include/alt-dummy/ecp_alt.h
vendored
Normal file
22
vendor/mbedtls/tests/include/alt-dummy/ecp_alt.h
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/* ecp_alt.h with dummy types for MBEDTLS_ECP_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef ECP_ALT_H
|
||||
#define ECP_ALT_H
|
||||
|
||||
typedef struct mbedtls_ecp_group {
|
||||
const mbedtls_ecp_group_id id;
|
||||
const mbedtls_mpi P;
|
||||
const mbedtls_mpi A;
|
||||
const mbedtls_mpi B;
|
||||
const mbedtls_ecp_point G;
|
||||
const mbedtls_mpi N;
|
||||
const size_t pbits;
|
||||
const size_t nbits;
|
||||
}
|
||||
mbedtls_ecp_group;
|
||||
|
||||
#endif /* ecp_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/gcm_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/gcm_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* gcm_alt.h with dummy types for MBEDTLS_GCM_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef GCM_ALT_H
|
||||
#define GCM_ALT_H
|
||||
|
||||
typedef struct mbedtls_gcm_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_gcm_context;
|
||||
|
||||
|
||||
#endif /* gcm_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/md5_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/md5_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* md5_alt.h with dummy types for MBEDTLS_MD5_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef MD5_ALT_H
|
||||
#define MD5_ALT_H
|
||||
|
||||
typedef struct mbedtls_md5_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_md5_context;
|
||||
|
||||
|
||||
#endif /* md5_alt.h */
|
||||
15
vendor/mbedtls/tests/include/alt-dummy/nist_kw_alt.h
vendored
Normal file
15
vendor/mbedtls/tests/include/alt-dummy/nist_kw_alt.h
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/* nist_kw_alt.h with dummy types for MBEDTLS_NIST_KW_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef NIST_KW_ALT_H
|
||||
#define NIST_KW_ALT_H
|
||||
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} mbedtls_nist_kw_context;
|
||||
|
||||
|
||||
#endif /* nist_kw_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/platform_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/platform_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* platform_alt.h with dummy types for MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_ALT_H
|
||||
#define PLATFORM_ALT_H
|
||||
|
||||
typedef struct mbedtls_platform_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_platform_context;
|
||||
|
||||
|
||||
#endif /* platform_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/poly1305_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/poly1305_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* poly1305_alt.h with dummy types for MBEDTLS_POLY1305_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef POLY1305_ALT_H
|
||||
#define POLY1305_ALT_H
|
||||
|
||||
typedef struct mbedtls_poly1305_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_poly1305_context;
|
||||
|
||||
|
||||
#endif /* poly1305_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/ripemd160_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/ripemd160_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* ripemd160_alt.h with dummy types for MBEDTLS_RIPEMD160_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef RIPEMD160_ALT_H
|
||||
#define RIPEMD160_ALT_H
|
||||
|
||||
typedef struct mbedtls_ripemd160_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_ripemd160_context;
|
||||
|
||||
|
||||
#endif /* ripemd160_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/rsa_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/rsa_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* rsa_alt.h with dummy types for MBEDTLS_RSA_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef RSA_ALT_H
|
||||
#define RSA_ALT_H
|
||||
|
||||
typedef struct mbedtls_rsa_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_rsa_context;
|
||||
|
||||
|
||||
#endif /* rsa_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/sha1_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/sha1_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* sha1_alt.h with dummy types for MBEDTLS_SHA1_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef SHA1_ALT_H
|
||||
#define SHA1_ALT_H
|
||||
|
||||
typedef struct mbedtls_sha1_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_sha1_context;
|
||||
|
||||
|
||||
#endif /* sha1_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/sha256_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/sha256_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* sha256_alt.h with dummy types for MBEDTLS_SHA256_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef SHA256_ALT_H
|
||||
#define SHA256_ALT_H
|
||||
|
||||
typedef struct mbedtls_sha256_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_sha256_context;
|
||||
|
||||
|
||||
#endif /* sha256_alt.h */
|
||||
16
vendor/mbedtls/tests/include/alt-dummy/sha512_alt.h
vendored
Normal file
16
vendor/mbedtls/tests/include/alt-dummy/sha512_alt.h
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/* sha512_alt.h with dummy types for MBEDTLS_SHA512_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef SHA512_ALT_H
|
||||
#define SHA512_ALT_H
|
||||
|
||||
typedef struct mbedtls_sha512_context {
|
||||
int dummy;
|
||||
}
|
||||
mbedtls_sha512_context;
|
||||
|
||||
|
||||
#endif /* sha512_alt.h */
|
||||
14
vendor/mbedtls/tests/include/alt-dummy/threading_alt.h
vendored
Normal file
14
vendor/mbedtls/tests/include/alt-dummy/threading_alt.h
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/* threading_alt.h with dummy types for MBEDTLS_THREADING_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef THREADING_ALT_H
|
||||
#define THREADING_ALT_H
|
||||
|
||||
typedef struct mbedtls_threading_mutex_t {
|
||||
int dummy;
|
||||
} mbedtls_threading_mutex_t;
|
||||
|
||||
#endif /* threading_alt.h */
|
||||
19
vendor/mbedtls/tests/include/alt-dummy/timing_alt.h
vendored
Normal file
19
vendor/mbedtls/tests/include/alt-dummy/timing_alt.h
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/* timing_alt.h with dummy types for MBEDTLS_TIMING_ALT */
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef TIMING_ALT_H
|
||||
#define TIMING_ALT_H
|
||||
|
||||
struct mbedtls_timing_hr_time {
|
||||
int dummy;
|
||||
};
|
||||
|
||||
typedef struct mbedtls_timing_delay_context {
|
||||
int dummy;
|
||||
} mbedtls_timing_delay_context;
|
||||
|
||||
|
||||
#endif /* timing_alt.h */
|
||||
234
vendor/mbedtls/tests/include/test/certs.h
vendored
Normal file
234
vendor/mbedtls/tests/include/test/certs.h
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
/**
|
||||
* \file certs.h
|
||||
*
|
||||
* \brief Sample certificates and DHM parameters for testing
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
#ifndef MBEDTLS_CERTS_H
|
||||
#define MBEDTLS_CERTS_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* List of all PEM-encoded CA certificates, terminated by NULL;
|
||||
* PEM encoded if MBEDTLS_PEM_PARSE_C is enabled, DER encoded
|
||||
* otherwise. */
|
||||
extern const char *mbedtls_test_cas[];
|
||||
extern const size_t mbedtls_test_cas_len[];
|
||||
|
||||
/* List of all DER-encoded CA certificates, terminated by NULL */
|
||||
extern const unsigned char *mbedtls_test_cas_der[];
|
||||
extern const size_t mbedtls_test_cas_der_len[];
|
||||
|
||||
#if defined(MBEDTLS_PEM_PARSE_C)
|
||||
/* Concatenation of all CA certificates in PEM format if available */
|
||||
extern const char mbedtls_test_cas_pem[];
|
||||
extern const size_t mbedtls_test_cas_pem_len;
|
||||
#endif /* MBEDTLS_PEM_PARSE_C */
|
||||
|
||||
/*
|
||||
* CA test certificates
|
||||
*/
|
||||
|
||||
extern const char mbedtls_test_ca_crt_ec_pem[];
|
||||
extern const char mbedtls_test_ca_key_ec_pem[];
|
||||
extern const char mbedtls_test_ca_pwd_ec_pem[];
|
||||
extern const char mbedtls_test_ca_key_rsa_pem[];
|
||||
extern const char mbedtls_test_ca_pwd_rsa_pem[];
|
||||
extern const char mbedtls_test_ca_crt_rsa_sha1_pem[];
|
||||
extern const char mbedtls_test_ca_crt_rsa_sha256_pem[];
|
||||
|
||||
extern const unsigned char mbedtls_test_ca_crt_ec_der[];
|
||||
extern const unsigned char mbedtls_test_ca_key_ec_der[];
|
||||
extern const unsigned char mbedtls_test_ca_key_rsa_der[];
|
||||
extern const unsigned char mbedtls_test_ca_crt_rsa_sha1_der[];
|
||||
extern const unsigned char mbedtls_test_ca_crt_rsa_sha256_der[];
|
||||
|
||||
extern const size_t mbedtls_test_ca_crt_ec_pem_len;
|
||||
extern const size_t mbedtls_test_ca_key_ec_pem_len;
|
||||
extern const size_t mbedtls_test_ca_pwd_ec_pem_len;
|
||||
extern const size_t mbedtls_test_ca_key_rsa_pem_len;
|
||||
extern const size_t mbedtls_test_ca_pwd_rsa_pem_len;
|
||||
extern const size_t mbedtls_test_ca_crt_rsa_sha1_pem_len;
|
||||
extern const size_t mbedtls_test_ca_crt_rsa_sha256_pem_len;
|
||||
|
||||
extern const size_t mbedtls_test_ca_crt_ec_der_len;
|
||||
extern const size_t mbedtls_test_ca_key_ec_der_len;
|
||||
extern const size_t mbedtls_test_ca_pwd_ec_der_len;
|
||||
extern const size_t mbedtls_test_ca_key_rsa_der_len;
|
||||
extern const size_t mbedtls_test_ca_pwd_rsa_der_len;
|
||||
extern const size_t mbedtls_test_ca_crt_rsa_sha1_der_len;
|
||||
extern const size_t mbedtls_test_ca_crt_rsa_sha256_der_len;
|
||||
|
||||
/* Config-dependent dispatch between PEM and DER encoding
|
||||
* (PEM if enabled, otherwise DER) */
|
||||
|
||||
extern const char mbedtls_test_ca_crt_ec[];
|
||||
extern const char mbedtls_test_ca_key_ec[];
|
||||
extern const char mbedtls_test_ca_pwd_ec[];
|
||||
extern const char mbedtls_test_ca_key_rsa[];
|
||||
extern const char mbedtls_test_ca_pwd_rsa[];
|
||||
extern const char mbedtls_test_ca_crt_rsa_sha1[];
|
||||
extern const char mbedtls_test_ca_crt_rsa_sha256[];
|
||||
|
||||
extern const size_t mbedtls_test_ca_crt_ec_len;
|
||||
extern const size_t mbedtls_test_ca_key_ec_len;
|
||||
extern const size_t mbedtls_test_ca_pwd_ec_len;
|
||||
extern const size_t mbedtls_test_ca_key_rsa_len;
|
||||
extern const size_t mbedtls_test_ca_pwd_rsa_len;
|
||||
extern const size_t mbedtls_test_ca_crt_rsa_sha1_len;
|
||||
extern const size_t mbedtls_test_ca_crt_rsa_sha256_len;
|
||||
|
||||
/* Config-dependent dispatch between SHA-1 and SHA-256
|
||||
* (SHA-256 if enabled, otherwise SHA-1) */
|
||||
|
||||
extern const char mbedtls_test_ca_crt_rsa[];
|
||||
extern const size_t mbedtls_test_ca_crt_rsa_len;
|
||||
|
||||
/* Config-dependent dispatch between EC and RSA
|
||||
* (RSA if enabled, otherwise EC) */
|
||||
|
||||
extern const char *mbedtls_test_ca_crt;
|
||||
extern const char *mbedtls_test_ca_key;
|
||||
extern const char *mbedtls_test_ca_pwd;
|
||||
extern const size_t mbedtls_test_ca_crt_len;
|
||||
extern const size_t mbedtls_test_ca_key_len;
|
||||
extern const size_t mbedtls_test_ca_pwd_len;
|
||||
|
||||
/*
|
||||
* Server test certificates
|
||||
*/
|
||||
|
||||
extern const char mbedtls_test_srv_crt_ec_pem[];
|
||||
extern const char mbedtls_test_srv_key_ec_pem[];
|
||||
extern const char mbedtls_test_srv_pwd_ec_pem[];
|
||||
extern const char mbedtls_test_srv_key_rsa_pem[];
|
||||
extern const char mbedtls_test_srv_pwd_rsa_pem[];
|
||||
extern const char mbedtls_test_srv_crt_rsa_sha1_pem[];
|
||||
extern const char mbedtls_test_srv_crt_rsa_sha256_pem[];
|
||||
|
||||
extern const unsigned char mbedtls_test_srv_crt_ec_der[];
|
||||
extern const unsigned char mbedtls_test_srv_key_ec_der[];
|
||||
extern const unsigned char mbedtls_test_srv_key_rsa_der[];
|
||||
extern const unsigned char mbedtls_test_srv_crt_rsa_sha1_der[];
|
||||
extern const unsigned char mbedtls_test_srv_crt_rsa_sha256_der[];
|
||||
|
||||
extern const size_t mbedtls_test_srv_crt_ec_pem_len;
|
||||
extern const size_t mbedtls_test_srv_key_ec_pem_len;
|
||||
extern const size_t mbedtls_test_srv_pwd_ec_pem_len;
|
||||
extern const size_t mbedtls_test_srv_key_rsa_pem_len;
|
||||
extern const size_t mbedtls_test_srv_pwd_rsa_pem_len;
|
||||
extern const size_t mbedtls_test_srv_crt_rsa_sha1_pem_len;
|
||||
extern const size_t mbedtls_test_srv_crt_rsa_sha256_pem_len;
|
||||
|
||||
extern const size_t mbedtls_test_srv_crt_ec_der_len;
|
||||
extern const size_t mbedtls_test_srv_key_ec_der_len;
|
||||
extern const size_t mbedtls_test_srv_pwd_ec_der_len;
|
||||
extern const size_t mbedtls_test_srv_key_rsa_der_len;
|
||||
extern const size_t mbedtls_test_srv_pwd_rsa_der_len;
|
||||
extern const size_t mbedtls_test_srv_crt_rsa_sha1_der_len;
|
||||
extern const size_t mbedtls_test_srv_crt_rsa_sha256_der_len;
|
||||
|
||||
/* Config-dependent dispatch between PEM and DER encoding
|
||||
* (PEM if enabled, otherwise DER) */
|
||||
|
||||
extern const char mbedtls_test_srv_crt_ec[];
|
||||
extern const char mbedtls_test_srv_key_ec[];
|
||||
extern const char mbedtls_test_srv_pwd_ec[];
|
||||
extern const char mbedtls_test_srv_key_rsa[];
|
||||
extern const char mbedtls_test_srv_pwd_rsa[];
|
||||
extern const char mbedtls_test_srv_crt_rsa_sha1[];
|
||||
extern const char mbedtls_test_srv_crt_rsa_sha256[];
|
||||
|
||||
extern const size_t mbedtls_test_srv_crt_ec_len;
|
||||
extern const size_t mbedtls_test_srv_key_ec_len;
|
||||
extern const size_t mbedtls_test_srv_pwd_ec_len;
|
||||
extern const size_t mbedtls_test_srv_key_rsa_len;
|
||||
extern const size_t mbedtls_test_srv_pwd_rsa_len;
|
||||
extern const size_t mbedtls_test_srv_crt_rsa_sha1_len;
|
||||
extern const size_t mbedtls_test_srv_crt_rsa_sha256_len;
|
||||
|
||||
/* Config-dependent dispatch between SHA-1 and SHA-256
|
||||
* (SHA-256 if enabled, otherwise SHA-1) */
|
||||
|
||||
extern const char mbedtls_test_srv_crt_rsa[];
|
||||
extern const size_t mbedtls_test_srv_crt_rsa_len;
|
||||
|
||||
/* Config-dependent dispatch between EC and RSA
|
||||
* (RSA if enabled, otherwise EC) */
|
||||
|
||||
extern const char *mbedtls_test_srv_crt;
|
||||
extern const char *mbedtls_test_srv_key;
|
||||
extern const char *mbedtls_test_srv_pwd;
|
||||
extern const size_t mbedtls_test_srv_crt_len;
|
||||
extern const size_t mbedtls_test_srv_key_len;
|
||||
extern const size_t mbedtls_test_srv_pwd_len;
|
||||
|
||||
/*
|
||||
* Client test certificates
|
||||
*/
|
||||
|
||||
extern const char mbedtls_test_cli_crt_ec_pem[];
|
||||
extern const char mbedtls_test_cli_key_ec_pem[];
|
||||
extern const char mbedtls_test_cli_pwd_ec_pem[];
|
||||
extern const char mbedtls_test_cli_key_rsa_pem[];
|
||||
extern const char mbedtls_test_cli_pwd_rsa_pem[];
|
||||
extern const char mbedtls_test_cli_crt_rsa_pem[];
|
||||
|
||||
extern const unsigned char mbedtls_test_cli_crt_ec_der[];
|
||||
extern const unsigned char mbedtls_test_cli_key_ec_der[];
|
||||
extern const unsigned char mbedtls_test_cli_key_rsa_der[];
|
||||
extern const unsigned char mbedtls_test_cli_crt_rsa_der[];
|
||||
|
||||
extern const size_t mbedtls_test_cli_crt_ec_pem_len;
|
||||
extern const size_t mbedtls_test_cli_key_ec_pem_len;
|
||||
extern const size_t mbedtls_test_cli_pwd_ec_pem_len;
|
||||
extern const size_t mbedtls_test_cli_key_rsa_pem_len;
|
||||
extern const size_t mbedtls_test_cli_pwd_rsa_pem_len;
|
||||
extern const size_t mbedtls_test_cli_crt_rsa_pem_len;
|
||||
|
||||
extern const size_t mbedtls_test_cli_crt_ec_der_len;
|
||||
extern const size_t mbedtls_test_cli_key_ec_der_len;
|
||||
extern const size_t mbedtls_test_cli_key_rsa_der_len;
|
||||
extern const size_t mbedtls_test_cli_crt_rsa_der_len;
|
||||
|
||||
/* Config-dependent dispatch between PEM and DER encoding
|
||||
* (PEM if enabled, otherwise DER) */
|
||||
|
||||
extern const char mbedtls_test_cli_crt_ec[];
|
||||
extern const char mbedtls_test_cli_key_ec[];
|
||||
extern const char mbedtls_test_cli_pwd_ec[];
|
||||
extern const char mbedtls_test_cli_key_rsa[];
|
||||
extern const char mbedtls_test_cli_pwd_rsa[];
|
||||
extern const char mbedtls_test_cli_crt_rsa[];
|
||||
|
||||
extern const size_t mbedtls_test_cli_crt_ec_len;
|
||||
extern const size_t mbedtls_test_cli_key_ec_len;
|
||||
extern const size_t mbedtls_test_cli_pwd_ec_len;
|
||||
extern const size_t mbedtls_test_cli_key_rsa_len;
|
||||
extern const size_t mbedtls_test_cli_pwd_rsa_len;
|
||||
extern const size_t mbedtls_test_cli_crt_rsa_len;
|
||||
|
||||
/* Config-dependent dispatch between EC and RSA
|
||||
* (RSA if enabled, otherwise EC) */
|
||||
|
||||
extern const char *mbedtls_test_cli_crt;
|
||||
extern const char *mbedtls_test_cli_key;
|
||||
extern const char *mbedtls_test_cli_pwd;
|
||||
extern const size_t mbedtls_test_cli_crt_len;
|
||||
extern const size_t mbedtls_test_cli_key_len;
|
||||
extern const size_t mbedtls_test_cli_pwd_len;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* certs.h */
|
||||
804
vendor/mbedtls/tests/include/test/psa_test_wrappers.h
vendored
Normal file
804
vendor/mbedtls/tests/include/test/psa_test_wrappers.h
vendored
Normal file
@@ -0,0 +1,804 @@
|
||||
/* Automatically generated by generate_psa_wrappers.py, do not edit! */
|
||||
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef TEST_PSA_TEST_WRAPPERS_H
|
||||
#define TEST_PSA_TEST_WRAPPERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mbedtls/build_info.h>
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_TEST_HOOKS) && \
|
||||
!defined(RECORD_PSA_STATUS_COVERAGE_LOG)
|
||||
|
||||
#include <psa/crypto.h>
|
||||
#include <test/memory.h>
|
||||
#include <test/psa_crypto_helpers.h>
|
||||
#include <test/psa_test_wrappers.h>
|
||||
|
||||
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
|
||||
psa_status_t mbedtls_test_wrap_mbedtls_psa_inject_entropy(
|
||||
const uint8_t *arg0_seed,
|
||||
size_t arg1_seed_size);
|
||||
#define mbedtls_psa_inject_entropy(arg0_seed, arg1_seed_size) \
|
||||
mbedtls_test_wrap_mbedtls_psa_inject_entropy(arg0_seed, arg1_seed_size)
|
||||
#endif /* defined(MBEDTLS_PSA_INJECT_ENTROPY) */
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
|
||||
psa_status_t mbedtls_test_wrap_mbedtls_psa_platform_get_builtin_key(
|
||||
mbedtls_svc_key_id_t arg0_key_id,
|
||||
psa_key_lifetime_t *arg1_lifetime,
|
||||
psa_drv_slot_number_t *arg2_slot_number);
|
||||
#define mbedtls_psa_platform_get_builtin_key(arg0_key_id, arg1_lifetime, arg2_slot_number) \
|
||||
mbedtls_test_wrap_mbedtls_psa_platform_get_builtin_key(arg0_key_id, arg1_lifetime, arg2_slot_number)
|
||||
#endif /* defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS) */
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
|
||||
psa_status_t mbedtls_test_wrap_mbedtls_psa_register_se_key(
|
||||
const psa_key_attributes_t *arg0_attributes);
|
||||
#define mbedtls_psa_register_se_key(arg0_attributes) \
|
||||
mbedtls_test_wrap_mbedtls_psa_register_se_key(arg0_attributes)
|
||||
#endif /* defined(MBEDTLS_PSA_CRYPTO_SE_C) */
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_abort(
|
||||
psa_aead_operation_t *arg0_operation);
|
||||
#define psa_aead_abort(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_aead_abort(arg0_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_decrypt(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_nonce,
|
||||
size_t arg3_nonce_length,
|
||||
const uint8_t *arg4_additional_data,
|
||||
size_t arg5_additional_data_length,
|
||||
const uint8_t *arg6_ciphertext,
|
||||
size_t arg7_ciphertext_length,
|
||||
uint8_t *arg8_plaintext,
|
||||
size_t arg9_plaintext_size,
|
||||
size_t *arg10_plaintext_length);
|
||||
#define psa_aead_decrypt(arg0_key, arg1_alg, arg2_nonce, arg3_nonce_length, arg4_additional_data, arg5_additional_data_length, arg6_ciphertext, arg7_ciphertext_length, arg8_plaintext, arg9_plaintext_size, arg10_plaintext_length) \
|
||||
mbedtls_test_wrap_psa_aead_decrypt(arg0_key, arg1_alg, arg2_nonce, arg3_nonce_length, arg4_additional_data, arg5_additional_data_length, arg6_ciphertext, arg7_ciphertext_length, arg8_plaintext, arg9_plaintext_size, arg10_plaintext_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_decrypt_setup(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_key,
|
||||
psa_algorithm_t arg2_alg);
|
||||
#define psa_aead_decrypt_setup(arg0_operation, arg1_key, arg2_alg) \
|
||||
mbedtls_test_wrap_psa_aead_decrypt_setup(arg0_operation, arg1_key, arg2_alg)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_encrypt(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_nonce,
|
||||
size_t arg3_nonce_length,
|
||||
const uint8_t *arg4_additional_data,
|
||||
size_t arg5_additional_data_length,
|
||||
const uint8_t *arg6_plaintext,
|
||||
size_t arg7_plaintext_length,
|
||||
uint8_t *arg8_ciphertext,
|
||||
size_t arg9_ciphertext_size,
|
||||
size_t *arg10_ciphertext_length);
|
||||
#define psa_aead_encrypt(arg0_key, arg1_alg, arg2_nonce, arg3_nonce_length, arg4_additional_data, arg5_additional_data_length, arg6_plaintext, arg7_plaintext_length, arg8_ciphertext, arg9_ciphertext_size, arg10_ciphertext_length) \
|
||||
mbedtls_test_wrap_psa_aead_encrypt(arg0_key, arg1_alg, arg2_nonce, arg3_nonce_length, arg4_additional_data, arg5_additional_data_length, arg6_plaintext, arg7_plaintext_length, arg8_ciphertext, arg9_ciphertext_size, arg10_ciphertext_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_encrypt_setup(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_key,
|
||||
psa_algorithm_t arg2_alg);
|
||||
#define psa_aead_encrypt_setup(arg0_operation, arg1_key, arg2_alg) \
|
||||
mbedtls_test_wrap_psa_aead_encrypt_setup(arg0_operation, arg1_key, arg2_alg)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_finish(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
uint8_t *arg1_ciphertext,
|
||||
size_t arg2_ciphertext_size,
|
||||
size_t *arg3_ciphertext_length,
|
||||
uint8_t *arg4_tag,
|
||||
size_t arg5_tag_size,
|
||||
size_t *arg6_tag_length);
|
||||
#define psa_aead_finish(arg0_operation, arg1_ciphertext, arg2_ciphertext_size, arg3_ciphertext_length, arg4_tag, arg5_tag_size, arg6_tag_length) \
|
||||
mbedtls_test_wrap_psa_aead_finish(arg0_operation, arg1_ciphertext, arg2_ciphertext_size, arg3_ciphertext_length, arg4_tag, arg5_tag_size, arg6_tag_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_generate_nonce(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
uint8_t *arg1_nonce,
|
||||
size_t arg2_nonce_size,
|
||||
size_t *arg3_nonce_length);
|
||||
#define psa_aead_generate_nonce(arg0_operation, arg1_nonce, arg2_nonce_size, arg3_nonce_length) \
|
||||
mbedtls_test_wrap_psa_aead_generate_nonce(arg0_operation, arg1_nonce, arg2_nonce_size, arg3_nonce_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_set_lengths(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
size_t arg1_ad_length,
|
||||
size_t arg2_plaintext_length);
|
||||
#define psa_aead_set_lengths(arg0_operation, arg1_ad_length, arg2_plaintext_length) \
|
||||
mbedtls_test_wrap_psa_aead_set_lengths(arg0_operation, arg1_ad_length, arg2_plaintext_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_set_nonce(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_nonce,
|
||||
size_t arg2_nonce_length);
|
||||
#define psa_aead_set_nonce(arg0_operation, arg1_nonce, arg2_nonce_length) \
|
||||
mbedtls_test_wrap_psa_aead_set_nonce(arg0_operation, arg1_nonce, arg2_nonce_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_update(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_input,
|
||||
size_t arg2_input_length,
|
||||
uint8_t *arg3_output,
|
||||
size_t arg4_output_size,
|
||||
size_t *arg5_output_length);
|
||||
#define psa_aead_update(arg0_operation, arg1_input, arg2_input_length, arg3_output, arg4_output_size, arg5_output_length) \
|
||||
mbedtls_test_wrap_psa_aead_update(arg0_operation, arg1_input, arg2_input_length, arg3_output, arg4_output_size, arg5_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_update_ad(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_input,
|
||||
size_t arg2_input_length);
|
||||
#define psa_aead_update_ad(arg0_operation, arg1_input, arg2_input_length) \
|
||||
mbedtls_test_wrap_psa_aead_update_ad(arg0_operation, arg1_input, arg2_input_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_aead_verify(
|
||||
psa_aead_operation_t *arg0_operation,
|
||||
uint8_t *arg1_plaintext,
|
||||
size_t arg2_plaintext_size,
|
||||
size_t *arg3_plaintext_length,
|
||||
const uint8_t *arg4_tag,
|
||||
size_t arg5_tag_length);
|
||||
#define psa_aead_verify(arg0_operation, arg1_plaintext, arg2_plaintext_size, arg3_plaintext_length, arg4_tag, arg5_tag_length) \
|
||||
mbedtls_test_wrap_psa_aead_verify(arg0_operation, arg1_plaintext, arg2_plaintext_size, arg3_plaintext_length, arg4_tag, arg5_tag_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_asymmetric_decrypt(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length,
|
||||
const uint8_t *arg4_salt,
|
||||
size_t arg5_salt_length,
|
||||
uint8_t *arg6_output,
|
||||
size_t arg7_output_size,
|
||||
size_t *arg8_output_length);
|
||||
#define psa_asymmetric_decrypt(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_salt, arg5_salt_length, arg6_output, arg7_output_size, arg8_output_length) \
|
||||
mbedtls_test_wrap_psa_asymmetric_decrypt(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_salt, arg5_salt_length, arg6_output, arg7_output_size, arg8_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_asymmetric_encrypt(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length,
|
||||
const uint8_t *arg4_salt,
|
||||
size_t arg5_salt_length,
|
||||
uint8_t *arg6_output,
|
||||
size_t arg7_output_size,
|
||||
size_t *arg8_output_length);
|
||||
#define psa_asymmetric_encrypt(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_salt, arg5_salt_length, arg6_output, arg7_output_size, arg8_output_length) \
|
||||
mbedtls_test_wrap_psa_asymmetric_encrypt(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_salt, arg5_salt_length, arg6_output, arg7_output_size, arg8_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_abort(
|
||||
psa_cipher_operation_t *arg0_operation);
|
||||
#define psa_cipher_abort(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_cipher_abort(arg0_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_decrypt(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length,
|
||||
uint8_t *arg4_output,
|
||||
size_t arg5_output_size,
|
||||
size_t *arg6_output_length);
|
||||
#define psa_cipher_decrypt(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_output, arg5_output_size, arg6_output_length) \
|
||||
mbedtls_test_wrap_psa_cipher_decrypt(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_output, arg5_output_size, arg6_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_decrypt_setup(
|
||||
psa_cipher_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_key,
|
||||
psa_algorithm_t arg2_alg);
|
||||
#define psa_cipher_decrypt_setup(arg0_operation, arg1_key, arg2_alg) \
|
||||
mbedtls_test_wrap_psa_cipher_decrypt_setup(arg0_operation, arg1_key, arg2_alg)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_encrypt(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length,
|
||||
uint8_t *arg4_output,
|
||||
size_t arg5_output_size,
|
||||
size_t *arg6_output_length);
|
||||
#define psa_cipher_encrypt(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_output, arg5_output_size, arg6_output_length) \
|
||||
mbedtls_test_wrap_psa_cipher_encrypt(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_output, arg5_output_size, arg6_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_encrypt_setup(
|
||||
psa_cipher_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_key,
|
||||
psa_algorithm_t arg2_alg);
|
||||
#define psa_cipher_encrypt_setup(arg0_operation, arg1_key, arg2_alg) \
|
||||
mbedtls_test_wrap_psa_cipher_encrypt_setup(arg0_operation, arg1_key, arg2_alg)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_finish(
|
||||
psa_cipher_operation_t *arg0_operation,
|
||||
uint8_t *arg1_output,
|
||||
size_t arg2_output_size,
|
||||
size_t *arg3_output_length);
|
||||
#define psa_cipher_finish(arg0_operation, arg1_output, arg2_output_size, arg3_output_length) \
|
||||
mbedtls_test_wrap_psa_cipher_finish(arg0_operation, arg1_output, arg2_output_size, arg3_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_generate_iv(
|
||||
psa_cipher_operation_t *arg0_operation,
|
||||
uint8_t *arg1_iv,
|
||||
size_t arg2_iv_size,
|
||||
size_t *arg3_iv_length);
|
||||
#define psa_cipher_generate_iv(arg0_operation, arg1_iv, arg2_iv_size, arg3_iv_length) \
|
||||
mbedtls_test_wrap_psa_cipher_generate_iv(arg0_operation, arg1_iv, arg2_iv_size, arg3_iv_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_set_iv(
|
||||
psa_cipher_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_iv,
|
||||
size_t arg2_iv_length);
|
||||
#define psa_cipher_set_iv(arg0_operation, arg1_iv, arg2_iv_length) \
|
||||
mbedtls_test_wrap_psa_cipher_set_iv(arg0_operation, arg1_iv, arg2_iv_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_cipher_update(
|
||||
psa_cipher_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_input,
|
||||
size_t arg2_input_length,
|
||||
uint8_t *arg3_output,
|
||||
size_t arg4_output_size,
|
||||
size_t *arg5_output_length);
|
||||
#define psa_cipher_update(arg0_operation, arg1_input, arg2_input_length, arg3_output, arg4_output_size, arg5_output_length) \
|
||||
mbedtls_test_wrap_psa_cipher_update(arg0_operation, arg1_input, arg2_input_length, arg3_output, arg4_output_size, arg5_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_copy_key(
|
||||
mbedtls_svc_key_id_t arg0_source_key,
|
||||
const psa_key_attributes_t *arg1_attributes,
|
||||
mbedtls_svc_key_id_t *arg2_target_key);
|
||||
#define psa_copy_key(arg0_source_key, arg1_attributes, arg2_target_key) \
|
||||
mbedtls_test_wrap_psa_copy_key(arg0_source_key, arg1_attributes, arg2_target_key)
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_crypto_driver_pake_get_cipher_suite(
|
||||
const psa_crypto_driver_pake_inputs_t *arg0_inputs,
|
||||
psa_pake_cipher_suite_t *arg1_cipher_suite);
|
||||
#define psa_crypto_driver_pake_get_cipher_suite(arg0_inputs, arg1_cipher_suite) \
|
||||
mbedtls_test_wrap_psa_crypto_driver_pake_get_cipher_suite(arg0_inputs, arg1_cipher_suite)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_crypto_driver_pake_get_password(
|
||||
const psa_crypto_driver_pake_inputs_t *arg0_inputs,
|
||||
uint8_t *arg1_buffer,
|
||||
size_t arg2_buffer_size,
|
||||
size_t *arg3_buffer_length);
|
||||
#define psa_crypto_driver_pake_get_password(arg0_inputs, arg1_buffer, arg2_buffer_size, arg3_buffer_length) \
|
||||
mbedtls_test_wrap_psa_crypto_driver_pake_get_password(arg0_inputs, arg1_buffer, arg2_buffer_size, arg3_buffer_length)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_crypto_driver_pake_get_password_len(
|
||||
const psa_crypto_driver_pake_inputs_t *arg0_inputs,
|
||||
size_t *arg1_password_len);
|
||||
#define psa_crypto_driver_pake_get_password_len(arg0_inputs, arg1_password_len) \
|
||||
mbedtls_test_wrap_psa_crypto_driver_pake_get_password_len(arg0_inputs, arg1_password_len)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_crypto_driver_pake_get_peer(
|
||||
const psa_crypto_driver_pake_inputs_t *arg0_inputs,
|
||||
uint8_t *arg1_peer_id,
|
||||
size_t arg2_peer_id_size,
|
||||
size_t *arg3_peer_id_length);
|
||||
#define psa_crypto_driver_pake_get_peer(arg0_inputs, arg1_peer_id, arg2_peer_id_size, arg3_peer_id_length) \
|
||||
mbedtls_test_wrap_psa_crypto_driver_pake_get_peer(arg0_inputs, arg1_peer_id, arg2_peer_id_size, arg3_peer_id_length)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_crypto_driver_pake_get_peer_len(
|
||||
const psa_crypto_driver_pake_inputs_t *arg0_inputs,
|
||||
size_t *arg1_peer_len);
|
||||
#define psa_crypto_driver_pake_get_peer_len(arg0_inputs, arg1_peer_len) \
|
||||
mbedtls_test_wrap_psa_crypto_driver_pake_get_peer_len(arg0_inputs, arg1_peer_len)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_crypto_driver_pake_get_user(
|
||||
const psa_crypto_driver_pake_inputs_t *arg0_inputs,
|
||||
uint8_t *arg1_user_id,
|
||||
size_t arg2_user_id_size,
|
||||
size_t *arg3_user_id_len);
|
||||
#define psa_crypto_driver_pake_get_user(arg0_inputs, arg1_user_id, arg2_user_id_size, arg3_user_id_len) \
|
||||
mbedtls_test_wrap_psa_crypto_driver_pake_get_user(arg0_inputs, arg1_user_id, arg2_user_id_size, arg3_user_id_len)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_crypto_driver_pake_get_user_len(
|
||||
const psa_crypto_driver_pake_inputs_t *arg0_inputs,
|
||||
size_t *arg1_user_len);
|
||||
#define psa_crypto_driver_pake_get_user_len(arg0_inputs, arg1_user_len) \
|
||||
mbedtls_test_wrap_psa_crypto_driver_pake_get_user_len(arg0_inputs, arg1_user_len)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_crypto_init(void);
|
||||
#define psa_crypto_init() \
|
||||
mbedtls_test_wrap_psa_crypto_init()
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_destroy_key(
|
||||
mbedtls_svc_key_id_t arg0_key);
|
||||
#define psa_destroy_key(arg0_key) \
|
||||
mbedtls_test_wrap_psa_destroy_key(arg0_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_export_key(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
uint8_t *arg1_data,
|
||||
size_t arg2_data_size,
|
||||
size_t *arg3_data_length);
|
||||
#define psa_export_key(arg0_key, arg1_data, arg2_data_size, arg3_data_length) \
|
||||
mbedtls_test_wrap_psa_export_key(arg0_key, arg1_data, arg2_data_size, arg3_data_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_export_public_key(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
uint8_t *arg1_data,
|
||||
size_t arg2_data_size,
|
||||
size_t *arg3_data_length);
|
||||
#define psa_export_public_key(arg0_key, arg1_data, arg2_data_size, arg3_data_length) \
|
||||
mbedtls_test_wrap_psa_export_public_key(arg0_key, arg1_data, arg2_data_size, arg3_data_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_generate_key(
|
||||
const psa_key_attributes_t *arg0_attributes,
|
||||
mbedtls_svc_key_id_t *arg1_key);
|
||||
#define psa_generate_key(arg0_attributes, arg1_key) \
|
||||
mbedtls_test_wrap_psa_generate_key(arg0_attributes, arg1_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_generate_key_custom(
|
||||
const psa_key_attributes_t *arg0_attributes,
|
||||
const psa_custom_key_parameters_t *arg1_custom,
|
||||
const uint8_t *arg2_custom_data,
|
||||
size_t arg3_custom_data_length,
|
||||
mbedtls_svc_key_id_t *arg4_key);
|
||||
#define psa_generate_key_custom(arg0_attributes, arg1_custom, arg2_custom_data, arg3_custom_data_length, arg4_key) \
|
||||
mbedtls_test_wrap_psa_generate_key_custom(arg0_attributes, arg1_custom, arg2_custom_data, arg3_custom_data_length, arg4_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_generate_key_ext(
|
||||
const psa_key_attributes_t *arg0_attributes,
|
||||
const psa_key_production_parameters_t *arg1_params,
|
||||
size_t arg2_params_data_length,
|
||||
mbedtls_svc_key_id_t *arg3_key);
|
||||
#define psa_generate_key_ext(arg0_attributes, arg1_params, arg2_params_data_length, arg3_key) \
|
||||
mbedtls_test_wrap_psa_generate_key_ext(arg0_attributes, arg1_params, arg2_params_data_length, arg3_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_generate_random(
|
||||
uint8_t *arg0_output,
|
||||
size_t arg1_output_size);
|
||||
#define psa_generate_random(arg0_output, arg1_output_size) \
|
||||
mbedtls_test_wrap_psa_generate_random(arg0_output, arg1_output_size)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_get_key_attributes(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_key_attributes_t *arg1_attributes);
|
||||
#define psa_get_key_attributes(arg0_key, arg1_attributes) \
|
||||
mbedtls_test_wrap_psa_get_key_attributes(arg0_key, arg1_attributes)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_hash_abort(
|
||||
psa_hash_operation_t *arg0_operation);
|
||||
#define psa_hash_abort(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_hash_abort(arg0_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_hash_clone(
|
||||
const psa_hash_operation_t *arg0_source_operation,
|
||||
psa_hash_operation_t *arg1_target_operation);
|
||||
#define psa_hash_clone(arg0_source_operation, arg1_target_operation) \
|
||||
mbedtls_test_wrap_psa_hash_clone(arg0_source_operation, arg1_target_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_hash_compare(
|
||||
psa_algorithm_t arg0_alg,
|
||||
const uint8_t *arg1_input,
|
||||
size_t arg2_input_length,
|
||||
const uint8_t *arg3_hash,
|
||||
size_t arg4_hash_length);
|
||||
#define psa_hash_compare(arg0_alg, arg1_input, arg2_input_length, arg3_hash, arg4_hash_length) \
|
||||
mbedtls_test_wrap_psa_hash_compare(arg0_alg, arg1_input, arg2_input_length, arg3_hash, arg4_hash_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_hash_compute(
|
||||
psa_algorithm_t arg0_alg,
|
||||
const uint8_t *arg1_input,
|
||||
size_t arg2_input_length,
|
||||
uint8_t *arg3_hash,
|
||||
size_t arg4_hash_size,
|
||||
size_t *arg5_hash_length);
|
||||
#define psa_hash_compute(arg0_alg, arg1_input, arg2_input_length, arg3_hash, arg4_hash_size, arg5_hash_length) \
|
||||
mbedtls_test_wrap_psa_hash_compute(arg0_alg, arg1_input, arg2_input_length, arg3_hash, arg4_hash_size, arg5_hash_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_hash_finish(
|
||||
psa_hash_operation_t *arg0_operation,
|
||||
uint8_t *arg1_hash,
|
||||
size_t arg2_hash_size,
|
||||
size_t *arg3_hash_length);
|
||||
#define psa_hash_finish(arg0_operation, arg1_hash, arg2_hash_size, arg3_hash_length) \
|
||||
mbedtls_test_wrap_psa_hash_finish(arg0_operation, arg1_hash, arg2_hash_size, arg3_hash_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_hash_setup(
|
||||
psa_hash_operation_t *arg0_operation,
|
||||
psa_algorithm_t arg1_alg);
|
||||
#define psa_hash_setup(arg0_operation, arg1_alg) \
|
||||
mbedtls_test_wrap_psa_hash_setup(arg0_operation, arg1_alg)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_hash_update(
|
||||
psa_hash_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_input,
|
||||
size_t arg2_input_length);
|
||||
#define psa_hash_update(arg0_operation, arg1_input, arg2_input_length) \
|
||||
mbedtls_test_wrap_psa_hash_update(arg0_operation, arg1_input, arg2_input_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_hash_verify(
|
||||
psa_hash_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_hash,
|
||||
size_t arg2_hash_length);
|
||||
#define psa_hash_verify(arg0_operation, arg1_hash, arg2_hash_length) \
|
||||
mbedtls_test_wrap_psa_hash_verify(arg0_operation, arg1_hash, arg2_hash_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_import_key(
|
||||
const psa_key_attributes_t *arg0_attributes,
|
||||
const uint8_t *arg1_data,
|
||||
size_t arg2_data_length,
|
||||
mbedtls_svc_key_id_t *arg3_key);
|
||||
#define psa_import_key(arg0_attributes, arg1_data, arg2_data_length, arg3_key) \
|
||||
mbedtls_test_wrap_psa_import_key(arg0_attributes, arg1_data, arg2_data_length, arg3_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_abort(
|
||||
psa_key_derivation_operation_t *arg0_operation);
|
||||
#define psa_key_derivation_abort(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_key_derivation_abort(arg0_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_get_capacity(
|
||||
const psa_key_derivation_operation_t *arg0_operation,
|
||||
size_t *arg1_capacity);
|
||||
#define psa_key_derivation_get_capacity(arg0_operation, arg1_capacity) \
|
||||
mbedtls_test_wrap_psa_key_derivation_get_capacity(arg0_operation, arg1_capacity)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_input_bytes(
|
||||
psa_key_derivation_operation_t *arg0_operation,
|
||||
psa_key_derivation_step_t arg1_step,
|
||||
const uint8_t *arg2_data,
|
||||
size_t arg3_data_length);
|
||||
#define psa_key_derivation_input_bytes(arg0_operation, arg1_step, arg2_data, arg3_data_length) \
|
||||
mbedtls_test_wrap_psa_key_derivation_input_bytes(arg0_operation, arg1_step, arg2_data, arg3_data_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_input_integer(
|
||||
psa_key_derivation_operation_t *arg0_operation,
|
||||
psa_key_derivation_step_t arg1_step,
|
||||
uint64_t arg2_value);
|
||||
#define psa_key_derivation_input_integer(arg0_operation, arg1_step, arg2_value) \
|
||||
mbedtls_test_wrap_psa_key_derivation_input_integer(arg0_operation, arg1_step, arg2_value)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_input_key(
|
||||
psa_key_derivation_operation_t *arg0_operation,
|
||||
psa_key_derivation_step_t arg1_step,
|
||||
mbedtls_svc_key_id_t arg2_key);
|
||||
#define psa_key_derivation_input_key(arg0_operation, arg1_step, arg2_key) \
|
||||
mbedtls_test_wrap_psa_key_derivation_input_key(arg0_operation, arg1_step, arg2_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_key_agreement(
|
||||
psa_key_derivation_operation_t *arg0_operation,
|
||||
psa_key_derivation_step_t arg1_step,
|
||||
mbedtls_svc_key_id_t arg2_private_key,
|
||||
const uint8_t *arg3_peer_key,
|
||||
size_t arg4_peer_key_length);
|
||||
#define psa_key_derivation_key_agreement(arg0_operation, arg1_step, arg2_private_key, arg3_peer_key, arg4_peer_key_length) \
|
||||
mbedtls_test_wrap_psa_key_derivation_key_agreement(arg0_operation, arg1_step, arg2_private_key, arg3_peer_key, arg4_peer_key_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_output_bytes(
|
||||
psa_key_derivation_operation_t *arg0_operation,
|
||||
uint8_t *arg1_output,
|
||||
size_t arg2_output_length);
|
||||
#define psa_key_derivation_output_bytes(arg0_operation, arg1_output, arg2_output_length) \
|
||||
mbedtls_test_wrap_psa_key_derivation_output_bytes(arg0_operation, arg1_output, arg2_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_output_key(
|
||||
const psa_key_attributes_t *arg0_attributes,
|
||||
psa_key_derivation_operation_t *arg1_operation,
|
||||
mbedtls_svc_key_id_t *arg2_key);
|
||||
#define psa_key_derivation_output_key(arg0_attributes, arg1_operation, arg2_key) \
|
||||
mbedtls_test_wrap_psa_key_derivation_output_key(arg0_attributes, arg1_operation, arg2_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_output_key_custom(
|
||||
const psa_key_attributes_t *arg0_attributes,
|
||||
psa_key_derivation_operation_t *arg1_operation,
|
||||
const psa_custom_key_parameters_t *arg2_custom,
|
||||
const uint8_t *arg3_custom_data,
|
||||
size_t arg4_custom_data_length,
|
||||
mbedtls_svc_key_id_t *arg5_key);
|
||||
#define psa_key_derivation_output_key_custom(arg0_attributes, arg1_operation, arg2_custom, arg3_custom_data, arg4_custom_data_length, arg5_key) \
|
||||
mbedtls_test_wrap_psa_key_derivation_output_key_custom(arg0_attributes, arg1_operation, arg2_custom, arg3_custom_data, arg4_custom_data_length, arg5_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_output_key_ext(
|
||||
const psa_key_attributes_t *arg0_attributes,
|
||||
psa_key_derivation_operation_t *arg1_operation,
|
||||
const psa_key_production_parameters_t *arg2_params,
|
||||
size_t arg3_params_data_length,
|
||||
mbedtls_svc_key_id_t *arg4_key);
|
||||
#define psa_key_derivation_output_key_ext(arg0_attributes, arg1_operation, arg2_params, arg3_params_data_length, arg4_key) \
|
||||
mbedtls_test_wrap_psa_key_derivation_output_key_ext(arg0_attributes, arg1_operation, arg2_params, arg3_params_data_length, arg4_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_set_capacity(
|
||||
psa_key_derivation_operation_t *arg0_operation,
|
||||
size_t arg1_capacity);
|
||||
#define psa_key_derivation_set_capacity(arg0_operation, arg1_capacity) \
|
||||
mbedtls_test_wrap_psa_key_derivation_set_capacity(arg0_operation, arg1_capacity)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_key_derivation_setup(
|
||||
psa_key_derivation_operation_t *arg0_operation,
|
||||
psa_algorithm_t arg1_alg);
|
||||
#define psa_key_derivation_setup(arg0_operation, arg1_alg) \
|
||||
mbedtls_test_wrap_psa_key_derivation_setup(arg0_operation, arg1_alg)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_mac_abort(
|
||||
psa_mac_operation_t *arg0_operation);
|
||||
#define psa_mac_abort(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_mac_abort(arg0_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_mac_compute(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length,
|
||||
uint8_t *arg4_mac,
|
||||
size_t arg5_mac_size,
|
||||
size_t *arg6_mac_length);
|
||||
#define psa_mac_compute(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_mac, arg5_mac_size, arg6_mac_length) \
|
||||
mbedtls_test_wrap_psa_mac_compute(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_mac, arg5_mac_size, arg6_mac_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_mac_sign_finish(
|
||||
psa_mac_operation_t *arg0_operation,
|
||||
uint8_t *arg1_mac,
|
||||
size_t arg2_mac_size,
|
||||
size_t *arg3_mac_length);
|
||||
#define psa_mac_sign_finish(arg0_operation, arg1_mac, arg2_mac_size, arg3_mac_length) \
|
||||
mbedtls_test_wrap_psa_mac_sign_finish(arg0_operation, arg1_mac, arg2_mac_size, arg3_mac_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_mac_sign_setup(
|
||||
psa_mac_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_key,
|
||||
psa_algorithm_t arg2_alg);
|
||||
#define psa_mac_sign_setup(arg0_operation, arg1_key, arg2_alg) \
|
||||
mbedtls_test_wrap_psa_mac_sign_setup(arg0_operation, arg1_key, arg2_alg)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_mac_update(
|
||||
psa_mac_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_input,
|
||||
size_t arg2_input_length);
|
||||
#define psa_mac_update(arg0_operation, arg1_input, arg2_input_length) \
|
||||
mbedtls_test_wrap_psa_mac_update(arg0_operation, arg1_input, arg2_input_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_mac_verify(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length,
|
||||
const uint8_t *arg4_mac,
|
||||
size_t arg5_mac_length);
|
||||
#define psa_mac_verify(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_mac, arg5_mac_length) \
|
||||
mbedtls_test_wrap_psa_mac_verify(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_mac, arg5_mac_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_mac_verify_finish(
|
||||
psa_mac_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_mac,
|
||||
size_t arg2_mac_length);
|
||||
#define psa_mac_verify_finish(arg0_operation, arg1_mac, arg2_mac_length) \
|
||||
mbedtls_test_wrap_psa_mac_verify_finish(arg0_operation, arg1_mac, arg2_mac_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_mac_verify_setup(
|
||||
psa_mac_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_key,
|
||||
psa_algorithm_t arg2_alg);
|
||||
#define psa_mac_verify_setup(arg0_operation, arg1_key, arg2_alg) \
|
||||
mbedtls_test_wrap_psa_mac_verify_setup(arg0_operation, arg1_key, arg2_alg)
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_abort(
|
||||
psa_pake_operation_t *arg0_operation);
|
||||
#define psa_pake_abort(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_pake_abort(arg0_operation)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_get_implicit_key(
|
||||
psa_pake_operation_t *arg0_operation,
|
||||
psa_key_derivation_operation_t *arg1_output);
|
||||
#define psa_pake_get_implicit_key(arg0_operation, arg1_output) \
|
||||
mbedtls_test_wrap_psa_pake_get_implicit_key(arg0_operation, arg1_output)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_input(
|
||||
psa_pake_operation_t *arg0_operation,
|
||||
psa_pake_step_t arg1_step,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length);
|
||||
#define psa_pake_input(arg0_operation, arg1_step, arg2_input, arg3_input_length) \
|
||||
mbedtls_test_wrap_psa_pake_input(arg0_operation, arg1_step, arg2_input, arg3_input_length)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_output(
|
||||
psa_pake_operation_t *arg0_operation,
|
||||
psa_pake_step_t arg1_step,
|
||||
uint8_t *arg2_output,
|
||||
size_t arg3_output_size,
|
||||
size_t *arg4_output_length);
|
||||
#define psa_pake_output(arg0_operation, arg1_step, arg2_output, arg3_output_size, arg4_output_length) \
|
||||
mbedtls_test_wrap_psa_pake_output(arg0_operation, arg1_step, arg2_output, arg3_output_size, arg4_output_length)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_set_password_key(
|
||||
psa_pake_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_password);
|
||||
#define psa_pake_set_password_key(arg0_operation, arg1_password) \
|
||||
mbedtls_test_wrap_psa_pake_set_password_key(arg0_operation, arg1_password)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_set_peer(
|
||||
psa_pake_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_peer_id,
|
||||
size_t arg2_peer_id_len);
|
||||
#define psa_pake_set_peer(arg0_operation, arg1_peer_id, arg2_peer_id_len) \
|
||||
mbedtls_test_wrap_psa_pake_set_peer(arg0_operation, arg1_peer_id, arg2_peer_id_len)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_set_role(
|
||||
psa_pake_operation_t *arg0_operation,
|
||||
psa_pake_role_t arg1_role);
|
||||
#define psa_pake_set_role(arg0_operation, arg1_role) \
|
||||
mbedtls_test_wrap_psa_pake_set_role(arg0_operation, arg1_role)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_set_user(
|
||||
psa_pake_operation_t *arg0_operation,
|
||||
const uint8_t *arg1_user_id,
|
||||
size_t arg2_user_id_len);
|
||||
#define psa_pake_set_user(arg0_operation, arg1_user_id, arg2_user_id_len) \
|
||||
mbedtls_test_wrap_psa_pake_set_user(arg0_operation, arg1_user_id, arg2_user_id_len)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
#if defined(PSA_WANT_ALG_SOME_PAKE)
|
||||
psa_status_t mbedtls_test_wrap_psa_pake_setup(
|
||||
psa_pake_operation_t *arg0_operation,
|
||||
const psa_pake_cipher_suite_t *arg1_cipher_suite);
|
||||
#define psa_pake_setup(arg0_operation, arg1_cipher_suite) \
|
||||
mbedtls_test_wrap_psa_pake_setup(arg0_operation, arg1_cipher_suite)
|
||||
#endif /* defined(PSA_WANT_ALG_SOME_PAKE) */
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_purge_key(
|
||||
mbedtls_svc_key_id_t arg0_key);
|
||||
#define psa_purge_key(arg0_key) \
|
||||
mbedtls_test_wrap_psa_purge_key(arg0_key)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_random_deplete(void);
|
||||
#define psa_random_deplete() \
|
||||
mbedtls_test_wrap_psa_random_deplete()
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_random_reseed(
|
||||
const uint8_t *arg0_perso,
|
||||
size_t arg1_perso_size);
|
||||
#define psa_random_reseed(arg0_perso, arg1_perso_size) \
|
||||
mbedtls_test_wrap_psa_random_reseed(arg0_perso, arg1_perso_size)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_random_set_prediction_resistance(
|
||||
unsigned arg0_enabled);
|
||||
#define psa_random_set_prediction_resistance(arg0_enabled) \
|
||||
mbedtls_test_wrap_psa_random_set_prediction_resistance(arg0_enabled)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_raw_key_agreement(
|
||||
psa_algorithm_t arg0_alg,
|
||||
mbedtls_svc_key_id_t arg1_private_key,
|
||||
const uint8_t *arg2_peer_key,
|
||||
size_t arg3_peer_key_length,
|
||||
uint8_t *arg4_output,
|
||||
size_t arg5_output_size,
|
||||
size_t *arg6_output_length);
|
||||
#define psa_raw_key_agreement(arg0_alg, arg1_private_key, arg2_peer_key, arg3_peer_key_length, arg4_output, arg5_output_size, arg6_output_length) \
|
||||
mbedtls_test_wrap_psa_raw_key_agreement(arg0_alg, arg1_private_key, arg2_peer_key, arg3_peer_key_length, arg4_output, arg5_output_size, arg6_output_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_sign_hash(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_hash,
|
||||
size_t arg3_hash_length,
|
||||
uint8_t *arg4_signature,
|
||||
size_t arg5_signature_size,
|
||||
size_t *arg6_signature_length);
|
||||
#define psa_sign_hash(arg0_key, arg1_alg, arg2_hash, arg3_hash_length, arg4_signature, arg5_signature_size, arg6_signature_length) \
|
||||
mbedtls_test_wrap_psa_sign_hash(arg0_key, arg1_alg, arg2_hash, arg3_hash_length, arg4_signature, arg5_signature_size, arg6_signature_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_sign_hash_abort(
|
||||
psa_sign_hash_interruptible_operation_t *arg0_operation);
|
||||
#define psa_sign_hash_abort(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_sign_hash_abort(arg0_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_sign_hash_complete(
|
||||
psa_sign_hash_interruptible_operation_t *arg0_operation,
|
||||
uint8_t *arg1_signature,
|
||||
size_t arg2_signature_size,
|
||||
size_t *arg3_signature_length);
|
||||
#define psa_sign_hash_complete(arg0_operation, arg1_signature, arg2_signature_size, arg3_signature_length) \
|
||||
mbedtls_test_wrap_psa_sign_hash_complete(arg0_operation, arg1_signature, arg2_signature_size, arg3_signature_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_sign_hash_start(
|
||||
psa_sign_hash_interruptible_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_key,
|
||||
psa_algorithm_t arg2_alg,
|
||||
const uint8_t *arg3_hash,
|
||||
size_t arg4_hash_length);
|
||||
#define psa_sign_hash_start(arg0_operation, arg1_key, arg2_alg, arg3_hash, arg4_hash_length) \
|
||||
mbedtls_test_wrap_psa_sign_hash_start(arg0_operation, arg1_key, arg2_alg, arg3_hash, arg4_hash_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_sign_message(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length,
|
||||
uint8_t *arg4_signature,
|
||||
size_t arg5_signature_size,
|
||||
size_t *arg6_signature_length);
|
||||
#define psa_sign_message(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_signature, arg5_signature_size, arg6_signature_length) \
|
||||
mbedtls_test_wrap_psa_sign_message(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_signature, arg5_signature_size, arg6_signature_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_verify_hash(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_hash,
|
||||
size_t arg3_hash_length,
|
||||
const uint8_t *arg4_signature,
|
||||
size_t arg5_signature_length);
|
||||
#define psa_verify_hash(arg0_key, arg1_alg, arg2_hash, arg3_hash_length, arg4_signature, arg5_signature_length) \
|
||||
mbedtls_test_wrap_psa_verify_hash(arg0_key, arg1_alg, arg2_hash, arg3_hash_length, arg4_signature, arg5_signature_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_verify_hash_abort(
|
||||
psa_verify_hash_interruptible_operation_t *arg0_operation);
|
||||
#define psa_verify_hash_abort(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_verify_hash_abort(arg0_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_verify_hash_complete(
|
||||
psa_verify_hash_interruptible_operation_t *arg0_operation);
|
||||
#define psa_verify_hash_complete(arg0_operation) \
|
||||
mbedtls_test_wrap_psa_verify_hash_complete(arg0_operation)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_verify_hash_start(
|
||||
psa_verify_hash_interruptible_operation_t *arg0_operation,
|
||||
mbedtls_svc_key_id_t arg1_key,
|
||||
psa_algorithm_t arg2_alg,
|
||||
const uint8_t *arg3_hash,
|
||||
size_t arg4_hash_length,
|
||||
const uint8_t *arg5_signature,
|
||||
size_t arg6_signature_length);
|
||||
#define psa_verify_hash_start(arg0_operation, arg1_key, arg2_alg, arg3_hash, arg4_hash_length, arg5_signature, arg6_signature_length) \
|
||||
mbedtls_test_wrap_psa_verify_hash_start(arg0_operation, arg1_key, arg2_alg, arg3_hash, arg4_hash_length, arg5_signature, arg6_signature_length)
|
||||
|
||||
psa_status_t mbedtls_test_wrap_psa_verify_message(
|
||||
mbedtls_svc_key_id_t arg0_key,
|
||||
psa_algorithm_t arg1_alg,
|
||||
const uint8_t *arg2_input,
|
||||
size_t arg3_input_length,
|
||||
const uint8_t *arg4_signature,
|
||||
size_t arg5_signature_length);
|
||||
#define psa_verify_message(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_signature, arg5_signature_length) \
|
||||
mbedtls_test_wrap_psa_verify_message(arg0_key, arg1_alg, arg2_input, arg3_input_length, arg4_signature, arg5_signature_length)
|
||||
|
||||
#endif /* defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_TEST_HOOKS) && \
|
||||
!defined(RECORD_PSA_STATUS_COVERAGE_LOG) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TEST_PSA_TEST_WRAPPERS_H */
|
||||
|
||||
/* End of automatically generated file. */
|
||||
749
vendor/mbedtls/tests/include/test/ssl_helpers.h
vendored
Normal file
749
vendor/mbedtls/tests/include/test/ssl_helpers.h
vendored
Normal file
@@ -0,0 +1,749 @@
|
||||
/** \file ssl_helpers.h
|
||||
*
|
||||
* \brief This file contains helper functions to set up a TLS connection.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef SSL_HELPERS_H
|
||||
#define SSL_HELPERS_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <test/helpers.h>
|
||||
#include <test/macros.h>
|
||||
#include <test/random.h>
|
||||
#include <test/psa_crypto_helpers.h>
|
||||
|
||||
#if defined(MBEDTLS_SSL_TLS_C)
|
||||
#include <ssl_misc.h>
|
||||
#include <mbedtls/timing.h>
|
||||
#include <mbedtls/debug.h>
|
||||
|
||||
#include "test/certs.h"
|
||||
|
||||
#if defined(MBEDTLS_SSL_CACHE_C)
|
||||
#include "mbedtls/ssl_cache.h"
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
#define PSA_TO_MBEDTLS_ERR(status) PSA_TO_MBEDTLS_ERR_LIST(status, \
|
||||
psa_to_ssl_errors, \
|
||||
psa_generic_status_to_mbedtls)
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
#if defined(MBEDTLS_SSL_HAVE_AES)
|
||||
#if defined(MBEDTLS_SSL_HAVE_GCM)
|
||||
#if defined(MBEDTLS_MD_CAN_SHA384)
|
||||
#define MBEDTLS_TEST_HAS_TLS1_3_AES_256_GCM_SHA384
|
||||
#endif
|
||||
#if defined(MBEDTLS_MD_CAN_SHA256)
|
||||
#define MBEDTLS_TEST_HAS_TLS1_3_AES_128_GCM_SHA256
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_HAVE_GCM */
|
||||
#if defined(MBEDTLS_SSL_HAVE_CCM) && defined(MBEDTLS_MD_CAN_SHA256)
|
||||
#define MBEDTLS_TEST_HAS_TLS1_3_AES_128_CCM_SHA256
|
||||
#define MBEDTLS_TEST_HAS_TLS1_3_AES_128_CCM_8_SHA256
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_HAVE_AES */
|
||||
#if defined(MBEDTLS_SSL_HAVE_CHACHAPOLY) && defined(MBEDTLS_MD_CAN_SHA256)
|
||||
#define MBEDTLS_TEST_HAS_TLS1_3_CHACHA20_POLY1305_SHA256
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_TEST_HAS_TLS1_3_AES_256_GCM_SHA384) || \
|
||||
defined(MBEDTLS_TEST_HAS_TLS1_3_AES_128_GCM_SHA256) || \
|
||||
defined(MBEDTLS_TEST_HAS_TLS1_3_AES_128_CCM_SHA256) || \
|
||||
defined(MBEDTLS_TEST_HAS_TLS1_3_AES_128_CCM_8_SHA256) || \
|
||||
defined(MBEDTLS_TEST_HAS_TLS1_3_CHACHA20_POLY1305_SHA256)
|
||||
#define MBEDTLS_TEST_AT_LEAST_ONE_TLS1_3_CIPHERSUITE
|
||||
#endif
|
||||
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
|
||||
defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
|
||||
#define MBEDTLS_CAN_HANDLE_RSA_TEST_KEY
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
|
||||
defined(MBEDTLS_ECP_HAVE_SECP384R1) && \
|
||||
defined(MBEDTLS_MD_CAN_SHA384)
|
||||
#define MBEDTLS_CAN_HANDLE_ECDSA_TEST_KEY
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
|
||||
defined(MBEDTLS_ECP_HAVE_SECP256R1) && \
|
||||
defined(MBEDTLS_MD_CAN_SHA256)
|
||||
#define MBEDTLS_CAN_HANDLE_ECDSA_CLIENT_TEST_KEY
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_HAVE_CURVE25519) || \
|
||||
defined(MBEDTLS_ECP_HAVE_SECP256R1) || \
|
||||
defined(MBEDTLS_ECP_HAVE_SECP384R1) || \
|
||||
defined(MBEDTLS_ECP_HAVE_CURVE448) || \
|
||||
defined(MBEDTLS_ECP_HAVE_SECP521R1) || \
|
||||
defined(MBEDTLS_ECP_HAVE_BP256R1) || \
|
||||
defined(MBEDTLS_ECP_HAVE_BP384R1) || \
|
||||
defined(MBEDTLS_ECP_HAVE_BP512R1)
|
||||
#define MBEDTLS_TEST_HAS_DEFAULT_EC_GROUP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* To use the test keys we need PSA_WANT_ALG_SHA_256. Some test cases need an additional hash that
|
||||
* is configured by default (see mbedtls_ssl_config_defaults()), but it doesn't matter which one.
|
||||
*/
|
||||
#if defined(MBEDTLS_MD_CAN_SHA512) || \
|
||||
defined(MBEDTLS_MD_CAN_SHA384)
|
||||
#define MBEDTLS_TEST_HAS_ADDITIONAL_HASH
|
||||
#endif
|
||||
|
||||
enum {
|
||||
#define MBEDTLS_SSL_TLS1_3_LABEL(name, string) \
|
||||
tls13_label_ ## name,
|
||||
MBEDTLS_SSL_TLS1_3_LABEL_LIST
|
||||
#undef MBEDTLS_SSL_TLS1_3_LABEL
|
||||
};
|
||||
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
#define MBEDTLS_TEST_MAX_ALPN_LIST_SIZE 10
|
||||
#endif
|
||||
|
||||
/* Forward declaration. Defined below. */
|
||||
struct mbedtls_test_ssl_endpoint;
|
||||
|
||||
typedef struct mbedtls_test_ssl_log_pattern {
|
||||
const char *pattern;
|
||||
size_t counter;
|
||||
} mbedtls_test_ssl_log_pattern;
|
||||
|
||||
typedef struct mbedtls_test_handshake_test_options {
|
||||
const char *cipher;
|
||||
uint16_t *group_list;
|
||||
mbedtls_ssl_protocol_version client_min_version;
|
||||
mbedtls_ssl_protocol_version client_max_version;
|
||||
mbedtls_ssl_protocol_version server_min_version;
|
||||
mbedtls_ssl_protocol_version server_max_version;
|
||||
mbedtls_ssl_protocol_version expected_negotiated_version;
|
||||
int expected_handshake_result;
|
||||
int expected_ciphersuite;
|
||||
int pk_alg;
|
||||
int opaque_alg;
|
||||
int opaque_alg2;
|
||||
int opaque_usage;
|
||||
data_t *psk_str;
|
||||
int dtls;
|
||||
int srv_auth_mode;
|
||||
int serialize;
|
||||
int mfl;
|
||||
int cli_msg_len;
|
||||
int srv_msg_len;
|
||||
int expected_cli_fragments;
|
||||
int expected_srv_fragments;
|
||||
int renegotiate;
|
||||
int legacy_renegotiation;
|
||||
/** Hook that mbedtls_test_ssl_perform_handshake() runs just before
|
||||
* the initial handshake. */
|
||||
void (*pre_handshake_fun)(struct mbedtls_test_ssl_endpoint *client,
|
||||
struct mbedtls_test_ssl_endpoint *server,
|
||||
void *param);
|
||||
/** Value passed to ::pre_handshake_fun. */
|
||||
void *pre_handshake_param;
|
||||
/** Hook that mbedtls_test_ssl_perform_handshake() runs after
|
||||
* the initial handshake succeeds. */
|
||||
void (*post_handshake_fun)(struct mbedtls_test_ssl_endpoint *client,
|
||||
struct mbedtls_test_ssl_endpoint *server,
|
||||
void *param);
|
||||
/** Value passed to ::post_handshake_fun. */
|
||||
void *post_handshake_param;
|
||||
/** Hook that mbedtls_test_ssl_perform_handshake() runs after
|
||||
* exchanging some data, before testing additional features such as
|
||||
* serialization and renegotiation. */
|
||||
void (*post_data_fun)(struct mbedtls_test_ssl_endpoint *client,
|
||||
struct mbedtls_test_ssl_endpoint *server,
|
||||
void *param);
|
||||
/** Value passed to ::post_data_fun. */
|
||||
void *post_data_param;
|
||||
/** Hook that mbedtls_test_ssl_perform_handshake() runs after a successful
|
||||
* connection, just before closing down. */
|
||||
void (*pre_shutdown_fun)(struct mbedtls_test_ssl_endpoint *client,
|
||||
struct mbedtls_test_ssl_endpoint *server,
|
||||
void *param);
|
||||
/** Value passed to ::pre_shutdown_fun. */
|
||||
void *pre_shutdown_param;
|
||||
void *srv_log_obj;
|
||||
void *cli_log_obj;
|
||||
void (*srv_log_fun)(void *, int, const char *, int, const char *);
|
||||
void (*cli_log_fun)(void *, int, const char *, int, const char *);
|
||||
int resize_buffers;
|
||||
int early_data;
|
||||
int max_early_data_size;
|
||||
#if defined(MBEDTLS_SSL_CACHE_C)
|
||||
mbedtls_ssl_cache_context *cache;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
const char *alpn_list[MBEDTLS_TEST_MAX_ALPN_LIST_SIZE];
|
||||
#endif
|
||||
} mbedtls_test_handshake_test_options;
|
||||
|
||||
/*
|
||||
* Buffer structure for custom I/O callbacks.
|
||||
*/
|
||||
typedef struct mbedtls_test_ssl_buffer {
|
||||
size_t start;
|
||||
size_t content_length;
|
||||
size_t capacity;
|
||||
unsigned char *buffer;
|
||||
} mbedtls_test_ssl_buffer;
|
||||
|
||||
/*
|
||||
* Context for a message metadata queue (fifo) that is on top of the ring buffer.
|
||||
*/
|
||||
typedef struct mbedtls_test_ssl_message_queue {
|
||||
size_t *messages;
|
||||
int pos;
|
||||
int num;
|
||||
int capacity;
|
||||
} mbedtls_test_ssl_message_queue;
|
||||
|
||||
/*
|
||||
* Context for the I/O callbacks simulating network connection.
|
||||
*/
|
||||
|
||||
#define MBEDTLS_MOCK_SOCKET_CONNECTED 1
|
||||
|
||||
typedef struct mbedtls_test_mock_socket {
|
||||
int status;
|
||||
mbedtls_test_ssl_buffer *input;
|
||||
mbedtls_test_ssl_buffer *output;
|
||||
struct mbedtls_test_mock_socket *peer;
|
||||
} mbedtls_test_mock_socket;
|
||||
|
||||
/* Errors used in the message socket mocks */
|
||||
|
||||
#define MBEDTLS_TEST_ERROR_CONTEXT_ERROR -55
|
||||
#define MBEDTLS_TEST_ERROR_SEND_FAILED -66
|
||||
#define MBEDTLS_TEST_ERROR_RECV_FAILED -77
|
||||
|
||||
/*
|
||||
* Structure used as an addon, or a wrapper, around the mocked sockets.
|
||||
* Contains an input queue, to which the other socket pushes metadata,
|
||||
* and an output queue, to which this one pushes metadata. This context is
|
||||
* considered as an owner of the input queue only, which is initialized and
|
||||
* freed in the respective setup and free calls.
|
||||
*/
|
||||
typedef struct mbedtls_test_message_socket_context {
|
||||
mbedtls_test_ssl_message_queue *queue_input;
|
||||
mbedtls_test_ssl_message_queue *queue_output;
|
||||
mbedtls_test_mock_socket *socket;
|
||||
} mbedtls_test_message_socket_context;
|
||||
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
|
||||
/*
|
||||
* Structure with endpoint's certificates for SSL communication tests.
|
||||
*/
|
||||
typedef struct mbedtls_test_ssl_endpoint_certificate {
|
||||
mbedtls_x509_crt *ca_cert;
|
||||
mbedtls_x509_crt *cert;
|
||||
mbedtls_pk_context *pkey;
|
||||
} mbedtls_test_ssl_endpoint_certificate;
|
||||
|
||||
/*
|
||||
* Endpoint structure for SSL communication tests.
|
||||
*/
|
||||
typedef struct mbedtls_test_ssl_endpoint {
|
||||
const char *name;
|
||||
mbedtls_ssl_context ssl;
|
||||
mbedtls_ssl_config conf;
|
||||
mbedtls_test_mock_socket socket;
|
||||
mbedtls_test_ssl_endpoint_certificate cert;
|
||||
} mbedtls_test_ssl_endpoint;
|
||||
|
||||
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
|
||||
|
||||
/*
|
||||
* Random number generator aimed for TLS unitary tests. Its main purpose is to
|
||||
* simplify the set-up of a random number generator for TLS
|
||||
* unitary tests: no need to set up a good entropy source for example.
|
||||
*/
|
||||
int mbedtls_test_random(void *p_rng, unsigned char *output, size_t output_len);
|
||||
|
||||
/*
|
||||
* This function can be passed to mbedtls to receive output logs from it. In
|
||||
* this case, it will count the instances of a mbedtls_test_ssl_log_pattern
|
||||
* in the received logged messages.
|
||||
*/
|
||||
void mbedtls_test_ssl_log_analyzer(void *ctx, int level,
|
||||
const char *file, int line,
|
||||
const char *str);
|
||||
|
||||
void mbedtls_test_init_handshake_options(
|
||||
mbedtls_test_handshake_test_options *opts);
|
||||
|
||||
void mbedtls_test_free_handshake_options(
|
||||
mbedtls_test_handshake_test_options *opts);
|
||||
|
||||
/*
|
||||
* Initialises \p buf. After calling this function it is safe to call
|
||||
* `mbedtls_test_ssl_buffer_free()` on \p buf.
|
||||
*/
|
||||
void mbedtls_test_ssl_buffer_init(mbedtls_test_ssl_buffer *buf);
|
||||
|
||||
/*
|
||||
* Sets up \p buf. After calling this function it is safe to call
|
||||
* `mbedtls_test_ssl_buffer_put()` and `mbedtls_test_ssl_buffer_get()`
|
||||
* on \p buf.
|
||||
*/
|
||||
int mbedtls_test_ssl_buffer_setup(mbedtls_test_ssl_buffer *buf,
|
||||
size_t capacity);
|
||||
|
||||
void mbedtls_test_ssl_buffer_free(mbedtls_test_ssl_buffer *buf);
|
||||
|
||||
/*
|
||||
* Puts \p input_len bytes from the \p input buffer into the ring buffer \p buf.
|
||||
*
|
||||
* \p buf must have been initialized and set up by calling
|
||||
* `mbedtls_test_ssl_buffer_init()` and `mbedtls_test_ssl_buffer_setup()`.
|
||||
*
|
||||
* \retval \p input_len, if the data fits.
|
||||
* \retval 0 <= value < \p input_len, if the data does not fit.
|
||||
* \retval -1, if \p buf is NULL, it hasn't been set up or \p input_len is not
|
||||
* zero and \p input is NULL.
|
||||
*/
|
||||
int mbedtls_test_ssl_buffer_put(mbedtls_test_ssl_buffer *buf,
|
||||
const unsigned char *input, size_t input_len);
|
||||
|
||||
/*
|
||||
* Gets \p output_len bytes from the ring buffer \p buf into the
|
||||
* \p output buffer. The output buffer can be NULL, in this case a part of the
|
||||
* ring buffer will be dropped, if the requested length is available.
|
||||
*
|
||||
* \p buf must have been initialized and set up by calling
|
||||
* `mbedtls_test_ssl_buffer_init()` and `mbedtls_test_ssl_buffer_setup()`.
|
||||
*
|
||||
* \retval \p output_len, if the data is available.
|
||||
* \retval 0 <= value < \p output_len, if the data is not available.
|
||||
* \retval -1, if \buf is NULL or it hasn't been set up.
|
||||
*/
|
||||
int mbedtls_test_ssl_buffer_get(mbedtls_test_ssl_buffer *buf,
|
||||
unsigned char *output, size_t output_len);
|
||||
|
||||
/*
|
||||
* Errors used in the message transport mock tests
|
||||
*/
|
||||
#define MBEDTLS_TEST_ERROR_ARG_NULL -11
|
||||
#define MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED -44
|
||||
|
||||
/*
|
||||
* Setup and free functions for the message metadata queue.
|
||||
*
|
||||
* \p capacity describes the number of message metadata chunks that can be held
|
||||
* within the queue.
|
||||
*
|
||||
* \retval 0, if a metadata queue of a given length can be allocated.
|
||||
* \retval MBEDTLS_ERR_SSL_ALLOC_FAILED, if allocation failed.
|
||||
*/
|
||||
int mbedtls_test_ssl_message_queue_setup(
|
||||
mbedtls_test_ssl_message_queue *queue, size_t capacity);
|
||||
|
||||
void mbedtls_test_ssl_message_queue_free(
|
||||
mbedtls_test_ssl_message_queue *queue);
|
||||
|
||||
/*
|
||||
* Push message length information onto the message metadata queue.
|
||||
* This will become the last element to leave it (fifo).
|
||||
*
|
||||
* \retval MBEDTLS_TEST_ERROR_ARG_NULL, if the queue is null.
|
||||
* \retval MBEDTLS_ERR_SSL_WANT_WRITE, if the queue is full.
|
||||
* \retval \p len, if the push was successful.
|
||||
*/
|
||||
int mbedtls_test_ssl_message_queue_push_info(
|
||||
mbedtls_test_ssl_message_queue *queue, size_t len);
|
||||
|
||||
/*
|
||||
* Pop information about the next message length from the queue. This will be
|
||||
* the oldest inserted message length(fifo). \p msg_len can be null, in which
|
||||
* case the data will be popped from the queue but not copied anywhere.
|
||||
*
|
||||
* \retval MBEDTLS_TEST_ERROR_ARG_NULL, if the queue is null.
|
||||
* \retval MBEDTLS_ERR_SSL_WANT_READ, if the queue is empty.
|
||||
* \retval message length, if the pop was successful, up to the given
|
||||
\p buf_len.
|
||||
*/
|
||||
int mbedtls_test_ssl_message_queue_pop_info(
|
||||
mbedtls_test_ssl_message_queue *queue, size_t buf_len);
|
||||
|
||||
/*
|
||||
* Setup and teardown functions for mock sockets.
|
||||
*/
|
||||
void mbedtls_test_mock_socket_init(mbedtls_test_mock_socket *socket);
|
||||
|
||||
/*
|
||||
* Closes the socket \p socket.
|
||||
*
|
||||
* \p socket must have been previously initialized by calling
|
||||
* mbedtls_test_mock_socket_init().
|
||||
*
|
||||
* This function frees all allocated resources and both sockets are aware of the
|
||||
* new connection state.
|
||||
*
|
||||
* That is, this function does not simulate half-open TCP connections and the
|
||||
* phenomenon that when closing a UDP connection the peer is not aware of the
|
||||
* connection having been closed.
|
||||
*/
|
||||
void mbedtls_test_mock_socket_close(mbedtls_test_mock_socket *socket);
|
||||
|
||||
/*
|
||||
* Establishes a connection between \p peer1 and \p peer2.
|
||||
*
|
||||
* \p peer1 and \p peer2 must have been previously initialized by calling
|
||||
* mbedtls_test_mock_socket_init().
|
||||
*
|
||||
* The capacities of the internal buffers are set to \p bufsize. Setting this to
|
||||
* the correct value allows for simulation of MTU, sanity testing the mock
|
||||
* implementation and mocking TCP connections with lower memory cost.
|
||||
*/
|
||||
int mbedtls_test_mock_socket_connect(mbedtls_test_mock_socket *peer1,
|
||||
mbedtls_test_mock_socket *peer2,
|
||||
size_t bufsize);
|
||||
|
||||
|
||||
/*
|
||||
* Callbacks for simulating blocking I/O over connection-oriented transport.
|
||||
*/
|
||||
int mbedtls_test_mock_tcp_send_b(void *ctx,
|
||||
const unsigned char *buf, size_t len);
|
||||
|
||||
int mbedtls_test_mock_tcp_recv_b(void *ctx, unsigned char *buf, size_t len);
|
||||
|
||||
/*
|
||||
* Callbacks for simulating non-blocking I/O over connection-oriented transport.
|
||||
*/
|
||||
int mbedtls_test_mock_tcp_send_nb(void *ctx,
|
||||
const unsigned char *buf, size_t len);
|
||||
|
||||
int mbedtls_test_mock_tcp_recv_nb(void *ctx, unsigned char *buf, size_t len);
|
||||
|
||||
void mbedtls_test_message_socket_init(
|
||||
mbedtls_test_message_socket_context *ctx);
|
||||
|
||||
/*
|
||||
* Setup a given message socket context including initialization of
|
||||
* input/output queues to a chosen capacity of messages. Also set the
|
||||
* corresponding mock socket.
|
||||
*
|
||||
* \retval 0, if everything succeeds.
|
||||
* \retval MBEDTLS_ERR_SSL_ALLOC_FAILED, if allocation of a message
|
||||
* queue failed.
|
||||
*/
|
||||
int mbedtls_test_message_socket_setup(
|
||||
mbedtls_test_ssl_message_queue *queue_input,
|
||||
mbedtls_test_ssl_message_queue *queue_output,
|
||||
size_t queue_capacity,
|
||||
mbedtls_test_mock_socket *socket,
|
||||
mbedtls_test_message_socket_context *ctx);
|
||||
|
||||
/*
|
||||
* Close a given message socket context, along with the socket itself. Free the
|
||||
* memory allocated by the input queue.
|
||||
*/
|
||||
void mbedtls_test_message_socket_close(
|
||||
mbedtls_test_message_socket_context *ctx);
|
||||
|
||||
/*
|
||||
* Send one message through a given message socket context.
|
||||
*
|
||||
* \retval \p len, if everything succeeds.
|
||||
* \retval MBEDTLS_TEST_ERROR_CONTEXT_ERROR, if any of the needed context
|
||||
* elements or the context itself is null.
|
||||
* \retval MBEDTLS_TEST_ERROR_SEND_FAILED if
|
||||
* mbedtls_test_mock_tcp_send_b failed.
|
||||
* \retval MBEDTLS_ERR_SSL_WANT_WRITE, if the output queue is full.
|
||||
*
|
||||
* This function will also return any error from
|
||||
* mbedtls_test_ssl_message_queue_push_info.
|
||||
*/
|
||||
int mbedtls_test_mock_tcp_send_msg(void *ctx,
|
||||
const unsigned char *buf, size_t len);
|
||||
|
||||
/*
|
||||
* Receive one message from a given message socket context and return message
|
||||
* length or an error.
|
||||
*
|
||||
* \retval message length, if everything succeeds.
|
||||
* \retval MBEDTLS_TEST_ERROR_CONTEXT_ERROR, if any of the needed context
|
||||
* elements or the context itself is null.
|
||||
* \retval MBEDTLS_TEST_ERROR_RECV_FAILED if
|
||||
* mbedtls_test_mock_tcp_recv_b failed.
|
||||
*
|
||||
* This function will also return any error other than
|
||||
* MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED from test_ssl_message_queue_peek_info.
|
||||
*/
|
||||
int mbedtls_test_mock_tcp_recv_msg(void *ctx,
|
||||
unsigned char *buf, size_t buf_len);
|
||||
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
|
||||
/*
|
||||
* Initializes \p ep_cert structure and assigns it to endpoint
|
||||
* represented by \p ep.
|
||||
*
|
||||
* \retval 0 on success, otherwise error code.
|
||||
*/
|
||||
int mbedtls_test_ssl_endpoint_certificate_init(mbedtls_test_ssl_endpoint *ep,
|
||||
int pk_alg,
|
||||
int opaque_alg, int opaque_alg2,
|
||||
int opaque_usage);
|
||||
|
||||
/*
|
||||
* Initializes \p ep structure. It is important to call
|
||||
* `mbedtls_test_ssl_endpoint_free()` after calling this function
|
||||
* even if it fails.
|
||||
*
|
||||
* \p endpoint_type must be set as MBEDTLS_SSL_IS_SERVER or
|
||||
* MBEDTLS_SSL_IS_CLIENT.
|
||||
* \p pk_alg the algorithm to use, currently only MBEDTLS_PK_RSA and
|
||||
* MBEDTLS_PK_ECDSA are supported.
|
||||
* \p dtls_context - in case of DTLS - this is the context handling metadata.
|
||||
* \p input_queue - used only in case of DTLS.
|
||||
* \p output_queue - used only in case of DTLS.
|
||||
*
|
||||
* \retval 0 on success, otherwise error code.
|
||||
*/
|
||||
int mbedtls_test_ssl_endpoint_init(
|
||||
mbedtls_test_ssl_endpoint *ep, int endpoint_type,
|
||||
mbedtls_test_handshake_test_options *options,
|
||||
mbedtls_test_message_socket_context *dtls_context,
|
||||
mbedtls_test_ssl_message_queue *input_queue,
|
||||
mbedtls_test_ssl_message_queue *output_queue);
|
||||
|
||||
/*
|
||||
* Deinitializes endpoint represented by \p ep.
|
||||
*/
|
||||
void mbedtls_test_ssl_endpoint_free(
|
||||
mbedtls_test_ssl_endpoint *ep,
|
||||
mbedtls_test_message_socket_context *context);
|
||||
|
||||
/*
|
||||
* This function moves ssl handshake from \p ssl to prescribed \p state.
|
||||
* /p second_ssl is used as second endpoint and their sockets have to be
|
||||
* connected before calling this function.
|
||||
*
|
||||
* For example, to perform a full handshake:
|
||||
* ```
|
||||
* mbedtls_test_move_handshake_to_state(
|
||||
* &server.ssl, &client.ssl,
|
||||
* MBEDTLS_SSL_HANDSHAKE_OVER);
|
||||
* mbedtls_test_move_handshake_to_state(
|
||||
* &client.ssl, &server.ssl,
|
||||
* MBEDTLS_SSL_HANDSHAKE_OVER);
|
||||
* ```
|
||||
* Note that you need both calls to reach the handshake-over state on
|
||||
* both sides.
|
||||
*
|
||||
* \retval 0 on success, otherwise error code.
|
||||
*/
|
||||
int mbedtls_test_move_handshake_to_state(mbedtls_ssl_context *ssl,
|
||||
mbedtls_ssl_context *second_ssl,
|
||||
int state);
|
||||
|
||||
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
|
||||
|
||||
/*
|
||||
* Helper function setting up inverse record transformations
|
||||
* using given cipher, hash, EtM mode, authentication tag length,
|
||||
* and version.
|
||||
*/
|
||||
#define CHK(x) \
|
||||
do \
|
||||
{ \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
ret = -1; \
|
||||
goto cleanup; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#if MBEDTLS_SSL_CID_OUT_LEN_MAX > MBEDTLS_SSL_CID_IN_LEN_MAX
|
||||
#define SSL_CID_LEN_MIN MBEDTLS_SSL_CID_IN_LEN_MAX
|
||||
#else
|
||||
#define SSL_CID_LEN_MIN MBEDTLS_SSL_CID_OUT_LEN_MAX
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \
|
||||
defined(MBEDTLS_SSL_HAVE_CBC) && defined(MBEDTLS_SSL_HAVE_AES)
|
||||
int mbedtls_test_psa_cipher_encrypt_helper(mbedtls_ssl_transform *transform,
|
||||
const unsigned char *iv,
|
||||
size_t iv_len,
|
||||
const unsigned char *input,
|
||||
size_t ilen,
|
||||
unsigned char *output,
|
||||
size_t *olen);
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 && MBEDTLS_SSL_HAVE_CBC &&
|
||||
MBEDTLS_SSL_HAVE_AES */
|
||||
|
||||
int mbedtls_test_ssl_build_transforms(mbedtls_ssl_transform *t_in,
|
||||
mbedtls_ssl_transform *t_out,
|
||||
int cipher_type, int hash_id,
|
||||
int etm, int tag_mode,
|
||||
mbedtls_ssl_protocol_version tls_version,
|
||||
size_t cid0_len,
|
||||
size_t cid1_len);
|
||||
|
||||
#if defined(MBEDTLS_SSL_SOME_SUITES_USE_MAC)
|
||||
/**
|
||||
* \param[in,out] record The record to prepare.
|
||||
* It must contain the data to MAC at offset
|
||||
* `record->data_offset`, of length
|
||||
* `record->data_length`.
|
||||
* On success, write the MAC immediately
|
||||
* after the data and increment
|
||||
* `record->data_length` accordingly.
|
||||
* \param[in,out] transform_out The out transform, typically prepared by
|
||||
* mbedtls_test_ssl_build_transforms().
|
||||
* Its HMAC context may be used. Other than that
|
||||
* it is treated as an input parameter.
|
||||
*
|
||||
* \return 0 on success, an `MBEDTLS_ERR_xxx` error code
|
||||
* or -1 on error.
|
||||
*/
|
||||
int mbedtls_test_ssl_prepare_record_mac(mbedtls_record *record,
|
||||
mbedtls_ssl_transform *transform_out);
|
||||
#endif /* MBEDTLS_SSL_SOME_SUITES_USE_MAC */
|
||||
|
||||
/*
|
||||
* Populate a session structure for serialization tests.
|
||||
* Choose dummy values, mostly non-0 to distinguish from the init default.
|
||||
*/
|
||||
int mbedtls_test_ssl_tls12_populate_session(mbedtls_ssl_session *session,
|
||||
int ticket_len,
|
||||
int endpoint_type,
|
||||
const char *crt_file);
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
int mbedtls_test_ssl_tls13_populate_session(mbedtls_ssl_session *session,
|
||||
int ticket_len,
|
||||
int endpoint_type);
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
/*
|
||||
* Perform data exchanging between \p ssl_1 and \p ssl_2 and check if the
|
||||
* message was sent in the correct number of fragments.
|
||||
*
|
||||
* /p ssl_1 and /p ssl_2 Endpoints represented by mbedtls_ssl_context. Both
|
||||
* of them must be initialized and connected
|
||||
* beforehand.
|
||||
* /p msg_len_1 and /p msg_len_2 specify the size of the message to send.
|
||||
* /p expected_fragments_1 and /p expected_fragments_2 determine in how many
|
||||
* fragments the message should be sent.
|
||||
* expected_fragments is 0: can be used for DTLS testing while the message
|
||||
* size is larger than MFL. In that case the message
|
||||
* cannot be fragmented and sent to the second
|
||||
* endpoint.
|
||||
* This value can be used for negative tests.
|
||||
* expected_fragments is 1: can be used for TLS/DTLS testing while the
|
||||
* message size is below MFL
|
||||
* expected_fragments > 1: can be used for TLS testing while the message
|
||||
* size is larger than MFL
|
||||
*
|
||||
* \retval 0 on success, otherwise error code.
|
||||
*/
|
||||
int mbedtls_test_ssl_exchange_data(
|
||||
mbedtls_ssl_context *ssl_1,
|
||||
int msg_len_1, const int expected_fragments_1,
|
||||
mbedtls_ssl_context *ssl_2,
|
||||
int msg_len_2, const int expected_fragments_2);
|
||||
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
int mbedtls_test_ssl_do_handshake_with_endpoints(
|
||||
mbedtls_test_ssl_endpoint *server_ep,
|
||||
mbedtls_test_ssl_endpoint *client_ep,
|
||||
mbedtls_test_handshake_test_options *options,
|
||||
mbedtls_ssl_protocol_version proto);
|
||||
#endif /* defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED) */
|
||||
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
void mbedtls_test_ssl_perform_handshake(
|
||||
mbedtls_test_handshake_test_options *options);
|
||||
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_TEST_HOOKS)
|
||||
/*
|
||||
* Tweak vector lengths in a TLS 1.3 Certificate message
|
||||
*
|
||||
* \param[in] buf Buffer containing the Certificate message to tweak
|
||||
* \param[in]]out] end End of the buffer to parse
|
||||
* \param tweak Tweak identifier (from 1 to the number of tweaks).
|
||||
* \param[out] expected_result Error code expected from the parsing function
|
||||
* \param[out] args Arguments of the MBEDTLS_SSL_CHK_BUF_READ_PTR call that
|
||||
* is expected to fail. All zeroes if no
|
||||
* MBEDTLS_SSL_CHK_BUF_READ_PTR failure is expected.
|
||||
*/
|
||||
int mbedtls_test_tweak_tls13_certificate_msg_vector_len(
|
||||
unsigned char *buf, unsigned char **end, int tweak,
|
||||
int *expected_result, mbedtls_ssl_chk_buf_ptr_args *args);
|
||||
#endif /* MBEDTLS_TEST_HOOKS */
|
||||
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||
int mbedtls_test_ticket_write(
|
||||
void *p_ticket, const mbedtls_ssl_session *session,
|
||||
unsigned char *start, const unsigned char *end,
|
||||
size_t *tlen, uint32_t *ticket_lifetime);
|
||||
|
||||
int mbedtls_test_ticket_parse(void *p_ticket, mbedtls_ssl_session *session,
|
||||
unsigned char *buf, size_t len);
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
|
||||
#if defined(MBEDTLS_SSL_CLI_C) && defined(MBEDTLS_SSL_SRV_C) && \
|
||||
defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS) && \
|
||||
defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
int mbedtls_test_get_tls13_ticket(
|
||||
mbedtls_test_handshake_test_options *client_options,
|
||||
mbedtls_test_handshake_test_options *server_options,
|
||||
mbedtls_ssl_session *session);
|
||||
#endif
|
||||
|
||||
#define ECJPAKE_TEST_PWD "bla"
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
#define ECJPAKE_TEST_SET_PASSWORD(exp_ret_val) \
|
||||
ret = (use_opaque_arg) ? \
|
||||
mbedtls_ssl_set_hs_ecjpake_password_opaque(&ssl, pwd_slot) : \
|
||||
mbedtls_ssl_set_hs_ecjpake_password(&ssl, pwd_string, pwd_len); \
|
||||
TEST_EQUAL(ret, exp_ret_val)
|
||||
#else
|
||||
#define ECJPAKE_TEST_SET_PASSWORD(exp_ret_val) \
|
||||
ret = mbedtls_ssl_set_hs_ecjpake_password(&ssl, \
|
||||
pwd_string, pwd_len); \
|
||||
TEST_EQUAL(ret, exp_ret_val)
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#define TEST_AVAILABLE_ECC(tls_id_, group_id_, psa_family_, psa_bits_) \
|
||||
TEST_EQUAL(mbedtls_ssl_get_ecp_group_id_from_tls_id(tls_id_), \
|
||||
group_id_); \
|
||||
TEST_EQUAL(mbedtls_ssl_get_tls_id_from_ecp_group_id(group_id_), \
|
||||
tls_id_); \
|
||||
TEST_EQUAL(mbedtls_ssl_get_psa_curve_info_from_tls_id(tls_id_, \
|
||||
&psa_type, &psa_bits), PSA_SUCCESS); \
|
||||
TEST_EQUAL(psa_family_, PSA_KEY_TYPE_ECC_GET_FAMILY(psa_type)); \
|
||||
TEST_EQUAL(psa_bits_, psa_bits);
|
||||
|
||||
#define TEST_UNAVAILABLE_ECC(tls_id_, group_id_, psa_family_, psa_bits_) \
|
||||
TEST_EQUAL(mbedtls_ssl_get_ecp_group_id_from_tls_id(tls_id_), \
|
||||
MBEDTLS_ECP_DP_NONE); \
|
||||
TEST_EQUAL(mbedtls_ssl_get_tls_id_from_ecp_group_id(group_id_), \
|
||||
0); \
|
||||
TEST_EQUAL(mbedtls_ssl_get_psa_curve_info_from_tls_id(tls_id_, \
|
||||
&psa_type, &psa_bits), \
|
||||
PSA_ERROR_NOT_SUPPORTED);
|
||||
|
||||
#endif /* MBEDTLS_SSL_TLS_C */
|
||||
|
||||
#endif /* SSL_HELPERS_H */
|
||||
1227
vendor/mbedtls/tests/include/test/test_certs.h
vendored
Normal file
1227
vendor/mbedtls/tests/include/test/test_certs.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1713
vendor/mbedtls/tests/include/test/test_keys.h
vendored
Normal file
1713
vendor/mbedtls/tests/include/test/test_keys.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
vendor/mbedtls/tests/make-in-docker.sh
vendored
Executable file
21
vendor/mbedtls/tests/make-in-docker.sh
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
# make-in-docker.sh
|
||||
#
|
||||
# Purpose
|
||||
# -------
|
||||
# This runs make in a Docker container.
|
||||
#
|
||||
# See also:
|
||||
# - scripts/docker_env.sh for general Docker prerequisites and other information.
|
||||
#
|
||||
# WARNING: the Dockerfile used by this script is no longer maintained! See
|
||||
# https://github.com/Mbed-TLS/mbedtls-test/blob/master/README.md#quick-start
|
||||
# for the set of Docker images we use on the CI.
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
source tests/scripts/docker_env.sh
|
||||
|
||||
run_in_docker make $@
|
||||
730
vendor/mbedtls/tests/opt-testcases/handshake-generated.sh
vendored
Normal file
730
vendor/mbedtls/tests/opt-testcases/handshake-generated.sh
vendored
Normal file
@@ -0,0 +1,730 @@
|
||||
# Miscellaneous tests related to the TLS handshake layer.
|
||||
#
|
||||
# Automatically generated by generate_tls_handshake_tests.py. Do not edit!
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
run_test "Handshake defragmentation on client: no fragmentation, for reference" \
|
||||
"$O_NEXT_SRV -allow_no_dhe_kex" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-C "waiting for more fragments"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=512, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 512" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 512, 0\\.\\.512 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 512\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 512/" \
|
||||
-c "Consume: waiting for more handshake fragments 512/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=512, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 512" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 512, 0\\.\\.512 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 512\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 512/" \
|
||||
-c "Consume: waiting for more handshake fragments 512/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=513, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 513" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 513, 0\\.\\.513 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 513\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 513/" \
|
||||
-c "Consume: waiting for more handshake fragments 513/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=513, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 513" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 513, 0\\.\\.513 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 513\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 513/" \
|
||||
-c "Consume: waiting for more handshake fragments 513/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=256, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 256" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 256, 0\\.\\.256 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 256\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 256/" \
|
||||
-c "Consume: waiting for more handshake fragments 256/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=256, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 256" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 256, 0\\.\\.256 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 256\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 256/" \
|
||||
-c "Consume: waiting for more handshake fragments 256/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=128, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 128" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 128, 0\\.\\.128 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 128\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 128/" \
|
||||
-c "Consume: waiting for more handshake fragments 128/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=128, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 128" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 128, 0\\.\\.128 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 128\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 128/" \
|
||||
-c "Consume: waiting for more handshake fragments 128/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=64, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 64" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 64, 0\\.\\.64 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 64\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 64/" \
|
||||
-c "Consume: waiting for more handshake fragments 64/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=64, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 64" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 64, 0\\.\\.64 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 64\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 64/" \
|
||||
-c "Consume: waiting for more handshake fragments 64/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=36, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 36" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 36, 0\\.\\.36 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 36\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 36/" \
|
||||
-c "Consume: waiting for more handshake fragments 36/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=36, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 36" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 36, 0\\.\\.36 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 36\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 36/" \
|
||||
-c "Consume: waiting for more handshake fragments 36/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=32, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 32" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 32, 0\\.\\.32 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 32\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 32/" \
|
||||
-c "Consume: waiting for more handshake fragments 32/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=32, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 32" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 32, 0\\.\\.32 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 32\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 32/" \
|
||||
-c "Consume: waiting for more handshake fragments 32/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=16, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 16" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 16, 0\\.\\.16 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 16\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 16/" \
|
||||
-c "Consume: waiting for more handshake fragments 16/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=16, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 16" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 16, 0\\.\\.16 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 16\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 16/" \
|
||||
-c "Consume: waiting for more handshake fragments 16/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=13, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 13" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 13, 0\\.\\.13 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 13\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 13/" \
|
||||
-c "Consume: waiting for more handshake fragments 13/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=13, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 13" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 13, 0\\.\\.13 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 13\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 13/" \
|
||||
-c "Consume: waiting for more handshake fragments 13/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=5, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 5" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 5, 0\\.\\.5 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 5\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 5/" \
|
||||
-c "Consume: waiting for more handshake fragments 5/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=5, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 5" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 5, 0\\.\\.5 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 5\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 5/" \
|
||||
-c "Consume: waiting for more handshake fragments 5/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on client: len=4, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -split_send_frag 4" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 4/" \
|
||||
-c "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=4, TLS 1.2, default" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 4" \
|
||||
"$P_CLI debug_level=4" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 4/" \
|
||||
-c "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=4, TLS 1.2, null" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 4 -cipher ALL@SECLEVEL=0:COMPLEMENTOFALL@SECLEVEL=0" \
|
||||
"$P_CLI debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-NULL-SHA" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 4/" \
|
||||
-c "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=4, TLS 1.2, ChachaPoly" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 4" \
|
||||
"$P_CLI debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 4/" \
|
||||
-c "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=4, TLS 1.2, GCM" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 4" \
|
||||
"$P_CLI debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 4/" \
|
||||
-c "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
run_test "Handshake defragmentation on client: len=4, TLS 1.2, CBC, etm=n" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 4" \
|
||||
"$P_CLI debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 etm=0" \
|
||||
0 \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 4/" \
|
||||
-c "Consume: waiting for more handshake fragments 4/" \
|
||||
-C "using encrypt then mac"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_config_enabled MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
requires_config_enabled MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
run_test "Handshake defragmentation on client: len=4, TLS 1.2, CBC, etm=y" \
|
||||
"$O_NEXT_SRV -tls1_2 -split_send_frag 4" \
|
||||
"$P_CLI debug_level=4 force_ciphersuite=TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256 etm=1" \
|
||||
0 \
|
||||
-c "using encrypt then mac" \
|
||||
-c "reassembled record" \
|
||||
-c "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-c "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-c "Prepare: waiting for more handshake fragments 4/" \
|
||||
-c "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
run_test "Handshake defragmentation on client: len=3, TLS 1.3" \
|
||||
"$O_NEXT_SRV -tls1_3 -allow_no_dhe_kex -split_send_frag 3" \
|
||||
"$P_CLI debug_level=4" \
|
||||
1 \
|
||||
-c "=> ssl_tls13_process_server_hello" \
|
||||
-c "handshake message too short: 3" \
|
||||
-c "SSL - An invalid SSL record was received"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Handshake defragmentation on client: len=3, TLS 1.2" \
|
||||
"$O_NEXT_SRV -tls1_2 -allow_no_dhe_kex -split_send_frag 3" \
|
||||
"$P_CLI debug_level=4" \
|
||||
1 \
|
||||
-c "handshake message too short: 3" \
|
||||
-c "SSL - An invalid SSL record was received"
|
||||
|
||||
run_test "Handshake defragmentation on server: no fragmentation, for reference" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -allow_no_dhe_kex -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-S "waiting for more fragments"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=512, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 512 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 512, 0\\.\\.512 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 512\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 512/" \
|
||||
-s "Consume: waiting for more handshake fragments 512/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=512, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 512 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 512, 0\\.\\.512 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 512\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 512/" \
|
||||
-s "Consume: waiting for more handshake fragments 512/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=513, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 513 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 513, 0\\.\\.513 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 513\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 513/" \
|
||||
-s "Consume: waiting for more handshake fragments 513/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=513, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 513 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 513, 0\\.\\.513 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 513\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 513/" \
|
||||
-s "Consume: waiting for more handshake fragments 513/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=256, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 256 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 256, 0\\.\\.256 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 256\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 256/" \
|
||||
-s "Consume: waiting for more handshake fragments 256/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=256, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 256 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 256, 0\\.\\.256 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 256\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 256/" \
|
||||
-s "Consume: waiting for more handshake fragments 256/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=128, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 128 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 128, 0\\.\\.128 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 128\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 128/" \
|
||||
-s "Consume: waiting for more handshake fragments 128/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=128, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 128 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 128, 0\\.\\.128 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 128\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 128/" \
|
||||
-s "Consume: waiting for more handshake fragments 128/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=64, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 64 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 64, 0\\.\\.64 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 64\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 64/" \
|
||||
-s "Consume: waiting for more handshake fragments 64/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=64, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 64 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 64, 0\\.\\.64 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 64\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 64/" \
|
||||
-s "Consume: waiting for more handshake fragments 64/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=36, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 36 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 36, 0\\.\\.36 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 36\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 36/" \
|
||||
-s "Consume: waiting for more handshake fragments 36/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=36, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 36 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 36, 0\\.\\.36 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 36\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 36/" \
|
||||
-s "Consume: waiting for more handshake fragments 36/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=32, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 32 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 32, 0\\.\\.32 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 32\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 32/" \
|
||||
-s "Consume: waiting for more handshake fragments 32/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=32, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 32 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 32, 0\\.\\.32 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 32\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 32/" \
|
||||
-s "Consume: waiting for more handshake fragments 32/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=16, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 16 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 16, 0\\.\\.16 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 16\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 16/" \
|
||||
-s "Consume: waiting for more handshake fragments 16/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=16, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 16 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 16, 0\\.\\.16 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 16\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 16/" \
|
||||
-s "Consume: waiting for more handshake fragments 16/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=13, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 13 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 13, 0\\.\\.13 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 13\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 13/" \
|
||||
-s "Consume: waiting for more handshake fragments 13/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=13, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 13 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 13, 0\\.\\.13 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 13\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 13/" \
|
||||
-s "Consume: waiting for more handshake fragments 13/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=5, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 5 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 5, 0\\.\\.5 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 5\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 5/" \
|
||||
-s "Consume: waiting for more handshake fragments 5/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=5, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 5 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 5, 0\\.\\.5 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 5\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 5/" \
|
||||
-s "Consume: waiting for more handshake fragments 5/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=4, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -split_send_frag 4 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 4/" \
|
||||
-s "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
run_test "Handshake defragmentation on server: len=4, TLS 1.2, default" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 4 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 4/" \
|
||||
-s "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_ciphersuite_enabled TLS-ECDHE-ECDSA-WITH-NULL-SHA
|
||||
run_test "Handshake defragmentation on server: len=4, TLS 1.2, null" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 4 -cipher ECDHE-ECDSA-NULL-SHA@SECLEVEL=0 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 4/" \
|
||||
-s "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_ciphersuite_enabled TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256
|
||||
run_test "Handshake defragmentation on server: len=4, TLS 1.2, ChachaPoly" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 4 -cipher ECDHE-ECDSA-CHACHA20-POLY1305 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 4/" \
|
||||
-s "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_ciphersuite_enabled TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
|
||||
run_test "Handshake defragmentation on server: len=4, TLS 1.2, GCM" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 4 -cipher ECDHE-ECDSA-AES128-GCM-SHA256 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 4/" \
|
||||
-s "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_ciphersuite_enabled TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256
|
||||
run_test "Handshake defragmentation on server: len=4, TLS 1.2, CBC, etm=n" \
|
||||
"$P_SRV debug_level=4 etm=0 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 4 -cipher ECDHE-ECDSA-AES128-SHA256 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 4/" \
|
||||
-s "Consume: waiting for more handshake fragments 4/" \
|
||||
-S "using encrypt then mac"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
requires_certificate_authentication
|
||||
requires_ciphersuite_enabled TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256
|
||||
requires_config_enabled MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
run_test "Handshake defragmentation on server: len=4, TLS 1.2, CBC, etm=y" \
|
||||
"$P_SRV debug_level=4 etm=1 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -split_send_frag 4 -cipher ECDHE-ECDSA-AES128-SHA256 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
0 \
|
||||
-s "using encrypt then mac" \
|
||||
-s "reassembled record" \
|
||||
-s "initial handshake fragment: 4, 0\\.\\.4 of [0-9]\\+" \
|
||||
-s "subsequent handshake fragment: [0-9]\\+, 4\\.\\." \
|
||||
-s "Prepare: waiting for more handshake fragments 4/" \
|
||||
-s "Consume: waiting for more handshake fragments 4/"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3
|
||||
run_test "Handshake defragmentation on server: len=3, TLS 1.3" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_3 -allow_no_dhe_kex -split_send_frag 3 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
1 \
|
||||
-s "=> parse client hello" \
|
||||
-s "handshake message too short: 3" \
|
||||
-s "SSL - An invalid SSL record was received"
|
||||
|
||||
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
|
||||
run_test "Handshake defragmentation on server: len=3, TLS 1.2" \
|
||||
"$P_SRV debug_level=4 auth_mode=required" \
|
||||
"$O_NEXT_CLI -tls1_2 -allow_no_dhe_kex -split_send_frag 3 -cert $DATA_FILES_PATH/server5.crt -key $DATA_FILES_PATH/server5.key" \
|
||||
1 \
|
||||
-s "=> parse client hello" \
|
||||
-s "handshake message too short: 3" \
|
||||
-s "SSL - An invalid SSL record was received"
|
||||
|
||||
# End of automatically generated file.
|
||||
374
vendor/mbedtls/tests/opt-testcases/sample.sh
vendored
Normal file
374
vendor/mbedtls/tests/opt-testcases/sample.sh
vendored
Normal file
@@ -0,0 +1,374 @@
|
||||
# Test that SSL sample programs can interoperate with each other
|
||||
# and with OpenSSL and GnuTLS.
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
: ${PROGRAMS_DIR:=../programs/ssl}
|
||||
|
||||
run_test "Sample: ssl_client1, ssl_server2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_server2" \
|
||||
"$PROGRAMS_DIR/ssl_client1" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version tls12
|
||||
run_test "Sample: ssl_client1, openssl server, TLS 1.2" \
|
||||
-P 4433 \
|
||||
"$O_SRV -tls1_2" \
|
||||
"$PROGRAMS_DIR/ssl_client1" \
|
||||
0 \
|
||||
-c "Protocol.*TLSv1.2" \
|
||||
-S "ERROR" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version tls12
|
||||
run_test "Sample: ssl_client1, gnutls server, TLS 1.2" \
|
||||
-P 4433 \
|
||||
"$G_SRV --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" \
|
||||
"$PROGRAMS_DIR/ssl_client1" \
|
||||
0 \
|
||||
-s "Version: TLS1.2" \
|
||||
-c "<TD>Protocol version:</TD><TD>TLS1.2</TD>" \
|
||||
-S "Error" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version tls13
|
||||
requires_openssl_tls1_3
|
||||
run_test "Sample: ssl_client1, openssl server, TLS 1.3" \
|
||||
-P 4433 \
|
||||
"$O_NEXT_SRV -tls1_3" \
|
||||
"$PROGRAMS_DIR/ssl_client1" \
|
||||
0 \
|
||||
-c "New, TLSv1.3, Cipher is" \
|
||||
-S "ERROR" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version tls13
|
||||
requires_gnutls_tls1_3
|
||||
run_test "Sample: ssl_client1, gnutls server, TLS 1.3" \
|
||||
-P 4433 \
|
||||
"$G_NEXT_SRV --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.3" \
|
||||
"$PROGRAMS_DIR/ssl_client1" \
|
||||
0 \
|
||||
-s "Version: TLS1.3" \
|
||||
-c "<TD>Protocol version:</TD><TD>TLS1.3</TD>" \
|
||||
-S "Error" \
|
||||
-C "error"
|
||||
|
||||
# The server complains of extra data after it closes the connection
|
||||
# because the client keeps sending data, so the server receives
|
||||
# more application data when it expects a new handshake. We consider
|
||||
# the test a success if both sides have sent and received application
|
||||
# data, no matter what happens afterwards.
|
||||
run_test "Sample: dtls_client, ssl_server2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_server2 dtls=1 server_addr=localhost" \
|
||||
"$PROGRAMS_DIR/dtls_client" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-C "error"
|
||||
|
||||
# The dtls_client program connects to localhost. This test case fails on
|
||||
# systems where the name "localhost" resolves to an IPv6 address, but
|
||||
# the IPv6 connection is not possible. Possible reasons include:
|
||||
# * OpenSSL is too old (IPv6 support was added in 1.1.0).
|
||||
# * OpenSSL was built without IPv6 support.
|
||||
# * A firewall blocks IPv6.
|
||||
#
|
||||
# To facilitate working with this test case, have it run with $OPENSSL_NEXT
|
||||
# which is at least 1.1.1a. At the time it was introduced, this test case
|
||||
# passed with OpenSSL 1.0.2g on an environment where IPv6 is disabled.
|
||||
requires_protocol_version dtls12
|
||||
run_test "Sample: dtls_client, openssl server, DTLS 1.2" \
|
||||
-P 4433 \
|
||||
"$O_NEXT_SRV -dtls1_2" \
|
||||
"$PROGRAMS_DIR/dtls_client" \
|
||||
0 \
|
||||
-s "Echo this" \
|
||||
-c "Echo this" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-S "ERROR" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version dtls12
|
||||
run_test "Sample: dtls_client, gnutls server, DTLS 1.2" \
|
||||
-P 4433 \
|
||||
"$G_SRV -u --echo --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" \
|
||||
"$PROGRAMS_DIR/dtls_client" \
|
||||
0 \
|
||||
-s "Server listening" \
|
||||
-s "[1-9][0-9]* bytes command:" \
|
||||
-c "Echo this" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-S "Error" \
|
||||
-C "error"
|
||||
|
||||
run_test "Sample: ssl_server, ssl_client2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_server" \
|
||||
"$PROGRAMS_DIR/ssl_client2" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
run_test "Sample: ssl_client1 with ssl_server" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_server" \
|
||||
"$PROGRAMS_DIR/ssl_client1" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version tls12
|
||||
run_test "Sample: ssl_server, openssl client, TLS 1.2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_server" \
|
||||
"$O_CLI -tls1_2" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS-" \
|
||||
-c "Protocol.*TLSv1.2" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls12
|
||||
run_test "Sample: ssl_server, gnutls client, TLS 1.2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_server" \
|
||||
"$G_CLI --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2 localhost" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS-" \
|
||||
-c "Description:.*TLS1.2" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls13
|
||||
requires_openssl_tls1_3
|
||||
run_test "Sample: ssl_server, openssl client, TLS 1.3" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_server" \
|
||||
"$O_NEXT_CLI -tls1_3" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS1-3-" \
|
||||
-c "New, TLSv1.3, Cipher is" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls13
|
||||
requires_gnutls_tls1_3
|
||||
run_test "Sample: ssl_server, gnutls client, TLS 1.3" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_server" \
|
||||
"$G_NEXT_CLI --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.3 localhost" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS1-3-" \
|
||||
-c "Description:.*TLS1.3" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
run_test "Sample: ssl_fork_server, ssl_client2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_fork_server" \
|
||||
"$PROGRAMS_DIR/ssl_client2" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
run_test "Sample: ssl_client1 with ssl_fork_server" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_fork_server" \
|
||||
"$PROGRAMS_DIR/ssl_client1" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version tls12
|
||||
run_test "Sample: ssl_fork_server, openssl client, TLS 1.2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_fork_server" \
|
||||
"$O_CLI -tls1_2" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS-" \
|
||||
-c "Protocol.*TLSv1.2" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls12
|
||||
run_test "Sample: ssl_fork_server, gnutls client, TLS 1.2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_fork_server" \
|
||||
"$G_CLI --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2 localhost" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS-" \
|
||||
-c "Description:.*TLS1.2" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls13
|
||||
requires_openssl_tls1_3
|
||||
run_test "Sample: ssl_fork_server, openssl client, TLS 1.3" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_fork_server" \
|
||||
"$O_NEXT_CLI -tls1_3" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS1-3-" \
|
||||
-c "New, TLSv1.3, Cipher is" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls13
|
||||
requires_gnutls_tls1_3
|
||||
run_test "Sample: ssl_fork_server, gnutls client, TLS 1.3" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_fork_server" \
|
||||
"$G_NEXT_CLI --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.3 localhost" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS1-3-" \
|
||||
-c "Description:.*TLS1.3" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
run_test "Sample: ssl_pthread_server, ssl_client2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_pthread_server" \
|
||||
"$PROGRAMS_DIR/ssl_client2" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
run_test "Sample: ssl_client1 with ssl_pthread_server" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_pthread_server" \
|
||||
"$PROGRAMS_DIR/ssl_client1" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version tls12
|
||||
run_test "Sample: ssl_pthread_server, openssl client, TLS 1.2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_pthread_server" \
|
||||
"$O_CLI -tls1_2" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS-" \
|
||||
-c "Protocol.*TLSv1.2" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls12
|
||||
run_test "Sample: ssl_pthread_server, gnutls client, TLS 1.2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_pthread_server" \
|
||||
"$G_CLI --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2 localhost" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS-" \
|
||||
-c "Description:.*TLS1.2" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls13
|
||||
requires_openssl_tls1_3
|
||||
run_test "Sample: ssl_pthread_server, openssl client, TLS 1.3" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_pthread_server" \
|
||||
"$O_NEXT_CLI -tls1_3" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS1-3-" \
|
||||
-c "New, TLSv1.3, Cipher is" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version tls13
|
||||
requires_gnutls_tls1_3
|
||||
run_test "Sample: ssl_pthread_server, gnutls client, TLS 1.3" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/ssl_pthread_server" \
|
||||
"$G_NEXT_CLI --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.3 localhost" \
|
||||
0 \
|
||||
-s "Successful connection using: TLS1-3-" \
|
||||
-c "Description:.*TLS1.3" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
run_test "Sample: dtls_client with dtls_server" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/dtls_server" \
|
||||
"$PROGRAMS_DIR/dtls_client" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
run_test "Sample: ssl_client2, dtls_server" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/dtls_server" \
|
||||
"$PROGRAMS_DIR/ssl_client2 dtls=1" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "[1-9][0-9]* bytes read" \
|
||||
-c "[1-9][0-9]* bytes written" \
|
||||
-S "error" \
|
||||
-C "error"
|
||||
|
||||
requires_protocol_version dtls12
|
||||
run_test "Sample: dtls_server, openssl client, DTLS 1.2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/dtls_server" \
|
||||
"$O_CLI -dtls1_2" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "Protocol.*TLSv1.2" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
|
||||
requires_protocol_version dtls12
|
||||
run_test "Sample: dtls_server, gnutls client, DTLS 1.2" \
|
||||
-P 4433 \
|
||||
"$PROGRAMS_DIR/dtls_server" \
|
||||
"$G_CLI -u --priority=NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2 localhost" \
|
||||
0 \
|
||||
-s "[1-9][0-9]* bytes read" \
|
||||
-s "[1-9][0-9]* bytes written" \
|
||||
-c "Description:.*DTLS1.2" \
|
||||
-S "error" \
|
||||
-C "ERROR"
|
||||
14032
vendor/mbedtls/tests/opt-testcases/tls13-compat.sh
vendored
Normal file
14032
vendor/mbedtls/tests/opt-testcases/tls13-compat.sh
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3325
vendor/mbedtls/tests/opt-testcases/tls13-kex-modes.sh
vendored
Normal file
3325
vendor/mbedtls/tests/opt-testcases/tls13-kex-modes.sh
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1362
vendor/mbedtls/tests/opt-testcases/tls13-misc.sh
vendored
Normal file
1362
vendor/mbedtls/tests/opt-testcases/tls13-misc.sh
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16
vendor/mbedtls/tests/scripts/all.sh
vendored
Executable file
16
vendor/mbedtls/tests/scripts/all.sh
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# all.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file is executable; it is the entry point for users and the CI.
|
||||
# See "Files structure" in all-core.sh for other files used.
|
||||
|
||||
# This script must be invoked from the project's root.
|
||||
|
||||
FRAMEWORK="$PWD/framework"
|
||||
source $FRAMEWORK/scripts/all-core.sh
|
||||
|
||||
main "$@"
|
||||
742
vendor/mbedtls/tests/scripts/analyze_outcomes.py
vendored
Executable file
742
vendor/mbedtls/tests/scripts/analyze_outcomes.py
vendored
Executable file
@@ -0,0 +1,742 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""Analyze the test outcomes from a full CI run.
|
||||
|
||||
This script can also run on outcomes from a partial run, but the results are
|
||||
less likely to be useful.
|
||||
"""
|
||||
|
||||
import re
|
||||
import typing
|
||||
|
||||
import scripts_path # pylint: disable=unused-import
|
||||
from mbedtls_framework import outcome_analysis
|
||||
|
||||
|
||||
class CoverageTask(outcome_analysis.CoverageTask):
|
||||
"""Justify test cases that are never executed."""
|
||||
|
||||
@staticmethod
|
||||
def _has_word_re(words: typing.Iterable[str],
|
||||
exclude: typing.Optional[str] = None) -> typing.Pattern:
|
||||
"""Construct a regex that matches if any of the words appears.
|
||||
|
||||
The occurrence must start and end at a word boundary.
|
||||
|
||||
If exclude is specified, strings containing a match for that
|
||||
regular expression will not match the returned pattern.
|
||||
"""
|
||||
exclude_clause = r''
|
||||
if exclude:
|
||||
exclude_clause = r'(?!.*' + exclude + ')'
|
||||
return re.compile(exclude_clause +
|
||||
r'.*\b(?:' + r'|'.join(words) + r')\b.*',
|
||||
re.DOTALL)
|
||||
|
||||
UNCOVERED_TESTS = {
|
||||
'ssl-opt': [
|
||||
# We don't run ssl-opt.sh with Valgrind on the CI because
|
||||
# it's extremely slow. We don't intend to change this.
|
||||
'DTLS client reconnect from same port: reconnect, nbio, valgrind',
|
||||
# We don't have IPv6 in our CI environment.
|
||||
# https://github.com/Mbed-TLS/mbedtls-test/issues/176
|
||||
'DTLS cookie: enabled, IPv6',
|
||||
# Disabled due to OpenSSL bug.
|
||||
# https://github.com/openssl/openssl/issues/18887
|
||||
'DTLS fragmenting: 3d, MTU=512, openssl client, DTLS 1.2',
|
||||
# We don't run ssl-opt.sh with Valgrind on the CI because
|
||||
# it's extremely slow. We don't intend to change this.
|
||||
'DTLS fragmenting: proxy MTU: auto-reduction (with valgrind)',
|
||||
# It seems that we don't run `ssl-opt.sh` with
|
||||
# `MBEDTLS_USE_PSA_CRYPTO` enabled but `MBEDTLS_SSL_ASYNC_PRIVATE`
|
||||
# disabled.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9581
|
||||
'Opaque key for server authentication: invalid key: decrypt with ECC key, no async',
|
||||
'Opaque key for server authentication: invalid key: ecdh with RSA key, no async',
|
||||
# The following test fails intermittently on the CI with a frequency
|
||||
# that significantly impacts CI throughput. They are thus disabled
|
||||
# for the time being. See
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/10652 for more
|
||||
# information.
|
||||
'DTLS proxy: 3d, openssl client, fragmentation',
|
||||
'DTLS proxy: 3d, openssl client, fragmentation, nbio',
|
||||
'DTLS proxy: 3d, gnutls client, fragmentation',
|
||||
'DTLS proxy: 3d, gnutls client, fragmentation, nbio=2',
|
||||
],
|
||||
'test_suite_config.mbedtls_boolean': [
|
||||
# We never test with CBC/PKCS5/PKCS12 enabled but
|
||||
# PKCS7 padding disabled.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9580
|
||||
'Config: !MBEDTLS_CIPHER_PADDING_PKCS7',
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9583
|
||||
'Config: !MBEDTLS_ECP_NIST_OPTIM',
|
||||
# MBEDTLS_ECP_NO_FALLBACK only affects builds using a partial
|
||||
# alternative implementation of ECP arithmetic (with
|
||||
# MBEDTLS_ECP_INTERNAL_ALT enabled). We don't test those builds.
|
||||
# The configuration enumeration script skips xxx_ALT options
|
||||
# but not MBEDTLS_ECP_NO_FALLBACK, so it appears in the report,
|
||||
# but we don't care about it.
|
||||
'Config: MBEDTLS_ECP_NO_FALLBACK',
|
||||
# Missing coverage of test configurations.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9585
|
||||
'Config: !MBEDTLS_SSL_DTLS_ANTI_REPLAY',
|
||||
# Missing coverage of test configurations.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9585
|
||||
'Config: !MBEDTLS_SSL_DTLS_HELLO_VERIFY',
|
||||
# We don't run test_suite_config when we test this.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9586
|
||||
'Config: !MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED',
|
||||
# We only test multithreading with pthreads.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9584
|
||||
'Config: !MBEDTLS_THREADING_PTHREAD',
|
||||
# Built but not tested.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9587
|
||||
'Config: MBEDTLS_AES_USE_HARDWARE_ONLY',
|
||||
# Untested platform-specific optimizations.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9588
|
||||
'Config: MBEDTLS_HAVE_SSE2',
|
||||
# Untested aspect of the platform interface.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9589
|
||||
'Config: MBEDTLS_PLATFORM_NO_STD_FUNCTIONS',
|
||||
# In a client-server build, test_suite_config runs in the
|
||||
# client configuration, so it will never report
|
||||
# MBEDTLS_PSA_CRYPTO_SPM as enabled. That's ok.
|
||||
'Config: MBEDTLS_PSA_CRYPTO_SPM',
|
||||
# We don't test on armv8 yet.
|
||||
'Config: MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT',
|
||||
'Config: MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY',
|
||||
'Config: MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY',
|
||||
'Config: MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY',
|
||||
],
|
||||
'test_suite_config.psa_boolean': [
|
||||
# We don't test with HMAC disabled.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9591
|
||||
'Config: !PSA_WANT_ALG_HMAC',
|
||||
# The DERIVE key type is always enabled.
|
||||
'Config: !PSA_WANT_KEY_TYPE_DERIVE',
|
||||
# More granularity of key pair type enablement macros
|
||||
# than we care to test.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9590
|
||||
'Config: !PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT',
|
||||
'Config: !PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE',
|
||||
'Config: !PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT',
|
||||
# More granularity of key pair type enablement macros
|
||||
# than we care to test.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9590
|
||||
'Config: !PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT',
|
||||
'Config: !PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT',
|
||||
# We don't test with HMAC disabled.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9591
|
||||
'Config: !PSA_WANT_KEY_TYPE_HMAC',
|
||||
# The PASSWORD key type is always enabled.
|
||||
'Config: !PSA_WANT_KEY_TYPE_PASSWORD',
|
||||
# The PASSWORD_HASH key type is always enabled.
|
||||
'Config: !PSA_WANT_KEY_TYPE_PASSWORD_HASH',
|
||||
# The RAW_DATA key type is always enabled.
|
||||
'Config: !PSA_WANT_KEY_TYPE_RAW_DATA',
|
||||
# More granularity of key pair type enablement macros
|
||||
# than we care to test.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9590
|
||||
'Config: !PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT',
|
||||
'Config: !PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT',
|
||||
# Algorithm declared but not supported.
|
||||
'Config: PSA_WANT_ALG_CBC_MAC',
|
||||
# Algorithm declared but not supported.
|
||||
'Config: PSA_WANT_ALG_XTS',
|
||||
# Family declared but not supported.
|
||||
'Config: PSA_WANT_ECC_SECP_K1_224',
|
||||
# More granularity of key pair type enablement macros
|
||||
# than we care to test.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9590
|
||||
'Config: PSA_WANT_KEY_TYPE_DH_KEY_PAIR_DERIVE',
|
||||
'Config: PSA_WANT_KEY_TYPE_ECC_KEY_PAIR',
|
||||
'Config: PSA_WANT_KEY_TYPE_RSA_KEY_PAIR',
|
||||
'Config: PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE',
|
||||
],
|
||||
'test_suite_config.psa_combinations': [
|
||||
# We don't test this unusual, but sensible configuration.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9592
|
||||
'Config: PSA_WANT_ALG_DETERMINSTIC_ECDSA without PSA_WANT_ALG_ECDSA',
|
||||
],
|
||||
'test_suite_pkcs12': [
|
||||
# We never test with CBC/PKCS5/PKCS12 enabled but
|
||||
# PKCS7 padding disabled.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9580
|
||||
'PBE Decrypt, (Invalid padding & PKCS7 padding disabled)',
|
||||
'PBE Encrypt, pad = 8 (PKCS7 padding disabled)',
|
||||
],
|
||||
'test_suite_pkcs5': [
|
||||
# We never test with CBC/PKCS5/PKCS12 enabled but
|
||||
# PKCS7 padding disabled.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9580
|
||||
'PBES2 Decrypt (Invalid padding & PKCS7 padding disabled)',
|
||||
'PBES2 Encrypt, pad=6 (PKCS7 padding disabled)',
|
||||
'PBES2 Encrypt, pad=8 (PKCS7 padding disabled)',
|
||||
],
|
||||
'test_suite_psa_crypto': [
|
||||
# We don't test this unusual, but sensible configuration.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9592
|
||||
re.compile(r'.*ECDSA.*only deterministic supported'),
|
||||
],
|
||||
'test_suite_psa_crypto_metadata': [
|
||||
# Algorithms declared but not supported.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9579
|
||||
'Asymmetric signature: Ed25519ph',
|
||||
'Asymmetric signature: Ed448ph',
|
||||
'Asymmetric signature: pure EdDSA',
|
||||
'Cipher: XTS',
|
||||
'MAC: CBC_MAC-3DES',
|
||||
'MAC: CBC_MAC-AES-128',
|
||||
'MAC: CBC_MAC-AES-192',
|
||||
'MAC: CBC_MAC-AES-256',
|
||||
],
|
||||
'test_suite_psa_crypto_not_supported.generated': [
|
||||
# We never test with DH key support disabled but support
|
||||
# for a DH group enabled. The dependencies of these test
|
||||
# cases don't really make sense.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9574
|
||||
re.compile(r'PSA \w+ DH_.*type not supported'),
|
||||
# We only test partial support for DH with the 2048-bit group
|
||||
# enabled and the other groups disabled.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9575
|
||||
'PSA generate DH_KEY_PAIR(RFC7919) 2048-bit group not supported',
|
||||
'PSA import DH_KEY_PAIR(RFC7919) 2048-bit group not supported',
|
||||
'PSA import DH_PUBLIC_KEY(RFC7919) 2048-bit group not supported',
|
||||
],
|
||||
'test_suite_psa_crypto_op_fail.generated': [
|
||||
# We don't test this unusual, but sensible configuration.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9592
|
||||
re.compile(r'.*: !ECDSA but DETERMINISTIC_ECDSA with ECC_.*'),
|
||||
# PBKDF2_HMAC is not in the default configuration, so we don't
|
||||
# enable it in depends.py where we remove hashes.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9576
|
||||
re.compile(r'PSA key_derivation PBKDF2_HMAC\(\w+\): !(?!PBKDF2_HMAC\Z).*'),
|
||||
|
||||
# We never test with the HMAC algorithm enabled but the HMAC
|
||||
# key type disabled. Those dependencies don't really make sense.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9573
|
||||
re.compile(r'.* !HMAC with HMAC'),
|
||||
# There's something wrong with PSA_WANT_ALG_RSA_PSS_ANY_SALT
|
||||
# differing from PSA_WANT_ALG_RSA_PSS.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9578
|
||||
re.compile(r'PSA sign RSA_PSS_ANY_SALT.*!(?:MD|RIPEMD|SHA).*'),
|
||||
# We don't test with ECDH disabled but the key type enabled.
|
||||
# https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/161
|
||||
re.compile(r'PSA key_agreement.* !ECDH with ECC_KEY_PAIR\(.*'),
|
||||
# We don't test with FFDH disabled but the key type enabled.
|
||||
# https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/160
|
||||
re.compile(r'PSA key_agreement.* !FFDH with DH_KEY_PAIR\(.*'),
|
||||
],
|
||||
'test_suite_psa_crypto_op_fail.misc': [
|
||||
# We don't test this unusual, but sensible configuration.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9592
|
||||
'PSA sign DETERMINISTIC_ECDSA(SHA_256): !ECDSA but DETERMINISTIC_ECDSA with ECC_KEY_PAIR(SECP_R1)', #pylint: disable=line-too-long
|
||||
],
|
||||
'tls13-misc': [
|
||||
# Disabled due to OpenSSL bug.
|
||||
# https://github.com/openssl/openssl/issues/10714
|
||||
'TLS 1.3 O->m: resumption',
|
||||
# Disabled due to OpenSSL command line limitation.
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/9582
|
||||
'TLS 1.3 m->O: resumption with early data',
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
# The names that we give to classes derived from DriverVSReference do not
|
||||
# follow the usual naming convention, because it's more readable to use
|
||||
# underscores and parts of the configuration names. Also, these classes
|
||||
# are just there to specify some data, so they don't need repetitive
|
||||
# documentation.
|
||||
#pylint: disable=invalid-name,missing-class-docstring
|
||||
|
||||
class DriverVSReference_hash(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_hash_use_psa'
|
||||
DRIVER = 'test_psa_crypto_config_accel_hash_use_psa'
|
||||
IGNORED_SUITES = [
|
||||
'shax', 'mdx', # the software implementations that are being excluded
|
||||
'md.psa', # purposefully depends on whether drivers are present
|
||||
'psa_crypto_low_hash.generated', # testing the builtins
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_(MD5|RIPEMD160|SHA[0-9]+)_.*'),
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_hmac(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_hmac'
|
||||
DRIVER = 'test_psa_crypto_config_accel_hmac'
|
||||
IGNORED_SUITES = [
|
||||
# These suites require legacy hash support, which is disabled
|
||||
# in the accelerated component.
|
||||
'shax', 'mdx',
|
||||
# This suite tests builtins directly, but these are missing
|
||||
# in the accelerated case.
|
||||
'psa_crypto_low_hash.generated',
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_(MD5|RIPEMD160|SHA[0-9]+)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_MD_C\b')
|
||||
],
|
||||
'test_suite_md': [
|
||||
# Builtin HMAC is not supported in the accelerate component.
|
||||
re.compile('.*HMAC.*'),
|
||||
# Following tests make use of functions which are not available
|
||||
# when MD_C is disabled, as it happens in the accelerated
|
||||
# test component.
|
||||
re.compile('generic .* Hash file .*'),
|
||||
'MD list',
|
||||
],
|
||||
'test_suite_md.psa': [
|
||||
# "legacy only" tests require hash algorithms to be NOT
|
||||
# accelerated, but this of course false for the accelerated
|
||||
# test component.
|
||||
re.compile('PSA dispatch .* legacy only'),
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_cipher_aead_cmac(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_cipher_aead_cmac'
|
||||
DRIVER = 'test_psa_crypto_config_accel_cipher_aead_cmac'
|
||||
# Modules replaced by drivers.
|
||||
IGNORED_SUITES = [
|
||||
# low-level (block/stream) cipher modules
|
||||
'aes', 'aria', 'camellia', 'des', 'chacha20',
|
||||
# AEAD modes and CMAC
|
||||
'ccm', 'chachapoly', 'cmac', 'gcm',
|
||||
# The Cipher abstraction layer
|
||||
'cipher',
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_(AES|ARIA|CAMELLIA|CHACHA20|DES)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_(CCM|CHACHAPOLY|CMAC|GCM)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_AES(\w+)_C\b.*'),
|
||||
re.compile(r'.*\bMBEDTLS_CIPHER_.*'),
|
||||
],
|
||||
# PEM decryption is not supported so far.
|
||||
# The rest of PEM (write, unencrypted read) works though.
|
||||
'test_suite_pem': [
|
||||
re.compile(r'PEM read .*(AES|DES|\bencrypt).*'),
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
# Following tests depend on AES_C/DES_C but are not about
|
||||
# them really, just need to know some error code is there.
|
||||
'test_suite_error': [
|
||||
'Low and high error',
|
||||
'Single low error'
|
||||
],
|
||||
# Similar to test_suite_error above.
|
||||
'test_suite_version': [
|
||||
'Check for MBEDTLS_AES_C when already present',
|
||||
],
|
||||
# The en/decryption part of PKCS#12 is not supported so far.
|
||||
# The rest of PKCS#12 (key derivation) works though.
|
||||
'test_suite_pkcs12': [
|
||||
re.compile(r'PBE Encrypt, .*'),
|
||||
re.compile(r'PBE Decrypt, .*'),
|
||||
],
|
||||
# The en/decryption part of PKCS#5 is not supported so far.
|
||||
# The rest of PKCS#5 (PBKDF2) works though.
|
||||
'test_suite_pkcs5': [
|
||||
re.compile(r'PBES2 Encrypt, .*'),
|
||||
re.compile(r'PBES2 Decrypt .*'),
|
||||
],
|
||||
# Encrypted keys are not supported so far.
|
||||
# pylint: disable=line-too-long
|
||||
'test_suite_pkparse': [
|
||||
'Key ASN1 (Encrypted key PKCS12, trailing garbage data)',
|
||||
'Key ASN1 (Encrypted key PKCS5, trailing garbage data)',
|
||||
re.compile(r'Parse (RSA|EC) Key .*\(.* ([Ee]ncrypted|password).*\)'),
|
||||
],
|
||||
# Encrypted keys are not supported so far.
|
||||
'ssl-opt': [
|
||||
'TLS: password protected server key',
|
||||
'TLS: password protected client key',
|
||||
'TLS: password protected server key, two certificates',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_ecp_light_only(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_ecc_ecp_light_only'
|
||||
DRIVER = 'test_psa_crypto_config_accel_ecc_ecp_light_only'
|
||||
IGNORED_SUITES = [
|
||||
# Modules replaced by drivers
|
||||
'ecdsa', 'ecdh', 'ecjpake',
|
||||
# Unit tests for the built-in implementation
|
||||
'psa_crypto_ecp',
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'),
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
# This test wants a legacy function that takes f_rng, p_rng
|
||||
# arguments, and uses legacy ECDSA for that. The test is
|
||||
# really about the wrapper around the PSA RNG, not ECDSA.
|
||||
'test_suite_random': [
|
||||
'PSA classic wrapper: ECDSA signature (SECP256R1)',
|
||||
],
|
||||
# In the accelerated test ECP_C is not set (only ECP_LIGHT is)
|
||||
# so we must ignore disparities in the tests for which ECP_C
|
||||
# is required.
|
||||
'test_suite_ecp': [
|
||||
re.compile(r'ECP check public-private .*'),
|
||||
re.compile(r'ECP calculate public: .*'),
|
||||
re.compile(r'ECP gen keypair .*'),
|
||||
re.compile(r'ECP point muladd .*'),
|
||||
re.compile(r'ECP point multiplication .*'),
|
||||
re.compile(r'ECP test vectors .*'),
|
||||
],
|
||||
'test_suite_ssl': [
|
||||
# This deprecated function is only present when ECP_C is On.
|
||||
'Test configuration of EC groups through mbedtls_ssl_conf_curves()',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_no_ecp_at_all(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_ecc_no_ecp_at_all'
|
||||
DRIVER = 'test_psa_crypto_config_accel_ecc_no_ecp_at_all'
|
||||
IGNORED_SUITES = [
|
||||
# Modules replaced by drivers
|
||||
'ecp', 'ecdsa', 'ecdh', 'ecjpake',
|
||||
# Unit tests for the built-in implementation
|
||||
'psa_crypto_ecp',
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'),
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
# See ecp_light_only
|
||||
'test_suite_random': [
|
||||
'PSA classic wrapper: ECDSA signature (SECP256R1)',
|
||||
],
|
||||
'test_suite_pkparse': [
|
||||
# When PK_PARSE_C and ECP_C are defined then PK_PARSE_EC_COMPRESSED
|
||||
# is automatically enabled in build_info.h (backward compatibility)
|
||||
# even if it is disabled in config_psa_crypto_no_ecp_at_all(). As a
|
||||
# consequence compressed points are supported in the reference
|
||||
# component but not in the accelerated one, so they should be skipped
|
||||
# while checking driver's coverage.
|
||||
re.compile(r'Parse EC Key .*(?<!un)compressed\)'),
|
||||
re.compile(r'Parse Public EC Key.*(?<!un)compressed.*'),
|
||||
],
|
||||
# See ecp_light_only
|
||||
'test_suite_ssl': [
|
||||
'Test configuration of EC groups through mbedtls_ssl_conf_curves()',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_ecc_no_bignum(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_ecc_no_bignum'
|
||||
DRIVER = 'test_psa_crypto_config_accel_ecc_no_bignum'
|
||||
IGNORED_SUITES = [
|
||||
# Modules replaced by drivers
|
||||
'ecp', 'ecdsa', 'ecdh', 'ecjpake',
|
||||
'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw',
|
||||
'bignum.generated', 'bignum.misc',
|
||||
# Unit tests for the built-in implementation
|
||||
'psa_crypto_ecp',
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'),
|
||||
re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'),
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
# See ecp_light_only
|
||||
'test_suite_random': [
|
||||
'PSA classic wrapper: ECDSA signature (SECP256R1)',
|
||||
],
|
||||
# See no_ecp_at_all
|
||||
'test_suite_pkparse': [
|
||||
re.compile(r'Parse EC Key .*(?<!un)compressed\)'),
|
||||
re.compile(r'Parse Public EC Key.*(?<!un)compressed.*'),
|
||||
],
|
||||
'test_suite_asn1parse': [
|
||||
'INTEGER too large for mpi',
|
||||
],
|
||||
'test_suite_asn1write': [
|
||||
re.compile(r'ASN.1 Write mpi.*'),
|
||||
],
|
||||
'test_suite_debug': [
|
||||
re.compile(r'Debug print mbedtls_mpi.*'),
|
||||
],
|
||||
# See ecp_light_only
|
||||
'test_suite_ssl': [
|
||||
'Test configuration of EC groups through mbedtls_ssl_conf_curves()',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_ecc_ffdh_no_bignum(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_ecc_ffdh_no_bignum'
|
||||
DRIVER = 'test_psa_crypto_config_accel_ecc_ffdh_no_bignum'
|
||||
IGNORED_SUITES = [
|
||||
# Modules replaced by drivers
|
||||
'ecp', 'ecdsa', 'ecdh', 'ecjpake', 'dhm',
|
||||
'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw',
|
||||
'bignum.generated', 'bignum.misc',
|
||||
# Unit tests for the built-in implementation
|
||||
'psa_crypto_ecp',
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'ssl-opt': [
|
||||
# DHE support in TLS 1.2 requires built-in MBEDTLS_DHM_C
|
||||
# (because it needs custom groups, which PSA does not
|
||||
# provide), even with MBEDTLS_USE_PSA_CRYPTO.
|
||||
re.compile(r'PSK callback:.*\bdhe-psk\b.*'),
|
||||
],
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'),
|
||||
re.compile(r'.*\bMBEDTLS_DHM_C\b.*'),
|
||||
re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECJPAKE|ECP)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED\b.*'),
|
||||
re.compile(r'.*\bMBEDTLS_PK_PARSE_EC_COMPRESSED\b.*'),
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
# See ecp_light_only
|
||||
'test_suite_random': [
|
||||
'PSA classic wrapper: ECDSA signature (SECP256R1)',
|
||||
],
|
||||
# See no_ecp_at_all
|
||||
'test_suite_pkparse': [
|
||||
re.compile(r'Parse EC Key .*(?<!un)compressed\)'),
|
||||
re.compile(r'Parse Public EC Key.*(?<!un)compressed.*'),
|
||||
],
|
||||
'test_suite_asn1parse': [
|
||||
'INTEGER too large for mpi',
|
||||
],
|
||||
'test_suite_asn1write': [
|
||||
re.compile(r'ASN.1 Write mpi.*'),
|
||||
],
|
||||
'test_suite_debug': [
|
||||
re.compile(r'Debug print mbedtls_mpi.*'),
|
||||
],
|
||||
# See ecp_light_only
|
||||
'test_suite_ssl': [
|
||||
'Test configuration of EC groups through mbedtls_ssl_conf_curves()',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_ffdh_alg(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_ffdh'
|
||||
DRIVER = 'test_psa_crypto_config_accel_ffdh'
|
||||
IGNORED_SUITES = ['dhm']
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_DHM_C\b.*'),
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_tfm_config(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_tfm_config_no_p256m'
|
||||
DRIVER = 'test_tfm_config_p256m_driver_accel_ec'
|
||||
IGNORED_SUITES = [
|
||||
# Modules replaced by drivers
|
||||
'asn1parse', 'asn1write',
|
||||
'ecp', 'ecdsa', 'ecdh', 'ecjpake',
|
||||
'bignum_core', 'bignum_random', 'bignum_mod', 'bignum_mod_raw',
|
||||
'bignum.generated', 'bignum.misc',
|
||||
# Unit tests for the built-in implementation
|
||||
'psa_crypto_ecp',
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_BIGNUM_C\b.*'),
|
||||
re.compile(r'.*\bMBEDTLS_(ASN1\w+)_C\b.*'),
|
||||
re.compile(r'.*\bMBEDTLS_(ECDH|ECDSA|ECP)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_PSA_P256M_DRIVER_ENABLED\b.*')
|
||||
],
|
||||
'test_suite_config.crypto_combinations': [
|
||||
'Config: ECC: Weierstrass curves only',
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
# See ecp_light_only
|
||||
'test_suite_random': [
|
||||
'PSA classic wrapper: ECDSA signature (SECP256R1)',
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_rsa(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_psa_crypto_config_reference_rsa_crypto'
|
||||
DRIVER = 'test_psa_crypto_config_accel_rsa_crypto'
|
||||
IGNORED_SUITES = [
|
||||
# Modules replaced by drivers.
|
||||
'rsa', 'pkcs1_v15', 'pkcs1_v21',
|
||||
# We temporarily don't care about PK stuff.
|
||||
'pk', 'pkwrite', 'pkparse'
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_(PKCS1|RSA)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_GENPRIME\b.*')
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
# Following tests depend on RSA_C but are not about
|
||||
# them really, just need to know some error code is there.
|
||||
'test_suite_error': [
|
||||
'Low and high error',
|
||||
'Single high error'
|
||||
],
|
||||
# Constant time operations only used for PKCS1_V15
|
||||
'test_suite_constant_time': [
|
||||
re.compile(r'mbedtls_ct_zeroize_if .*'),
|
||||
re.compile(r'mbedtls_ct_memmove_left .*')
|
||||
],
|
||||
'test_suite_psa_crypto': [
|
||||
# We don't support generate_key_custom entry points
|
||||
# in drivers yet.
|
||||
re.compile(r'PSA generate key custom: RSA, e=.*'),
|
||||
re.compile(r'PSA generate key ext: RSA, e=.*'),
|
||||
],
|
||||
}
|
||||
|
||||
class DriverVSReference_block_cipher_dispatch(outcome_analysis.DriverVSReference):
|
||||
REFERENCE = 'test_full_block_cipher_legacy_dispatch'
|
||||
DRIVER = 'test_full_block_cipher_psa_dispatch'
|
||||
IGNORED_SUITES = [
|
||||
# Skipped in the accelerated component
|
||||
'aes', 'aria', 'camellia',
|
||||
# These require AES_C, ARIA_C or CAMELLIA_C to be enabled in
|
||||
# order for the cipher module (actually cipher_wrapper) to work
|
||||
# properly. However these symbols are disabled in the accelerated
|
||||
# component so we ignore them.
|
||||
'cipher.ccm', 'cipher.gcm', 'cipher.aes', 'cipher.aria',
|
||||
'cipher.camellia',
|
||||
]
|
||||
IGNORED_TESTS = {
|
||||
'test_suite_config': [
|
||||
re.compile(r'.*\bMBEDTLS_(AES|ARIA|CAMELLIA)_.*'),
|
||||
re.compile(r'.*\bMBEDTLS_AES(\w+)_C\b.*'),
|
||||
],
|
||||
'test_suite_cmac': [
|
||||
# Following tests require AES_C/ARIA_C/CAMELLIA_C to be enabled,
|
||||
# but these are not available in the accelerated component.
|
||||
'CMAC null arguments',
|
||||
re.compile('CMAC.* (AES|ARIA|Camellia).*'),
|
||||
],
|
||||
'test_suite_cipher.constant_time': [
|
||||
# Like with test_suite_cipher.aes and such, these tests call
|
||||
# cipher_wrapper in a way that requires the block cipher to
|
||||
# be built in.
|
||||
re.compile('.*(AES|ARIA|CAMELLIA).*(encrypt|decrypt).*', re.I),
|
||||
],
|
||||
'test_suite_cipher.padding': [
|
||||
# Following tests require AES_C/CAMELLIA_C to be enabled,
|
||||
# but these are not available in the accelerated component.
|
||||
re.compile('Set( non-existent)? padding with (AES|CAMELLIA).*'),
|
||||
],
|
||||
'test_suite_pkcs5': [
|
||||
# The AES part of PKCS#5 PBES2 is not yet supported.
|
||||
# The rest of PKCS#5 (PBKDF2) works, though.
|
||||
re.compile(r'PBES2 .* AES-.*')
|
||||
],
|
||||
'test_suite_pkparse': [
|
||||
# PEM (called by pkparse) requires AES_C in order to decrypt
|
||||
# the key, but this is not available in the accelerated
|
||||
# component.
|
||||
re.compile('Parse RSA Key.*(password|AES-).*'),
|
||||
],
|
||||
'test_suite_pem': [
|
||||
# Following tests require AES_C, but this is diabled in the
|
||||
# accelerated component.
|
||||
re.compile('PEM read .*AES.*'),
|
||||
'PEM read (unknown encryption algorithm)',
|
||||
],
|
||||
'test_suite_error': [
|
||||
# Following tests depend on AES_C but are not about them
|
||||
# really, just need to know some error code is there.
|
||||
'Single low error',
|
||||
'Low and high error',
|
||||
],
|
||||
'test_suite_version': [
|
||||
# Similar to test_suite_error above.
|
||||
'Check for MBEDTLS_AES_C when already present',
|
||||
],
|
||||
'test_suite_platform': [
|
||||
# Incompatible with sanitizers (e.g. ASan). If the driver
|
||||
# component uses a sanitizer but the reference component
|
||||
# doesn't, we have a PASS vs SKIP mismatch.
|
||||
'Check mbedtls_calloc overallocation',
|
||||
],
|
||||
}
|
||||
|
||||
#pylint: enable=invalid-name,missing-class-docstring
|
||||
|
||||
|
||||
# List of tasks with a function that can handle this task and additional arguments if required
|
||||
KNOWN_TASKS = {
|
||||
'analyze_coverage': CoverageTask,
|
||||
'analyze_driver_vs_reference_hash': DriverVSReference_hash,
|
||||
'analyze_driver_vs_reference_hmac': DriverVSReference_hmac,
|
||||
'analyze_driver_vs_reference_cipher_aead_cmac': DriverVSReference_cipher_aead_cmac,
|
||||
'analyze_driver_vs_reference_ecp_light_only': DriverVSReference_ecp_light_only,
|
||||
'analyze_driver_vs_reference_no_ecp_at_all': DriverVSReference_no_ecp_at_all,
|
||||
'analyze_driver_vs_reference_ecc_no_bignum': DriverVSReference_ecc_no_bignum,
|
||||
'analyze_driver_vs_reference_ecc_ffdh_no_bignum': DriverVSReference_ecc_ffdh_no_bignum,
|
||||
'analyze_driver_vs_reference_ffdh_alg': DriverVSReference_ffdh_alg,
|
||||
'analyze_driver_vs_reference_tfm_config': DriverVSReference_tfm_config,
|
||||
'analyze_driver_vs_reference_rsa': DriverVSReference_rsa,
|
||||
'analyze_block_cipher_dispatch': DriverVSReference_block_cipher_dispatch,
|
||||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
outcome_analysis.main(KNOWN_TASKS)
|
||||
246
vendor/mbedtls/tests/scripts/basic-build-test.sh
vendored
Executable file
246
vendor/mbedtls/tests/scripts/basic-build-test.sh
vendored
Executable file
@@ -0,0 +1,246 @@
|
||||
#!/bin/sh
|
||||
|
||||
# basic-build-test.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Executes the basic test suites, captures the results, and generates a simple
|
||||
# test report and code coverage report.
|
||||
#
|
||||
# The tests include:
|
||||
# * Unit tests - executed using tests/scripts/run-test-suite.pl
|
||||
# * Self-tests - executed using the test suites above
|
||||
# * System tests - executed using tests/ssl-opt.sh
|
||||
# * Interoperability tests - executed using tests/compat.sh
|
||||
#
|
||||
# The tests focus on functionality and do not consider performance.
|
||||
#
|
||||
# Note the tests self-adapt due to configurations in include/mbedtls/mbedtls_config.h
|
||||
# which can lead to some tests being skipped, and can cause the number of
|
||||
# available tests to fluctuate.
|
||||
#
|
||||
# This script has been written to be generic and should work on any shell.
|
||||
#
|
||||
# Usage: basic-build-test.sh
|
||||
#
|
||||
|
||||
# Abort on errors (and uninitiliased variables)
|
||||
set -eu
|
||||
|
||||
if [ -d library -a -d include -a -d tests ]; then :; else
|
||||
echo "Must be run from Mbed TLS root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
: ${OPENSSL:="openssl"}
|
||||
: ${GNUTLS_CLI:="gnutls-cli"}
|
||||
: ${GNUTLS_SERV:="gnutls-serv"}
|
||||
|
||||
# Used to make ssl-opt.sh deterministic.
|
||||
#
|
||||
# See also RELEASE_SEED in all.sh. Debugging is easier if both values are kept
|
||||
# in sync. If you change the value here because it breaks some tests, you'll
|
||||
# definitely want to change it in all.sh as well.
|
||||
: ${SEED:=1}
|
||||
export SEED
|
||||
|
||||
# if MAKEFLAGS is not set add the -j option to speed up invocations of make
|
||||
if [ -z "${MAKEFLAGS+set}" ]; then
|
||||
export MAKEFLAGS="-j"
|
||||
fi
|
||||
|
||||
# To avoid setting OpenSSL and GnuTLS for each call to compat.sh and ssl-opt.sh
|
||||
# we just export the variables they require
|
||||
export OPENSSL="$OPENSSL"
|
||||
export GNUTLS_CLI="$GNUTLS_CLI"
|
||||
export GNUTLS_SERV="$GNUTLS_SERV"
|
||||
|
||||
CONFIG_H='include/mbedtls/mbedtls_config.h'
|
||||
CONFIG_BAK="$CONFIG_H.bak"
|
||||
|
||||
# Step 0 - print build environment info
|
||||
OPENSSL="$OPENSSL" \
|
||||
GNUTLS_CLI="$GNUTLS_CLI" \
|
||||
GNUTLS_SERV="$GNUTLS_SERV" \
|
||||
framework/scripts/output_env.sh
|
||||
echo
|
||||
|
||||
# Step 1 - Make and instrumented build for code coverage
|
||||
export CFLAGS=' --coverage -g3 -O0 '
|
||||
export LDFLAGS=' --coverage'
|
||||
make clean
|
||||
cp "$CONFIG_H" "$CONFIG_BAK"
|
||||
scripts/config.py full
|
||||
make
|
||||
|
||||
|
||||
# Step 2 - Execute the tests
|
||||
TEST_OUTPUT=out_${PPID}
|
||||
cd tests
|
||||
if [ ! -f "seedfile" ]; then
|
||||
dd if=/dev/urandom of="seedfile" bs=64 count=1
|
||||
fi
|
||||
echo
|
||||
|
||||
# Step 2a - Unit Tests (keep going even if some tests fail)
|
||||
echo '################ Unit tests ################'
|
||||
perl scripts/run-test-suites.pl -v 2 |tee unit-test-$TEST_OUTPUT
|
||||
echo '^^^^^^^^^^^^^^^^ Unit tests ^^^^^^^^^^^^^^^^'
|
||||
echo
|
||||
|
||||
# Step 2b - System Tests (keep going even if some tests fail)
|
||||
echo
|
||||
echo '################ ssl-opt.sh ################'
|
||||
echo "ssl-opt.sh will use SEED=$SEED for udp_proxy"
|
||||
sh ssl-opt.sh |tee sys-test-$TEST_OUTPUT
|
||||
echo '^^^^^^^^^^^^^^^^ ssl-opt.sh ^^^^^^^^^^^^^^^^'
|
||||
echo
|
||||
|
||||
# Step 2c - Compatibility tests (keep going even if some tests fail)
|
||||
echo '################ compat.sh ################'
|
||||
{
|
||||
echo '#### compat.sh: Default versions'
|
||||
sh compat.sh -e 'ARIA\|CHACHA'
|
||||
echo
|
||||
|
||||
echo '#### compat.sh: next (ARIA, ChaCha)'
|
||||
OPENSSL="$OPENSSL_NEXT" sh compat.sh -e '^$' -f 'ARIA\|CHACHA'
|
||||
echo
|
||||
} | tee compat-test-$TEST_OUTPUT
|
||||
echo '^^^^^^^^^^^^^^^^ compat.sh ^^^^^^^^^^^^^^^^'
|
||||
echo
|
||||
|
||||
# Step 3 - Process the coverage report
|
||||
cd ..
|
||||
{
|
||||
make lcov
|
||||
echo SUCCESS
|
||||
} | tee tests/cov-$TEST_OUTPUT
|
||||
|
||||
if [ "$(tail -n1 tests/cov-$TEST_OUTPUT)" != "SUCCESS" ]; then
|
||||
echo >&2 "Fatal: 'make lcov' failed"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
# Step 4 - Summarise the test report
|
||||
echo
|
||||
echo "========================================================================="
|
||||
echo "Test Report Summary"
|
||||
echo
|
||||
|
||||
# A failure of the left-hand side of a pipe is ignored (this is a limitation
|
||||
# of sh). We'll use the presence of this file as a marker that the generation
|
||||
# of the report succeeded.
|
||||
rm -f "tests/basic-build-test-$$.ok"
|
||||
|
||||
{
|
||||
|
||||
cd tests
|
||||
|
||||
# Step 4a - Unit tests
|
||||
echo "Unit tests - tests/scripts/run-test-suites.pl"
|
||||
|
||||
PASSED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/test cases passed :[\t]*\([0-9]*\)/\1/p'| tr -d ' ')
|
||||
SKIPPED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/skipped :[ \t]*\([0-9]*\)/\1/p'| tr -d ' ')
|
||||
TOTAL_SUITES=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/.* (\([0-9]*\) .*, [0-9]* tests run)/\1/p'| tr -d ' ')
|
||||
FAILED_TESTS=$(tail -n6 unit-test-$TEST_OUTPUT|sed -n -e 's/failed :[\t]*\([0-9]*\)/\1/p' |tr -d ' ')
|
||||
|
||||
echo "No test suites : $TOTAL_SUITES"
|
||||
echo "Passed : $PASSED_TESTS"
|
||||
echo "Failed : $FAILED_TESTS"
|
||||
echo "Skipped : $SKIPPED_TESTS"
|
||||
echo "Total exec'd tests : $(($PASSED_TESTS + $FAILED_TESTS))"
|
||||
echo "Total avail tests : $(($PASSED_TESTS + $FAILED_TESTS + $SKIPPED_TESTS))"
|
||||
echo
|
||||
|
||||
TOTAL_PASS=$PASSED_TESTS
|
||||
TOTAL_FAIL=$FAILED_TESTS
|
||||
TOTAL_SKIP=$SKIPPED_TESTS
|
||||
TOTAL_AVAIL=$(($PASSED_TESTS + $FAILED_TESTS + $SKIPPED_TESTS))
|
||||
TOTAL_EXED=$(($PASSED_TESTS + $FAILED_TESTS))
|
||||
|
||||
# Step 4b - TLS Options tests
|
||||
echo "TLS Options tests - tests/ssl-opt.sh"
|
||||
|
||||
PASSED_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* (\([0-9]*\) \/ [0-9]* tests ([0-9]* skipped))$/\1/p')
|
||||
SKIPPED_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* ([0-9]* \/ [0-9]* tests (\([0-9]*\) skipped))$/\1/p')
|
||||
TOTAL_TESTS=$(tail -n5 sys-test-$TEST_OUTPUT|sed -n -e 's/.* ([0-9]* \/ \([0-9]*\) tests ([0-9]* skipped))$/\1/p')
|
||||
FAILED_TESTS=$(($TOTAL_TESTS - $PASSED_TESTS))
|
||||
|
||||
echo "Passed : $PASSED_TESTS"
|
||||
echo "Failed : $FAILED_TESTS"
|
||||
echo "Skipped : $SKIPPED_TESTS"
|
||||
echo "Total exec'd tests : $TOTAL_TESTS"
|
||||
echo "Total avail tests : $(($TOTAL_TESTS + $SKIPPED_TESTS))"
|
||||
echo
|
||||
|
||||
TOTAL_PASS=$(($TOTAL_PASS+$PASSED_TESTS))
|
||||
TOTAL_FAIL=$(($TOTAL_FAIL+$FAILED_TESTS))
|
||||
TOTAL_SKIP=$(($TOTAL_SKIP+$SKIPPED_TESTS))
|
||||
TOTAL_AVAIL=$(($TOTAL_AVAIL + $TOTAL_TESTS + $SKIPPED_TESTS))
|
||||
TOTAL_EXED=$(($TOTAL_EXED + $TOTAL_TESTS))
|
||||
|
||||
|
||||
# Step 4c - System Compatibility tests
|
||||
echo "System/Compatibility tests - tests/compat.sh"
|
||||
|
||||
PASSED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* (\([0-9]*\) \/ [0-9]* tests ([0-9]* skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }')
|
||||
SKIPPED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* ([0-9]* \/ [0-9]* tests (\([0-9]*\) skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }')
|
||||
EXED_TESTS=$(cat compat-test-$TEST_OUTPUT | sed -n -e 's/.* ([0-9]* \/ \([0-9]*\) tests ([0-9]* skipped))$/\1/p' | awk 'BEGIN{ s = 0 } { s += $1 } END{ print s }')
|
||||
FAILED_TESTS=$(($EXED_TESTS - $PASSED_TESTS))
|
||||
|
||||
echo "Passed : $PASSED_TESTS"
|
||||
echo "Failed : $FAILED_TESTS"
|
||||
echo "Skipped : $SKIPPED_TESTS"
|
||||
echo "Total exec'd tests : $EXED_TESTS"
|
||||
echo "Total avail tests : $(($EXED_TESTS + $SKIPPED_TESTS))"
|
||||
echo
|
||||
|
||||
TOTAL_PASS=$(($TOTAL_PASS+$PASSED_TESTS))
|
||||
TOTAL_FAIL=$(($TOTAL_FAIL+$FAILED_TESTS))
|
||||
TOTAL_SKIP=$(($TOTAL_SKIP+$SKIPPED_TESTS))
|
||||
TOTAL_AVAIL=$(($TOTAL_AVAIL + $EXED_TESTS + $SKIPPED_TESTS))
|
||||
TOTAL_EXED=$(($TOTAL_EXED + $EXED_TESTS))
|
||||
|
||||
|
||||
# Step 4d - Grand totals
|
||||
echo "-------------------------------------------------------------------------"
|
||||
echo "Total tests"
|
||||
|
||||
echo "Total Passed : $TOTAL_PASS"
|
||||
echo "Total Failed : $TOTAL_FAIL"
|
||||
echo "Total Skipped : $TOTAL_SKIP"
|
||||
echo "Total exec'd tests : $TOTAL_EXED"
|
||||
echo "Total avail tests : $TOTAL_AVAIL"
|
||||
echo
|
||||
|
||||
|
||||
# Step 4e - Coverage report
|
||||
echo "Coverage statistics:"
|
||||
sed -n '1,/^Overall coverage/d; /%/p' cov-$TEST_OUTPUT
|
||||
echo
|
||||
|
||||
rm unit-test-$TEST_OUTPUT
|
||||
rm sys-test-$TEST_OUTPUT
|
||||
rm compat-test-$TEST_OUTPUT
|
||||
rm cov-$TEST_OUTPUT
|
||||
|
||||
# Mark the report generation as having succeeded. This must be the
|
||||
# last thing in the report generation.
|
||||
touch "basic-build-test-$$.ok"
|
||||
} | tee coverage-summary.txt
|
||||
|
||||
make clean
|
||||
|
||||
if [ -f "$CONFIG_BAK" ]; then
|
||||
mv "$CONFIG_BAK" "$CONFIG_H"
|
||||
fi
|
||||
|
||||
# The file must exist, otherwise it means something went wrong while generating
|
||||
# the coverage report. If something did go wrong, rm will complain so this
|
||||
# script will exit with a failure status.
|
||||
rm "tests/basic-build-test-$$.ok"
|
||||
146
vendor/mbedtls/tests/scripts/check-generated-files.sh
vendored
Executable file
146
vendor/mbedtls/tests/scripts/check-generated-files.sh
vendored
Executable file
@@ -0,0 +1,146 @@
|
||||
#! /usr/bin/env sh
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
# Purpose
|
||||
#
|
||||
# Check if generated files are up-to-date.
|
||||
|
||||
set -eu
|
||||
|
||||
if [ $# -ne 0 ] && [ "$1" = "--help" ]; then
|
||||
cat <<EOF
|
||||
$0 [-l | -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.
|
||||
-l List generated files, but do not update them.
|
||||
EOF
|
||||
exit
|
||||
fi
|
||||
|
||||
. framework/scripts/project_detection.sh
|
||||
|
||||
if in_mbedtls_repo; then
|
||||
library_dir='library'
|
||||
elif in_tf_psa_crypto_repo; then
|
||||
library_dir='core'
|
||||
else
|
||||
echo "Must be run from Mbed TLS root or TF-PSA-Crypto root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UPDATE=
|
||||
LIST=
|
||||
while getopts lu OPTLET; do
|
||||
case $OPTLET in
|
||||
l) LIST=1;;
|
||||
u) UPDATE=1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# check SCRIPT FILENAME[...]
|
||||
# check SCRIPT DIRECTORY
|
||||
# Run SCRIPT and check that it does not modify any of the specified files.
|
||||
# In the first form, there can be any number of FILENAMEs, which must be
|
||||
# regular files.
|
||||
# In the second form, there must be a single DIRECTORY, standing for the
|
||||
# list of files in the directory. Running SCRIPT must not modify any file
|
||||
# in the directory and must not add or remove files either.
|
||||
# If $UPDATE is empty, abort with an error status if a file is modified.
|
||||
check()
|
||||
{
|
||||
SCRIPT=$1
|
||||
shift
|
||||
|
||||
if [ -n "$LIST" ]; then
|
||||
printf '%s\n' "$@"
|
||||
return
|
||||
fi
|
||||
|
||||
directory=
|
||||
if [ -d "$1" ]; then
|
||||
directory="$1"
|
||||
rm -f "$directory"/*.bak
|
||||
set -- "$1"/*
|
||||
fi
|
||||
|
||||
for FILE in "$@"; do
|
||||
if [ -e "$FILE" ]; then
|
||||
cp -p "$FILE" "$FILE.bak"
|
||||
else
|
||||
rm -f "$FILE.bak"
|
||||
fi
|
||||
done
|
||||
|
||||
"$SCRIPT"
|
||||
|
||||
# Compare the script output to the old files and remove backups
|
||||
for FILE in "$@"; do
|
||||
if diff "$FILE" "$FILE.bak" >/dev/null 2>&1; then
|
||||
# Move the original file back so that $FILE's timestamp doesn't
|
||||
# change (avoids spurious rebuilds with make).
|
||||
mv "$FILE.bak" "$FILE"
|
||||
else
|
||||
echo "'$FILE' was either modified or deleted by '$SCRIPT'"
|
||||
if [ -z "$UPDATE" ]; then
|
||||
exit 1
|
||||
else
|
||||
rm -f "$FILE.bak"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$directory" ]; then
|
||||
old_list="$*"
|
||||
set -- "$directory"/*
|
||||
new_list="$*"
|
||||
# Check if there are any new files
|
||||
if [ "$old_list" != "$new_list" ]; then
|
||||
echo "Files were deleted or created by '$SCRIPT'"
|
||||
echo "Before: $old_list"
|
||||
echo "After: $new_list"
|
||||
if [ -z "$UPDATE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Note: if the format of calls to the "check" function changes, update
|
||||
# framework/scripts/code_style.py accordingly. For generated C source files (*.h or *.c),
|
||||
# the format must be "check SCRIPT FILENAME...". For other source files,
|
||||
# any shell syntax is permitted (including e.g. command substitution).
|
||||
|
||||
# Note: Instructions to generate those files are replicated in:
|
||||
# - **/Makefile (to (re)build them with make)
|
||||
# - **/CMakeLists.txt (to (re)build them with cmake)
|
||||
# - scripts/make_generated_files.bat (to generate them under Windows)
|
||||
|
||||
# These checks are common to Mbed TLS and TF-PSA-Crypto
|
||||
check scripts/generate_psa_constants.py programs/psa/psa_constant_names_generated.c
|
||||
check framework/scripts/generate_bignum_tests.py $(framework/scripts/generate_bignum_tests.py --list)
|
||||
check framework/scripts/generate_config_tests.py $(framework/scripts/generate_config_tests.py --list)
|
||||
check framework/scripts/generate_ecp_tests.py $(framework/scripts/generate_ecp_tests.py --list)
|
||||
check framework/scripts/generate_psa_tests.py $(framework/scripts/generate_psa_tests.py --list)
|
||||
check framework/scripts/generate_psa_wrappers.py tests/include/test/psa_test_wrappers.h tests/src/psa_test_wrappers.c
|
||||
check framework/scripts/generate_test_keys.py tests/include/test/test_keys.h
|
||||
check scripts/generate_driver_wrappers.py $library_dir/psa_crypto_driver_wrappers.h $library_dir/psa_crypto_driver_wrappers_no_static.c
|
||||
|
||||
# Additional checks for Mbed TLS only
|
||||
if in_mbedtls_repo; then
|
||||
check scripts/generate_errors.pl library/error.c
|
||||
check scripts/generate_query_config.pl programs/test/query_config.c
|
||||
check scripts/generate_features.pl library/version_features.c
|
||||
check framework/scripts/generate_ssl_debug_helpers.py library/ssl_debug_helpers_generated.c
|
||||
check scripts/generate_tls_handshake_tests.py tests/opt-testcases/handshake-generated.sh
|
||||
check framework/scripts/generate_tls13_compat_tests.py tests/opt-testcases/tls13-compat.sh
|
||||
check framework/scripts/generate_test_cert_macros.py tests/include/test/test_certs.h
|
||||
# generate_visualc_files enumerates source files (library/*.c). It doesn't
|
||||
# care about their content, but the files must exist. So it must run after
|
||||
# the step that creates or updates these files.
|
||||
check scripts/generate_visualc_files.pl visualc/VS2017
|
||||
fi
|
||||
164
vendor/mbedtls/tests/scripts/components-basic-checks.sh
vendored
Normal file
164
vendor/mbedtls/tests/scripts/components-basic-checks.sh
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
# components-basic-checks.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Basic checks
|
||||
################################################################
|
||||
|
||||
component_check_recursion () {
|
||||
msg "Check: recursion.pl" # < 1s
|
||||
./framework/scripts/recursion.pl library/*.c
|
||||
}
|
||||
|
||||
component_check_generated_files () {
|
||||
msg "Check: check-generated-files, files generated with make" # 2s
|
||||
make generated_files
|
||||
tests/scripts/check-generated-files.sh
|
||||
|
||||
msg "Check: check-generated-files -u, files present" # 2s
|
||||
tests/scripts/check-generated-files.sh -u
|
||||
# Check that the generated files are considered up to date.
|
||||
tests/scripts/check-generated-files.sh
|
||||
|
||||
msg "Check: check-generated-files -u, files absent" # 2s
|
||||
command make neat
|
||||
tests/scripts/check-generated-files.sh -u
|
||||
# Check that the generated files are considered up to date.
|
||||
tests/scripts/check-generated-files.sh
|
||||
|
||||
# This component ends with the generated files present in the source tree.
|
||||
# This is necessary for subsequent components!
|
||||
}
|
||||
|
||||
component_check_doxy_blocks () {
|
||||
msg "Check: doxygen markup outside doxygen blocks" # < 1s
|
||||
./framework/scripts/check-doxy-blocks.pl
|
||||
}
|
||||
|
||||
component_check_files () {
|
||||
msg "Check: file sanity checks (permissions, encodings)" # < 1s
|
||||
framework/scripts/check_files.py
|
||||
}
|
||||
|
||||
component_check_changelog () {
|
||||
msg "Check: changelog entries" # < 1s
|
||||
rm -f ChangeLog.new
|
||||
./framework/scripts/assemble_changelog.py -o ChangeLog.new
|
||||
if [ -e ChangeLog.new ]; then
|
||||
# Show the diff for information. It isn't an error if the diff is
|
||||
# non-empty.
|
||||
diff -u ChangeLog ChangeLog.new || true
|
||||
rm ChangeLog.new
|
||||
fi
|
||||
}
|
||||
|
||||
component_check_names () {
|
||||
msg "Check: declared and exported names (builds the library)" # < 3s
|
||||
framework/scripts/check_names.py -v
|
||||
}
|
||||
|
||||
component_check_test_cases () {
|
||||
msg "Check: test case descriptions" # < 1s
|
||||
if [ $QUIET -eq 1 ]; then
|
||||
opt='--quiet'
|
||||
else
|
||||
opt=''
|
||||
fi
|
||||
framework/scripts/check_test_cases.py -q $opt
|
||||
unset opt
|
||||
}
|
||||
|
||||
component_check_test_dependencies () {
|
||||
msg "Check: test case dependencies: legacy vs PSA" # < 1s
|
||||
# The purpose of this component is to catch unjustified dependencies on
|
||||
# legacy feature macros (MBEDTLS_xxx) in PSA tests. Generally speaking,
|
||||
# PSA test should use PSA feature macros (PSA_WANT_xxx, more rarely
|
||||
# MBEDTLS_PSA_xxx).
|
||||
#
|
||||
# Most of the time, use of legacy MBEDTLS_xxx macros are mistakes, which
|
||||
# this component is meant to catch. However a few of them are justified,
|
||||
# mostly by the absence of a PSA equivalent, so this component includes a
|
||||
# list of expected exceptions.
|
||||
|
||||
found="check-test-deps-found-$$"
|
||||
expected="check-test-deps-expected-$$"
|
||||
|
||||
# Find legacy dependencies in PSA tests
|
||||
grep 'depends_on' \
|
||||
tests/suites/test_suite_psa*.data tests/suites/test_suite_psa*.function |
|
||||
grep -Eo '!?MBEDTLS_[^: ]*' |
|
||||
grep -v -e MBEDTLS_ENTROPY_HAVE_ -e MBEDTLS_PLATFORM -e MBEDTLS_PSA_ -e MBEDTLS_TEST_ |
|
||||
sort -u > $found
|
||||
|
||||
# Expected ones with justification - keep in sorted order by ASCII table!
|
||||
rm -f $expected
|
||||
# No PSA equivalent - WANT_KEY_TYPE_AES means all sizes
|
||||
echo "!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH" >> $expected
|
||||
# No PSA equivalent - used to skip decryption tests in PSA-ECB, CBC/XTS/NIST_KW/DES
|
||||
echo "!MBEDTLS_BLOCK_CIPHER_NO_DECRYPT" >> $expected
|
||||
# MBEDTLS_ASN1_WRITE_C is used by import_rsa_made_up() in test_suite_psa_crypto
|
||||
# in order to build a fake RSA key of the wanted size based on
|
||||
# PSA_VENDOR_RSA_MAX_KEY_BITS. The legacy module is only used by
|
||||
# the test code and that's probably the most convenient way of achieving
|
||||
# the test's goal.
|
||||
echo "MBEDTLS_ASN1_WRITE_C" >> $expected
|
||||
# No PSA equivalent - used in test_suite_psa_crypto to get some "known" size
|
||||
# for raw key generation.
|
||||
echo "MBEDTLS_CTR_DRBG_MAX_REQUEST" >> $expected
|
||||
# No PSA equivalent - we should probably have one in the future.
|
||||
echo "MBEDTLS_ECP_RESTARTABLE" >> $expected
|
||||
# No PSA equivalent - needed by some init tests
|
||||
echo "MBEDTLS_ENTROPY_NV_SEED" >> $expected
|
||||
# No PSA equivalent - required to run threaded tests.
|
||||
echo "MBEDTLS_THREADING_PTHREAD" >> $expected
|
||||
|
||||
# Compare reality with expectation.
|
||||
# We want an exact match, to ensure the above list remains up-to-date.
|
||||
#
|
||||
# The output should be empty. When it's not:
|
||||
# - Each '+' line is a macro that was found but not expected. You want to
|
||||
# find where that macro occurs, and either replace it with PSA macros, or
|
||||
# add it to the exceptions list above with a justification.
|
||||
# - Each '-' line is a macro that was expected but not found; it means the
|
||||
# exceptions list above should be updated by removing that macro.
|
||||
diff -U0 $expected $found
|
||||
|
||||
rm $found $expected
|
||||
}
|
||||
|
||||
component_check_doxygen_warnings () {
|
||||
msg "Check: doxygen warnings (builds the documentation)" # ~ 3s
|
||||
./framework/scripts/doxygen.sh
|
||||
}
|
||||
|
||||
component_check_code_style () {
|
||||
msg "Check C code style"
|
||||
./framework/scripts/code_style.py
|
||||
}
|
||||
|
||||
support_check_code_style () {
|
||||
case $(uncrustify --version) in
|
||||
*0.75.1*) true;;
|
||||
*) false;;
|
||||
esac
|
||||
}
|
||||
|
||||
component_check_python_files () {
|
||||
msg "Lint: Python scripts"
|
||||
./framework/scripts/check-python-files.sh
|
||||
}
|
||||
|
||||
component_check_test_helpers () {
|
||||
msg "unit test: generate_test_code.py"
|
||||
# unittest writes out mundane stuff like number or tests run on stderr.
|
||||
# Our convention is to reserve stderr for actual errors, and write
|
||||
# harmless info on stdout so it can be suppress with --quiet.
|
||||
./framework/scripts/test_generate_test_code.py 2>&1
|
||||
|
||||
msg "unit test: translate_ciphers.py"
|
||||
python3 -m unittest framework/scripts/translate_ciphers.py 2>&1
|
||||
}
|
||||
332
vendor/mbedtls/tests/scripts/components-build-system.sh
vendored
Normal file
332
vendor/mbedtls/tests/scripts/components-build-system.sh
vendored
Normal file
@@ -0,0 +1,332 @@
|
||||
# components-build-system.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Build System Testing
|
||||
################################################################
|
||||
|
||||
component_test_make_shared () {
|
||||
msg "build/test: make shared" # ~ 40s
|
||||
make SHARED=1 TEST_CPP=1 all check
|
||||
ldd programs/util/strerror | grep libmbedcrypto
|
||||
$FRAMEWORK/tests/programs/dlopen_demo.sh
|
||||
}
|
||||
|
||||
component_test_cmake_shared () {
|
||||
msg "build/test: cmake shared" # ~ 2min
|
||||
cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On .
|
||||
make
|
||||
ldd programs/util/strerror | grep libmbedcrypto
|
||||
make test
|
||||
$FRAMEWORK/tests/programs/dlopen_demo.sh
|
||||
}
|
||||
|
||||
component_build_make_no_gen_files () {
|
||||
msg "prepare for building in a minimal environment"
|
||||
|
||||
# Ensure that the generated files are present (should be a no-op
|
||||
# since the all.sh infrastructure already does it).
|
||||
make generated_files
|
||||
|
||||
# Arrange for the non-generated sources to be more recent than any
|
||||
# generated file. This allows us to detect if the makefile tries
|
||||
# to rebuild the generated files from their dependencies when it
|
||||
# shouldn't.
|
||||
# Wait 1 second so this test is effective even if the filesystem
|
||||
# only has a granularity of 1 second for timestamps.
|
||||
sleep 1
|
||||
git ls-files -z | xargs -0 touch --
|
||||
|
||||
# The setup code of all.sh sets up a "quiet" wrapper for `make`.
|
||||
# We want to bypass it and just use the normal make program,
|
||||
# so that this test mimics a normal user's platform.
|
||||
# And anyway we need to bypass it because it wouldn't work without bash
|
||||
# and other tools in the $PATH.
|
||||
# The wrapper is used because the setup code adds the
|
||||
# `.../framework/scripts/quiet` directlry to the beginning of the $PATH.
|
||||
# So here we remove that.
|
||||
shopt -s extglob
|
||||
# Strip off all entries in $PATH that ends with `/quiet`. (This misses
|
||||
# the very last element, but we know we'll never need to remove the last
|
||||
# element, since we just want to remove the wrapper directory that comes
|
||||
# before the normal programs.)
|
||||
PATH=${PATH//*([!:])\/quiet:/}
|
||||
|
||||
# Locate the minimum programs needed for the build: ${CC} and ${AR}.
|
||||
AR="$(command -v ar)"
|
||||
# GCC needs "as" in $PATH by default. To use GCC, we need to tell it where
|
||||
# to find the assembler. Or we can use clang which just works.
|
||||
CC="$(command -v clang)"
|
||||
# For cleaning.
|
||||
RM="$(command -v rm)"
|
||||
|
||||
# Test the build with make.
|
||||
# Preferably we should also test with CMake. Note that a CMake test
|
||||
# would be harder to set up, because CMake will find e.g. /usr/bin/python
|
||||
# even if it isn't on $PATH.
|
||||
msg "build: make lib with GEN_FILES off in minimal environment"
|
||||
env PATH=/no/such/directory "$(command -v make)" GEN_FILES= AR="$AR" CC="$CC" lib
|
||||
|
||||
msg "build: make -C library clean with GEN_FILES off in minimal environment"
|
||||
env PATH=/no/such/directory "$(command -v make)" GEN_FILES= RM="$RM" -C library clean
|
||||
|
||||
msg "build: make lib with GEN_FILES off with generated files missing"
|
||||
make neat
|
||||
# Check that a sample generated file is absent
|
||||
not test -f library/error.c
|
||||
PERL="$(command -v perl)"
|
||||
PYTHON="$(command -v python3)"
|
||||
# We take whatever Python environment we're in. For a future improvement,
|
||||
# make a venv with just scripts/basic.requirements.txt.
|
||||
env PATH=/no/such/directory "$(command -v make)" GEN_FILES= AR="$AR" CC="$CC" PERL="$PERL" PYTHON="$PYTHON" lib
|
||||
}
|
||||
|
||||
support_test_cmake_out_of_source () {
|
||||
distrib_id=""
|
||||
distrib_ver=""
|
||||
distrib_ver_minor=""
|
||||
distrib_ver_major=""
|
||||
|
||||
# Attempt to parse lsb-release to find out distribution and version. If not
|
||||
# found this should fail safe (test is supported).
|
||||
if [[ -f /etc/lsb-release ]]; then
|
||||
|
||||
while read -r lsb_line; do
|
||||
case "$lsb_line" in
|
||||
"DISTRIB_ID"*) distrib_id=${lsb_line/#DISTRIB_ID=};;
|
||||
"DISTRIB_RELEASE"*) distrib_ver=${lsb_line/#DISTRIB_RELEASE=};;
|
||||
esac
|
||||
done < /etc/lsb-release
|
||||
|
||||
distrib_ver_major="${distrib_ver%%.*}"
|
||||
distrib_ver="${distrib_ver#*.}"
|
||||
distrib_ver_minor="${distrib_ver%%.*}"
|
||||
fi
|
||||
|
||||
# Running the out of source CMake test on Ubuntu 16.04 using more than one
|
||||
# processor (as the CI does) can create a race condition whereby the build
|
||||
# fails to see a generated file, despite that file actually having been
|
||||
# generated. This problem appears to go away with 18.04 or newer, so make
|
||||
# the out of source tests unsupported on Ubuntu 16.04.
|
||||
[ "$distrib_id" != "Ubuntu" ] || [ "$distrib_ver_major" -gt 16 ]
|
||||
}
|
||||
|
||||
component_test_cmake_out_of_source () {
|
||||
# Remove existing generated files so that we use the ones cmake
|
||||
# generates
|
||||
make neat
|
||||
|
||||
msg "build: cmake 'out-of-source' build"
|
||||
MBEDTLS_ROOT_DIR="$PWD"
|
||||
mkdir "$OUT_OF_SOURCE_DIR"
|
||||
cd "$OUT_OF_SOURCE_DIR"
|
||||
# Note: Explicitly generate files as these are turned off in releases
|
||||
cmake -D CMAKE_BUILD_TYPE:String=Check -D GEN_FILES=ON -D TEST_CPP=1 "$MBEDTLS_ROOT_DIR"
|
||||
make
|
||||
|
||||
msg "test: cmake 'out-of-source' build"
|
||||
make test
|
||||
# Check that ssl-opt.sh can find the test programs.
|
||||
# Also ensure that there are no error messages such as
|
||||
# "No such file or directory", which would indicate that some required
|
||||
# file is missing (ssl-opt.sh tolerates the absence of some files so
|
||||
# may exit with status 0 but emit errors).
|
||||
./tests/ssl-opt.sh -f 'Default' >ssl-opt.out 2>ssl-opt.err
|
||||
grep PASS ssl-opt.out
|
||||
cat ssl-opt.err >&2
|
||||
# If ssl-opt.err is non-empty, record an error and keep going.
|
||||
[ ! -s ssl-opt.err ]
|
||||
rm ssl-opt.out ssl-opt.err
|
||||
cd "$MBEDTLS_ROOT_DIR"
|
||||
rm -rf "$OUT_OF_SOURCE_DIR"
|
||||
}
|
||||
|
||||
component_test_cmake_as_subdirectory () {
|
||||
# Remove existing generated files so that we use the ones CMake
|
||||
# generates
|
||||
make neat
|
||||
|
||||
msg "build: cmake 'as-subdirectory' build"
|
||||
cd programs/test/cmake_subproject
|
||||
# Note: Explicitly generate files as these are turned off in releases
|
||||
cmake -D GEN_FILES=ON .
|
||||
make
|
||||
./cmake_subproject
|
||||
}
|
||||
|
||||
support_test_cmake_as_subdirectory () {
|
||||
support_test_cmake_out_of_source
|
||||
}
|
||||
|
||||
component_test_cmake_as_package () {
|
||||
# Remove existing generated files so that we use the ones CMake
|
||||
# generates
|
||||
make neat
|
||||
|
||||
msg "build: cmake 'as-package' build"
|
||||
root_dir="$(pwd)"
|
||||
cd programs/test/cmake_package
|
||||
build_variant_dir="$(pwd)"
|
||||
cmake .
|
||||
make
|
||||
./cmake_package
|
||||
if [[ "$OSTYPE" == linux* ]]; then
|
||||
PKG_CONFIG_PATH="${build_variant_dir}/mbedtls/pkgconfig" \
|
||||
${root_dir}/framework/scripts/pkgconfig.sh \
|
||||
mbedtls mbedx509 mbedcrypto
|
||||
# These are the EXPECTED package names. Renaming these could break
|
||||
# consumers of pkg-config, consider carefully.
|
||||
fi
|
||||
}
|
||||
|
||||
support_test_cmake_as_package () {
|
||||
support_test_cmake_out_of_source
|
||||
}
|
||||
|
||||
component_test_cmake_as_package_install () {
|
||||
# Remove existing generated files so that we use the ones CMake
|
||||
# generates
|
||||
make neat
|
||||
|
||||
msg "build: cmake 'as-installed-package' build"
|
||||
cd programs/test/cmake_package_install
|
||||
cmake .
|
||||
make
|
||||
./cmake_package_install
|
||||
}
|
||||
|
||||
support_test_cmake_as_package_install () {
|
||||
support_test_cmake_out_of_source
|
||||
}
|
||||
|
||||
component_test_cmake_install_with_destdir () {
|
||||
# Remove existing generated files so that we use the ones CMake
|
||||
# generates
|
||||
$MAKE_COMMAND neat
|
||||
|
||||
msg "install: cmake with DESTDIR staging"
|
||||
MBEDTLS_ROOT_DIR="$PWD"
|
||||
mkdir "$OUT_OF_SOURCE_DIR"
|
||||
cd "$OUT_OF_SOURCE_DIR"
|
||||
cmake -DGEN_FILES=ON -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr "$MBEDTLS_ROOT_DIR"
|
||||
make
|
||||
|
||||
DESTDIR="$OUT_OF_SOURCE_DIR/stage" make install
|
||||
|
||||
install_lib_subdir="$(sed -n 's/^CMAKE_INSTALL_LIBDIR:PATH=//p' CMakeCache.txt)"
|
||||
[ -n "$install_lib_subdir" ] # Failed to read CMAKE_INSTALL_LIBDIR from CMakeCache.txt
|
||||
|
||||
install_lib_path="$OUT_OF_SOURCE_DIR/stage/usr/${install_lib_subdir}"
|
||||
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
# On macOS the custom install logic installs libmbedcrypto.dylib
|
||||
# directly without a versioned symlink chain.
|
||||
for lib in mbedcrypto mbedx509 mbedtls; do
|
||||
[ -f "$install_lib_path/lib${lib}.a" ]
|
||||
[ -e "$install_lib_path/lib${lib}.dylib" ]
|
||||
done
|
||||
else
|
||||
# library/CMakeLists.txt installs libmbedcrypto.so with a versioned
|
||||
# symlink chain on Linux.
|
||||
for lib in mbedcrypto mbedx509 mbedtls; do
|
||||
if [ "$QUIET" -eq 0 ]; then
|
||||
echo "Checking lib=$lib"
|
||||
fi
|
||||
[ -f "$install_lib_path/lib${lib}.a" ]
|
||||
[ -L "$install_lib_path/lib${lib}.so" ]
|
||||
[ -e "$install_lib_path/lib${lib}.so" ]
|
||||
|
||||
# Match ABI-version names such as libxxx.so.17
|
||||
# and check that symlink.
|
||||
versioned=( "$install_lib_path/lib${lib}.so".+([0-9]) )
|
||||
if [ "$QUIET" -eq 0 ]; then
|
||||
declare -p versioned
|
||||
fi
|
||||
[ "${#versioned[@]}" -eq 1 ]
|
||||
[ -L "${versioned[0]}" ]
|
||||
[ -e "${versioned[0]}" ]
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
support_test_cmake_install_with_destdir () {
|
||||
support_test_cmake_out_of_source
|
||||
}
|
||||
|
||||
component_build_cmake_custom_config_file () {
|
||||
# Make a copy of config file to use for the in-tree test
|
||||
cp "$CONFIG_H" include/mbedtls_config_in_tree_copy.h
|
||||
|
||||
MBEDTLS_ROOT_DIR="$PWD"
|
||||
mkdir "$OUT_OF_SOURCE_DIR"
|
||||
cd "$OUT_OF_SOURCE_DIR"
|
||||
|
||||
# Build once to get the generated files (which need an intact config file)
|
||||
cmake "$MBEDTLS_ROOT_DIR"
|
||||
make
|
||||
|
||||
msg "build: cmake with -DMBEDTLS_CONFIG_FILE"
|
||||
scripts/config.py -w full_config.h full
|
||||
echo '#error "cmake -DMBEDTLS_CONFIG_FILE is not working."' > "$MBEDTLS_ROOT_DIR/$CONFIG_H"
|
||||
cmake -DGEN_FILES=OFF -DMBEDTLS_CONFIG_FILE=full_config.h "$MBEDTLS_ROOT_DIR"
|
||||
make
|
||||
|
||||
msg "build: cmake with -DMBEDTLS_CONFIG_FILE + -DMBEDTLS_USER_CONFIG_FILE"
|
||||
# In the user config, disable one feature (for simplicity, pick a feature
|
||||
# that nothing else depends on).
|
||||
echo '#undef MBEDTLS_NIST_KW_C' >user_config.h
|
||||
|
||||
cmake -DGEN_FILES=OFF -DMBEDTLS_CONFIG_FILE=full_config.h -DMBEDTLS_USER_CONFIG_FILE=user_config.h "$MBEDTLS_ROOT_DIR"
|
||||
make
|
||||
not programs/test/query_compile_time_config MBEDTLS_NIST_KW_C
|
||||
|
||||
rm -f user_config.h full_config.h
|
||||
|
||||
cd "$MBEDTLS_ROOT_DIR"
|
||||
rm -rf "$OUT_OF_SOURCE_DIR"
|
||||
|
||||
# Now repeat the test for an in-tree build:
|
||||
|
||||
# Restore config for the in-tree test
|
||||
mv include/mbedtls_config_in_tree_copy.h "$CONFIG_H"
|
||||
|
||||
# Build once to get the generated files (which need an intact config)
|
||||
cmake .
|
||||
make
|
||||
|
||||
msg "build: cmake (in-tree) with -DMBEDTLS_CONFIG_FILE"
|
||||
scripts/config.py -w full_config.h full
|
||||
echo '#error "cmake -DMBEDTLS_CONFIG_FILE is not working."' > "$MBEDTLS_ROOT_DIR/$CONFIG_H"
|
||||
cmake -DGEN_FILES=OFF -DMBEDTLS_CONFIG_FILE=full_config.h .
|
||||
make
|
||||
|
||||
msg "build: cmake (in-tree) with -DMBEDTLS_CONFIG_FILE + -DMBEDTLS_USER_CONFIG_FILE"
|
||||
# In the user config, disable one feature (for simplicity, pick a feature
|
||||
# that nothing else depends on).
|
||||
echo '#undef MBEDTLS_NIST_KW_C' >user_config.h
|
||||
|
||||
cmake -DGEN_FILES=OFF -DMBEDTLS_CONFIG_FILE=full_config.h -DMBEDTLS_USER_CONFIG_FILE=user_config.h .
|
||||
make
|
||||
not programs/test/query_compile_time_config MBEDTLS_NIST_KW_C
|
||||
|
||||
rm -f user_config.h full_config.h
|
||||
}
|
||||
|
||||
support_build_cmake_custom_config_file () {
|
||||
support_test_cmake_out_of_source
|
||||
}
|
||||
|
||||
component_build_cmake_programs_no_testing () {
|
||||
# Verify that the type of builds performed by oss-fuzz don't get accidentally broken
|
||||
msg "build: cmake with -DENABLE_PROGRAMS=ON and -DENABLE_TESTING=OFF"
|
||||
cmake -DENABLE_PROGRAMS=ON -DENABLE_TESTING=OFF .
|
||||
make
|
||||
}
|
||||
|
||||
support_build_cmake_programs_no_testing () {
|
||||
support_test_cmake_out_of_source
|
||||
}
|
||||
216
vendor/mbedtls/tests/scripts/components-compiler.sh
vendored
Normal file
216
vendor/mbedtls/tests/scripts/components-compiler.sh
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
# components-compiler.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Compiler Testing
|
||||
################################################################
|
||||
|
||||
support_build_tfm_armcc () {
|
||||
support_build_armcc
|
||||
}
|
||||
|
||||
component_build_tfm_armcc () {
|
||||
# test the TF-M configuration can build cleanly with various warning flags enabled
|
||||
cp configs/config-tfm.h "$CONFIG_H"
|
||||
|
||||
msg "build: TF-M config, armclang armv7-m thumb2"
|
||||
helper_armc6_build_test "--target=arm-arm-none-eabi -march=armv7-m -mthumb -Os -std=c99 -Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wasm-operand-widths -Wunused -I../framework/tests/include/spe"
|
||||
}
|
||||
|
||||
test_build_opt () {
|
||||
info=$1 cc=$2; shift 2
|
||||
$cc --version
|
||||
for opt in "$@"; do
|
||||
msg "build/test: $cc $opt, $info" # ~ 30s
|
||||
make CC="$cc" CFLAGS="$opt -std=c99 -pedantic -Wall -Wextra -Werror"
|
||||
# We're confident enough in compilers to not run _all_ the tests,
|
||||
# but at least run the unit tests. In particular, runs with
|
||||
# optimizations use inline assembly whereas runs with -O0
|
||||
# skip inline assembly.
|
||||
make test # ~30s
|
||||
make clean
|
||||
done
|
||||
}
|
||||
|
||||
# For FreeBSD we invoke the function by name so this condition is added
|
||||
# to disable the existing test_clang_opt function for linux.
|
||||
if [[ $(uname) != "Linux" ]]; then
|
||||
component_test_clang_opt () {
|
||||
scripts/config.py full
|
||||
test_build_opt 'full config' clang -O0 -Os -O2
|
||||
}
|
||||
fi
|
||||
|
||||
component_test_clang_latest_opt () {
|
||||
scripts/config.py full
|
||||
test_build_opt 'full config' "$CLANG_LATEST" -O0 -Os -O2
|
||||
}
|
||||
|
||||
support_test_clang_latest_opt () {
|
||||
type "$CLANG_LATEST" >/dev/null 2>/dev/null
|
||||
}
|
||||
|
||||
component_test_clang_earliest_opt () {
|
||||
scripts/config.py full
|
||||
test_build_opt 'full config' "$CLANG_EARLIEST" -O2
|
||||
}
|
||||
|
||||
support_test_clang_earliest_opt () {
|
||||
type "$CLANG_EARLIEST" >/dev/null 2>/dev/null
|
||||
}
|
||||
|
||||
component_test_gcc_latest_opt () {
|
||||
scripts/config.py full
|
||||
test_build_opt 'full config' "$GCC_LATEST" -O0 -Os -O2
|
||||
}
|
||||
|
||||
support_test_gcc_latest_opt () {
|
||||
type "$GCC_LATEST" >/dev/null 2>/dev/null
|
||||
}
|
||||
|
||||
# Prepare for a non-regression for https://github.com/Mbed-TLS/mbedtls/issues/9814 :
|
||||
# test with GCC 15.
|
||||
# Eventually, $GCC_LATEST will be GCC 15 or above, and we can remove this
|
||||
# separate component.
|
||||
# For the time being, we don't make $GCC_LATEST be GCC 15 on the CI
|
||||
# platform, because that would break branches where #9814 isn't fixed yet.
|
||||
support_test_gcc15_drivers_opt () {
|
||||
if type gcc-15 >/dev/null 2>/dev/null; then
|
||||
GCC_15=gcc-15
|
||||
elif [ -x /usr/local/gcc-15/bin/gcc-15 ]; then
|
||||
GCC_15=/usr/local/gcc-15/bin/gcc-15
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
component_test_gcc15_drivers_opt () {
|
||||
msg "build: GCC 15: full + test drivers dispatching to builtins"
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
loc_cflags="$ASAN_CFLAGS -DPSA_CRYPTO_DRIVER_TEST_ALL"
|
||||
loc_cflags="${loc_cflags} '-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'"
|
||||
loc_cflags="${loc_cflags} -I../framework/tests/include -O2"
|
||||
|
||||
make CC=$GCC_15 CFLAGS="${loc_cflags}" LDFLAGS="$ASAN_CFLAGS"
|
||||
|
||||
msg "test: GCC 15: full + test drivers dispatching to builtins"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_gcc_earliest_opt () {
|
||||
scripts/config.py full
|
||||
test_build_opt 'full config' "$GCC_EARLIEST" -O2
|
||||
}
|
||||
|
||||
support_test_gcc_earliest_opt () {
|
||||
type "$GCC_EARLIEST" >/dev/null 2>/dev/null
|
||||
}
|
||||
|
||||
component_build_mingw () {
|
||||
msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s
|
||||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-Werror -Wall -Wextra -maes -msse2 -mpclmul' WINDOWS_BUILD=1 lib programs
|
||||
|
||||
# note Make tests only builds the tests, but doesn't run them
|
||||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-Werror -maes -msse2 -mpclmul' WINDOWS_BUILD=1 tests
|
||||
make WINDOWS_BUILD=1 clean
|
||||
|
||||
msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s
|
||||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-Werror -Wall -Wextra -maes -msse2 -mpclmul' WINDOWS_BUILD=1 SHARED=1 lib programs
|
||||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-Werror -Wall -Wextra -maes -msse2 -mpclmul' WINDOWS_BUILD=1 SHARED=1 tests
|
||||
make WINDOWS_BUILD=1 clean
|
||||
|
||||
msg "build: Windows cross build - mingw64, make (Library only, default config without MBEDTLS_AESNI_C)" # ~ 30s
|
||||
./scripts/config.py unset MBEDTLS_AESNI_C #
|
||||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 lib
|
||||
make WINDOWS_BUILD=1 clean
|
||||
}
|
||||
|
||||
support_build_mingw () {
|
||||
case $(i686-w64-mingw32-gcc -dumpversion 2>/dev/null) in
|
||||
[0-5]*|"") false;;
|
||||
*) true;;
|
||||
esac
|
||||
}
|
||||
|
||||
component_build_zeroize_checks () {
|
||||
msg "build: check for obviously wrong calls to mbedtls_platform_zeroize()"
|
||||
|
||||
scripts/config.py full
|
||||
|
||||
# Only compile - we're looking for sizeof-pointer-memaccess warnings
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-zeroize-memset.h\"' -DMBEDTLS_TEST_DEFINES_ZEROIZE -Werror -Wsizeof-pointer-memaccess"
|
||||
}
|
||||
|
||||
component_test_zeroize () {
|
||||
# Test that the function mbedtls_platform_zeroize() is not optimized away by
|
||||
# different combinations of compilers and optimization flags by using an
|
||||
# auxiliary GDB script. Unfortunately, GDB does not return error values to the
|
||||
# system in all cases that the script fails, so we must manually search the
|
||||
# output to check whether the pass string is present and no failure strings
|
||||
# were printed.
|
||||
|
||||
# Don't try to disable ASLR. We don't care about ASLR here. We do care
|
||||
# about a spurious message if Gdb tries and fails, so suppress that.
|
||||
gdb_disable_aslr=
|
||||
if [ -z "$(gdb -batch -nw -ex 'set disable-randomization off' 2>&1)" ]; then
|
||||
gdb_disable_aslr='set disable-randomization off'
|
||||
fi
|
||||
|
||||
for optimization_flag in -O2 -O3 -Ofast -Os; do
|
||||
for compiler in clang gcc; do
|
||||
msg "test: $compiler $optimization_flag, mbedtls_platform_zeroize()"
|
||||
make programs CC="$compiler" DEBUG=1 CFLAGS="$optimization_flag"
|
||||
gdb -ex "$gdb_disable_aslr" -x $FRAMEWORK/tests/programs/test_zeroize.gdb -nw -batch -nx 2>&1 | tee test_zeroize.log
|
||||
grep "The buffer was correctly zeroized" test_zeroize.log
|
||||
not grep -i "error" test_zeroize.log
|
||||
rm -f test_zeroize.log
|
||||
make clean
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# This originated from an issue (https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/665) found
|
||||
# in GCM when the library is built with GCC "10.0 <= version <= 14.2" on platforms other than
|
||||
# x86 and ARM64.
|
||||
component_test_tf_psa_crypto_optimized_alignment() {
|
||||
msg "build: verify alignment with O3 optimizations in GCC"
|
||||
|
||||
# Disable optimizations for x86 (and ARM64) so that alignment related problems in
|
||||
# "alignment.h" can be tested also on standard PC.
|
||||
scripts/config.py unset MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_AESCE_C
|
||||
|
||||
# "-O3" is the optimization level that causes issues: the compiler tries to
|
||||
# optimize operations order and if memory dependencies are not respected
|
||||
# (as it happens in issue tf-psa-crypto#665) this completely messes up results.
|
||||
EXTRA_C_FLAGS="-O3"
|
||||
# Forcedly ignore "MBEDTLS_EFFICIENT_UNALIGNED_ACCESS" on x86 so that we
|
||||
# can test the problematic case, i.e. the case where uint64 integers are
|
||||
# accessed through "mbedtls_uint64_unaligned_t" structs.
|
||||
EXTRA_C_FLAGS="$EXTRA_C_FLAGS -DMBEDTLS_ALIGNMENT_DISABLE_EFFICENT_UNALIGNED_ACCESS"
|
||||
# Adding '-g3' flag doesn't affect testing, BUT it allows to dump the generated
|
||||
# assembly code for "gcm.o" module for inspection. To do this use the
|
||||
# following command:
|
||||
# > objdump -S --disassemble out_of_source_build/drivers/builtin/CMakeFiles/builtin.dir/src/gcm.c.o > gcm.s
|
||||
# A file named "gcm.s" will be generated containing a mix of C and corresponding
|
||||
# assembly code.
|
||||
EXTRA_C_FLAGS="$EXTRA_C_FLAGS -g3"
|
||||
|
||||
make CC=gcc CFLAGS="$EXTRA_C_FLAGS"
|
||||
|
||||
msg "test: verify alignment with O3 optimizations in GCC"
|
||||
make test
|
||||
}
|
||||
|
||||
support_test_tf_psa_crypto_optimized_alignment() {
|
||||
case $(gcc -dumpfullversion 2>/dev/null) in
|
||||
""|?.*) false;; # too old
|
||||
10.*|11.*|12.*|13.*) true;;
|
||||
14.[012].*) true;;
|
||||
*) false;; # too recent
|
||||
esac
|
||||
}
|
||||
31
vendor/mbedtls/tests/scripts/components-compliance.sh
vendored
Normal file
31
vendor/mbedtls/tests/scripts/components-compliance.sh
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# components-compliance.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Compliance Testing
|
||||
################################################################
|
||||
|
||||
component_test_psa_compliance () {
|
||||
# The arch tests build with gcc, so require use of gcc here to link properly
|
||||
msg "build: make, default config (out-of-box), libmbedcrypto.a only"
|
||||
CC=gcc make -C library libmbedcrypto.a
|
||||
|
||||
msg "unit test: test_psa_compliance.py"
|
||||
CC=gcc $FRAMEWORK/scripts/test_psa_compliance.py
|
||||
}
|
||||
|
||||
support_test_psa_compliance () {
|
||||
# psa-compliance-tests only supports CMake >= 3.10.0
|
||||
ver="$(cmake --version)"
|
||||
ver="${ver#cmake version }"
|
||||
ver_major="${ver%%.*}"
|
||||
|
||||
ver="${ver#*.}"
|
||||
ver_minor="${ver%%.*}"
|
||||
|
||||
[ "$ver_major" -eq 3 ] && [ "$ver_minor" -ge 10 ]
|
||||
}
|
||||
3369
vendor/mbedtls/tests/scripts/components-configuration-crypto.sh
vendored
Normal file
3369
vendor/mbedtls/tests/scripts/components-configuration-crypto.sh
vendored
Normal file
File diff suppressed because it is too large
Load Diff
111
vendor/mbedtls/tests/scripts/components-configuration-platform.sh
vendored
Normal file
111
vendor/mbedtls/tests/scripts/components-configuration-platform.sh
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
# components-configuration-platform.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Configuration Testing - Platform
|
||||
################################################################
|
||||
|
||||
component_build_no_std_function () {
|
||||
# catch compile bugs in _uninit functions
|
||||
msg "build: full config with NO_STD_FUNCTION, make, gcc" # ~ 30s
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
|
||||
scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED
|
||||
scripts/config.py unset MBEDTLS_PLATFORM_NV_SEED_ALT
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Check .
|
||||
make
|
||||
}
|
||||
|
||||
component_build_no_sockets () {
|
||||
# Note, C99 compliance can also be tested with the sockets support disabled,
|
||||
# as that requires a POSIX platform (which isn't the same as C99).
|
||||
msg "build: full config except net_sockets.c, make, gcc -std=c99 -pedantic" # ~ 30s
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_NET_C # getaddrinfo() undeclared, etc.
|
||||
scripts/config.py set MBEDTLS_NO_PLATFORM_ENTROPY # uses syscall() on GNU/Linux
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -std=c99 -pedantic' lib
|
||||
}
|
||||
|
||||
component_test_no_date_time () {
|
||||
msg "build: default config without MBEDTLS_HAVE_TIME_DATE"
|
||||
scripts/config.py unset MBEDTLS_HAVE_TIME_DATE
|
||||
cmake -D CMAKE_BUILD_TYPE:String=Check .
|
||||
make
|
||||
|
||||
msg "test: !MBEDTLS_HAVE_TIME_DATE - main suites"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_platform_calloc_macro () {
|
||||
msg "build: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
|
||||
scripts/config.py set MBEDTLS_PLATFORM_MEMORY
|
||||
scripts/config.py set MBEDTLS_PLATFORM_CALLOC_MACRO calloc
|
||||
scripts/config.py set MBEDTLS_PLATFORM_FREE_MACRO free
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: MBEDTLS_PLATFORM_{CALLOC/FREE}_MACRO enabled (ASan build)"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_have_int32 () {
|
||||
msg "build: gcc, force 32-bit bignum limbs"
|
||||
scripts/config.py unset MBEDTLS_HAVE_ASM
|
||||
scripts/config.py unset MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
||||
scripts/config.py unset MBEDTLS_AESCE_C
|
||||
make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32'
|
||||
|
||||
msg "test: gcc, force 32-bit bignum limbs"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_have_int64 () {
|
||||
msg "build: gcc, force 64-bit bignum limbs"
|
||||
scripts/config.py unset MBEDTLS_HAVE_ASM
|
||||
scripts/config.py unset MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
||||
scripts/config.py unset MBEDTLS_AESCE_C
|
||||
make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT64'
|
||||
|
||||
msg "test: gcc, force 64-bit bignum limbs"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_have_int32_cmake_new_bignum () {
|
||||
msg "build: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
|
||||
scripts/config.py unset MBEDTLS_HAVE_ASM
|
||||
scripts/config.py unset MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
||||
scripts/config.py unset MBEDTLS_AESCE_C
|
||||
scripts/config.py set MBEDTLS_TEST_HOOKS
|
||||
scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
|
||||
make CC=gcc CFLAGS="$ASAN_CFLAGS -Werror -Wall -Wextra -DMBEDTLS_HAVE_INT32" LDFLAGS="$ASAN_CFLAGS"
|
||||
|
||||
msg "test: gcc, force 32-bit bignum limbs, new bignum interface, test hooks (ASan build)"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_no_udbl_division () {
|
||||
msg "build: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_NO_UDBL_DIVISION
|
||||
make CFLAGS='-Werror -O1'
|
||||
|
||||
msg "test: MBEDTLS_NO_UDBL_DIVISION native" # ~ 10s
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_no_64bit_multiplication () {
|
||||
msg "build: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION
|
||||
make CFLAGS='-Werror -O1'
|
||||
|
||||
msg "test: MBEDTLS_NO_64BIT_MULTIPLICATION native" # ~ 10s
|
||||
make test
|
||||
}
|
||||
852
vendor/mbedtls/tests/scripts/components-configuration-tls.sh
vendored
Normal file
852
vendor/mbedtls/tests/scripts/components-configuration-tls.sh
vendored
Normal file
@@ -0,0 +1,852 @@
|
||||
# components-configuration-tls.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Configuration Testing - TLS
|
||||
################################################################
|
||||
|
||||
component_test_config_suite_b_legacy () {
|
||||
msg "build: configs/config-suite-b.h"
|
||||
cp configs/config-suite-b.h "$CONFIG_H"
|
||||
# test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
|
||||
# want to re-generate generated files that depend on it, quite correctly.
|
||||
# However this doesn't work as the generation script expects a specific
|
||||
# format for mbedtls_config.h, which the other files don't follow. Also,
|
||||
# cmake can't know this, but re-generation is actually not necessary as
|
||||
# the generated files only depend on the list of available options, not
|
||||
# whether they're on or off. So, disable cmake's (over-sensitive here)
|
||||
# dependency resolution for generated files and just rely on them being
|
||||
# present (thanks to pre_generate_files) by turning GEN_FILES off.
|
||||
CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: configs/config-suite-b.h - unit tests"
|
||||
make test
|
||||
|
||||
msg "test: configs/config-suite-b.h - compat.sh"
|
||||
tests/compat.sh -m tls12 -f 'ECDHE_ECDSA.*AES.*GCM' -p mbedTLS
|
||||
|
||||
msg "build: configs/config-suite-b.h + DEBUG"
|
||||
MBEDTLS_TEST_CONFIGURATION="$MBEDTLS_TEST_CONFIGURATION+DEBUG"
|
||||
make clean
|
||||
scripts/config.py set MBEDTLS_DEBUG_C
|
||||
scripts/config.py set MBEDTLS_ERROR_C
|
||||
make ssl-opt
|
||||
|
||||
msg "test: configs/config-suite-b.h + DEBUG - ssl-opt.sh"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_config_suite_b_psa () {
|
||||
msg "build: configs/config-suite-b.h + USE_PSA_CRYPTO"
|
||||
cp configs/config-suite-b.h "$CONFIG_H"
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_C
|
||||
scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
|
||||
# test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
|
||||
# want to re-generate generated files that depend on it, quite correctly.
|
||||
# However this doesn't work as the generation script expects a specific
|
||||
# format for mbedtls_config.h, which the other files don't follow. Also,
|
||||
# cmake can't know this, but re-generation is actually not necessary as
|
||||
# the generated files only depend on the list of available options, not
|
||||
# whether they're on or off. So, disable cmake's (over-sensitive here)
|
||||
# dependency resolution for generated files and just rely on them being
|
||||
# present (thanks to pre_generate_files) by turning GEN_FILES off.
|
||||
CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: configs/config-suite-b.h + USE_PSA_CRYPTO - unit tests"
|
||||
make test
|
||||
|
||||
msg "test: configs/config-suite-b.h + USE_PSA_CRYPTO - compat.sh"
|
||||
tests/compat.sh -m tls12 -f 'ECDHE_ECDSA.*AES.*GCM' -p mbedTLS
|
||||
|
||||
msg "build: configs/config-suite-b.h + USE_PSA_CRYPTO + DEBUG"
|
||||
MBEDTLS_TEST_CONFIGURATION="$MBEDTLS_TEST_CONFIGURATION+DEBUG"
|
||||
make clean
|
||||
scripts/config.py set MBEDTLS_DEBUG_C
|
||||
scripts/config.py set MBEDTLS_ERROR_C
|
||||
make ssl-opt
|
||||
|
||||
msg "test: configs/config-suite-b.h + USE_PSA_CRYPTO + DEBUG - ssl-opt.sh"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_no_renegotiation () {
|
||||
msg "build: Default + !MBEDTLS_SSL_RENEGOTIATION (ASan build)" # ~ 6 min
|
||||
scripts/config.py unset MBEDTLS_SSL_RENEGOTIATION
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: !MBEDTLS_SSL_RENEGOTIATION - main suites (inc. selftests) (ASan build)" # ~ 50s
|
||||
make test
|
||||
|
||||
msg "test: !MBEDTLS_SSL_RENEGOTIATION - ssl-opt.sh (ASan build)" # ~ 6 min
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls1_2_default_stream_cipher_only () {
|
||||
msg "build: default with only stream cipher"
|
||||
|
||||
# Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C
|
||||
scripts/config.py unset MBEDTLS_GCM_C
|
||||
scripts/config.py unset MBEDTLS_CCM_C
|
||||
scripts/config.py unset MBEDTLS_CHACHAPOLY_C
|
||||
#Disable TLS 1.3 (as no AEAD)
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
# Disable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES))
|
||||
scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC
|
||||
# Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC)
|
||||
scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
# Enable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER))
|
||||
scripts/config.py set MBEDTLS_CIPHER_NULL_CIPHER
|
||||
# Modules that depend on AEAD
|
||||
scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION
|
||||
scripts/config.py unset MBEDTLS_SSL_TICKET_C
|
||||
|
||||
make
|
||||
|
||||
msg "test: default with only stream cipher"
|
||||
make test
|
||||
|
||||
# Not running ssl-opt.sh because most tests require a non-NULL ciphersuite.
|
||||
}
|
||||
|
||||
component_test_tls1_2_default_stream_cipher_only_use_psa () {
|
||||
msg "build: default with only stream cipher use psa"
|
||||
|
||||
scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
|
||||
# Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C)
|
||||
scripts/config.py unset MBEDTLS_GCM_C
|
||||
scripts/config.py unset MBEDTLS_CCM_C
|
||||
scripts/config.py unset MBEDTLS_CHACHAPOLY_C
|
||||
#Disable TLS 1.3 (as no AEAD)
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
# Disable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES))
|
||||
scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC
|
||||
# Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC)
|
||||
scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
# Enable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER))
|
||||
scripts/config.py set MBEDTLS_CIPHER_NULL_CIPHER
|
||||
# Modules that depend on AEAD
|
||||
scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION
|
||||
scripts/config.py unset MBEDTLS_SSL_TICKET_C
|
||||
|
||||
make
|
||||
|
||||
msg "test: default with only stream cipher use psa"
|
||||
make test
|
||||
|
||||
# Not running ssl-opt.sh because most tests require a non-NULL ciphersuite.
|
||||
}
|
||||
|
||||
component_test_tls1_2_default_cbc_legacy_cipher_only () {
|
||||
msg "build: default with only CBC-legacy cipher"
|
||||
|
||||
# Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C)
|
||||
scripts/config.py unset MBEDTLS_GCM_C
|
||||
scripts/config.py unset MBEDTLS_CCM_C
|
||||
scripts/config.py unset MBEDTLS_CHACHAPOLY_C
|
||||
#Disable TLS 1.3 (as no AEAD)
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
# Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES))
|
||||
scripts/config.py set MBEDTLS_CIPHER_MODE_CBC
|
||||
# Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC)
|
||||
scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
# Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER))
|
||||
scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER
|
||||
# Modules that depend on AEAD
|
||||
scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION
|
||||
scripts/config.py unset MBEDTLS_SSL_TICKET_C
|
||||
|
||||
make
|
||||
|
||||
msg "test: default with only CBC-legacy cipher"
|
||||
make test
|
||||
|
||||
msg "test: default with only CBC-legacy cipher - ssl-opt.sh (subset)"
|
||||
tests/ssl-opt.sh -f "TLS 1.2"
|
||||
}
|
||||
|
||||
component_test_tls1_2_default_cbc_legacy_cipher_only_use_psa () {
|
||||
msg "build: default with only CBC-legacy cipher use psa"
|
||||
|
||||
scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
|
||||
# Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C)
|
||||
scripts/config.py unset MBEDTLS_GCM_C
|
||||
scripts/config.py unset MBEDTLS_CCM_C
|
||||
scripts/config.py unset MBEDTLS_CHACHAPOLY_C
|
||||
#Disable TLS 1.3 (as no AEAD)
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
# Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES))
|
||||
scripts/config.py set MBEDTLS_CIPHER_MODE_CBC
|
||||
# Disable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC)
|
||||
scripts/config.py unset MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
# Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER))
|
||||
scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER
|
||||
# Modules that depend on AEAD
|
||||
scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION
|
||||
scripts/config.py unset MBEDTLS_SSL_TICKET_C
|
||||
|
||||
make
|
||||
|
||||
msg "test: default with only CBC-legacy cipher use psa"
|
||||
make test
|
||||
|
||||
msg "test: default with only CBC-legacy cipher use psa - ssl-opt.sh (subset)"
|
||||
tests/ssl-opt.sh -f "TLS 1.2"
|
||||
}
|
||||
|
||||
component_test_tls1_2_default_cbc_legacy_cbc_etm_cipher_only () {
|
||||
msg "build: default with only CBC-legacy and CBC-EtM ciphers"
|
||||
|
||||
# Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C)
|
||||
scripts/config.py unset MBEDTLS_GCM_C
|
||||
scripts/config.py unset MBEDTLS_CCM_C
|
||||
scripts/config.py unset MBEDTLS_CHACHAPOLY_C
|
||||
#Disable TLS 1.3 (as no AEAD)
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
# Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES))
|
||||
scripts/config.py set MBEDTLS_CIPHER_MODE_CBC
|
||||
# Enable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC)
|
||||
scripts/config.py set MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
# Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER))
|
||||
scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER
|
||||
# Modules that depend on AEAD
|
||||
scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION
|
||||
scripts/config.py unset MBEDTLS_SSL_TICKET_C
|
||||
|
||||
make
|
||||
|
||||
msg "test: default with only CBC-legacy and CBC-EtM ciphers"
|
||||
make test
|
||||
|
||||
msg "test: default with only CBC-legacy and CBC-EtM ciphers - ssl-opt.sh (subset)"
|
||||
tests/ssl-opt.sh -f "TLS 1.2"
|
||||
}
|
||||
|
||||
component_test_tls1_2_default_cbc_legacy_cbc_etm_cipher_only_use_psa () {
|
||||
msg "build: default with only CBC-legacy and CBC-EtM ciphers use psa"
|
||||
|
||||
scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
|
||||
# Disable AEAD (controlled by the presence of one of GCM_C, CCM_C, CHACHAPOLY_C)
|
||||
scripts/config.py unset MBEDTLS_GCM_C
|
||||
scripts/config.py unset MBEDTLS_CCM_C
|
||||
scripts/config.py unset MBEDTLS_CHACHAPOLY_C
|
||||
#Disable TLS 1.3 (as no AEAD)
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
# Enable CBC-legacy (controlled by MBEDTLS_CIPHER_MODE_CBC plus at least one block cipher (AES, ARIA, Camellia, DES))
|
||||
scripts/config.py set MBEDTLS_CIPHER_MODE_CBC
|
||||
# Enable CBC-EtM (controlled by the same as CBC-legacy plus MBEDTLS_SSL_ENCRYPT_THEN_MAC)
|
||||
scripts/config.py set MBEDTLS_SSL_ENCRYPT_THEN_MAC
|
||||
# Disable stream (currently that's just the NULL pseudo-cipher (controlled by MBEDTLS_CIPHER_NULL_CIPHER))
|
||||
scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER
|
||||
# Modules that depend on AEAD
|
||||
scripts/config.py unset MBEDTLS_SSL_CONTEXT_SERIALIZATION
|
||||
scripts/config.py unset MBEDTLS_SSL_TICKET_C
|
||||
|
||||
make
|
||||
|
||||
msg "test: default with only CBC-legacy and CBC-EtM ciphers use psa"
|
||||
make test
|
||||
|
||||
msg "test: default with only CBC-legacy and CBC-EtM ciphers use psa - ssl-opt.sh (subset)"
|
||||
tests/ssl-opt.sh -f "TLS 1.2"
|
||||
}
|
||||
|
||||
component_test_config_thread_legacy () {
|
||||
msg "build: configs/config-thread.h"
|
||||
cp configs/config-thread.h "$CONFIG_H"
|
||||
# test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
|
||||
# want to re-generate generated files that depend on it, quite correctly.
|
||||
# However this doesn't work as the generation script expects a specific
|
||||
# format for mbedtls_config.h, which the other files don't follow. Also,
|
||||
# cmake can't know this, but re-generation is actually not necessary as
|
||||
# the generated files only depend on the list of available options, not
|
||||
# whether they're on or off. So, disable cmake's (over-sensitive here)
|
||||
# dependency resolution for generated files and just rely on them being
|
||||
# present (thanks to pre_generate_files) by turning GEN_FILES off.
|
||||
CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: configs/config-thread.h - unit tests"
|
||||
make test
|
||||
|
||||
msg "test: configs/config-thread.h - ssl-opt.sh"
|
||||
tests/ssl-opt.sh -f 'ECJPAKE.*nolog'
|
||||
}
|
||||
|
||||
component_test_config_thread_psa () {
|
||||
msg "build: configs/config-thread.h + USE_PSA_CRYPTO"
|
||||
cp configs/config-thread.h "$CONFIG_H"
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_C
|
||||
scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
|
||||
# test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
|
||||
# want to re-generate generated files that depend on it, quite correctly.
|
||||
# However this doesn't work as the generation script expects a specific
|
||||
# format for mbedtls_config.h, which the other files don't follow. Also,
|
||||
# cmake can't know this, but re-generation is actually not necessary as
|
||||
# the generated files only depend on the list of available options, not
|
||||
# whether they're on or off. So, disable cmake's (over-sensitive here)
|
||||
# dependency resolution for generated files and just rely on them being
|
||||
# present (thanks to pre_generate_files) by turning GEN_FILES off.
|
||||
CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: configs/config-thread.h + USE_PSA_CRYPTO - unit tests"
|
||||
make test
|
||||
|
||||
msg "test: configs/config-thread.h + USE_PSA_CRYPTO - ssl-opt.sh"
|
||||
tests/ssl-opt.sh -f 'ECJPAKE.*nolog'
|
||||
}
|
||||
|
||||
# We're not aware of any other (open source) implementation of EC J-PAKE in TLS
|
||||
# that we could use for interop testing. However, we now have sort of two
|
||||
# implementations ourselves: one using PSA, the other not. At least test that
|
||||
# these two interoperate with each other.
|
||||
component_test_tls1_2_ecjpake_compatibility () {
|
||||
msg "build: TLS1.2 server+client w/ EC-JPAKE w/o USE_PSA"
|
||||
scripts/config.py set MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||
# Explicitly make lib first to avoid a race condition:
|
||||
# https://github.com/Mbed-TLS/mbedtls/issues/8229
|
||||
make lib
|
||||
make -C programs ssl/ssl_server2 ssl/ssl_client2
|
||||
cp programs/ssl/ssl_server2 s2_no_use_psa
|
||||
cp programs/ssl/ssl_client2 c2_no_use_psa
|
||||
|
||||
msg "build: TLS1.2 server+client w/ EC-JPAKE w/ USE_PSA"
|
||||
scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
|
||||
make clean
|
||||
make lib
|
||||
make -C programs ssl/ssl_server2 ssl/ssl_client2
|
||||
make -C programs test/udp_proxy test/query_compile_time_config
|
||||
|
||||
msg "test: server w/o USE_PSA - client w/ USE_PSA, text password"
|
||||
P_SRV=../s2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: working, TLS"
|
||||
msg "test: server w/o USE_PSA - client w/ USE_PSA, opaque password"
|
||||
P_SRV=../s2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: opaque password client only, working, TLS"
|
||||
msg "test: client w/o USE_PSA - server w/ USE_PSA, text password"
|
||||
P_CLI=../c2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: working, TLS"
|
||||
msg "test: client w/o USE_PSA - server w/ USE_PSA, opaque password"
|
||||
P_CLI=../c2_no_use_psa tests/ssl-opt.sh -f "ECJPAKE: opaque password server only, working, TLS"
|
||||
|
||||
rm s2_no_use_psa c2_no_use_psa
|
||||
}
|
||||
|
||||
component_test_tls1_2_ccm_psk_legacy () {
|
||||
msg "build: configs/config-ccm-psk-tls1_2.h"
|
||||
cp configs/config-ccm-psk-tls1_2.h "$CONFIG_H"
|
||||
# test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
|
||||
# want to re-generate generated files that depend on it, quite correctly.
|
||||
# However this doesn't work as the generation script expects a specific
|
||||
# format for mbedtls_config.h, which the other files don't follow. Also,
|
||||
# cmake can't know this, but re-generation is actually not necessary as
|
||||
# the generated files only depend on the list of available options, not
|
||||
# whether they're on or off. So, disable cmake's (over-sensitive here)
|
||||
# dependency resolution for generated files and just rely on them being
|
||||
# present (thanks to pre_generate_files) by turning GEN_FILES off.
|
||||
CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: configs/config-ccm-psk-tls1_2.h - unit tests"
|
||||
make test
|
||||
|
||||
msg "test: configs/config-ccm-psk-tls1_2.h - compat.sh"
|
||||
tests/compat.sh -m tls12 -f '^TLS_PSK_WITH_AES_..._CCM_8'
|
||||
}
|
||||
|
||||
component_test_tls1_2_ccm_psk_psa () {
|
||||
msg "build: configs/config-ccm-psk-tls1_2.h + USE_PSA_CRYPTO"
|
||||
cp configs/config-ccm-psk-tls1_2.h "$CONFIG_H"
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_C
|
||||
scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
|
||||
# test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
|
||||
# want to re-generate generated files that depend on it, quite correctly.
|
||||
# However this doesn't work as the generation script expects a specific
|
||||
# format for mbedtls_config.h, which the other files don't follow. Also,
|
||||
# cmake can't know this, but re-generation is actually not necessary as
|
||||
# the generated files only depend on the list of available options, not
|
||||
# whether they're on or off. So, disable cmake's (over-sensitive here)
|
||||
# dependency resolution for generated files and just rely on them being
|
||||
# present (thanks to pre_generate_files) by turning GEN_FILES off.
|
||||
CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: configs/config-ccm-psk-tls1_2.h + USE_PSA_CRYPTO - unit tests"
|
||||
make test
|
||||
|
||||
msg "test: configs/config-ccm-psk-tls1_2.h + USE_PSA_CRYPTO - compat.sh"
|
||||
tests/compat.sh -m tls12 -f '^TLS_PSK_WITH_AES_..._CCM_8'
|
||||
}
|
||||
|
||||
component_test_tls1_2_ccm_psk_dtls_legacy () {
|
||||
msg "build: configs/config-ccm-psk-dtls1_2.h"
|
||||
cp configs/config-ccm-psk-dtls1_2.h "$CONFIG_H"
|
||||
# test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
|
||||
# want to re-generate generated files that depend on it, quite correctly.
|
||||
# However this doesn't work as the generation script expects a specific
|
||||
# format for mbedtls_config.h, which the other files don't follow. Also,
|
||||
# cmake can't know this, but re-generation is actually not necessary as
|
||||
# the generated files only depend on the list of available options, not
|
||||
# whether they're on or off. So, disable cmake's (over-sensitive here)
|
||||
# dependency resolution for generated files and just rely on them being
|
||||
# present (thanks to pre_generate_files) by turning GEN_FILES off.
|
||||
CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: configs/config-ccm-psk-dtls1_2.h - unit tests"
|
||||
make test
|
||||
|
||||
msg "test: configs/config-ccm-psk-dtls1_2.h - compat.sh"
|
||||
tests/compat.sh -m dtls12 -f '^TLS_PSK_WITH_AES_..._CCM_8'
|
||||
|
||||
msg "build: configs/config-ccm-psk-dtls1_2.h + DEBUG"
|
||||
MBEDTLS_TEST_CONFIGURATION="$MBEDTLS_TEST_CONFIGURATION+DEBUG"
|
||||
make clean
|
||||
scripts/config.py set MBEDTLS_DEBUG_C
|
||||
scripts/config.py set MBEDTLS_ERROR_C
|
||||
make ssl-opt
|
||||
|
||||
msg "test: configs/config-ccm-psk-dtls1_2.h + DEBUG - ssl-opt.sh"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls1_2_ccm_psk_dtls_psa () {
|
||||
msg "build: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO"
|
||||
cp configs/config-ccm-psk-dtls1_2.h "$CONFIG_H"
|
||||
scripts/config.py set MBEDTLS_PSA_CRYPTO_C
|
||||
scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py set MBEDTLS_HAVE_TIME
|
||||
# test-ref-configs works by overwriting mbedtls_config.h; this makes cmake
|
||||
# want to re-generate generated files that depend on it, quite correctly.
|
||||
# However this doesn't work as the generation script expects a specific
|
||||
# format for mbedtls_config.h, which the other files don't follow. Also,
|
||||
# cmake can't know this, but re-generation is actually not necessary as
|
||||
# the generated files only depend on the list of available options, not
|
||||
# whether they're on or off. So, disable cmake's (over-sensitive here)
|
||||
# dependency resolution for generated files and just rely on them being
|
||||
# present (thanks to pre_generate_files) by turning GEN_FILES off.
|
||||
CC=$ASAN_CC cmake -D GEN_FILES=Off -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO - unit tests"
|
||||
make test
|
||||
|
||||
msg "test: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO - compat.sh"
|
||||
tests/compat.sh -m dtls12 -f '^TLS_PSK_WITH_AES_..._CCM_8'
|
||||
|
||||
msg "build: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO + DEBUG"
|
||||
MBEDTLS_TEST_CONFIGURATION="$MBEDTLS_TEST_CONFIGURATION+DEBUG"
|
||||
make clean
|
||||
scripts/config.py set MBEDTLS_DEBUG_C
|
||||
scripts/config.py set MBEDTLS_ERROR_C
|
||||
make ssl-opt
|
||||
|
||||
msg "test: configs/config-ccm-psk-dtls1_2.h + USE_PSA_CRYPTO + DEBUG - ssl-opt.sh"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_small_ssl_out_content_len () {
|
||||
msg "build: small SSL_OUT_CONTENT_LEN (ASan build)"
|
||||
scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 16384
|
||||
scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 4096
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: small SSL_OUT_CONTENT_LEN - ssl-opt.sh MFL and large packet tests"
|
||||
tests/ssl-opt.sh -f "Max fragment\|Large packet"
|
||||
}
|
||||
|
||||
component_test_small_ssl_in_content_len () {
|
||||
msg "build: small SSL_IN_CONTENT_LEN (ASan build)"
|
||||
scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 4096
|
||||
scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 16384
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: small SSL_IN_CONTENT_LEN - ssl-opt.sh MFL tests"
|
||||
tests/ssl-opt.sh -f "Max fragment"
|
||||
}
|
||||
|
||||
component_test_small_ssl_dtls_max_buffering () {
|
||||
msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0"
|
||||
scripts/config.py set MBEDTLS_SSL_DTLS_MAX_BUFFERING 1000
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #0 - ssl-opt.sh specific reordering test"
|
||||
tests/ssl-opt.sh -f "DTLS reordering: Buffer out-of-order hs msg before reassembling next, free buffered msg"
|
||||
}
|
||||
|
||||
component_test_small_mbedtls_ssl_dtls_max_buffering () {
|
||||
msg "build: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1"
|
||||
scripts/config.py set MBEDTLS_SSL_DTLS_MAX_BUFFERING 190
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: small MBEDTLS_SSL_DTLS_MAX_BUFFERING #1 - ssl-opt.sh specific reordering test"
|
||||
tests/ssl-opt.sh -f "DTLS reordering: Buffer encrypted Finished message, drop for fragmented NewSessionTicket"
|
||||
}
|
||||
|
||||
component_test_depends_py_kex () {
|
||||
msg "test/build: depends.py kex (gcc)"
|
||||
tests/scripts/depends.py kex --unset-use-psa
|
||||
}
|
||||
|
||||
component_test_depends_py_kex_psa () {
|
||||
msg "test/build: depends.py kex (gcc) with MBEDTLS_USE_PSA_CRYPTO defined"
|
||||
tests/scripts/depends.py kex
|
||||
}
|
||||
|
||||
# Common helper for component_full_without_ecdhe_ecdsa() and
|
||||
# component_full_without_ecdhe_ecdsa_and_tls13() which:
|
||||
# - starts from the "full" configuration minus the list of symbols passed in
|
||||
# as 1st parameter
|
||||
# - build
|
||||
# - test only TLS (i.e. test_suite_tls and ssl-opt)
|
||||
build_full_minus_something_and_test_tls () {
|
||||
symbols_to_disable="$1"
|
||||
|
||||
msg "build: full minus something, test TLS"
|
||||
|
||||
scripts/config.py full
|
||||
for sym in $symbols_to_disable; do
|
||||
echo "Disabling $sym"
|
||||
scripts/config.py unset $sym
|
||||
done
|
||||
|
||||
make
|
||||
|
||||
msg "test: full minus something, test TLS"
|
||||
( cd tests; ./test_suite_ssl )
|
||||
|
||||
msg "ssl-opt: full minus something, test TLS"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_full_without_ecdhe_ecdsa () {
|
||||
build_full_minus_something_and_test_tls "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED"
|
||||
}
|
||||
|
||||
component_full_without_ecdhe_ecdsa_and_tls13 () {
|
||||
build_full_minus_something_and_test_tls "MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
|
||||
MBEDTLS_SSL_PROTO_TLS1_3"
|
||||
}
|
||||
|
||||
component_build_no_ssl_srv () {
|
||||
msg "build: full config except SSL server, make, gcc" # ~ 30s
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_SSL_SRV_C
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -Wmissing-prototypes'
|
||||
}
|
||||
|
||||
component_build_no_ssl_cli () {
|
||||
msg "build: full config except SSL client, make, gcc" # ~ 30s
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_SSL_CLI_C
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -O1 -Wmissing-prototypes'
|
||||
}
|
||||
|
||||
component_test_no_max_fragment_length () {
|
||||
# Run max fragment length tests with MFL disabled
|
||||
msg "build: default config except MFL extension (ASan build)" # ~ 30s
|
||||
scripts/config.py unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: ssl-opt.sh, MFL-related tests"
|
||||
tests/ssl-opt.sh -f "Max fragment length"
|
||||
}
|
||||
|
||||
component_test_asan_remove_peer_certificate () {
|
||||
msg "build: default config with MBEDTLS_SSL_KEEP_PEER_CERTIFICATE disabled (ASan build)"
|
||||
scripts/config.py unset MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
|
||||
make test
|
||||
|
||||
msg "test: ssl-opt.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
|
||||
tests/ssl-opt.sh
|
||||
|
||||
msg "test: compat.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
|
||||
tests/compat.sh
|
||||
|
||||
msg "test: context-info.sh, !MBEDTLS_SSL_KEEP_PEER_CERTIFICATE"
|
||||
tests/context-info.sh
|
||||
}
|
||||
|
||||
component_test_no_max_fragment_length_small_ssl_out_content_len () {
|
||||
msg "build: no MFL extension, small SSL_OUT_CONTENT_LEN (ASan build)"
|
||||
scripts/config.py unset MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
scripts/config.py set MBEDTLS_SSL_IN_CONTENT_LEN 16384
|
||||
scripts/config.py set MBEDTLS_SSL_OUT_CONTENT_LEN 4096
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: MFL tests (disabled MFL extension case) & large packet tests"
|
||||
tests/ssl-opt.sh -f "Max fragment length\|Large buffer"
|
||||
|
||||
msg "test: context-info.sh (disabled MFL extension case)"
|
||||
tests/context-info.sh
|
||||
}
|
||||
|
||||
component_test_variable_ssl_in_out_buffer_len () {
|
||||
msg "build: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled (ASan build)"
|
||||
scripts/config.py set MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled"
|
||||
make test
|
||||
|
||||
msg "test: ssl-opt.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled"
|
||||
tests/ssl-opt.sh
|
||||
|
||||
msg "test: compat.sh, MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH enabled"
|
||||
tests/compat.sh
|
||||
}
|
||||
|
||||
component_test_dtls_cid_legacy () {
|
||||
msg "build: MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled (ASan build)"
|
||||
scripts/config.py set MBEDTLS_SSL_DTLS_CONNECTION_ID_COMPAT 1
|
||||
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy)"
|
||||
make test
|
||||
|
||||
msg "test: ssl-opt.sh, MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled"
|
||||
tests/ssl-opt.sh
|
||||
|
||||
msg "test: compat.sh, MBEDTLS_SSL_DTLS_CONNECTION_ID (legacy) enabled"
|
||||
tests/compat.sh
|
||||
}
|
||||
|
||||
component_test_ssl_alloc_buffer_and_mfl () {
|
||||
msg "build: default config with memory buffer allocator and MFL extension"
|
||||
scripts/config.py set MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
||||
scripts/config.py set MBEDTLS_PLATFORM_MEMORY
|
||||
scripts/config.py set MBEDTLS_MEMORY_DEBUG
|
||||
scripts/config.py set MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
|
||||
scripts/config.py set MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
|
||||
cmake -DCMAKE_BUILD_TYPE:String=Release .
|
||||
make
|
||||
|
||||
msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_MEMORY_DEBUG and MBEDTLS_SSL_MAX_FRAGMENT_LENGTH"
|
||||
make test
|
||||
|
||||
msg "test: MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH, MBEDTLS_MEMORY_BUFFER_ALLOC_C, MBEDTLS_MEMORY_DEBUG and MBEDTLS_SSL_MAX_FRAGMENT_LENGTH"
|
||||
tests/ssl-opt.sh -f "Handshake memory usage"
|
||||
}
|
||||
|
||||
component_test_when_no_ciphersuites_have_mac () {
|
||||
msg "build: when no ciphersuites have MAC"
|
||||
scripts/config.py unset MBEDTLS_CIPHER_NULL_CIPHER
|
||||
scripts/config.py unset MBEDTLS_CIPHER_MODE_CBC
|
||||
scripts/config.py unset MBEDTLS_CMAC_C
|
||||
make
|
||||
|
||||
msg "test: !MBEDTLS_SSL_SOME_SUITES_USE_MAC"
|
||||
make test
|
||||
|
||||
msg "test ssl-opt.sh: !MBEDTLS_SSL_SOME_SUITES_USE_MAC"
|
||||
tests/ssl-opt.sh -f 'Default\|EtM' -e 'without EtM'
|
||||
}
|
||||
|
||||
component_test_tls12_only () {
|
||||
msg "build: default config without MBEDTLS_SSL_PROTO_TLS1_3, cmake, gcc, ASan"
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: main suites (inc. selftests) (ASan build)"
|
||||
make test
|
||||
|
||||
msg "test: ssl-opt.sh (ASan build)"
|
||||
tests/ssl-opt.sh
|
||||
|
||||
msg "test: compat.sh (ASan build)"
|
||||
tests/compat.sh
|
||||
}
|
||||
|
||||
component_test_tls13_only () {
|
||||
msg "build: default config without MBEDTLS_SSL_PROTO_TLS1_2"
|
||||
scripts/config.py set MBEDTLS_SSL_EARLY_DATA
|
||||
scripts/config.py set MBEDTLS_SSL_RECORD_SIZE_LIMIT
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
|
||||
msg "test: TLS 1.3 only, all key exchange modes enabled"
|
||||
make test
|
||||
|
||||
msg "ssl-opt.sh: TLS 1.3 only, all key exchange modes enabled"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_only_psk () {
|
||||
msg "build: TLS 1.3 only from default, only PSK key exchange mode"
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
|
||||
scripts/config.py unset MBEDTLS_ECDH_C
|
||||
scripts/config.py unset MBEDTLS_DHM_C
|
||||
scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C
|
||||
scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT
|
||||
scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
scripts/config.py unset MBEDTLS_ECDSA_C
|
||||
scripts/config.py unset MBEDTLS_PKCS1_V21
|
||||
scripts/config.py unset MBEDTLS_PKCS7_C
|
||||
scripts/config.py set MBEDTLS_SSL_EARLY_DATA
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
|
||||
msg "test_suite_ssl: TLS 1.3 only, only PSK key exchange mode enabled"
|
||||
cd tests; ./test_suite_ssl; cd ..
|
||||
|
||||
msg "ssl-opt.sh: TLS 1.3 only, only PSK key exchange mode enabled"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_only_ephemeral () {
|
||||
msg "build: TLS 1.3 only from default, only ephemeral key exchange mode"
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
|
||||
scripts/config.py unset MBEDTLS_SSL_EARLY_DATA
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
|
||||
msg "test_suite_ssl: TLS 1.3 only, only ephemeral key exchange mode"
|
||||
cd tests; ./test_suite_ssl; cd ..
|
||||
|
||||
msg "ssl-opt.sh: TLS 1.3 only, only ephemeral key exchange mode"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_only_ephemeral_ffdh () {
|
||||
msg "build: TLS 1.3 only from default, only ephemeral ffdh key exchange mode"
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
|
||||
scripts/config.py unset MBEDTLS_SSL_EARLY_DATA
|
||||
scripts/config.py unset MBEDTLS_ECDH_C
|
||||
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
|
||||
msg "test_suite_ssl: TLS 1.3 only, only ephemeral ffdh key exchange mode"
|
||||
cd tests; ./test_suite_ssl; cd ..
|
||||
|
||||
msg "ssl-opt.sh: TLS 1.3 only, only ephemeral ffdh key exchange mode"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_only_psk_ephemeral () {
|
||||
msg "build: TLS 1.3 only from default, only PSK ephemeral key exchange mode"
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
|
||||
scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C
|
||||
scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT
|
||||
scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
scripts/config.py unset MBEDTLS_ECDSA_C
|
||||
scripts/config.py unset MBEDTLS_PKCS1_V21
|
||||
scripts/config.py unset MBEDTLS_PKCS7_C
|
||||
scripts/config.py set MBEDTLS_SSL_EARLY_DATA
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
|
||||
msg "test_suite_ssl: TLS 1.3 only, only PSK ephemeral key exchange mode"
|
||||
cd tests; ./test_suite_ssl; cd ..
|
||||
|
||||
msg "ssl-opt.sh: TLS 1.3 only, only PSK ephemeral key exchange mode"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_only_psk_ephemeral_ffdh () {
|
||||
msg "build: TLS 1.3 only from default, only PSK ephemeral ffdh key exchange mode"
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
|
||||
scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C
|
||||
scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT
|
||||
scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
scripts/config.py unset MBEDTLS_ECDSA_C
|
||||
scripts/config.py unset MBEDTLS_PKCS1_V21
|
||||
scripts/config.py unset MBEDTLS_PKCS7_C
|
||||
scripts/config.py set MBEDTLS_SSL_EARLY_DATA
|
||||
scripts/config.py unset MBEDTLS_ECDH_C
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
|
||||
msg "test_suite_ssl: TLS 1.3 only, only PSK ephemeral ffdh key exchange mode"
|
||||
cd tests; ./test_suite_ssl; cd ..
|
||||
|
||||
msg "ssl-opt.sh: TLS 1.3 only, only PSK ephemeral ffdh key exchange mode"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_only_psk_all () {
|
||||
msg "build: TLS 1.3 only from default, without ephemeral key exchange mode"
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
|
||||
scripts/config.py unset MBEDTLS_X509_CRT_PARSE_C
|
||||
scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT
|
||||
scripts/config.py unset MBEDTLS_SSL_SERVER_NAME_INDICATION
|
||||
scripts/config.py unset MBEDTLS_ECDSA_C
|
||||
scripts/config.py unset MBEDTLS_PKCS1_V21
|
||||
scripts/config.py unset MBEDTLS_PKCS7_C
|
||||
scripts/config.py set MBEDTLS_SSL_EARLY_DATA
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
|
||||
msg "test_suite_ssl: TLS 1.3 only, PSK and PSK ephemeral key exchange modes"
|
||||
cd tests; ./test_suite_ssl; cd ..
|
||||
|
||||
msg "ssl-opt.sh: TLS 1.3 only, PSK and PSK ephemeral key exchange modes"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_only_ephemeral_all () {
|
||||
msg "build: TLS 1.3 only from default, without PSK key exchange mode"
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
|
||||
scripts/config.py set MBEDTLS_SSL_EARLY_DATA
|
||||
make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/tls13-only.h\"'"
|
||||
|
||||
msg "test_suite_ssl: TLS 1.3 only, ephemeral and PSK ephemeral key exchange modes"
|
||||
cd tests; ./test_suite_ssl; cd ..
|
||||
|
||||
msg "ssl-opt.sh: TLS 1.3 only, ephemeral and PSK ephemeral key exchange modes"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_no_padding () {
|
||||
msg "build: default config plus early data minus padding"
|
||||
scripts/config.py set MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY 1
|
||||
scripts/config.py set MBEDTLS_SSL_EARLY_DATA
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
msg "test: default config plus early data minus padding"
|
||||
make test
|
||||
msg "ssl-opt.sh (TLS 1.3 no padding)"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_tls13_no_compatibility_mode () {
|
||||
msg "build: default config plus early data minus middlebox compatibility mode"
|
||||
scripts/config.py unset MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
|
||||
scripts/config.py set MBEDTLS_SSL_EARLY_DATA
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
msg "test: default config plus early data minus middlebox compatibility mode"
|
||||
make test
|
||||
msg "ssl-opt.sh (TLS 1.3 no compatibility mode)"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_full_minus_session_tickets () {
|
||||
msg "build: full config without session tickets"
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_SSL_SESSION_TICKETS
|
||||
scripts/config.py unset MBEDTLS_SSL_EARLY_DATA
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
msg "test: full config without session tickets"
|
||||
make test
|
||||
msg "ssl-opt.sh (full config without session tickets)"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
36
vendor/mbedtls/tests/scripts/components-configuration-x509.sh
vendored
Normal file
36
vendor/mbedtls/tests/scripts/components-configuration-x509.sh
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
# components-configuration-x509.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Configuration Testing - X509
|
||||
################################################################
|
||||
|
||||
component_test_no_x509_info () {
|
||||
msg "build: full + MBEDTLS_X509_REMOVE_INFO" # ~ 10s
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_MEMORY_BACKTRACE # too slow for tests
|
||||
scripts/config.py set MBEDTLS_X509_REMOVE_INFO
|
||||
make CFLAGS='-Werror -O2'
|
||||
|
||||
msg "test: full + MBEDTLS_X509_REMOVE_INFO" # ~ 10s
|
||||
make test
|
||||
|
||||
msg "test: ssl-opt.sh, full + MBEDTLS_X509_REMOVE_INFO" # ~ 1 min
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
component_test_sw_inet_pton () {
|
||||
msg "build: default plus MBEDTLS_TEST_SW_INET_PTON"
|
||||
|
||||
# MBEDTLS_TEST_HOOKS required for x509_crt_parse_cn_inet_pton
|
||||
scripts/config.py set MBEDTLS_TEST_HOOKS
|
||||
CC=$ASAN_CC CFLAGS="-DMBEDTLS_TEST_SW_INET_PTON" cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: default plus MBEDTLS_TEST_SW_INET_PTON"
|
||||
make test
|
||||
}
|
||||
385
vendor/mbedtls/tests/scripts/components-configuration.sh
vendored
Normal file
385
vendor/mbedtls/tests/scripts/components-configuration.sh
vendored
Normal file
@@ -0,0 +1,385 @@
|
||||
# components-configuration.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Configuration Testing
|
||||
################################################################
|
||||
|
||||
component_test_default_out_of_box () {
|
||||
msg "build: make, default config (out-of-box)" # ~1min
|
||||
make
|
||||
# Disable fancy stuff
|
||||
unset MBEDTLS_TEST_OUTCOME_FILE
|
||||
|
||||
msg "test: main suites make, default config (out-of-box)" # ~10s
|
||||
make test
|
||||
|
||||
msg "selftest: make, default config (out-of-box)" # ~10s
|
||||
programs/test/selftest
|
||||
|
||||
msg "program demos: make, default config (out-of-box)" # ~10s
|
||||
framework/scripts/run_demos.py
|
||||
}
|
||||
|
||||
component_test_default_cmake_gcc_asan () {
|
||||
msg "build: cmake, gcc, ASan" # ~ 1 min 50s
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s
|
||||
make test
|
||||
|
||||
msg "program demos (ASan build)" # ~10s
|
||||
framework/scripts/run_demos.py
|
||||
|
||||
msg "test: selftest (ASan build)" # ~ 10s
|
||||
programs/test/selftest
|
||||
|
||||
msg "test: metatests (GCC, ASan build)"
|
||||
framework/scripts/run-metatests.sh any asan poison
|
||||
|
||||
msg "test: ssl-opt.sh (ASan build)" # ~ 1 min
|
||||
tests/ssl-opt.sh
|
||||
|
||||
msg "test: compat.sh (ASan build)" # ~ 6 min
|
||||
tests/compat.sh
|
||||
|
||||
msg "test: context-info.sh (ASan build)" # ~ 15 sec
|
||||
tests/context-info.sh
|
||||
}
|
||||
|
||||
component_test_default_cmake_gcc_asan_new_bignum () {
|
||||
msg "build: cmake, gcc, ASan" # ~ 1 min 50s
|
||||
scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: main suites (inc. selftests) (ASan build)" # ~ 50s
|
||||
make test
|
||||
|
||||
msg "test: selftest (ASan build)" # ~ 10s
|
||||
programs/test/selftest
|
||||
|
||||
msg "test: ssl-opt.sh (ASan build)" # ~ 1 min
|
||||
tests/ssl-opt.sh
|
||||
|
||||
msg "test: compat.sh (ASan build)" # ~ 6 min
|
||||
tests/compat.sh
|
||||
|
||||
msg "test: context-info.sh (ASan build)" # ~ 15 sec
|
||||
tests/context-info.sh
|
||||
}
|
||||
|
||||
component_test_full_cmake_gcc_asan () {
|
||||
msg "build: full config, cmake, gcc, ASan"
|
||||
scripts/config.py full
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: main suites (inc. selftests) (full config, ASan build)"
|
||||
make test
|
||||
|
||||
msg "test: selftest (full config, ASan build)" # ~ 10s
|
||||
programs/test/selftest
|
||||
|
||||
msg "test: ssl-opt.sh (full config, ASan build)"
|
||||
tests/ssl-opt.sh
|
||||
|
||||
# Note: the next two invocations cover all compat.sh test cases.
|
||||
# We should use the same here and in basic-build-test.sh.
|
||||
msg "test: compat.sh: default version (full config, ASan build)"
|
||||
tests/compat.sh -e 'ARIA\|CHACHA'
|
||||
|
||||
msg "test: compat.sh: next: ARIA, Chacha (full config, ASan build)"
|
||||
env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
|
||||
|
||||
msg "test: context-info.sh (full config, ASan build)" # ~ 15 sec
|
||||
tests/context-info.sh
|
||||
}
|
||||
|
||||
component_test_full_cmake_gcc_asan_new_bignum () {
|
||||
msg "build: full config, cmake, gcc, ASan"
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_ECP_WITH_MPI_UINT
|
||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: main suites (inc. selftests) (full config, new bignum, ASan)"
|
||||
make test
|
||||
|
||||
msg "test: selftest (full config, new bignum, ASan)" # ~ 10s
|
||||
programs/test/selftest
|
||||
|
||||
msg "test: ssl-opt.sh (full config, new bignum, ASan)"
|
||||
tests/ssl-opt.sh
|
||||
|
||||
# Note: the next two invocations cover all compat.sh test cases.
|
||||
# We should use the same here and in basic-build-test.sh.
|
||||
msg "test: compat.sh: default version (full config, new bignum, ASan)"
|
||||
tests/compat.sh -e 'ARIA\|CHACHA'
|
||||
|
||||
msg "test: compat.sh: next: ARIA, Chacha (full config, new bignum, ASan)"
|
||||
env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
|
||||
|
||||
msg "test: context-info.sh (full config, new bignum, ASan)" # ~ 15 sec
|
||||
tests/context-info.sh
|
||||
}
|
||||
|
||||
component_test_full_cmake_clang () {
|
||||
msg "build: cmake, full config, clang" # ~ 50s
|
||||
scripts/config.py full
|
||||
CC=clang CXX=clang cmake -D CMAKE_BUILD_TYPE:String=Release -D ENABLE_TESTING=On -D TEST_CPP=1 .
|
||||
make
|
||||
|
||||
msg "test: main suites (full config, clang)" # ~ 5s
|
||||
make test
|
||||
|
||||
msg "test: cpp_dummy_build (full config, clang)" # ~ 1s
|
||||
programs/test/cpp_dummy_build
|
||||
|
||||
msg "test: metatests (clang)"
|
||||
framework/scripts/run-metatests.sh any pthread
|
||||
|
||||
msg "program demos (full config, clang)" # ~10s
|
||||
framework/scripts/run_demos.py
|
||||
|
||||
msg "test: psa_constant_names (full config, clang)" # ~ 1s
|
||||
$FRAMEWORK/scripts/test_psa_constant_names.py
|
||||
|
||||
msg "test: ssl-opt.sh default, ECJPAKE, SSL async (full config)" # ~ 1s
|
||||
tests/ssl-opt.sh -f 'Default\|ECJPAKE\|SSL async private'
|
||||
}
|
||||
|
||||
component_test_default_no_deprecated () {
|
||||
# Test that removing the deprecated features from the default
|
||||
# configuration leaves something consistent.
|
||||
msg "build: make, default + MBEDTLS_DEPRECATED_REMOVED" # ~ 30s
|
||||
scripts/config.py set MBEDTLS_DEPRECATED_REMOVED
|
||||
make CFLAGS='-O -Werror -Wall -Wextra'
|
||||
|
||||
msg "test: make, default + MBEDTLS_DEPRECATED_REMOVED" # ~ 5s
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_full_no_deprecated () {
|
||||
msg "build: make, full_no_deprecated config" # ~ 30s
|
||||
scripts/config.py full_no_deprecated
|
||||
make CFLAGS='-O -Werror -Wall -Wextra'
|
||||
|
||||
msg "test: make, full_no_deprecated config" # ~ 5s
|
||||
make test
|
||||
|
||||
msg "test: ensure that X509 has no direct dependency on BIGNUM_C"
|
||||
not grep mbedtls_mpi library/libmbedx509.a
|
||||
|
||||
msg "test: ssl-opt.sh authentication, full_no_deprecated config" # ~ 10s
|
||||
tests/ssl-opt.sh -f 'Default\|Authentication'
|
||||
}
|
||||
|
||||
component_test_full_no_deprecated_deprecated_warning () {
|
||||
# Test that there is nothing deprecated in "full_no_deprecated".
|
||||
# A deprecated feature would trigger a warning (made fatal) from
|
||||
# MBEDTLS_DEPRECATED_WARNING.
|
||||
msg "build: make, full_no_deprecated config, MBEDTLS_DEPRECATED_WARNING" # ~ 30s
|
||||
scripts/config.py full_no_deprecated
|
||||
scripts/config.py unset MBEDTLS_DEPRECATED_REMOVED
|
||||
scripts/config.py set MBEDTLS_DEPRECATED_WARNING
|
||||
make CFLAGS='-O -Werror -Wall -Wextra'
|
||||
|
||||
msg "test: make, full_no_deprecated config, MBEDTLS_DEPRECATED_WARNING" # ~ 5s
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_full_deprecated_warning () {
|
||||
# Test that when MBEDTLS_DEPRECATED_WARNING is enabled, the build passes
|
||||
# with only certain whitelisted types of warnings.
|
||||
msg "build: make, full config + MBEDTLS_DEPRECATED_WARNING, expect warnings" # ~ 30s
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_DEPRECATED_WARNING
|
||||
# Expect warnings from '#warning' directives in check_config.h.
|
||||
# Note that gcc is required to allow the use of -Wno-error=cpp, which allows us to
|
||||
# display #warning messages without them being treated as errors.
|
||||
make CC=gcc CFLAGS='-O -Werror -Wall -Wextra -Wno-error=cpp' lib programs
|
||||
|
||||
msg "build: make tests, full config + MBEDTLS_DEPRECATED_WARNING, expect warnings" # ~ 30s
|
||||
# Set MBEDTLS_TEST_DEPRECATED to enable tests for deprecated features.
|
||||
# By default those are disabled when MBEDTLS_DEPRECATED_WARNING is set.
|
||||
# Expect warnings from '#warning' directives in check_config.h and
|
||||
# from the use of deprecated functions in test suites.
|
||||
make CC=gcc CFLAGS='-O -Werror -Wall -Wextra -Wno-error=deprecated-declarations -Wno-error=cpp -DMBEDTLS_TEST_DEPRECATED' tests
|
||||
|
||||
msg "test: full config + MBEDTLS_TEST_DEPRECATED" # ~ 30s
|
||||
make test
|
||||
|
||||
msg "program demos: full config + MBEDTLS_TEST_DEPRECATED" # ~10s
|
||||
framework/scripts/run_demos.py
|
||||
}
|
||||
|
||||
component_build_baremetal () {
|
||||
msg "build: make, baremetal config"
|
||||
scripts/config.py baremetal
|
||||
make CFLAGS="-O1 -Werror -I$PWD/framework/tests/include/baremetal-override/ -DMBEDTLS_TEST_PLATFORM_IS_NOT_UNIXLIKE"
|
||||
}
|
||||
|
||||
support_build_baremetal () {
|
||||
# Older Glibc versions include time.h from other headers such as stdlib.h,
|
||||
# which makes the no-time.h-in-baremetal check fail. Ubuntu 16.04 has this
|
||||
# problem, Ubuntu 18.04 is ok.
|
||||
! grep -q -F time.h /usr/include/x86_64-linux-gnu/sys/types.h
|
||||
}
|
||||
|
||||
component_test_no_psa_crypto_full_cmake_asan () {
|
||||
# full minus MBEDTLS_PSA_CRYPTO_C: run the same set of tests as basic-build-test.sh
|
||||
msg "build: cmake, full config minus PSA crypto, ASan"
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_C
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_CLIENT
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_SSL_PROTO_TLS1_3
|
||||
scripts/config.py unset MBEDTLS_PSA_ITS_FILE_C
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
scripts/config.py unset MBEDTLS_LMS_C
|
||||
scripts/config.py unset MBEDTLS_LMS_PRIVATE
|
||||
CC=$ASAN_CC cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||
make
|
||||
|
||||
msg "test: main suites (full minus PSA crypto)"
|
||||
make test
|
||||
|
||||
# Note: ssl-opt.sh has some test cases that depend on
|
||||
# MBEDTLS_ECP_RESTARTABLE && !MBEDTLS_USE_PSA_CRYPTO
|
||||
# This is the only component where those tests are not skipped.
|
||||
msg "test: ssl-opt.sh (full minus PSA crypto)"
|
||||
tests/ssl-opt.sh
|
||||
|
||||
# Note: the next two invocations cover all compat.sh test cases.
|
||||
# We should use the same here and in basic-build-test.sh.
|
||||
msg "test: compat.sh: default version (full minus PSA crypto)"
|
||||
tests/compat.sh -e 'ARIA\|CHACHA'
|
||||
|
||||
msg "test: compat.sh: next: ARIA, Chacha (full minus PSA crypto)"
|
||||
env OPENSSL="$OPENSSL_NEXT" tests/compat.sh -e '^$' -f 'ARIA\|CHACHA'
|
||||
}
|
||||
|
||||
component_build_tfm () {
|
||||
# Check that the TF-M configuration can build cleanly with various
|
||||
# warning flags enabled. We don't build or run tests, since the
|
||||
# TF-M configuration needs a TF-M platform. A tweaked version of
|
||||
# the configuration that works on mainstream platforms is in
|
||||
# configs/config-tfm.h, tested via test-ref-configs.pl.
|
||||
cp configs/config-tfm.h "$CONFIG_H"
|
||||
|
||||
msg "build: TF-M config, clang, armv7-m thumb2"
|
||||
make lib CC="clang" CFLAGS="--target=arm-linux-gnueabihf -march=armv7-m -mthumb -Os -std=c99 -Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wasm-operand-widths -Wunused -I../framework/tests/include/spe"
|
||||
|
||||
msg "build: TF-M config, gcc native build"
|
||||
make clean
|
||||
make lib CC="gcc" CFLAGS="-Os -std=c99 -Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wformat-signedness -Wlogical-op -I../framework/tests/include/spe"
|
||||
}
|
||||
|
||||
component_test_no_platform () {
|
||||
# Full configuration build, without platform support, file IO and net sockets.
|
||||
# This should catch missing mbedtls_printf definitions, and by disabling file
|
||||
# IO, it should catch missing '#include <stdio.h>'
|
||||
msg "build: full config except platform/fsio/net, make, gcc, C99" # ~ 30s
|
||||
scripts/config.py full_no_platform
|
||||
scripts/config.py unset MBEDTLS_PLATFORM_C
|
||||
scripts/config.py unset MBEDTLS_NET_C
|
||||
scripts/config.py unset MBEDTLS_FS_IO
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
scripts/config.py unset MBEDTLS_PSA_ITS_FILE_C
|
||||
scripts/config.py unset MBEDTLS_ENTROPY_NV_SEED
|
||||
# Note, _DEFAULT_SOURCE needs to be defined for platforms using glibc version >2.19,
|
||||
# to re-enable platform integration features otherwise disabled in C99 builds
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -std=c99 -pedantic -Os -D_DEFAULT_SOURCE' lib programs
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -Os' test
|
||||
}
|
||||
|
||||
component_test_memory_buffer_allocator_backtrace () {
|
||||
msg "build: default config with memory buffer allocator and backtrace enabled"
|
||||
scripts/config.py set MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
||||
scripts/config.py set MBEDTLS_PLATFORM_MEMORY
|
||||
scripts/config.py set MBEDTLS_MEMORY_BACKTRACE
|
||||
scripts/config.py set MBEDTLS_MEMORY_DEBUG
|
||||
cmake -DCMAKE_BUILD_TYPE:String=Release .
|
||||
make
|
||||
|
||||
msg "test: MBEDTLS_MEMORY_BUFFER_ALLOC_C and MBEDTLS_MEMORY_BACKTRACE"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_memory_buffer_allocator () {
|
||||
msg "build: default config with memory buffer allocator"
|
||||
scripts/config.py set MBEDTLS_MEMORY_BUFFER_ALLOC_C
|
||||
scripts/config.py set MBEDTLS_PLATFORM_MEMORY
|
||||
cmake -DCMAKE_BUILD_TYPE:String=Release .
|
||||
make
|
||||
|
||||
msg "test: MBEDTLS_MEMORY_BUFFER_ALLOC_C"
|
||||
make test
|
||||
|
||||
msg "test: ssl-opt.sh, MBEDTLS_MEMORY_BUFFER_ALLOC_C"
|
||||
# MBEDTLS_MEMORY_BUFFER_ALLOC is slow. Skip tests that tend to time out.
|
||||
tests/ssl-opt.sh -e '^DTLS proxy'
|
||||
}
|
||||
|
||||
component_test_malloc_0_null () {
|
||||
msg "build: malloc(0) returns NULL (ASan+UBSan build)"
|
||||
scripts/config.py full
|
||||
make CC=$ASAN_CC CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"$PWD/tests/configs/user-config-malloc-0-null.h\"' $ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS"
|
||||
|
||||
msg "test: malloc(0) returns NULL (ASan+UBSan build)"
|
||||
make test
|
||||
|
||||
msg "selftest: malloc(0) returns NULL (ASan+UBSan build)"
|
||||
# Just the calloc selftest. "make test" ran the others as part of the
|
||||
# test suites.
|
||||
programs/test/selftest calloc
|
||||
|
||||
msg "test ssl-opt.sh: malloc(0) returns NULL (ASan+UBSan build)"
|
||||
# Run a subset of the tests. The choice is a balance between coverage
|
||||
# and time (including time indirectly wasted due to flaky tests).
|
||||
# The current choice is to skip tests whose description includes
|
||||
# "proxy", which is an approximation of skipping tests that use the
|
||||
# UDP proxy, which tend to be slower and flakier.
|
||||
tests/ssl-opt.sh -e 'proxy'
|
||||
}
|
||||
|
||||
component_build_mbedtls_config_file () {
|
||||
msg "build: make with MBEDTLS_CONFIG_FILE" # ~40s
|
||||
scripts/config.py -w full_config.h full
|
||||
echo '#error "MBEDTLS_CONFIG_FILE is not working"' >"$CONFIG_H"
|
||||
make CFLAGS="-I '$PWD' -DMBEDTLS_CONFIG_FILE='\"full_config.h\"'"
|
||||
# Make sure this feature is enabled. We'll disable it in the next phase.
|
||||
programs/test/query_compile_time_config MBEDTLS_NIST_KW_C
|
||||
make clean
|
||||
|
||||
msg "build: make with MBEDTLS_CONFIG_FILE + MBEDTLS_USER_CONFIG_FILE"
|
||||
# In the user config, disable one feature (for simplicity, pick a feature
|
||||
# that nothing else depends on).
|
||||
echo '#undef MBEDTLS_NIST_KW_C' >user_config.h
|
||||
make CFLAGS="-I '$PWD' -DMBEDTLS_CONFIG_FILE='\"full_config.h\"' -DMBEDTLS_USER_CONFIG_FILE='\"user_config.h\"'"
|
||||
not programs/test/query_compile_time_config MBEDTLS_NIST_KW_C
|
||||
|
||||
rm -f user_config.h full_config.h
|
||||
}
|
||||
|
||||
component_test_no_strings () {
|
||||
msg "build: no strings" # ~10s
|
||||
scripts/config.py full
|
||||
# Disable options that activate a large amount of string constants.
|
||||
scripts/config.py unset MBEDTLS_DEBUG_C
|
||||
scripts/config.py unset MBEDTLS_ERROR_C
|
||||
scripts/config.py set MBEDTLS_ERROR_STRERROR_DUMMY
|
||||
scripts/config.py unset MBEDTLS_VERSION_FEATURES
|
||||
make CFLAGS='-Werror -Os'
|
||||
|
||||
msg "test: no strings" # ~ 10s
|
||||
make test
|
||||
}
|
||||
617
vendor/mbedtls/tests/scripts/components-platform.sh
vendored
Normal file
617
vendor/mbedtls/tests/scripts/components-platform.sh
vendored
Normal file
@@ -0,0 +1,617 @@
|
||||
# components-platform.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Platform Testing
|
||||
################################################################
|
||||
|
||||
support_test_aesni () {
|
||||
# Check that gcc targets x86_64 (we can build AESNI), and check for
|
||||
# AESNI support on the host (we can run AESNI).
|
||||
#
|
||||
# The name of this function is possibly slightly misleading, but needs to align
|
||||
# with the name of the corresponding test, component_test_aesni.
|
||||
#
|
||||
# In principle 32-bit x86 can support AESNI, but our implementation does not
|
||||
# support 32-bit x86, so we check for x86-64.
|
||||
# We can only grep /proc/cpuinfo on Linux, so this also checks for Linux
|
||||
(gcc -v 2>&1 | grep Target | grep -q x86_64) &&
|
||||
[[ "$HOSTTYPE" == "x86_64" && "$OSTYPE" == "linux-gnu" ]] &&
|
||||
(lscpu | grep -qw aes)
|
||||
}
|
||||
|
||||
component_test_aesni () { # ~ 60s
|
||||
# This tests the two AESNI implementations (intrinsics and assembly), and also the plain C
|
||||
# fallback. It also tests the logic that is used to select which implementation(s) to build.
|
||||
#
|
||||
# This test does not require the host to have support for AESNI (if it doesn't, the run-time
|
||||
# AESNI detection will fallback to the plain C implementation, so the tests will instead
|
||||
# exercise the plain C impl).
|
||||
|
||||
msg "build: default config with different AES implementations"
|
||||
scripts/config.py set MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
scripts/config.py set MBEDTLS_HAVE_ASM
|
||||
|
||||
# test the intrinsics implementation
|
||||
msg "AES tests, test intrinsics"
|
||||
make clean
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mpclmul -msse2 -maes'
|
||||
# check that we built intrinsics - this should be used by default when supported by the compiler
|
||||
./programs/test/selftest aes | grep "AESNI code" | grep -q "intrinsics"
|
||||
|
||||
# test the asm implementation
|
||||
msg "AES tests, test assembly"
|
||||
make clean
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mno-pclmul -mno-sse2 -mno-aes'
|
||||
# check that we built assembly - this should be built if the compiler does not support intrinsics
|
||||
./programs/test/selftest aes | grep "AESNI code" | grep -q "assembly"
|
||||
|
||||
# test the plain C implementation
|
||||
scripts/config.py unset MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
msg "AES tests, plain C"
|
||||
make clean
|
||||
make CC=gcc CFLAGS='-O2 -Werror'
|
||||
# check that there is no AESNI code present
|
||||
./programs/test/selftest aes | not grep -q "AESNI code"
|
||||
not grep -q "AES note: using AESNI" ./programs/test/selftest
|
||||
grep -q "AES note: built-in implementation." ./programs/test/selftest
|
||||
|
||||
# test the intrinsics implementation
|
||||
scripts/config.py set MBEDTLS_AESNI_C
|
||||
scripts/config.py set MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
msg "AES tests, test AESNI only"
|
||||
make clean
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra -mpclmul -msse2 -maes'
|
||||
./programs/test/selftest aes | grep -q "AES note: using AESNI"
|
||||
./programs/test/selftest aes | not grep -q "AES note: built-in implementation."
|
||||
grep -q "AES note: using AESNI" ./programs/test/selftest
|
||||
not grep -q "AES note: built-in implementation." ./programs/test/selftest
|
||||
}
|
||||
|
||||
support_test_aesni_m32 () {
|
||||
support_test_m32_no_asm && (lscpu | grep -qw aes)
|
||||
}
|
||||
|
||||
component_test_aesni_m32 () { # ~ 60s
|
||||
# This tests are duplicated from component_test_aesni for i386 target
|
||||
#
|
||||
# AESNI intrinsic code supports i386 and assembly code does not support it.
|
||||
|
||||
msg "build: default config with different AES implementations"
|
||||
scripts/config.py set MBEDTLS_AESNI_C
|
||||
scripts/config.py set MBEDTLS_PADLOCK_C
|
||||
scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
scripts/config.py set MBEDTLS_HAVE_ASM
|
||||
|
||||
# test the intrinsics implementation with gcc
|
||||
msg "AES tests, test intrinsics (gcc)"
|
||||
make clean
|
||||
make CC=gcc CFLAGS='-m32 -Werror -Wall -Wextra' LDFLAGS='-m32'
|
||||
# check that we built intrinsics - this should be used by default when supported by the compiler
|
||||
./programs/test/selftest aes | grep "AESNI code" | grep -q "intrinsics"
|
||||
grep -q "AES note: using AESNI" ./programs/test/selftest
|
||||
grep -q "AES note: built-in implementation." ./programs/test/selftest
|
||||
grep -q "AES note: using VIA Padlock" ./programs/test/selftest
|
||||
grep -q mbedtls_aesni_has_support ./programs/test/selftest
|
||||
|
||||
scripts/config.py set MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
||||
scripts/config.py set MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
msg "AES tests, test AESNI only"
|
||||
make clean
|
||||
make CC=gcc CFLAGS='-m32 -Werror -Wall -Wextra -mpclmul -msse2 -maes' LDFLAGS='-m32'
|
||||
./programs/test/selftest aes | grep -q "AES note: using AESNI"
|
||||
./programs/test/selftest aes | not grep -q "AES note: built-in implementation."
|
||||
grep -q "AES note: using AESNI" ./programs/test/selftest
|
||||
not grep -q "AES note: built-in implementation." ./programs/test/selftest
|
||||
not grep -q "AES note: using VIA Padlock" ./programs/test/selftest
|
||||
not grep -q mbedtls_aesni_has_support ./programs/test/selftest
|
||||
}
|
||||
|
||||
support_test_aesni_m32_clang () {
|
||||
# clang >= 4 is required to build with target attributes
|
||||
support_test_aesni_m32 && [[ $(clang_version) -ge 4 ]]
|
||||
}
|
||||
|
||||
component_test_aesni_m32_clang () {
|
||||
|
||||
scripts/config.py set MBEDTLS_AESNI_C
|
||||
scripts/config.py set MBEDTLS_PADLOCK_C
|
||||
scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
scripts/config.py set MBEDTLS_HAVE_ASM
|
||||
|
||||
# test the intrinsics implementation with clang
|
||||
msg "AES tests, test intrinsics (clang)"
|
||||
make clean
|
||||
make CC=clang CFLAGS='-m32 -Werror -Wall -Wextra' LDFLAGS='-m32'
|
||||
# check that we built intrinsics - this should be used by default when supported by the compiler
|
||||
./programs/test/selftest aes | grep "AESNI code" | grep -q "intrinsics"
|
||||
grep -q "AES note: using AESNI" ./programs/test/selftest
|
||||
grep -q "AES note: built-in implementation." ./programs/test/selftest
|
||||
grep -q "AES note: using VIA Padlock" ./programs/test/selftest
|
||||
grep -q mbedtls_aesni_has_support ./programs/test/selftest
|
||||
}
|
||||
|
||||
support_build_aes_armce () {
|
||||
# clang >= 11 is required to build with AES extensions
|
||||
[[ $(clang_version) -ge 11 ]]
|
||||
}
|
||||
|
||||
component_build_aes_armce () {
|
||||
# Test variations of AES with Armv8 crypto extensions
|
||||
scripts/config.py set MBEDTLS_AESCE_C
|
||||
scripts/config.py set MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
|
||||
msg "MBEDTLS_AES_USE_HARDWARE_ONLY, clang, aarch64"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=aarch64-linux-gnu -march=armv8-a+crypto"
|
||||
msg "clang, test aarch64 crypto instructions built"
|
||||
grep -E 'aes[a-z]+\s*[qv]' library/aesce.s
|
||||
|
||||
msg "MBEDTLS_AES_USE_HARDWARE_ONLY, clang, arm"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a72+crypto -marm"
|
||||
msg "clang, test A32 crypto instructions built"
|
||||
grep -E 'aes[0-9a-z]+.[0-9]\s*[qv]' library/aesce.s
|
||||
|
||||
msg "MBEDTLS_AES_USE_HARDWARE_ONLY, clang, thumb"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a32+crypto -mthumb"
|
||||
msg "clang, test T32 crypto instructions built"
|
||||
grep -E 'aes[0-9a-z]+.[0-9]\s*[qv]' library/aesce.s
|
||||
|
||||
scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
|
||||
msg "MBEDTLS_AES_USE_both, clang, aarch64"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=aarch64-linux-gnu -march=armv8-a+crypto"
|
||||
msg "clang, test aarch64 crypto instructions built"
|
||||
grep -E 'aes[a-z]+\s*[qv]' library/aesce.s
|
||||
|
||||
msg "MBEDTLS_AES_USE_both, clang, arm"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a72+crypto -marm"
|
||||
msg "clang, test A32 crypto instructions built"
|
||||
grep -E 'aes[0-9a-z]+.[0-9]\s*[qv]' library/aesce.s
|
||||
|
||||
msg "MBEDTLS_AES_USE_both, clang, thumb"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a32+crypto -mthumb"
|
||||
msg "clang, test T32 crypto instructions built"
|
||||
grep -E 'aes[0-9a-z]+.[0-9]\s*[qv]' library/aesce.s
|
||||
|
||||
scripts/config.py unset MBEDTLS_AESCE_C
|
||||
|
||||
msg "no MBEDTLS_AESCE_C, clang, aarch64"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=aarch64-linux-gnu -march=armv8-a"
|
||||
msg "clang, test aarch64 crypto instructions not built"
|
||||
not grep -E 'aes[a-z]+\s*[qv]' library/aesce.s
|
||||
|
||||
msg "no MBEDTLS_AESCE_C, clang, arm"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a72 -marm"
|
||||
msg "clang, test A32 crypto instructions not built"
|
||||
not grep -E 'aes[0-9a-z]+.[0-9]\s*[qv]' library/aesce.s
|
||||
|
||||
msg "no MBEDTLS_AESCE_C, clang, thumb"
|
||||
make -B library/aesce.o library/aesce.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a32 -mthumb"
|
||||
msg "clang, test T32 crypto instructions not built"
|
||||
not grep -E 'aes[0-9a-z]+.[0-9]\s*[qv]' library/aesce.s
|
||||
}
|
||||
|
||||
support_build_sha_armce () {
|
||||
# clang >= 4 is required to build with SHA extensions
|
||||
[[ $(clang_version) -ge 4 ]]
|
||||
}
|
||||
|
||||
component_build_sha_armce () {
|
||||
scripts/config.py unset MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT
|
||||
|
||||
# Test variations of SHA256 Armv8 crypto extensions
|
||||
scripts/config.py set MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY
|
||||
msg "MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY clang, aarch64"
|
||||
make -B library/sha256.o library/sha256.s CC=clang CFLAGS="--target=aarch64-linux-gnu -march=armv8-a+crypto"
|
||||
msg "MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY clang, test aarch64 crypto instructions built"
|
||||
grep -E 'sha256[a-z0-9]+\s+[qv]' library/sha256.s
|
||||
|
||||
msg "MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY clang, arm"
|
||||
make -B library/sha256.o library/sha256.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a72+crypto -marm"
|
||||
msg "MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY clang, test A32 crypto instructions built"
|
||||
grep -E 'sha256[a-z0-9]+.32\s+[qv]' library/sha256.s
|
||||
scripts/config.py unset MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY
|
||||
|
||||
|
||||
# test the deprecated form of the config option
|
||||
scripts/config.py set MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY
|
||||
msg "MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY clang, thumb"
|
||||
make -B library/sha256.o library/sha256.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a32+crypto -mthumb"
|
||||
msg "MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY clang, test T32 crypto instructions built"
|
||||
grep -E 'sha256[a-z0-9]+.32\s+[qv]' library/sha256.s
|
||||
scripts/config.py unset MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY
|
||||
|
||||
scripts/config.py set MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT
|
||||
msg "MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT clang, aarch64"
|
||||
make -B library/sha256.o library/sha256.s CC=clang CFLAGS="--target=aarch64-linux-gnu -march=armv8-a+crypto"
|
||||
msg "MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT clang, test aarch64 crypto instructions built"
|
||||
grep -E 'sha256[a-z0-9]+\s+[qv]' library/sha256.s
|
||||
scripts/config.py unset MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT
|
||||
|
||||
|
||||
# test the deprecated form of the config option
|
||||
scripts/config.py set MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT
|
||||
msg "MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT clang, arm"
|
||||
make -B library/sha256.o library/sha256.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a72+crypto -marm -std=c99"
|
||||
|
||||
msg "MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT clang, thumb"
|
||||
make -B library/sha256.o library/sha256.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a32+crypto -mthumb"
|
||||
msg "MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT clang, test T32 crypto instructions built"
|
||||
grep -E 'sha256[a-z0-9]+.32\s+[qv]' library/sha256.s
|
||||
scripts/config.py unset MBEDTLS_SHA256_USE_A64_CRYPTO_IF_PRESENT
|
||||
|
||||
# examine the disassembly for absence of SHA instructions
|
||||
msg "clang, test A32 crypto instructions not built"
|
||||
make -B library/sha256.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a72 -marm"
|
||||
not grep -E 'sha256[a-z0-9]+.32\s+[qv]' library/sha256.s
|
||||
|
||||
msg "clang, test T32 crypto instructions not built"
|
||||
make -B library/sha256.s CC=clang CFLAGS="--target=arm-linux-gnueabihf -mcpu=cortex-a32 -mthumb"
|
||||
not grep -E 'sha256[a-z0-9]+.32\s+[qv]' library/sha256.s
|
||||
|
||||
msg "clang, test aarch64 crypto instructions not built"
|
||||
make -B library/sha256.s CC=clang CFLAGS="--target=aarch64-linux-gnu -march=armv8-a"
|
||||
not grep -E 'sha256[a-z0-9]+\s+[qv]' library/sha256.s
|
||||
}
|
||||
|
||||
component_test_m32_no_asm () {
|
||||
# Build without assembly, so as to use portable C code (in a 32-bit
|
||||
# build) and not the i386-specific inline assembly.
|
||||
#
|
||||
# Note that we require gcc, because clang Asan builds fail to link for
|
||||
# this target (cannot find libclang_rt.lsan-i386.a - this is a known clang issue).
|
||||
msg "build: i386, make, gcc, no asm (ASan build)" # ~ 30s
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_HAVE_ASM
|
||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
||||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI for 32-bit is tested in test_aesni_m32
|
||||
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32" LDFLAGS="-m32 $ASAN_CFLAGS"
|
||||
|
||||
msg "test: i386, make, gcc, no asm (ASan build)"
|
||||
make test
|
||||
}
|
||||
|
||||
support_test_m32_no_asm () {
|
||||
case $(uname -m) in
|
||||
amd64|x86_64) true;;
|
||||
*) false;;
|
||||
esac
|
||||
}
|
||||
|
||||
component_test_m32_o2 () {
|
||||
# Build with optimization, to use the i386 specific inline assembly
|
||||
# and go faster for tests.
|
||||
msg "build: i386, make, gcc -O2 (ASan build)" # ~ 30s
|
||||
scripts/config.py full
|
||||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI for 32-bit is tested in test_aesni_m32
|
||||
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32" LDFLAGS="-m32 $ASAN_CFLAGS"
|
||||
|
||||
msg "test: i386, make, gcc -O2 (ASan build)"
|
||||
make test
|
||||
|
||||
msg "test ssl-opt.sh, i386, make, gcc-O2"
|
||||
tests/ssl-opt.sh
|
||||
}
|
||||
|
||||
support_test_m32_o2 () {
|
||||
support_test_m32_no_asm "$@"
|
||||
}
|
||||
|
||||
component_test_m32_everest () {
|
||||
msg "build: i386, Everest ECDH context (ASan build)" # ~ 6 min
|
||||
scripts/config.py set MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
|
||||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI for 32-bit is tested in test_aesni_m32
|
||||
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32" LDFLAGS="-m32 $ASAN_CFLAGS"
|
||||
|
||||
msg "test: i386, Everest ECDH context - main suites (inc. selftests) (ASan build)" # ~ 50s
|
||||
make test
|
||||
|
||||
msg "test: i386, Everest ECDH context - ECDH-related part of ssl-opt.sh (ASan build)" # ~ 5s
|
||||
tests/ssl-opt.sh -f ECDH
|
||||
|
||||
msg "test: i386, Everest ECDH context - compat.sh with some ECDH ciphersuites (ASan build)" # ~ 3 min
|
||||
# Exclude some symmetric ciphers that are redundant here to gain time.
|
||||
tests/compat.sh -f ECDH -V NO -e 'ARIA\|CAMELLIA\|CHACHA'
|
||||
}
|
||||
|
||||
support_test_m32_everest () {
|
||||
support_test_m32_no_asm "$@"
|
||||
}
|
||||
|
||||
component_test_mx32 () {
|
||||
msg "build: 64-bit ILP32, make, gcc" # ~ 30s
|
||||
scripts/config.py full
|
||||
make CC=gcc CFLAGS='-O2 -Werror -Wall -Wextra -mx32' LDFLAGS='-mx32'
|
||||
|
||||
msg "test: 64-bit ILP32, make, gcc"
|
||||
make test
|
||||
}
|
||||
|
||||
support_test_mx32 () {
|
||||
case $(uname -m) in
|
||||
amd64|x86_64) true;;
|
||||
*) false;;
|
||||
esac
|
||||
}
|
||||
|
||||
component_test_arm_linux_gnueabi_gcc_arm5vte () {
|
||||
# Mimic Debian armel port
|
||||
msg "test: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -march=arm5vte, default config" # ~4m
|
||||
make CC="${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc" AR="${ARM_LINUX_GNUEABI_GCC_PREFIX}ar" CFLAGS='-Werror -Wall -Wextra -march=armv5te -O1'
|
||||
|
||||
msg "test: main suites make, default config (out-of-box)" # ~7m 40s
|
||||
make test
|
||||
|
||||
msg "selftest: make, default config (out-of-box)" # ~0s
|
||||
programs/test/selftest
|
||||
|
||||
msg "program demos: make, default config (out-of-box)" # ~0s
|
||||
framework/scripts/run_demos.py
|
||||
}
|
||||
|
||||
support_test_arm_linux_gnueabi_gcc_arm5vte () {
|
||||
can_run_arm_linux_gnueabi
|
||||
}
|
||||
|
||||
# The hard float ABI is not implemented for Thumb 1, so use gnueabi
|
||||
# Some Thumb 1 asm is sensitive to optimisation level, so test both -O0 and -Os
|
||||
component_test_arm_linux_gnueabi_gcc_thumb_1_opt_0 () {
|
||||
msg "test: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -O0, thumb 1, default config" # ~2m 10s
|
||||
make CC="${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc" CFLAGS='-std=c99 -Werror -Wextra -O0 -mcpu=arm1136j-s -mthumb'
|
||||
|
||||
msg "test: main suites make, default config (out-of-box)" # ~36m
|
||||
make test
|
||||
|
||||
msg "selftest: make, default config (out-of-box)" # ~10s
|
||||
programs/test/selftest
|
||||
|
||||
msg "program demos: make, default config (out-of-box)" # ~0s
|
||||
framework/scripts/run_demos.py
|
||||
}
|
||||
|
||||
support_test_arm_linux_gnueabi_gcc_thumb_1_opt_0 () {
|
||||
can_run_arm_linux_gnueabi
|
||||
}
|
||||
|
||||
component_test_arm_linux_gnueabi_gcc_thumb_1_opt_s () {
|
||||
msg "test: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -Os, thumb 1, default config" # ~3m 10s
|
||||
make CC="${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc" CFLAGS='-std=c99 -Werror -Wextra -Os -mcpu=arm1136j-s -mthumb'
|
||||
|
||||
msg "test: main suites make, default config (out-of-box)" # ~21m 10s
|
||||
make test
|
||||
|
||||
msg "selftest: make, default config (out-of-box)" # ~2s
|
||||
programs/test/selftest
|
||||
|
||||
msg "program demos: make, default config (out-of-box)" # ~0s
|
||||
framework/scripts/run_demos.py
|
||||
}
|
||||
|
||||
support_test_arm_linux_gnueabi_gcc_thumb_1_opt_s () {
|
||||
can_run_arm_linux_gnueabi
|
||||
}
|
||||
|
||||
component_test_arm_linux_gnueabihf_gcc_armv7 () {
|
||||
msg "test: ${ARM_LINUX_GNUEABIHF_GCC_PREFIX}gcc -O2, A32, default config" # ~4m 30s
|
||||
make CC="${ARM_LINUX_GNUEABIHF_GCC_PREFIX}gcc" CFLAGS='-std=c99 -Werror -Wextra -O2 -march=armv7-a -marm'
|
||||
|
||||
msg "test: main suites make, default config (out-of-box)" # ~3m 30s
|
||||
make test
|
||||
|
||||
msg "selftest: make, default config (out-of-box)" # ~0s
|
||||
programs/test/selftest
|
||||
|
||||
msg "program demos: make, default config (out-of-box)" # ~0s
|
||||
framework/scripts/run_demos.py
|
||||
}
|
||||
|
||||
support_test_arm_linux_gnueabihf_gcc_armv7 () {
|
||||
can_run_arm_linux_gnueabihf
|
||||
}
|
||||
|
||||
component_test_arm_linux_gnueabihf_gcc_thumb_2 () {
|
||||
msg "test: ${ARM_LINUX_GNUEABIHF_GCC_PREFIX}gcc -Os, thumb 2, default config" # ~4m
|
||||
make CC="${ARM_LINUX_GNUEABIHF_GCC_PREFIX}gcc" CFLAGS='-std=c99 -Werror -Wextra -Os -march=armv7-a -mthumb'
|
||||
|
||||
msg "test: main suites make, default config (out-of-box)" # ~3m 40s
|
||||
make test
|
||||
|
||||
msg "selftest: make, default config (out-of-box)" # ~0s
|
||||
programs/test/selftest
|
||||
|
||||
msg "program demos: make, default config (out-of-box)" # ~0s
|
||||
framework/scripts/run_demos.py
|
||||
}
|
||||
|
||||
support_test_arm_linux_gnueabihf_gcc_thumb_2 () {
|
||||
can_run_arm_linux_gnueabihf
|
||||
}
|
||||
|
||||
component_test_aarch64_linux_gnu_gcc () {
|
||||
msg "test: ${AARCH64_LINUX_GNU_GCC_PREFIX}gcc -O2, default config" # ~3m 50s
|
||||
make CC="${AARCH64_LINUX_GNU_GCC_PREFIX}gcc" CFLAGS='-std=c99 -Werror -Wextra -O2'
|
||||
|
||||
msg "test: main suites make, default config (out-of-box)" # ~1m 50s
|
||||
make test
|
||||
|
||||
msg "selftest: make, default config (out-of-box)" # ~0s
|
||||
programs/test/selftest
|
||||
|
||||
msg "program demos: make, default config (out-of-box)" # ~0s
|
||||
framework/scripts/run_demos.py
|
||||
}
|
||||
|
||||
support_test_aarch64_linux_gnu_gcc () {
|
||||
# Minimum version of GCC for MBEDTLS_AESCE_C is 6.0
|
||||
[ "$(gcc_version "${AARCH64_LINUX_GNU_GCC_PREFIX}gcc")" -ge 6 ] && can_run_aarch64_linux_gnu
|
||||
}
|
||||
|
||||
component_build_arm_none_eabi_gcc () {
|
||||
msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -O1, baremetal+debug" # ~ 10s
|
||||
scripts/config.py baremetal
|
||||
make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra -O1' lib
|
||||
|
||||
msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -O1, baremetal+debug"
|
||||
${ARM_NONE_EABI_GCC_PREFIX}size -t library/*.o
|
||||
}
|
||||
|
||||
component_build_arm_linux_gnueabi_gcc_arm5vte () {
|
||||
msg "build: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -march=arm5vte, baremetal+debug" # ~ 10s
|
||||
scripts/config.py baremetal
|
||||
# Build for a target platform that's close to what Debian uses
|
||||
# for its "armel" distribution (https://wiki.debian.org/ArmEabiPort).
|
||||
# See https://github.com/Mbed-TLS/mbedtls/pull/2169 and comments.
|
||||
# Build everything including programs, see for example
|
||||
# https://github.com/Mbed-TLS/mbedtls/pull/3449#issuecomment-675313720
|
||||
make CC="${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc" AR="${ARM_LINUX_GNUEABI_GCC_PREFIX}ar" CFLAGS='-Werror -Wall -Wextra -march=armv5te -O1' LDFLAGS='-march=armv5te'
|
||||
|
||||
msg "size: ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc -march=armv5te -O1, baremetal+debug"
|
||||
${ARM_LINUX_GNUEABI_GCC_PREFIX}size -t library/*.o
|
||||
}
|
||||
|
||||
support_build_arm_linux_gnueabi_gcc_arm5vte () {
|
||||
type ${ARM_LINUX_GNUEABI_GCC_PREFIX}gcc >/dev/null 2>&1
|
||||
}
|
||||
|
||||
component_build_arm_none_eabi_gcc_arm5vte () {
|
||||
msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -march=arm5vte, baremetal+debug" # ~ 10s
|
||||
scripts/config.py baremetal
|
||||
# This is an imperfect substitute for
|
||||
# component_build_arm_linux_gnueabi_gcc_arm5vte
|
||||
# in case the gcc-arm-linux-gnueabi toolchain is not available
|
||||
make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" CFLAGS='-std=c99 -Werror -Wall -Wextra -march=armv5te -O1' LDFLAGS='-march=armv5te' SHELL='sh -x' lib
|
||||
|
||||
msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -march=armv5te -O1, baremetal+debug"
|
||||
${ARM_NONE_EABI_GCC_PREFIX}size -t library/*.o
|
||||
}
|
||||
|
||||
component_build_arm_none_eabi_gcc_m0plus () {
|
||||
msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -mthumb -mcpu=cortex-m0plus, baremetal_size" # ~ 10s
|
||||
scripts/config.py baremetal_size
|
||||
make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra -mthumb -mcpu=cortex-m0plus -Os' lib
|
||||
|
||||
msg "size: ${ARM_NONE_EABI_GCC_PREFIX}gcc -mthumb -mcpu=cortex-m0plus -Os, baremetal_size"
|
||||
${ARM_NONE_EABI_GCC_PREFIX}size -t library/*.o
|
||||
for lib in library/*.a; do
|
||||
echo "$lib:"
|
||||
${ARM_NONE_EABI_GCC_PREFIX}size -t $lib | grep TOTALS
|
||||
done
|
||||
}
|
||||
|
||||
component_build_arm_none_eabi_gcc_no_udbl_division () {
|
||||
msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc -DMBEDTLS_NO_UDBL_DIVISION, make" # ~ 10s
|
||||
scripts/config.py baremetal
|
||||
scripts/config.py set MBEDTLS_NO_UDBL_DIVISION
|
||||
make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -Wall -Wextra' lib
|
||||
echo "Checking that software 64-bit division is not required"
|
||||
not grep __aeabi_uldiv library/*.o
|
||||
}
|
||||
|
||||
component_build_arm_none_eabi_gcc_no_64bit_multiplication () {
|
||||
msg "build: ${ARM_NONE_EABI_GCC_PREFIX}gcc MBEDTLS_NO_64BIT_MULTIPLICATION, make" # ~ 10s
|
||||
scripts/config.py baremetal
|
||||
scripts/config.py set MBEDTLS_NO_64BIT_MULTIPLICATION
|
||||
make CC="${ARM_NONE_EABI_GCC_PREFIX}gcc" AR="${ARM_NONE_EABI_GCC_PREFIX}ar" LD="${ARM_NONE_EABI_GCC_PREFIX}ld" CFLAGS='-std=c99 -Werror -O1 -march=armv6-m -mthumb' lib
|
||||
echo "Checking that software 64-bit multiplication is not required"
|
||||
not grep __aeabi_lmul library/*.o
|
||||
}
|
||||
|
||||
component_build_arm_clang_thumb () {
|
||||
# ~ 30s
|
||||
|
||||
scripts/config.py baremetal
|
||||
|
||||
msg "build: clang thumb 2, make"
|
||||
make clean
|
||||
make CC="clang" CFLAGS='-std=c99 -Werror -Os --target=arm-linux-gnueabihf -march=armv7-m -mthumb' lib
|
||||
|
||||
# Some Thumb 1 asm is sensitive to optimisation level, so test both -O0 and -Os
|
||||
msg "build: clang thumb 1 -O0, make"
|
||||
make clean
|
||||
make CC="clang" CFLAGS='-std=c99 -Werror -O0 --target=arm-linux-gnueabihf -mcpu=arm1136j-s -mthumb' lib
|
||||
|
||||
msg "build: clang thumb 1 -Os, make"
|
||||
make clean
|
||||
make CC="clang" CFLAGS='-std=c99 -Werror -Os --target=arm-linux-gnueabihf -mcpu=arm1136j-s -mthumb' lib
|
||||
}
|
||||
|
||||
component_build_armcc () {
|
||||
# Common configuration for all the builds below
|
||||
scripts/config.py baremetal
|
||||
|
||||
# armc[56] don't support SHA-512 intrinsics
|
||||
scripts/config.py unset MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT
|
||||
|
||||
# older versions of armcc/armclang don't support AESCE_C on 32-bit Arm
|
||||
scripts/config.py unset MBEDTLS_AESCE_C
|
||||
|
||||
# Stop armclang warning about feature detection for A64_CRYPTO.
|
||||
# With this enabled, the library does build correctly under armclang,
|
||||
# but in baremetal builds (as tested here), feature detection is
|
||||
# unavailable, and the user is notified via a #warning. So enabling
|
||||
# this feature would prevent us from building with -Werror on
|
||||
# armclang. Tracked in #7198.
|
||||
scripts/config.py unset MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT
|
||||
|
||||
scripts/config.py set MBEDTLS_HAVE_ASM
|
||||
|
||||
# Compile mostly with -O1 since some Arm inline assembly is disabled for -O0.
|
||||
|
||||
# ARM Compiler 6 - Target ARMv7-A
|
||||
helper_armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv7-a"
|
||||
|
||||
# ARM Compiler 6 - Target ARMv7-M
|
||||
helper_armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv7-m"
|
||||
|
||||
# ARM Compiler 6 - Target ARMv7-M+DSP
|
||||
helper_armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv7-m+dsp"
|
||||
|
||||
# ARM Compiler 6 - Target ARMv8-A - AArch32
|
||||
helper_armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv8.2-a"
|
||||
|
||||
# ARM Compiler 6 - Target ARMv8-M
|
||||
helper_armc6_build_test "-O1 --target=arm-arm-none-eabi -march=armv8-m.main"
|
||||
|
||||
# ARM Compiler 6 - Target Cortex-M0 - no optimisation
|
||||
helper_armc6_build_test "-O0 --target=arm-arm-none-eabi -mcpu=cortex-m0"
|
||||
|
||||
# ARM Compiler 6 - Target Cortex-M0
|
||||
helper_armc6_build_test "-Os --target=arm-arm-none-eabi -mcpu=cortex-m0"
|
||||
|
||||
# ARM Compiler 6 - Target ARMv8.2-A - AArch64
|
||||
#
|
||||
# Re-enable MBEDTLS_AESCE_C as this should be supported by the version of armclang
|
||||
# that we have in our CI
|
||||
scripts/config.py set MBEDTLS_AESCE_C
|
||||
helper_armc6_build_test "-O1 --target=aarch64-arm-none-eabi -march=armv8.2-a+crypto"
|
||||
}
|
||||
|
||||
support_build_armcc () {
|
||||
armc6_cc="$ARMC6_BIN_DIR/armclang"
|
||||
(check_tools "$armc6_cc" > /dev/null 2>&1)
|
||||
}
|
||||
|
||||
# For timebeing, no VIA Padlock platform available.
|
||||
component_build_aes_via_padlock () {
|
||||
|
||||
msg "AES:VIA PadLock, build with default configuration."
|
||||
scripts/config.py unset MBEDTLS_AESNI_C
|
||||
scripts/config.py set MBEDTLS_PADLOCK_C
|
||||
scripts/config.py unset MBEDTLS_AES_USE_HARDWARE_ONLY
|
||||
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32" LDFLAGS="-m32 $ASAN_CFLAGS"
|
||||
grep -q mbedtls_padlock_has_support ./programs/test/selftest
|
||||
|
||||
}
|
||||
|
||||
support_build_aes_via_padlock_only () {
|
||||
( [ "$MBEDTLS_TEST_PLATFORM" == "Linux-x86_64" ] || \
|
||||
[ "$MBEDTLS_TEST_PLATFORM" == "Linux-amd64" ] ) && \
|
||||
[ "`dpkg --print-foreign-architectures`" == "i386" ]
|
||||
}
|
||||
236
vendor/mbedtls/tests/scripts/components-sanitizers.sh
vendored
Normal file
236
vendor/mbedtls/tests/scripts/components-sanitizers.sh
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
# components-sanitizers.sh
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This file contains test components that are executed by all.sh
|
||||
|
||||
################################################################
|
||||
#### Sanitizer Testing
|
||||
################################################################
|
||||
|
||||
skip_suites_without_constant_flow () {
|
||||
# Skip the test suites that don't have any constant-flow annotations.
|
||||
# This will need to be adjusted if we ever start declaring things as
|
||||
# secret from macros or functions inside framework/tests/include or framework/tests/src.
|
||||
SKIP_TEST_SUITES=$(
|
||||
git -C tests/suites grep -L TEST_CF_ 'test_suite_*.function' |
|
||||
sed 's/test_suite_//; s/\.function$//' |
|
||||
tr '\n' ,)
|
||||
export SKIP_TEST_SUITES
|
||||
}
|
||||
|
||||
skip_all_except_given_suite () {
|
||||
# Skip all but the given test suite
|
||||
SKIP_TEST_SUITES=$(
|
||||
ls -1 tests/suites/test_suite_*.function |
|
||||
grep -v $1.function |
|
||||
sed 's/tests.suites.test_suite_//; s/\.function$//' |
|
||||
tr '\n' ,)
|
||||
export SKIP_TEST_SUITES
|
||||
}
|
||||
|
||||
component_test_memsan_constant_flow () {
|
||||
# This tests both (1) accesses to undefined memory, and (2) branches or
|
||||
# memory access depending on secret values. To distinguish between those:
|
||||
# - unset MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN - does the failure persist?
|
||||
# - or alternatively, change the build type to MemSanDbg, which enables
|
||||
# origin tracking and nicer stack traces (which are useful for debugging
|
||||
# anyway), and check if the origin was TEST_CF_SECRET() or something else.
|
||||
msg "build: cmake MSan (clang), full config minus MBEDTLS_USE_PSA_CRYPTO with constant flow testing"
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_AESNI_C # memsan doesn't grok asm
|
||||
scripts/config.py unset MBEDTLS_HAVE_ASM
|
||||
CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
|
||||
make
|
||||
|
||||
msg "test: main suites (full minus MBEDTLS_USE_PSA_CRYPTO, Msan + constant flow)"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_memsan_constant_flow_psa () {
|
||||
# This tests both (1) accesses to undefined memory, and (2) branches or
|
||||
# memory access depending on secret values. To distinguish between those:
|
||||
# - unset MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN - does the failure persist?
|
||||
# - or alternatively, change the build type to MemSanDbg, which enables
|
||||
# origin tracking and nicer stack traces (which are useful for debugging
|
||||
# anyway), and check if the origin was TEST_CF_SECRET() or something else.
|
||||
msg "build: cmake MSan (clang), full config with constant flow testing"
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN
|
||||
scripts/config.py unset MBEDTLS_AESNI_C # memsan doesn't grok asm
|
||||
scripts/config.py unset MBEDTLS_HAVE_ASM
|
||||
CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
|
||||
make
|
||||
|
||||
msg "test: main suites (Msan + constant flow)"
|
||||
make test
|
||||
}
|
||||
|
||||
component_release_test_valgrind_constant_flow () {
|
||||
# This tests both (1) everything that valgrind's memcheck usually checks
|
||||
# (heap buffer overflows, use of uninitialized memory, use-after-free,
|
||||
# etc.) and (2) branches or memory access depending on secret values,
|
||||
# which will be reported as uninitialized memory. To distinguish between
|
||||
# secret and actually uninitialized:
|
||||
# - unset MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND - does the failure persist?
|
||||
# - or alternatively, build with debug info and manually run the offending
|
||||
# test suite with valgrind --track-origins=yes, then check if the origin
|
||||
# was TEST_CF_SECRET() or something else.
|
||||
msg "build: cmake release GCC, full config minus MBEDTLS_USE_PSA_CRYPTO with constant flow testing"
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
skip_suites_without_constant_flow
|
||||
cmake -D CMAKE_BUILD_TYPE:String=Release .
|
||||
make
|
||||
|
||||
# this only shows a summary of the results (how many of each type)
|
||||
# details are left in Testing/<date>/DynamicAnalysis.xml
|
||||
msg "test: some suites (full minus MBEDTLS_USE_PSA_CRYPTO, valgrind + constant flow)"
|
||||
make memcheck
|
||||
|
||||
# Test asm path in constant time module - by default, it will test the plain C
|
||||
# path under Valgrind or Memsan. Running only the constant_time tests is fast (<1s)
|
||||
msg "test: valgrind asm constant_time"
|
||||
skip_all_except_given_suite test_suite_constant_time
|
||||
cmake -D CMAKE_BUILD_TYPE:String=Release .
|
||||
make clean
|
||||
make
|
||||
make memcheck
|
||||
}
|
||||
|
||||
component_release_test_valgrind_constant_flow_no_asm () {
|
||||
# This tests both (1) everything that valgrind's memcheck usually checks
|
||||
# (heap buffer overflows, use of uninitialized memory, use-after-free,
|
||||
# etc.) and (2) branches or memory access depending on secret values,
|
||||
# which will be reported as uninitialized memory. To distinguish between
|
||||
# secret and actually uninitialized:
|
||||
# - unset MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND - does the failure persist?
|
||||
# - or alternatively, build with debug info and manually run the offending
|
||||
# test suite with valgrind --track-origins=yes, then check if the origin
|
||||
# was TEST_CF_SECRET() or something else.
|
||||
msg "build: cmake release GCC, full config minus MBEDTLS_USE_PSA_CRYPTO, minus MBEDTLS_HAVE_ASM with constant flow testing"
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
|
||||
scripts/config.py unset MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py unset MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_HAVE_ASM
|
||||
skip_suites_without_constant_flow
|
||||
cmake -D CMAKE_BUILD_TYPE:String=Release .
|
||||
make
|
||||
|
||||
# this only shows a summary of the results (how many of each type)
|
||||
# details are left in Testing/<date>/DynamicAnalysis.xml
|
||||
msg "test: some suites (full minus MBEDTLS_USE_PSA_CRYPTO, minus MBEDTLS_HAVE_ASM, valgrind + constant flow)"
|
||||
make memcheck
|
||||
}
|
||||
|
||||
component_release_test_valgrind_constant_flow_psa () {
|
||||
# This tests both (1) everything that valgrind's memcheck usually checks
|
||||
# (heap buffer overflows, use of uninitialized memory, use-after-free,
|
||||
# etc.) and (2) branches or memory access depending on secret values,
|
||||
# which will be reported as uninitialized memory. To distinguish between
|
||||
# secret and actually uninitialized:
|
||||
# - unset MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND - does the failure persist?
|
||||
# - or alternatively, build with debug info and manually run the offending
|
||||
# test suite with valgrind --track-origins=yes, then check if the origin
|
||||
# was TEST_CF_SECRET() or something else.
|
||||
msg "build: cmake release GCC, full config with constant flow testing"
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
|
||||
skip_suites_without_constant_flow
|
||||
cmake -D CMAKE_BUILD_TYPE:String=Release .
|
||||
make
|
||||
|
||||
# this only shows a summary of the results (how many of each type)
|
||||
# details are left in Testing/<date>/DynamicAnalysis.xml
|
||||
msg "test: some suites (valgrind + constant flow)"
|
||||
make memcheck
|
||||
}
|
||||
|
||||
component_test_tsan () {
|
||||
msg "build: TSan (clang)"
|
||||
scripts/config.py full
|
||||
scripts/config.py set MBEDTLS_THREADING_C
|
||||
scripts/config.py set MBEDTLS_THREADING_PTHREAD
|
||||
# Self-tests do not currently use multiple threads.
|
||||
scripts/config.py unset MBEDTLS_SELF_TEST
|
||||
|
||||
# The deprecated MBEDTLS_PSA_CRYPTO_SE_C interface is not thread safe.
|
||||
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
|
||||
|
||||
CC=clang cmake -D CMAKE_BUILD_TYPE:String=TSan .
|
||||
make
|
||||
|
||||
msg "test: main suites (TSan)"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_memsan () {
|
||||
msg "build: MSan (clang)" # ~ 1 min 20s
|
||||
scripts/config.py unset MBEDTLS_AESNI_C # memsan doesn't grok asm
|
||||
scripts/config.py unset MBEDTLS_HAVE_ASM
|
||||
CC=clang cmake -D CMAKE_BUILD_TYPE:String=MemSan .
|
||||
make
|
||||
|
||||
msg "test: main suites (MSan)" # ~ 10s
|
||||
make test
|
||||
|
||||
msg "test: metatests (MSan)"
|
||||
framework/scripts/run-metatests.sh any msan
|
||||
|
||||
msg "program demos (MSan)" # ~20s
|
||||
framework/scripts/run_demos.py
|
||||
|
||||
msg "test: ssl-opt.sh (MSan)" # ~ 1 min
|
||||
tests/ssl-opt.sh
|
||||
|
||||
# Optional part(s)
|
||||
|
||||
if [ "$MEMORY" -gt 0 ]; then
|
||||
msg "test: compat.sh (MSan)" # ~ 6 min 20s
|
||||
tests/compat.sh
|
||||
fi
|
||||
}
|
||||
|
||||
component_release_test_valgrind () {
|
||||
msg "build: Release (clang)"
|
||||
# default config, in particular without MBEDTLS_USE_PSA_CRYPTO
|
||||
CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release .
|
||||
make
|
||||
|
||||
msg "test: main suites, Valgrind (default config)"
|
||||
make memcheck
|
||||
|
||||
# Optional parts (slow; currently broken on OS X because programs don't
|
||||
# seem to receive signals under valgrind on OS X).
|
||||
# These optional parts don't run on the CI.
|
||||
if [ "$MEMORY" -gt 0 ]; then
|
||||
msg "test: ssl-opt.sh --memcheck (default config)"
|
||||
tests/ssl-opt.sh --memcheck
|
||||
fi
|
||||
|
||||
if [ "$MEMORY" -gt 1 ]; then
|
||||
msg "test: compat.sh --memcheck (default config)"
|
||||
tests/compat.sh --memcheck
|
||||
fi
|
||||
|
||||
if [ "$MEMORY" -gt 0 ]; then
|
||||
msg "test: context-info.sh --memcheck (default config)"
|
||||
tests/context-info.sh --memcheck
|
||||
fi
|
||||
}
|
||||
|
||||
component_release_test_valgrind_psa () {
|
||||
msg "build: Release, full (clang)"
|
||||
# full config, in particular with MBEDTLS_USE_PSA_CRYPTO
|
||||
scripts/config.py full
|
||||
CC=clang cmake -D CMAKE_BUILD_TYPE:String=Release .
|
||||
make
|
||||
|
||||
msg "test: main suites, Valgrind (full config)"
|
||||
make memcheck
|
||||
}
|
||||
557
vendor/mbedtls/tests/scripts/depends.py
vendored
Executable file
557
vendor/mbedtls/tests/scripts/depends.py
vendored
Executable file
@@ -0,0 +1,557 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
"""
|
||||
Test Mbed TLS with a subset of algorithms.
|
||||
|
||||
This script can be divided into several steps:
|
||||
|
||||
First, include/mbedtls/mbedtls_config.h or a different config file passed
|
||||
in the arguments is parsed to extract any configuration options (using config.py).
|
||||
|
||||
Then, test domains (groups of jobs, tests) are built based on predefined data
|
||||
collected in the DomainData class. Here, each domain has five major traits:
|
||||
- domain name, can be used to run only specific tests via command-line;
|
||||
- configuration building method, described in detail below;
|
||||
- list of symbols passed to the configuration building method;
|
||||
- commands to be run on each job (only build, build and test, or any other custom);
|
||||
- optional list of symbols to be excluded from testing.
|
||||
|
||||
The configuration building method can be one of the three following:
|
||||
|
||||
- ComplementaryDomain - build a job for each passed symbol by disabling a single
|
||||
symbol and its reverse dependencies (defined in REVERSE_DEPENDENCIES);
|
||||
|
||||
- ExclusiveDomain - build a job where, for each passed symbol, only this particular
|
||||
one is defined and other symbols from the list are unset. For each job look for
|
||||
any non-standard symbols to set/unset in EXCLUSIVE_GROUPS. These are usually not
|
||||
direct dependencies, but rather non-trivial results of other configs missing. Then
|
||||
look for any unset symbols and handle their reverse dependencies.
|
||||
Examples of EXCLUSIVE_GROUPS usage:
|
||||
- MBEDTLS_SHA512_C job turns off all hashes except SHA512. MBEDTLS_SSL_COOKIE_C
|
||||
requires either SHA256 or SHA384 to work, so it also has to be disabled.
|
||||
This is not a dependency on SHA512_C, but a result of an exclusive domain
|
||||
config building method. Relevant field:
|
||||
'MBEDTLS_SHA512_C': ['-MBEDTLS_SSL_COOKIE_C'],
|
||||
|
||||
- DualDomain - combination of the two above - both complementary and exclusive domain
|
||||
job generation code will be run. Currently only used for hashes.
|
||||
|
||||
Lastly, the collected jobs are executed and (optionally) tested, with
|
||||
error reporting and coloring as configured in options. Each test starts with
|
||||
a full config without a couple of slowing down or unnecessary options
|
||||
(see set_reference_config), then the specific job config is derived.
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
from typing import Union
|
||||
|
||||
# Add the Mbed TLS Python library directory to the module search path
|
||||
import scripts_path # pylint: disable=unused-import
|
||||
import config
|
||||
|
||||
class Colors: # pylint: disable=too-few-public-methods
|
||||
"""Minimalistic support for colored output.
|
||||
Each field of an object of this class is either None if colored output
|
||||
is not possible or not desired, or a pair of strings (start, stop) such
|
||||
that outputting start switches the text color to the desired color and
|
||||
stop switches the text color back to the default."""
|
||||
red = None
|
||||
green = None
|
||||
cyan = None
|
||||
bold_red = None
|
||||
bold_green = None
|
||||
def __init__(self, options=None):
|
||||
"""Initialize color profile according to passed options."""
|
||||
if not options or options.color in ['no', 'never']:
|
||||
want_color = False
|
||||
elif options.color in ['yes', 'always']:
|
||||
want_color = True
|
||||
else:
|
||||
want_color = sys.stderr.isatty()
|
||||
if want_color:
|
||||
# Assume ANSI compatible terminal
|
||||
normal = '\033[0m'
|
||||
self.red = ('\033[31m', normal)
|
||||
self.green = ('\033[32m', normal)
|
||||
self.cyan = ('\033[36m', normal)
|
||||
self.bold_red = ('\033[1;31m', normal)
|
||||
self.bold_green = ('\033[1;32m', normal)
|
||||
NO_COLORS = Colors(None)
|
||||
|
||||
def log_line(text, prefix='depends.py:', suffix='', color=None):
|
||||
"""Print a status message."""
|
||||
if color is not None:
|
||||
prefix = color[0] + prefix
|
||||
suffix = suffix + color[1]
|
||||
sys.stderr.write(prefix + ' ' + text + suffix + '\n')
|
||||
sys.stderr.flush()
|
||||
|
||||
def log_command(cmd):
|
||||
"""Print a trace of the specified command.
|
||||
cmd is a list of strings: a command name and its arguments."""
|
||||
log_line(' '.join(cmd), prefix='+')
|
||||
|
||||
def backup_config(options):
|
||||
"""Back up the library configuration file (mbedtls_config.h).
|
||||
If the backup file already exists, it is presumed to be the desired backup,
|
||||
so don't make another backup."""
|
||||
if os.path.exists(options.config_backup):
|
||||
options.own_backup = False
|
||||
else:
|
||||
options.own_backup = True
|
||||
shutil.copy(options.config, options.config_backup)
|
||||
|
||||
def restore_config(options):
|
||||
"""Restore the library configuration file (mbedtls_config.h).
|
||||
Remove the backup file if it was saved earlier."""
|
||||
if options.own_backup:
|
||||
shutil.move(options.config_backup, options.config)
|
||||
else:
|
||||
shutil.copy(options.config_backup, options.config)
|
||||
|
||||
def option_exists(conf, option):
|
||||
return option in conf.settings
|
||||
|
||||
def set_config_option_value(conf, option, colors, value: Union[bool, str]):
|
||||
"""Set/unset a configuration option, optionally specifying a value.
|
||||
value can be either True/False (set/unset config option), or a string,
|
||||
which will make a symbol defined with a certain value."""
|
||||
if not option_exists(conf, option):
|
||||
log_line('Symbol {} was not found in {}'.format(option, conf.filename), color=colors.red)
|
||||
return False
|
||||
|
||||
if value is False:
|
||||
log_command(['config.py', 'unset', option])
|
||||
conf.unset(option)
|
||||
elif value is True:
|
||||
log_command(['config.py', 'set', option])
|
||||
conf.set(option)
|
||||
else:
|
||||
log_command(['config.py', 'set', option, value])
|
||||
conf.set(option, value)
|
||||
return True
|
||||
|
||||
def set_reference_config(conf, options, colors):
|
||||
"""Change the library configuration file (mbedtls_config.h) to the reference state.
|
||||
The reference state is the one from which the tested configurations are
|
||||
derived."""
|
||||
# Turn off options that are not relevant to the tests and slow them down.
|
||||
log_command(['config.py', 'full'])
|
||||
conf.adapt(config.full_adapter)
|
||||
set_config_option_value(conf, 'MBEDTLS_TEST_HOOKS', colors, False)
|
||||
set_config_option_value(conf, 'MBEDTLS_PSA_CRYPTO_CONFIG', colors, False)
|
||||
if options.unset_use_psa:
|
||||
set_config_option_value(conf, 'MBEDTLS_USE_PSA_CRYPTO', colors, False)
|
||||
|
||||
class Job:
|
||||
"""A job builds the library in a specific configuration and runs some tests."""
|
||||
def __init__(self, name, config_settings, commands):
|
||||
"""Build a job object.
|
||||
The job uses the configuration described by config_settings. This is a
|
||||
dictionary where the keys are preprocessor symbols and the values are
|
||||
booleans or strings. A boolean indicates whether or not to #define the
|
||||
symbol. With a string, the symbol is #define'd to that value.
|
||||
After setting the configuration, the job runs the programs specified by
|
||||
commands. This is a list of lists of strings; each list of string is a
|
||||
command name and its arguments and is passed to subprocess.call with
|
||||
shell=False."""
|
||||
self.name = name
|
||||
self.config_settings = config_settings
|
||||
self.commands = commands
|
||||
|
||||
def announce(self, colors, what):
|
||||
'''Announce the start or completion of a job.
|
||||
If what is None, announce the start of the job.
|
||||
If what is True, announce that the job has passed.
|
||||
If what is False, announce that the job has failed.'''
|
||||
if what is True:
|
||||
log_line(self.name + ' PASSED', color=colors.green)
|
||||
elif what is False:
|
||||
log_line(self.name + ' FAILED', color=colors.red)
|
||||
else:
|
||||
log_line('starting ' + self.name, color=colors.cyan)
|
||||
|
||||
def configure(self, conf, options, colors):
|
||||
'''Set library configuration options as required for the job.'''
|
||||
set_reference_config(conf, options, colors)
|
||||
for key, value in sorted(self.config_settings.items()):
|
||||
ret = set_config_option_value(conf, key, colors, value)
|
||||
if ret is False:
|
||||
return False
|
||||
return True
|
||||
|
||||
def test(self, options):
|
||||
'''Run the job's build and test commands.
|
||||
Return True if all the commands succeed and False otherwise.
|
||||
If options.keep_going is false, stop as soon as one command fails. Otherwise
|
||||
run all the commands, except that if the first command fails, none of the
|
||||
other commands are run (typically, the first command is a build command
|
||||
and subsequent commands are tests that cannot run if the build failed).'''
|
||||
built = False
|
||||
success = True
|
||||
for command in self.commands:
|
||||
log_command(command)
|
||||
env = os.environ.copy()
|
||||
if 'MBEDTLS_TEST_CONFIGURATION' in env:
|
||||
env['MBEDTLS_TEST_CONFIGURATION'] += '-' + self.name
|
||||
ret = subprocess.call(command, env=env)
|
||||
if ret != 0:
|
||||
if command[0] not in ['make', options.make_command]:
|
||||
log_line('*** [{}] Error {}'.format(' '.join(command), ret))
|
||||
if not options.keep_going or not built:
|
||||
return False
|
||||
success = False
|
||||
built = True
|
||||
return success
|
||||
|
||||
# If the configuration option A requires B, make sure that
|
||||
# B in REVERSE_DEPENDENCIES[A].
|
||||
# All the information here should be contained in check_config.h. This
|
||||
# file includes a copy because it changes rarely and it would be a pain
|
||||
# to extract automatically.
|
||||
REVERSE_DEPENDENCIES = {
|
||||
'MBEDTLS_AES_C': ['MBEDTLS_CTR_DRBG_C',
|
||||
'MBEDTLS_NIST_KW_C'],
|
||||
'MBEDTLS_CHACHA20_C': ['MBEDTLS_CHACHAPOLY_C'],
|
||||
'MBEDTLS_ECDSA_C': ['MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED'],
|
||||
'MBEDTLS_ECP_C': ['MBEDTLS_ECDSA_C',
|
||||
'MBEDTLS_ECDH_C',
|
||||
'MBEDTLS_ECJPAKE_C',
|
||||
'MBEDTLS_ECP_RESTARTABLE',
|
||||
'MBEDTLS_PK_PARSE_EC_EXTENDED',
|
||||
'MBEDTLS_PK_PARSE_EC_COMPRESSED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED',
|
||||
'MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED',
|
||||
'MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED'],
|
||||
'MBEDTLS_ECP_DP_SECP256R1_ENABLED': ['MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED'],
|
||||
'MBEDTLS_PKCS1_V21': ['MBEDTLS_X509_RSASSA_PSS_SUPPORT'],
|
||||
'MBEDTLS_PKCS1_V15': ['MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_RSA_ENABLED'],
|
||||
'MBEDTLS_RSA_C': ['MBEDTLS_X509_RSASSA_PSS_SUPPORT',
|
||||
'MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_RSA_ENABLED',
|
||||
'MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED'],
|
||||
'MBEDTLS_SHA256_C': ['MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED',
|
||||
'MBEDTLS_ENTROPY_FORCE_SHA256',
|
||||
'MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT',
|
||||
'MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY',
|
||||
'MBEDTLS_LMS_C',
|
||||
'MBEDTLS_LMS_PRIVATE'],
|
||||
'MBEDTLS_SHA512_C': ['MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT',
|
||||
'MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY'],
|
||||
'MBEDTLS_SHA224_C': ['MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED',
|
||||
'MBEDTLS_ENTROPY_FORCE_SHA256',
|
||||
'MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_IF_PRESENT',
|
||||
'MBEDTLS_SHA256_USE_ARMV8_A_CRYPTO_ONLY'],
|
||||
'MBEDTLS_X509_RSASSA_PSS_SUPPORT': []
|
||||
}
|
||||
|
||||
# If an option is tested in an exclusive test, alter the following defines.
|
||||
# These are not necessarily dependencies, but just minimal required changes
|
||||
# if a given define is the only one enabled from an exclusive group.
|
||||
EXCLUSIVE_GROUPS = {
|
||||
'MBEDTLS_SHA512_C': ['-MBEDTLS_SSL_COOKIE_C',
|
||||
'-MBEDTLS_SSL_TLS_C'],
|
||||
'MBEDTLS_ECP_DP_CURVE448_ENABLED': ['-MBEDTLS_ECDSA_C',
|
||||
'-MBEDTLS_ECDSA_DETERMINISTIC',
|
||||
'-MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED',
|
||||
'-MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED',
|
||||
'-MBEDTLS_ECJPAKE_C',
|
||||
'-MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED'],
|
||||
'MBEDTLS_ECP_DP_CURVE25519_ENABLED': ['-MBEDTLS_ECDSA_C',
|
||||
'-MBEDTLS_ECDSA_DETERMINISTIC',
|
||||
'-MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED',
|
||||
'-MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED',
|
||||
'-MBEDTLS_ECJPAKE_C',
|
||||
'-MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED'],
|
||||
'MBEDTLS_ARIA_C': ['-MBEDTLS_CMAC_C'],
|
||||
'MBEDTLS_CAMELLIA_C': ['-MBEDTLS_CMAC_C'],
|
||||
'MBEDTLS_CHACHA20_C': ['-MBEDTLS_CMAC_C', '-MBEDTLS_CCM_C', '-MBEDTLS_GCM_C'],
|
||||
'MBEDTLS_DES_C': ['-MBEDTLS_CCM_C',
|
||||
'-MBEDTLS_GCM_C',
|
||||
'-MBEDTLS_SSL_TICKET_C',
|
||||
'-MBEDTLS_SSL_CONTEXT_SERIALIZATION'],
|
||||
}
|
||||
def handle_exclusive_groups(config_settings, symbol):
|
||||
"""For every symbol tested in an exclusive group check if there are other
|
||||
defines to be altered. """
|
||||
for dep in EXCLUSIVE_GROUPS.get(symbol, []):
|
||||
unset = dep.startswith('-')
|
||||
dep = dep[1:]
|
||||
config_settings[dep] = not unset
|
||||
|
||||
def turn_off_dependencies(config_settings):
|
||||
"""For every option turned off config_settings, also turn off what depends on it.
|
||||
An option O is turned off if config_settings[O] is False."""
|
||||
for key, value in sorted(config_settings.items()):
|
||||
if value is not False:
|
||||
continue
|
||||
for dep in REVERSE_DEPENDENCIES.get(key, []):
|
||||
config_settings[dep] = False
|
||||
|
||||
class BaseDomain: # pylint: disable=too-few-public-methods, unused-argument
|
||||
"""A base class for all domains."""
|
||||
def __init__(self, symbols, commands, exclude):
|
||||
"""Initialize the jobs container"""
|
||||
self.jobs = []
|
||||
|
||||
class ExclusiveDomain(BaseDomain): # pylint: disable=too-few-public-methods
|
||||
"""A domain consisting of a set of conceptually-equivalent settings.
|
||||
Establish a list of configuration symbols. For each symbol, run a test job
|
||||
with this symbol set and the others unset."""
|
||||
def __init__(self, symbols, commands, exclude=None):
|
||||
"""Build a domain for the specified list of configuration symbols.
|
||||
The domain contains a set of jobs that enable one of the elements
|
||||
of symbols and disable the others.
|
||||
Each job runs the specified commands.
|
||||
If exclude is a regular expression, skip generated jobs whose description
|
||||
would match this regular expression."""
|
||||
super().__init__(symbols, commands, exclude)
|
||||
base_config_settings = {}
|
||||
for symbol in symbols:
|
||||
base_config_settings[symbol] = False
|
||||
for symbol in symbols:
|
||||
description = symbol
|
||||
if exclude and re.match(exclude, description):
|
||||
continue
|
||||
config_settings = base_config_settings.copy()
|
||||
config_settings[symbol] = True
|
||||
handle_exclusive_groups(config_settings, symbol)
|
||||
turn_off_dependencies(config_settings)
|
||||
job = Job(description, config_settings, commands)
|
||||
self.jobs.append(job)
|
||||
|
||||
class ComplementaryDomain(BaseDomain): # pylint: disable=too-few-public-methods
|
||||
"""A domain consisting of a set of loosely-related settings.
|
||||
Establish a list of configuration symbols. For each symbol, run a test job
|
||||
with this symbol unset.
|
||||
If exclude is a regular expression, skip generated jobs whose description
|
||||
would match this regular expression."""
|
||||
def __init__(self, symbols, commands, exclude=None):
|
||||
"""Build a domain for the specified list of configuration symbols.
|
||||
Each job in the domain disables one of the specified symbols.
|
||||
Each job runs the specified commands."""
|
||||
super().__init__(symbols, commands, exclude)
|
||||
for symbol in symbols:
|
||||
description = '!' + symbol
|
||||
if exclude and re.match(exclude, description):
|
||||
continue
|
||||
config_settings = {symbol: False}
|
||||
turn_off_dependencies(config_settings)
|
||||
job = Job(description, config_settings, commands)
|
||||
self.jobs.append(job)
|
||||
|
||||
class DualDomain(ExclusiveDomain, ComplementaryDomain): # pylint: disable=too-few-public-methods
|
||||
"""A domain that contains both the ExclusiveDomain and BaseDomain tests.
|
||||
Both parent class __init__ calls are performed in any order and
|
||||
each call adds respective jobs. The job array initialization is done once in
|
||||
BaseDomain, before the parent __init__ calls."""
|
||||
|
||||
class CipherInfo: # pylint: disable=too-few-public-methods
|
||||
"""Collect data about cipher.h."""
|
||||
def __init__(self):
|
||||
self.base_symbols = set()
|
||||
with open('include/mbedtls/cipher.h', encoding="utf-8") as fh:
|
||||
for line in fh:
|
||||
m = re.match(r' *MBEDTLS_CIPHER_ID_(\w+),', line)
|
||||
if m and m.group(1) not in ['NONE', 'NULL', '3DES']:
|
||||
self.base_symbols.add('MBEDTLS_' + m.group(1) + '_C')
|
||||
|
||||
class DomainData:
|
||||
"""A container for domains and jobs, used to structurize testing."""
|
||||
def config_symbols_matching(self, regexp):
|
||||
"""List the mbedtls_config.h settings matching regexp."""
|
||||
return [symbol for symbol in self.all_config_symbols
|
||||
if re.match(regexp, symbol)]
|
||||
|
||||
def __init__(self, options, conf):
|
||||
"""Gather data about the library and establish a list of domains to test."""
|
||||
build_command = [options.make_command, 'CFLAGS=-Werror -O2']
|
||||
build_and_test = [build_command, [options.make_command, 'test']]
|
||||
self.all_config_symbols = set(conf.settings.keys())
|
||||
# Find hash modules by name.
|
||||
hash_symbols = self.config_symbols_matching(r'MBEDTLS_(MD|RIPEMD|SHA)[0-9]+_C\Z')
|
||||
# Find elliptic curve enabling macros by name.
|
||||
curve_symbols = self.config_symbols_matching(r'MBEDTLS_ECP_DP_\w+_ENABLED\Z')
|
||||
# Find key exchange enabling macros by name.
|
||||
key_exchange_symbols = self.config_symbols_matching(r'MBEDTLS_KEY_EXCHANGE_\w+_ENABLED\Z')
|
||||
# Find cipher IDs (block permutations and stream ciphers --- chaining
|
||||
# and padding modes are exercised separately) information by parsing
|
||||
# cipher.h, as the information is not readily available in mbedtls_config.h.
|
||||
cipher_info = CipherInfo()
|
||||
# Find block cipher chaining and padding mode enabling macros by name.
|
||||
cipher_chaining_symbols = self.config_symbols_matching(r'MBEDTLS_CIPHER_MODE_\w+\Z')
|
||||
cipher_padding_symbols = self.config_symbols_matching(r'MBEDTLS_CIPHER_PADDING_\w+\Z')
|
||||
self.domains = {
|
||||
# Cipher IDs, chaining modes and padding modes. Run the test suites.
|
||||
'cipher_id': ExclusiveDomain(cipher_info.base_symbols,
|
||||
build_and_test),
|
||||
'cipher_chaining': ExclusiveDomain(cipher_chaining_symbols,
|
||||
build_and_test),
|
||||
'cipher_padding': ExclusiveDomain(cipher_padding_symbols,
|
||||
build_and_test),
|
||||
# Elliptic curves. Run the test suites.
|
||||
'curves': ExclusiveDomain(curve_symbols, build_and_test),
|
||||
# Hash algorithms. Excluding exclusive domains of MD, RIPEMD, SHA1,
|
||||
# SHA224 and SHA384 because MBEDTLS_ENTROPY_C is extensively used
|
||||
# across various modules, but it depends on either SHA256 or SHA512.
|
||||
# As a consequence an "exclusive" test of anything other than SHA256
|
||||
# or SHA512 with MBEDTLS_ENTROPY_C enabled is not possible.
|
||||
'hashes': DualDomain(hash_symbols, build_and_test,
|
||||
exclude=r'MBEDTLS_(MD|RIPEMD|SHA1_)' \
|
||||
'|MBEDTLS_SHA224_' \
|
||||
'|MBEDTLS_SHA384_' \
|
||||
'|MBEDTLS_SHA3_'),
|
||||
# Key exchange types.
|
||||
'kex': ExclusiveDomain(key_exchange_symbols, build_and_test),
|
||||
'pkalgs': ComplementaryDomain(['MBEDTLS_ECDSA_C',
|
||||
'MBEDTLS_ECP_C',
|
||||
'MBEDTLS_PKCS1_V21',
|
||||
'MBEDTLS_PKCS1_V15',
|
||||
'MBEDTLS_RSA_C',
|
||||
'MBEDTLS_X509_RSASSA_PSS_SUPPORT'],
|
||||
build_and_test),
|
||||
}
|
||||
self.jobs = {}
|
||||
for domain in self.domains.values():
|
||||
for job in domain.jobs:
|
||||
self.jobs[job.name] = job
|
||||
|
||||
def get_jobs(self, name):
|
||||
"""Return the list of jobs identified by the given name.
|
||||
A name can either be the name of a domain or the name of one specific job."""
|
||||
if name in self.domains:
|
||||
return sorted(self.domains[name].jobs, key=lambda job: job.name)
|
||||
else:
|
||||
return [self.jobs[name]]
|
||||
|
||||
def run(options, job, conf, colors=NO_COLORS):
|
||||
"""Run the specified job (a Job instance)."""
|
||||
subprocess.check_call([options.make_command, 'clean'])
|
||||
job.announce(colors, None)
|
||||
if not job.configure(conf, options, colors):
|
||||
job.announce(colors, False)
|
||||
return False
|
||||
conf.write()
|
||||
success = job.test(options)
|
||||
job.announce(colors, success)
|
||||
return success
|
||||
|
||||
def run_tests(options, domain_data, conf):
|
||||
"""Run the desired jobs.
|
||||
domain_data should be a DomainData instance that describes the available
|
||||
domains and jobs.
|
||||
Run the jobs listed in options.tasks."""
|
||||
if not hasattr(options, 'config_backup'):
|
||||
options.config_backup = options.config + '.bak'
|
||||
colors = Colors(options)
|
||||
jobs = []
|
||||
failures = []
|
||||
successes = []
|
||||
for name in options.tasks:
|
||||
jobs += domain_data.get_jobs(name)
|
||||
backup_config(options)
|
||||
try:
|
||||
for job in jobs:
|
||||
success = run(options, job, conf, colors=colors)
|
||||
if not success:
|
||||
if options.keep_going:
|
||||
failures.append(job.name)
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
successes.append(job.name)
|
||||
restore_config(options)
|
||||
except:
|
||||
# Restore the configuration, except in stop-on-error mode if there
|
||||
# was an error, where we leave the failing configuration up for
|
||||
# developer convenience.
|
||||
if options.keep_going:
|
||||
restore_config(options)
|
||||
raise
|
||||
if successes:
|
||||
log_line('{} passed'.format(' '.join(successes)), color=colors.bold_green)
|
||||
if failures:
|
||||
log_line('{} FAILED'.format(' '.join(failures)), color=colors.bold_red)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def main():
|
||||
try:
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description=
|
||||
"Test Mbed TLS with a subset of algorithms.\n\n"
|
||||
"Example usage:\n"
|
||||
r"./tests/scripts/depends.py \!MBEDTLS_SHA1_C MBEDTLS_SHA256_C""\n"
|
||||
"./tests/scripts/depends.py MBEDTLS_AES_C hashes\n"
|
||||
"./tests/scripts/depends.py cipher_id cipher_chaining\n")
|
||||
parser.add_argument('--color', metavar='WHEN',
|
||||
help='Colorize the output (always/auto/never)',
|
||||
choices=['always', 'auto', 'never'], default='auto')
|
||||
parser.add_argument('-c', '--config', metavar='FILE',
|
||||
help='Configuration file to modify',
|
||||
default='include/mbedtls/mbedtls_config.h')
|
||||
parser.add_argument('-C', '--directory', metavar='DIR',
|
||||
help='Change to this directory before anything else',
|
||||
default='.')
|
||||
parser.add_argument('-k', '--keep-going',
|
||||
help='Try all configurations even if some fail (default)',
|
||||
action='store_true', dest='keep_going', default=True)
|
||||
parser.add_argument('-e', '--no-keep-going',
|
||||
help='Stop as soon as a configuration fails',
|
||||
action='store_false', dest='keep_going')
|
||||
parser.add_argument('--list-jobs',
|
||||
help='List supported jobs and exit',
|
||||
action='append_const', dest='list', const='jobs')
|
||||
parser.add_argument('--list-domains',
|
||||
help='List supported domains and exit',
|
||||
action='append_const', dest='list', const='domains')
|
||||
parser.add_argument('--make-command', metavar='CMD',
|
||||
help='Command to run instead of make (e.g. gmake)',
|
||||
action='store', default='make')
|
||||
parser.add_argument('--unset-use-psa',
|
||||
help='Unset MBEDTLS_USE_PSA_CRYPTO before any test',
|
||||
action='store_true', dest='unset_use_psa')
|
||||
parser.add_argument('tasks', metavar='TASKS', nargs='*',
|
||||
help='The domain(s) or job(s) to test (default: all).',
|
||||
default=True)
|
||||
options = parser.parse_args()
|
||||
os.chdir(options.directory)
|
||||
conf = config.MbedTLSConfig(options.config)
|
||||
domain_data = DomainData(options, conf)
|
||||
|
||||
if options.tasks is True:
|
||||
options.tasks = sorted(domain_data.domains.keys())
|
||||
if options.list:
|
||||
for arg in options.list:
|
||||
for domain_name in sorted(getattr(domain_data, arg).keys()):
|
||||
print(domain_name)
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(0 if run_tests(options, domain_data, conf) else 1)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
traceback.print_exc()
|
||||
sys.exit(3)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
54
vendor/mbedtls/tests/scripts/list-identifiers.sh
vendored
Executable file
54
vendor/mbedtls/tests/scripts/list-identifiers.sh
vendored
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Create a file named identifiers containing identifiers from internal header
|
||||
# files, based on the --internal flag.
|
||||
# Outputs the line count of the file to stdout.
|
||||
# A very thin wrapper around list_internal_identifiers.py for backwards
|
||||
# compatibility.
|
||||
# Must be run from Mbed TLS root.
|
||||
#
|
||||
# Usage: list-identifiers.sh [ -i | --internal ]
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
set -eu
|
||||
|
||||
if [ -d include/mbedtls ]; then :; else
|
||||
echo "$0: Must be run from Mbed TLS root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
INTERNAL=""
|
||||
|
||||
until [ -z "${1-}" ]
|
||||
do
|
||||
case "$1" in
|
||||
-i|--internal)
|
||||
INTERNAL="1"
|
||||
;;
|
||||
*)
|
||||
# print error
|
||||
echo "Unknown argument: '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ $INTERNAL ]
|
||||
then
|
||||
tests/scripts/list_internal_identifiers.py
|
||||
wc -l identifiers
|
||||
else
|
||||
cat <<EOF
|
||||
Sorry, this script has to be called with --internal.
|
||||
|
||||
This script exists solely for backwards compatibility with the previous
|
||||
iteration of list-identifiers.sh, of which only the --internal option remains in
|
||||
use. It is a thin wrapper around list_internal_identifiers.py.
|
||||
|
||||
check-names.sh, which used to depend on this script, has been replaced with
|
||||
framework/scripts/check_names.py and is now self-complete.
|
||||
EOF
|
||||
fi
|
||||
47
vendor/mbedtls/tests/scripts/list_internal_identifiers.py
vendored
Executable file
47
vendor/mbedtls/tests/scripts/list_internal_identifiers.py
vendored
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
"""
|
||||
This script generates a file called identifiers that contains all Mbed TLS
|
||||
identifiers found on internal headers. This is the equivalent of what was
|
||||
previously `list-identifiers.sh --internal`, and is useful for generating an
|
||||
exclusion file list for ABI/API checking, since we do not promise compatibility
|
||||
for them.
|
||||
|
||||
It uses the CodeParser class from framework/scripts/check_names.py to perform
|
||||
the parsing.
|
||||
|
||||
The script returns 0 on success, 1 if there is a script error.
|
||||
Must be run from Mbed TLS root.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import scripts_path # pylint: disable=unused-import
|
||||
from check_names import CodeParser
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
description=(
|
||||
"This script writes a list of parsed identifiers in internal "
|
||||
"headers to \"identifiers\". This is useful for generating a list "
|
||||
"of names to exclude from API/ABI compatibility checking. "))
|
||||
|
||||
parser.parse_args()
|
||||
|
||||
name_check = CodeParser(logging.getLogger())
|
||||
result = name_check.parse_identifiers([
|
||||
"include/mbedtls/*_internal.h",
|
||||
"library/*.h"
|
||||
])[0]
|
||||
result.sort(key=lambda x: x.name)
|
||||
|
||||
identifiers = ["{}\n".format(match.name) for match in result]
|
||||
with open("identifiers", "w", encoding="utf-8") as f:
|
||||
f.writelines(identifiers)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
128
vendor/mbedtls/tests/scripts/psa_collect_statuses.py
vendored
Executable file
128
vendor/mbedtls/tests/scripts/psa_collect_statuses.py
vendored
Executable file
@@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Describe the test coverage of PSA functions in terms of return statuses.
|
||||
|
||||
1. Build Mbed TLS with -DRECORD_PSA_STATUS_COVERAGE_LOG
|
||||
2. Run psa_collect_statuses.py
|
||||
|
||||
The output is a series of line of the form "psa_foo PSA_ERROR_XXX". Each
|
||||
function/status combination appears only once.
|
||||
|
||||
This script must be run from the top of an Mbed TLS source tree.
|
||||
The build command is "make -DRECORD_PSA_STATUS_COVERAGE_LOG", which is
|
||||
only supported with make (as opposed to CMake or other build methods).
|
||||
"""
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
DEFAULT_STATUS_LOG_FILE = 'tests/statuses.log'
|
||||
DEFAULT_PSA_CONSTANT_NAMES = 'programs/psa/psa_constant_names'
|
||||
|
||||
class Statuses:
|
||||
"""Information about observed return statues of API functions."""
|
||||
|
||||
def __init__(self):
|
||||
self.functions = {}
|
||||
self.codes = set()
|
||||
self.status_names = {}
|
||||
|
||||
def collect_log(self, log_file_name):
|
||||
"""Read logs from RECORD_PSA_STATUS_COVERAGE_LOG.
|
||||
|
||||
Read logs produced by running Mbed TLS test suites built with
|
||||
-DRECORD_PSA_STATUS_COVERAGE_LOG.
|
||||
"""
|
||||
with open(log_file_name) as log:
|
||||
for line in log:
|
||||
value, function, tail = line.split(':', 2)
|
||||
if function not in self.functions:
|
||||
self.functions[function] = {}
|
||||
fdata = self.functions[function]
|
||||
if value not in self.functions[function]:
|
||||
fdata[value] = []
|
||||
fdata[value].append(tail)
|
||||
self.codes.add(int(value))
|
||||
|
||||
def get_constant_names(self, psa_constant_names):
|
||||
"""Run psa_constant_names to obtain names for observed numerical values."""
|
||||
values = [str(value) for value in self.codes]
|
||||
cmd = [psa_constant_names, 'status'] + values
|
||||
output = subprocess.check_output(cmd).decode('ascii')
|
||||
for value, name in zip(values, output.rstrip().split('\n')):
|
||||
self.status_names[value] = name
|
||||
|
||||
def report(self):
|
||||
"""Report observed return values for each function.
|
||||
|
||||
The report is a series of line of the form "psa_foo PSA_ERROR_XXX".
|
||||
"""
|
||||
for function in sorted(self.functions.keys()):
|
||||
fdata = self.functions[function]
|
||||
names = [self.status_names[value] for value in fdata.keys()]
|
||||
for name in sorted(names):
|
||||
sys.stdout.write('{} {}\n'.format(function, name))
|
||||
|
||||
def collect_status_logs(options):
|
||||
"""Build and run unit tests and report observed function return statuses.
|
||||
|
||||
Build Mbed TLS with -DRECORD_PSA_STATUS_COVERAGE_LOG, run the
|
||||
test suites and display information about observed return statuses.
|
||||
"""
|
||||
rebuilt = False
|
||||
if not options.use_existing_log and os.path.exists(options.log_file):
|
||||
os.remove(options.log_file)
|
||||
if not os.path.exists(options.log_file):
|
||||
if options.clean_before:
|
||||
subprocess.check_call(['make', 'clean'],
|
||||
cwd='tests',
|
||||
stdout=sys.stderr)
|
||||
with open(os.devnull, 'w') as devnull:
|
||||
make_q_ret = subprocess.call(['make', '-q', 'lib', 'tests'],
|
||||
stdout=devnull, stderr=devnull)
|
||||
if make_q_ret != 0:
|
||||
subprocess.check_call(['make', 'RECORD_PSA_STATUS_COVERAGE_LOG=1'],
|
||||
stdout=sys.stderr)
|
||||
rebuilt = True
|
||||
subprocess.check_call(['make', 'test'],
|
||||
stdout=sys.stderr)
|
||||
data = Statuses()
|
||||
data.collect_log(options.log_file)
|
||||
data.get_constant_names(options.psa_constant_names)
|
||||
if rebuilt and options.clean_after:
|
||||
subprocess.check_call(['make', 'clean'],
|
||||
cwd='tests',
|
||||
stdout=sys.stderr)
|
||||
return data
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=globals()['__doc__'])
|
||||
parser.add_argument('--clean-after',
|
||||
action='store_true',
|
||||
help='Run "make clean" after rebuilding')
|
||||
parser.add_argument('--clean-before',
|
||||
action='store_true',
|
||||
help='Run "make clean" before regenerating the log file)')
|
||||
parser.add_argument('--log-file', metavar='FILE',
|
||||
default=DEFAULT_STATUS_LOG_FILE,
|
||||
help='Log file location (default: {})'.format(
|
||||
DEFAULT_STATUS_LOG_FILE
|
||||
))
|
||||
parser.add_argument('--psa-constant-names', metavar='PROGRAM',
|
||||
default=DEFAULT_PSA_CONSTANT_NAMES,
|
||||
help='Path to psa_constant_names (default: {})'.format(
|
||||
DEFAULT_PSA_CONSTANT_NAMES
|
||||
))
|
||||
parser.add_argument('--use-existing-log', '-e',
|
||||
action='store_true',
|
||||
help='Don\'t regenerate the log file if it exists')
|
||||
options = parser.parse_args()
|
||||
data = collect_status_logs(options)
|
||||
data.report()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
158
vendor/mbedtls/tests/scripts/run-test-suites.pl
vendored
Executable file
158
vendor/mbedtls/tests/scripts/run-test-suites.pl
vendored
Executable file
@@ -0,0 +1,158 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# run-test-suites.pl
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
Execute all the test suites and print a summary of the results.
|
||||
|
||||
run-test-suites.pl [[-v|--verbose] [VERBOSITY]] [--skip=SUITE[...]]
|
||||
|
||||
Options:
|
||||
|
||||
-v|--verbose Print detailed failure information.
|
||||
-v 2|--verbose=2 Print detailed failure information and summary messages.
|
||||
-v 3|--verbose=3 Print detailed information about every test case.
|
||||
--skip=SUITE[,SUITE...]
|
||||
Skip the specified SUITE(s). This option can be used
|
||||
multiple times.
|
||||
|
||||
=cut
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use utf8;
|
||||
use open qw(:std utf8);
|
||||
|
||||
use Getopt::Long qw(:config auto_help gnu_compat);
|
||||
use Pod::Usage;
|
||||
|
||||
my $verbose = 0;
|
||||
my @skip_patterns = ();
|
||||
GetOptions(
|
||||
'skip=s' => \@skip_patterns,
|
||||
'verbose|v:1' => \$verbose,
|
||||
) or die;
|
||||
|
||||
# All test suites = executable files with a .datax file.
|
||||
my @suites = ();
|
||||
for my $data_file (glob 'test_suite_*.datax') {
|
||||
(my $base = $data_file) =~ s/\.datax$//;
|
||||
push @suites, $base if -x $base;
|
||||
push @suites, "$base.exe" if -e "$base.exe";
|
||||
}
|
||||
die "$0: no test suite found\n" unless @suites;
|
||||
|
||||
# "foo" as a skip pattern skips "test_suite_foo" and "test_suite_foo.bar"
|
||||
# but not "test_suite_foobar".
|
||||
my $skip_re =
|
||||
( '\Atest_suite_(' .
|
||||
join('|', map {
|
||||
s/[ ,;]/|/g; # allow any of " ,;|" as separators
|
||||
s/\./\./g; # "." in the input means ".", not "any character"
|
||||
$_
|
||||
} @skip_patterns) .
|
||||
')(\z|\.)' );
|
||||
|
||||
# in case test suites are linked dynamically
|
||||
$ENV{'LD_LIBRARY_PATH'} = '../library';
|
||||
$ENV{'DYLD_LIBRARY_PATH'} = '../library';
|
||||
|
||||
my $prefix = $^O eq "MSWin32" ? '' : './';
|
||||
|
||||
my (@failed_suites, $total_tests_run, $failed, $suite_cases_passed,
|
||||
$suite_cases_failed, $suite_cases_skipped, $total_cases_passed,
|
||||
$total_cases_failed, $total_cases_skipped );
|
||||
my $suites_skipped = 0;
|
||||
|
||||
sub pad_print_center {
|
||||
my( $width, $padchar, $string ) = @_;
|
||||
my $padlen = ( $width - length( $string ) - 2 ) / 2;
|
||||
print $padchar x( $padlen ), " $string ", $padchar x( $padlen ), "\n";
|
||||
}
|
||||
|
||||
for my $suite (@suites)
|
||||
{
|
||||
print "$suite ", "." x ( 72 - length($suite) - 2 - 4 ), " ";
|
||||
if( $suite =~ /$skip_re/o ) {
|
||||
print "SKIP\n";
|
||||
++$suites_skipped;
|
||||
next;
|
||||
}
|
||||
|
||||
my $command = "$prefix$suite";
|
||||
if( $verbose ) {
|
||||
$command .= ' -v';
|
||||
}
|
||||
my $result = `$command`;
|
||||
|
||||
$suite_cases_passed = () = $result =~ /.. PASS/g;
|
||||
$suite_cases_failed = () = $result =~ /.. FAILED/g;
|
||||
$suite_cases_skipped = () = $result =~ /.. ----/g;
|
||||
|
||||
if( $? == 0 ) {
|
||||
print "PASS\n";
|
||||
if( $verbose > 2 ) {
|
||||
pad_print_center( 72, '-', "Begin $suite" );
|
||||
print $result;
|
||||
pad_print_center( 72, '-', "End $suite" );
|
||||
}
|
||||
} else {
|
||||
push @failed_suites, $suite;
|
||||
print "FAIL\n";
|
||||
if( $verbose ) {
|
||||
pad_print_center( 72, '-', "Begin $suite" );
|
||||
print $result;
|
||||
pad_print_center( 72, '-', "End $suite" );
|
||||
}
|
||||
}
|
||||
|
||||
my ($passed, $tests, $skipped) = $result =~ /([0-9]*) \/ ([0-9]*) tests.*?([0-9]*) skipped/;
|
||||
$total_tests_run += $tests - $skipped;
|
||||
|
||||
if( $verbose > 1 ) {
|
||||
print "(test cases passed:", $suite_cases_passed,
|
||||
" failed:", $suite_cases_failed,
|
||||
" skipped:", $suite_cases_skipped,
|
||||
" of total:", ($suite_cases_passed + $suite_cases_failed +
|
||||
$suite_cases_skipped),
|
||||
")\n"
|
||||
}
|
||||
|
||||
$total_cases_passed += $suite_cases_passed;
|
||||
$total_cases_failed += $suite_cases_failed;
|
||||
$total_cases_skipped += $suite_cases_skipped;
|
||||
}
|
||||
|
||||
print "-" x 72, "\n";
|
||||
print @failed_suites ? "FAILED" : "PASSED";
|
||||
printf( " (%d suites, %d tests run%s)\n",
|
||||
scalar(@suites) - $suites_skipped,
|
||||
$total_tests_run,
|
||||
$suites_skipped ? ", $suites_skipped suites skipped" : "" );
|
||||
|
||||
if( $verbose && @failed_suites ) {
|
||||
# the output can be very long, so provide a summary of which suites failed
|
||||
print " failed suites : @failed_suites\n";
|
||||
}
|
||||
|
||||
if( $verbose > 1 ) {
|
||||
print " test cases passed :", $total_cases_passed, "\n";
|
||||
print " failed :", $total_cases_failed, "\n";
|
||||
print " skipped :", $total_cases_skipped, "\n";
|
||||
print " of tests executed :", ( $total_cases_passed + $total_cases_failed ),
|
||||
"\n";
|
||||
print " of available tests :",
|
||||
( $total_cases_passed + $total_cases_failed + $total_cases_skipped ),
|
||||
"\n";
|
||||
if( $suites_skipped != 0 ) {
|
||||
print "Note: $suites_skipped suites were skipped.\n";
|
||||
}
|
||||
}
|
||||
|
||||
exit( @failed_suites ? 1 : 0 );
|
||||
|
||||
20
vendor/mbedtls/tests/scripts/scripts_path.py
vendored
Normal file
20
vendor/mbedtls/tests/scripts/scripts_path.py
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"""Add our Python library directory to the module search path.
|
||||
|
||||
Usage:
|
||||
|
||||
import scripts_path # pylint: disable=unused-import
|
||||
"""
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__),
|
||||
os.path.pardir, os.path.pardir,
|
||||
'scripts'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__),
|
||||
os.path.pardir, os.path.pardir,
|
||||
'framework', 'scripts'))
|
||||
284
vendor/mbedtls/tests/scripts/set_psa_test_dependencies.py
vendored
Executable file
284
vendor/mbedtls/tests/scripts/set_psa_test_dependencies.py
vendored
Executable file
@@ -0,0 +1,284 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""Edit test cases to use PSA dependencies instead of classic dependencies.
|
||||
"""
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
CLASSIC_DEPENDENCIES = frozenset([
|
||||
# This list is manually filtered from mbedtls_config.h.
|
||||
|
||||
# Mbed TLS feature support.
|
||||
# Only features that affect what can be done are listed here.
|
||||
# Options that control optimizations or alternative implementations
|
||||
# are omitted.
|
||||
'MBEDTLS_CIPHER_MODE_CBC',
|
||||
'MBEDTLS_CIPHER_MODE_CFB',
|
||||
'MBEDTLS_CIPHER_MODE_CTR',
|
||||
'MBEDTLS_CIPHER_MODE_OFB',
|
||||
'MBEDTLS_CIPHER_MODE_XTS',
|
||||
'MBEDTLS_CIPHER_NULL_CIPHER',
|
||||
'MBEDTLS_CIPHER_PADDING_PKCS7',
|
||||
'MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS',
|
||||
'MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN',
|
||||
'MBEDTLS_CIPHER_PADDING_ZEROS',
|
||||
#curve#'MBEDTLS_ECP_DP_SECP192R1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_SECP224R1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_SECP256R1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_SECP384R1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_SECP521R1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_SECP192K1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_SECP224K1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_SECP256K1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_BP256R1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_BP384R1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_BP512R1_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_CURVE25519_ENABLED',
|
||||
#curve#'MBEDTLS_ECP_DP_CURVE448_ENABLED',
|
||||
'MBEDTLS_ECDSA_DETERMINISTIC',
|
||||
#'MBEDTLS_GENPRIME', #needed for RSA key generation
|
||||
'MBEDTLS_PKCS1_V15',
|
||||
'MBEDTLS_PKCS1_V21',
|
||||
|
||||
# Mbed TLS modules.
|
||||
# Only modules that provide cryptographic mechanisms are listed here.
|
||||
# Platform, data formatting, X.509 or TLS modules are omitted.
|
||||
'MBEDTLS_AES_C',
|
||||
'MBEDTLS_BIGNUM_C',
|
||||
'MBEDTLS_CAMELLIA_C',
|
||||
'MBEDTLS_ARIA_C',
|
||||
'MBEDTLS_CCM_C',
|
||||
'MBEDTLS_CHACHA20_C',
|
||||
'MBEDTLS_CHACHAPOLY_C',
|
||||
'MBEDTLS_CMAC_C',
|
||||
'MBEDTLS_CTR_DRBG_C',
|
||||
'MBEDTLS_DES_C',
|
||||
'MBEDTLS_DHM_C',
|
||||
'MBEDTLS_ECDH_C',
|
||||
'MBEDTLS_ECDSA_C',
|
||||
'MBEDTLS_ECJPAKE_C',
|
||||
'MBEDTLS_ECP_C',
|
||||
'MBEDTLS_ENTROPY_C',
|
||||
'MBEDTLS_GCM_C',
|
||||
'MBEDTLS_HKDF_C',
|
||||
'MBEDTLS_HMAC_DRBG_C',
|
||||
'MBEDTLS_NIST_KW_C',
|
||||
'MBEDTLS_MD5_C',
|
||||
'MBEDTLS_PKCS5_C',
|
||||
'MBEDTLS_PKCS12_C',
|
||||
'MBEDTLS_POLY1305_C',
|
||||
'MBEDTLS_RIPEMD160_C',
|
||||
'MBEDTLS_RSA_C',
|
||||
'MBEDTLS_SHA1_C',
|
||||
'MBEDTLS_SHA256_C',
|
||||
'MBEDTLS_SHA512_C',
|
||||
])
|
||||
|
||||
def is_classic_dependency(dep):
|
||||
"""Whether dep is a classic dependency that PSA test cases should not use."""
|
||||
if dep.startswith('!'):
|
||||
dep = dep[1:]
|
||||
return dep in CLASSIC_DEPENDENCIES
|
||||
|
||||
def is_systematic_dependency(dep):
|
||||
"""Whether dep is a PSA dependency which is determined systematically."""
|
||||
if dep.startswith('PSA_WANT_ECC_'):
|
||||
return False
|
||||
return dep.startswith('PSA_WANT_')
|
||||
|
||||
WITHOUT_SYSTEMATIC_DEPENDENCIES = frozenset([
|
||||
'PSA_ALG_AEAD_WITH_SHORTENED_TAG', # only a modifier
|
||||
'PSA_ALG_ANY_HASH', # only meaningful in policies
|
||||
'PSA_ALG_KEY_AGREEMENT', # only a way to combine algorithms
|
||||
'PSA_ALG_TRUNCATED_MAC', # only a modifier
|
||||
'PSA_KEY_TYPE_NONE', # not a real key type
|
||||
'PSA_KEY_TYPE_DERIVE', # always supported, don't list it to reduce noise
|
||||
'PSA_KEY_TYPE_RAW_DATA', # always supported, don't list it to reduce noise
|
||||
'PSA_ALG_AT_LEAST_THIS_LENGTH_MAC', #only a modifier
|
||||
'PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG', #only a modifier
|
||||
])
|
||||
|
||||
SPECIAL_SYSTEMATIC_DEPENDENCIES = {
|
||||
'PSA_ALG_ECDSA_ANY': frozenset(['PSA_WANT_ALG_ECDSA']),
|
||||
'PSA_ALG_RSA_PKCS1V15_SIGN_RAW': frozenset(['PSA_WANT_ALG_RSA_PKCS1V15_SIGN']),
|
||||
}
|
||||
|
||||
def dependencies_of_symbol(symbol):
|
||||
"""Return the dependencies for a symbol that designates a cryptographic mechanism."""
|
||||
if symbol in WITHOUT_SYSTEMATIC_DEPENDENCIES:
|
||||
return frozenset()
|
||||
if symbol in SPECIAL_SYSTEMATIC_DEPENDENCIES:
|
||||
return SPECIAL_SYSTEMATIC_DEPENDENCIES[symbol]
|
||||
if symbol.startswith('PSA_ALG_CATEGORY_') or \
|
||||
symbol.startswith('PSA_KEY_TYPE_CATEGORY_'):
|
||||
# Categories are used in test data when an unsupported but plausible
|
||||
# mechanism number needed. They have no associated dependency.
|
||||
return frozenset()
|
||||
return {symbol.replace('_', '_WANT_', 1)}
|
||||
|
||||
def systematic_dependencies(file_name, function_name, arguments):
|
||||
"""List the systematically determined dependency for a test case."""
|
||||
deps = set()
|
||||
|
||||
# Run key policy negative tests even if the algorithm to attempt performing
|
||||
# is not supported but in the case where the test is to check an
|
||||
# incompatibility between a requested algorithm for a cryptographic
|
||||
# operation and a key policy. In the latter, we want to filter out the
|
||||
# cases # where PSA_ERROR_NOT_SUPPORTED is returned instead of
|
||||
# PSA_ERROR_NOT_PERMITTED.
|
||||
if function_name.endswith('_key_policy') and \
|
||||
arguments[-1].startswith('PSA_ERROR_') and \
|
||||
arguments[-1] != ('PSA_ERROR_NOT_PERMITTED'):
|
||||
arguments[-2] = ''
|
||||
if function_name == 'copy_fail' and \
|
||||
arguments[-1].startswith('PSA_ERROR_'):
|
||||
arguments[-2] = ''
|
||||
arguments[-3] = ''
|
||||
|
||||
# Storage format tests that only look at how the file is structured and
|
||||
# don't care about the format of the key material don't depend on any
|
||||
# cryptographic mechanisms.
|
||||
if os.path.basename(file_name) == 'test_suite_psa_crypto_persistent_key.data' and \
|
||||
function_name in {'format_storage_data_check',
|
||||
'parse_storage_data_check'}:
|
||||
return []
|
||||
|
||||
for arg in arguments:
|
||||
for symbol in re.findall(r'PSA_(?:ALG|KEY_TYPE)_\w+', arg):
|
||||
deps.update(dependencies_of_symbol(symbol))
|
||||
return sorted(deps)
|
||||
|
||||
def updated_dependencies(file_name, function_name, arguments, dependencies):
|
||||
"""Rework the list of dependencies into PSA_WANT_xxx.
|
||||
|
||||
Remove classic crypto dependencies such as MBEDTLS_RSA_C,
|
||||
MBEDTLS_PKCS1_V15, etc.
|
||||
|
||||
Add systematic PSA_WANT_xxx dependencies based on the called function and
|
||||
its arguments, replacing existing PSA_WANT_xxx dependencies.
|
||||
"""
|
||||
automatic = systematic_dependencies(file_name, function_name, arguments)
|
||||
manual = [dep for dep in dependencies
|
||||
if not (is_systematic_dependency(dep) or
|
||||
is_classic_dependency(dep))]
|
||||
return automatic + manual
|
||||
|
||||
def keep_manual_dependencies(file_name, function_name, arguments):
|
||||
#pylint: disable=unused-argument
|
||||
"""Declare test functions with unusual dependencies here."""
|
||||
# If there are no arguments, we can't do any useful work. Assume that if
|
||||
# there are dependencies, they are warranted.
|
||||
if not arguments:
|
||||
return True
|
||||
# When PSA_ERROR_NOT_SUPPORTED is expected, usually, at least one of the
|
||||
# constants mentioned in the test should not be supported. It isn't
|
||||
# possible to determine which one in a systematic way. So let the programmer
|
||||
# decide.
|
||||
if arguments[-1] == 'PSA_ERROR_NOT_SUPPORTED':
|
||||
return True
|
||||
return False
|
||||
|
||||
def process_data_stanza(stanza, file_name, test_case_number):
|
||||
"""Update PSA crypto dependencies in one Mbed TLS test case.
|
||||
|
||||
stanza is the test case text (including the description, the dependencies,
|
||||
the line with the function and arguments, and optionally comments). Return
|
||||
a new stanza with an updated dependency line, preserving everything else
|
||||
(description, comments, arguments, etc.).
|
||||
"""
|
||||
if not stanza.lstrip('\n'):
|
||||
# Just blank lines
|
||||
return stanza
|
||||
# Expect 2 or 3 non-comment lines: description, optional dependencies,
|
||||
# function-and-arguments.
|
||||
content_matches = list(re.finditer(r'^[\t ]*([^\t #].*)$', stanza, re.M))
|
||||
if len(content_matches) < 2:
|
||||
raise Exception('Not enough content lines in paragraph {} in {}'
|
||||
.format(test_case_number, file_name))
|
||||
if len(content_matches) > 3:
|
||||
raise Exception('Too many content lines in paragraph {} in {}'
|
||||
.format(test_case_number, file_name))
|
||||
arguments = content_matches[-1].group(0).split(':')
|
||||
function_name = arguments.pop(0)
|
||||
if keep_manual_dependencies(file_name, function_name, arguments):
|
||||
return stanza
|
||||
if len(content_matches) == 2:
|
||||
# Insert a line for the dependencies. If it turns out that there are
|
||||
# no dependencies, we'll remove that empty line below.
|
||||
dependencies_location = content_matches[-1].start()
|
||||
text_before = stanza[:dependencies_location]
|
||||
text_after = '\n' + stanza[dependencies_location:]
|
||||
old_dependencies = []
|
||||
dependencies_leader = 'depends_on:'
|
||||
else:
|
||||
dependencies_match = content_matches[-2]
|
||||
text_before = stanza[:dependencies_match.start()]
|
||||
text_after = stanza[dependencies_match.end():]
|
||||
old_dependencies = dependencies_match.group(0).split(':')
|
||||
dependencies_leader = old_dependencies.pop(0) + ':'
|
||||
if dependencies_leader != 'depends_on:':
|
||||
raise Exception('Next-to-last line does not start with "depends_on:"'
|
||||
' in paragraph {} in {}'
|
||||
.format(test_case_number, file_name))
|
||||
new_dependencies = updated_dependencies(file_name, function_name, arguments,
|
||||
old_dependencies)
|
||||
if new_dependencies:
|
||||
stanza = (text_before +
|
||||
dependencies_leader + ':'.join(new_dependencies) +
|
||||
text_after)
|
||||
else:
|
||||
# The dependencies have become empty. Remove the depends_on: line.
|
||||
assert text_after[0] == '\n'
|
||||
stanza = text_before + text_after[1:]
|
||||
return stanza
|
||||
|
||||
def process_data_file(file_name, old_content):
|
||||
"""Update PSA crypto dependencies in an Mbed TLS test suite data file.
|
||||
|
||||
Process old_content (the old content of the file) and return the new content.
|
||||
"""
|
||||
old_stanzas = old_content.split('\n\n')
|
||||
new_stanzas = [process_data_stanza(stanza, file_name, n)
|
||||
for n, stanza in enumerate(old_stanzas, start=1)]
|
||||
return '\n\n'.join(new_stanzas)
|
||||
|
||||
def update_file(file_name, old_content, new_content):
|
||||
"""Update the given file with the given new content.
|
||||
|
||||
Replace the existing file. The previous version is renamed to *.bak.
|
||||
Don't modify the file if the content was unchanged.
|
||||
"""
|
||||
if new_content == old_content:
|
||||
return
|
||||
backup = file_name + '.bak'
|
||||
tmp = file_name + '.tmp'
|
||||
with open(tmp, 'w', encoding='utf-8') as new_file:
|
||||
new_file.write(new_content)
|
||||
os.replace(file_name, backup)
|
||||
os.replace(tmp, file_name)
|
||||
|
||||
def process_file(file_name):
|
||||
"""Update PSA crypto dependencies in an Mbed TLS test suite data file.
|
||||
|
||||
Replace the existing file. The previous version is renamed to *.bak.
|
||||
Don't modify the file if the content was unchanged.
|
||||
"""
|
||||
old_content = open(file_name, encoding='utf-8').read()
|
||||
if file_name.endswith('.data'):
|
||||
new_content = process_data_file(file_name, old_content)
|
||||
else:
|
||||
raise Exception('File type not recognized: {}'
|
||||
.format(file_name))
|
||||
update_file(file_name, old_content, new_content)
|
||||
|
||||
def main(args):
|
||||
for file_name in args:
|
||||
process_file(file_name)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
||||
480
vendor/mbedtls/tests/src/certs.c
vendored
Normal file
480
vendor/mbedtls/tests/src/certs.c
vendored
Normal file
@@ -0,0 +1,480 @@
|
||||
/*
|
||||
* X.509 test certificates
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <test/certs.h>
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#include "mbedtls/pk.h"
|
||||
|
||||
#include "test/test_certs.h"
|
||||
|
||||
/*
|
||||
*
|
||||
* Test certificates and keys as C variables
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* CA
|
||||
*/
|
||||
|
||||
const char mbedtls_test_ca_crt_ec_pem[] = TEST_CA_CRT_EC_PEM;
|
||||
const char mbedtls_test_ca_key_ec_pem[] = TEST_CA_KEY_EC_PEM;
|
||||
const char mbedtls_test_ca_pwd_ec_pem[] = TEST_CA_PWD_EC_PEM;
|
||||
const char mbedtls_test_ca_key_rsa_pem[] = TEST_CA_KEY_RSA_PEM;
|
||||
const char mbedtls_test_ca_pwd_rsa_pem[] = TEST_CA_PWD_RSA_PEM;
|
||||
const char mbedtls_test_ca_crt_rsa_sha1_pem[] = TEST_CA_CRT_RSA_SHA1_PEM;
|
||||
const char mbedtls_test_ca_crt_rsa_sha256_pem[] = TEST_CA_CRT_RSA_SHA256_PEM;
|
||||
|
||||
const unsigned char mbedtls_test_ca_crt_ec_der[] = TEST_CA_CRT_EC_DER;
|
||||
const unsigned char mbedtls_test_ca_key_ec_der[] = TEST_CA_KEY_EC_DER;
|
||||
const unsigned char mbedtls_test_ca_key_rsa_der[] = TEST_CA_KEY_RSA_DER;
|
||||
const unsigned char mbedtls_test_ca_crt_rsa_sha1_der[] =
|
||||
TEST_CA_CRT_RSA_SHA1_DER;
|
||||
const unsigned char mbedtls_test_ca_crt_rsa_sha256_der[] =
|
||||
TEST_CA_CRT_RSA_SHA256_DER;
|
||||
|
||||
const size_t mbedtls_test_ca_crt_ec_pem_len =
|
||||
sizeof(mbedtls_test_ca_crt_ec_pem);
|
||||
const size_t mbedtls_test_ca_key_ec_pem_len =
|
||||
sizeof(mbedtls_test_ca_key_ec_pem);
|
||||
const size_t mbedtls_test_ca_pwd_ec_pem_len =
|
||||
sizeof(mbedtls_test_ca_pwd_ec_pem) - 1;
|
||||
const size_t mbedtls_test_ca_key_rsa_pem_len =
|
||||
sizeof(mbedtls_test_ca_key_rsa_pem);
|
||||
const size_t mbedtls_test_ca_pwd_rsa_pem_len =
|
||||
sizeof(mbedtls_test_ca_pwd_rsa_pem) - 1;
|
||||
const size_t mbedtls_test_ca_crt_rsa_sha1_pem_len =
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha1_pem);
|
||||
const size_t mbedtls_test_ca_crt_rsa_sha256_pem_len =
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha256_pem);
|
||||
|
||||
const size_t mbedtls_test_ca_crt_ec_der_len =
|
||||
sizeof(mbedtls_test_ca_crt_ec_der);
|
||||
const size_t mbedtls_test_ca_key_ec_der_len =
|
||||
sizeof(mbedtls_test_ca_key_ec_der);
|
||||
const size_t mbedtls_test_ca_pwd_ec_der_len = 0;
|
||||
const size_t mbedtls_test_ca_key_rsa_der_len =
|
||||
sizeof(mbedtls_test_ca_key_rsa_der);
|
||||
const size_t mbedtls_test_ca_pwd_rsa_der_len = 0;
|
||||
const size_t mbedtls_test_ca_crt_rsa_sha1_der_len =
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha1_der);
|
||||
const size_t mbedtls_test_ca_crt_rsa_sha256_der_len =
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha256_der);
|
||||
|
||||
/*
|
||||
* Server
|
||||
*/
|
||||
|
||||
const char mbedtls_test_srv_crt_ec_pem[] = TEST_SRV_CRT_EC_PEM;
|
||||
const char mbedtls_test_srv_key_ec_pem[] = TEST_SRV_KEY_EC_PEM;
|
||||
const char mbedtls_test_srv_pwd_ec_pem[] = "";
|
||||
const char mbedtls_test_srv_key_rsa_pem[] = TEST_SRV_KEY_RSA_PEM;
|
||||
const char mbedtls_test_srv_pwd_rsa_pem[] = "";
|
||||
const char mbedtls_test_srv_crt_rsa_sha1_pem[] = TEST_SRV_CRT_RSA_SHA1_PEM;
|
||||
const char mbedtls_test_srv_crt_rsa_sha256_pem[] = TEST_SRV_CRT_RSA_SHA256_PEM;
|
||||
|
||||
const unsigned char mbedtls_test_srv_crt_ec_der[] = TEST_SRV_CRT_EC_DER;
|
||||
const unsigned char mbedtls_test_srv_key_ec_der[] = TEST_SRV_KEY_EC_DER;
|
||||
const unsigned char mbedtls_test_srv_key_rsa_der[] = TEST_SRV_KEY_RSA_DER;
|
||||
const unsigned char mbedtls_test_srv_crt_rsa_sha1_der[] =
|
||||
TEST_SRV_CRT_RSA_SHA1_DER;
|
||||
const unsigned char mbedtls_test_srv_crt_rsa_sha256_der[] =
|
||||
TEST_SRV_CRT_RSA_SHA256_DER;
|
||||
|
||||
const size_t mbedtls_test_srv_crt_ec_pem_len =
|
||||
sizeof(mbedtls_test_srv_crt_ec_pem);
|
||||
const size_t mbedtls_test_srv_key_ec_pem_len =
|
||||
sizeof(mbedtls_test_srv_key_ec_pem);
|
||||
const size_t mbedtls_test_srv_pwd_ec_pem_len =
|
||||
sizeof(mbedtls_test_srv_pwd_ec_pem) - 1;
|
||||
const size_t mbedtls_test_srv_key_rsa_pem_len =
|
||||
sizeof(mbedtls_test_srv_key_rsa_pem);
|
||||
const size_t mbedtls_test_srv_pwd_rsa_pem_len =
|
||||
sizeof(mbedtls_test_srv_pwd_rsa_pem) - 1;
|
||||
const size_t mbedtls_test_srv_crt_rsa_sha1_pem_len =
|
||||
sizeof(mbedtls_test_srv_crt_rsa_sha1_pem);
|
||||
const size_t mbedtls_test_srv_crt_rsa_sha256_pem_len =
|
||||
sizeof(mbedtls_test_srv_crt_rsa_sha256_pem);
|
||||
|
||||
const size_t mbedtls_test_srv_crt_ec_der_len =
|
||||
sizeof(mbedtls_test_srv_crt_ec_der);
|
||||
const size_t mbedtls_test_srv_key_ec_der_len =
|
||||
sizeof(mbedtls_test_srv_key_ec_der);
|
||||
const size_t mbedtls_test_srv_pwd_ec_der_len = 0;
|
||||
const size_t mbedtls_test_srv_key_rsa_der_len =
|
||||
sizeof(mbedtls_test_srv_key_rsa_der);
|
||||
const size_t mbedtls_test_srv_pwd_rsa_der_len = 0;
|
||||
const size_t mbedtls_test_srv_crt_rsa_sha1_der_len =
|
||||
sizeof(mbedtls_test_srv_crt_rsa_sha1_der);
|
||||
const size_t mbedtls_test_srv_crt_rsa_sha256_der_len =
|
||||
sizeof(mbedtls_test_srv_crt_rsa_sha256_der);
|
||||
|
||||
/*
|
||||
* Client
|
||||
*/
|
||||
|
||||
const char mbedtls_test_cli_crt_ec_pem[] = TEST_CLI_CRT_EC_PEM;
|
||||
const char mbedtls_test_cli_key_ec_pem[] = TEST_CLI_KEY_EC_PEM;
|
||||
const char mbedtls_test_cli_pwd_ec_pem[] = "";
|
||||
const char mbedtls_test_cli_key_rsa_pem[] = TEST_CLI_KEY_RSA_PEM;
|
||||
const char mbedtls_test_cli_pwd_rsa_pem[] = "";
|
||||
const char mbedtls_test_cli_crt_rsa_pem[] = TEST_CLI_CRT_RSA_PEM;
|
||||
|
||||
const unsigned char mbedtls_test_cli_crt_ec_der[] = TEST_CLI_CRT_EC_DER;
|
||||
const unsigned char mbedtls_test_cli_key_ec_der[] = TEST_CLI_KEY_EC_DER;
|
||||
const unsigned char mbedtls_test_cli_key_rsa_der[] = TEST_CLI_KEY_RSA_DER;
|
||||
const unsigned char mbedtls_test_cli_crt_rsa_der[] = TEST_CLI_CRT_RSA_DER;
|
||||
|
||||
const size_t mbedtls_test_cli_crt_ec_pem_len =
|
||||
sizeof(mbedtls_test_cli_crt_ec_pem);
|
||||
const size_t mbedtls_test_cli_key_ec_pem_len =
|
||||
sizeof(mbedtls_test_cli_key_ec_pem);
|
||||
const size_t mbedtls_test_cli_pwd_ec_pem_len =
|
||||
sizeof(mbedtls_test_cli_pwd_ec_pem) - 1;
|
||||
const size_t mbedtls_test_cli_key_rsa_pem_len =
|
||||
sizeof(mbedtls_test_cli_key_rsa_pem);
|
||||
const size_t mbedtls_test_cli_pwd_rsa_pem_len =
|
||||
sizeof(mbedtls_test_cli_pwd_rsa_pem) - 1;
|
||||
const size_t mbedtls_test_cli_crt_rsa_pem_len =
|
||||
sizeof(mbedtls_test_cli_crt_rsa_pem);
|
||||
|
||||
const size_t mbedtls_test_cli_crt_ec_der_len =
|
||||
sizeof(mbedtls_test_cli_crt_ec_der);
|
||||
const size_t mbedtls_test_cli_key_ec_der_len =
|
||||
sizeof(mbedtls_test_cli_key_ec_der);
|
||||
const size_t mbedtls_test_cli_key_rsa_der_len =
|
||||
sizeof(mbedtls_test_cli_key_rsa_der);
|
||||
const size_t mbedtls_test_cli_crt_rsa_der_len =
|
||||
sizeof(mbedtls_test_cli_crt_rsa_der);
|
||||
|
||||
/*
|
||||
*
|
||||
* Definitions of test CRTs without specification of all parameters, choosing
|
||||
* them automatically according to the config. For example, mbedtls_test_ca_crt
|
||||
* is one of mbedtls_test_ca_crt_{rsa|ec}_{sha1|sha256}_{pem|der}.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Dispatch between PEM and DER according to config
|
||||
*/
|
||||
|
||||
#if defined(MBEDTLS_PEM_PARSE_C)
|
||||
|
||||
/* PEM encoded test CA certificates and keys */
|
||||
|
||||
#define TEST_CA_KEY_RSA TEST_CA_KEY_RSA_PEM
|
||||
#define TEST_CA_PWD_RSA TEST_CA_PWD_RSA_PEM
|
||||
#define TEST_CA_CRT_RSA_SHA256 TEST_CA_CRT_RSA_SHA256_PEM
|
||||
#define TEST_CA_CRT_RSA_SHA1 TEST_CA_CRT_RSA_SHA1_PEM
|
||||
#define TEST_CA_KEY_EC TEST_CA_KEY_EC_PEM
|
||||
#define TEST_CA_PWD_EC TEST_CA_PWD_EC_PEM
|
||||
#define TEST_CA_CRT_EC TEST_CA_CRT_EC_PEM
|
||||
|
||||
/* PEM encoded test server certificates and keys */
|
||||
|
||||
#define TEST_SRV_KEY_RSA TEST_SRV_KEY_RSA_PEM
|
||||
#define TEST_SRV_PWD_RSA ""
|
||||
#define TEST_SRV_CRT_RSA_SHA256 TEST_SRV_CRT_RSA_SHA256_PEM
|
||||
#define TEST_SRV_CRT_RSA_SHA1 TEST_SRV_CRT_RSA_SHA1_PEM
|
||||
#define TEST_SRV_KEY_EC TEST_SRV_KEY_EC_PEM
|
||||
#define TEST_SRV_PWD_EC ""
|
||||
#define TEST_SRV_CRT_EC TEST_SRV_CRT_EC_PEM
|
||||
|
||||
/* PEM encoded test client certificates and keys */
|
||||
|
||||
#define TEST_CLI_KEY_RSA TEST_CLI_KEY_RSA_PEM
|
||||
#define TEST_CLI_PWD_RSA ""
|
||||
#define TEST_CLI_CRT_RSA TEST_CLI_CRT_RSA_PEM
|
||||
#define TEST_CLI_KEY_EC TEST_CLI_KEY_EC_PEM
|
||||
#define TEST_CLI_PWD_EC ""
|
||||
#define TEST_CLI_CRT_EC TEST_CLI_CRT_EC_PEM
|
||||
|
||||
#else /* MBEDTLS_PEM_PARSE_C */
|
||||
|
||||
/* DER encoded test CA certificates and keys */
|
||||
|
||||
#define TEST_CA_KEY_RSA TEST_CA_KEY_RSA_DER
|
||||
#define TEST_CA_PWD_RSA ""
|
||||
#define TEST_CA_CRT_RSA_SHA256 TEST_CA_CRT_RSA_SHA256_DER
|
||||
#define TEST_CA_CRT_RSA_SHA1 TEST_CA_CRT_RSA_SHA1_DER
|
||||
#define TEST_CA_KEY_EC TEST_CA_KEY_EC_DER
|
||||
#define TEST_CA_PWD_EC ""
|
||||
#define TEST_CA_CRT_EC TEST_CA_CRT_EC_DER
|
||||
|
||||
/* DER encoded test server certificates and keys */
|
||||
|
||||
#define TEST_SRV_KEY_RSA TEST_SRV_KEY_RSA_DER
|
||||
#define TEST_SRV_PWD_RSA ""
|
||||
#define TEST_SRV_CRT_RSA_SHA256 TEST_SRV_CRT_RSA_SHA256_DER
|
||||
#define TEST_SRV_CRT_RSA_SHA1 TEST_SRV_CRT_RSA_SHA1_DER
|
||||
#define TEST_SRV_KEY_EC TEST_SRV_KEY_EC_DER
|
||||
#define TEST_SRV_PWD_EC ""
|
||||
#define TEST_SRV_CRT_EC TEST_SRV_CRT_EC_DER
|
||||
|
||||
/* DER encoded test client certificates and keys */
|
||||
|
||||
#define TEST_CLI_KEY_RSA TEST_CLI_KEY_RSA_DER
|
||||
#define TEST_CLI_PWD_RSA ""
|
||||
#define TEST_CLI_CRT_RSA TEST_CLI_CRT_RSA_DER
|
||||
#define TEST_CLI_KEY_EC TEST_CLI_KEY_EC_DER
|
||||
#define TEST_CLI_PWD_EC ""
|
||||
#define TEST_CLI_CRT_EC TEST_CLI_CRT_EC_DER
|
||||
|
||||
#endif /* MBEDTLS_PEM_PARSE_C */
|
||||
|
||||
const char mbedtls_test_ca_key_rsa[] = TEST_CA_KEY_RSA;
|
||||
const char mbedtls_test_ca_pwd_rsa[] = TEST_CA_PWD_RSA;
|
||||
const char mbedtls_test_ca_crt_rsa_sha256[] = TEST_CA_CRT_RSA_SHA256;
|
||||
const char mbedtls_test_ca_crt_rsa_sha1[] = TEST_CA_CRT_RSA_SHA1;
|
||||
const char mbedtls_test_ca_key_ec[] = TEST_CA_KEY_EC;
|
||||
const char mbedtls_test_ca_pwd_ec[] = TEST_CA_PWD_EC;
|
||||
const char mbedtls_test_ca_crt_ec[] = TEST_CA_CRT_EC;
|
||||
|
||||
const char mbedtls_test_srv_key_rsa[] = TEST_SRV_KEY_RSA;
|
||||
const char mbedtls_test_srv_pwd_rsa[] = TEST_SRV_PWD_RSA;
|
||||
const char mbedtls_test_srv_crt_rsa_sha256[] = TEST_SRV_CRT_RSA_SHA256;
|
||||
const char mbedtls_test_srv_crt_rsa_sha1[] = TEST_SRV_CRT_RSA_SHA1;
|
||||
const char mbedtls_test_srv_key_ec[] = TEST_SRV_KEY_EC;
|
||||
const char mbedtls_test_srv_pwd_ec[] = TEST_SRV_PWD_EC;
|
||||
const char mbedtls_test_srv_crt_ec[] = TEST_SRV_CRT_EC;
|
||||
|
||||
const char mbedtls_test_cli_key_rsa[] = TEST_CLI_KEY_RSA;
|
||||
const char mbedtls_test_cli_pwd_rsa[] = TEST_CLI_PWD_RSA;
|
||||
const char mbedtls_test_cli_crt_rsa[] = TEST_CLI_CRT_RSA;
|
||||
const char mbedtls_test_cli_key_ec[] = TEST_CLI_KEY_EC;
|
||||
const char mbedtls_test_cli_pwd_ec[] = TEST_CLI_PWD_EC;
|
||||
const char mbedtls_test_cli_crt_ec[] = TEST_CLI_CRT_EC;
|
||||
|
||||
const size_t mbedtls_test_ca_key_rsa_len =
|
||||
sizeof(mbedtls_test_ca_key_rsa);
|
||||
const size_t mbedtls_test_ca_pwd_rsa_len =
|
||||
sizeof(mbedtls_test_ca_pwd_rsa) - 1;
|
||||
const size_t mbedtls_test_ca_crt_rsa_sha256_len =
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha256);
|
||||
const size_t mbedtls_test_ca_crt_rsa_sha1_len =
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha1);
|
||||
const size_t mbedtls_test_ca_key_ec_len =
|
||||
sizeof(mbedtls_test_ca_key_ec);
|
||||
const size_t mbedtls_test_ca_pwd_ec_len =
|
||||
sizeof(mbedtls_test_ca_pwd_ec) - 1;
|
||||
const size_t mbedtls_test_ca_crt_ec_len =
|
||||
sizeof(mbedtls_test_ca_crt_ec);
|
||||
|
||||
const size_t mbedtls_test_srv_key_rsa_len =
|
||||
sizeof(mbedtls_test_srv_key_rsa);
|
||||
const size_t mbedtls_test_srv_pwd_rsa_len =
|
||||
sizeof(mbedtls_test_srv_pwd_rsa) -1;
|
||||
const size_t mbedtls_test_srv_crt_rsa_sha256_len =
|
||||
sizeof(mbedtls_test_srv_crt_rsa_sha256);
|
||||
const size_t mbedtls_test_srv_crt_rsa_sha1_len =
|
||||
sizeof(mbedtls_test_srv_crt_rsa_sha1);
|
||||
const size_t mbedtls_test_srv_key_ec_len =
|
||||
sizeof(mbedtls_test_srv_key_ec);
|
||||
const size_t mbedtls_test_srv_pwd_ec_len =
|
||||
sizeof(mbedtls_test_srv_pwd_ec) - 1;
|
||||
const size_t mbedtls_test_srv_crt_ec_len =
|
||||
sizeof(mbedtls_test_srv_crt_ec);
|
||||
|
||||
const size_t mbedtls_test_cli_key_rsa_len =
|
||||
sizeof(mbedtls_test_cli_key_rsa);
|
||||
const size_t mbedtls_test_cli_pwd_rsa_len =
|
||||
sizeof(mbedtls_test_cli_pwd_rsa) - 1;
|
||||
const size_t mbedtls_test_cli_crt_rsa_len =
|
||||
sizeof(mbedtls_test_cli_crt_rsa);
|
||||
const size_t mbedtls_test_cli_key_ec_len =
|
||||
sizeof(mbedtls_test_cli_key_ec);
|
||||
const size_t mbedtls_test_cli_pwd_ec_len =
|
||||
sizeof(mbedtls_test_cli_pwd_ec) - 1;
|
||||
const size_t mbedtls_test_cli_crt_ec_len =
|
||||
sizeof(mbedtls_test_cli_crt_ec);
|
||||
|
||||
/*
|
||||
* Dispatch between SHA-1 and SHA-256
|
||||
*/
|
||||
|
||||
#if defined(MBEDTLS_MD_CAN_SHA256)
|
||||
#define TEST_CA_CRT_RSA TEST_CA_CRT_RSA_SHA256
|
||||
#define TEST_SRV_CRT_RSA TEST_SRV_CRT_RSA_SHA256
|
||||
#else
|
||||
#define TEST_CA_CRT_RSA TEST_CA_CRT_RSA_SHA1
|
||||
#define TEST_SRV_CRT_RSA TEST_SRV_CRT_RSA_SHA1
|
||||
#endif /* MBEDTLS_MD_CAN_SHA256 */
|
||||
|
||||
const char mbedtls_test_ca_crt_rsa[] = TEST_CA_CRT_RSA;
|
||||
const char mbedtls_test_srv_crt_rsa[] = TEST_SRV_CRT_RSA;
|
||||
|
||||
const size_t mbedtls_test_ca_crt_rsa_len =
|
||||
sizeof(mbedtls_test_ca_crt_rsa);
|
||||
const size_t mbedtls_test_srv_crt_rsa_len =
|
||||
sizeof(mbedtls_test_srv_crt_rsa);
|
||||
|
||||
/*
|
||||
* Dispatch between RSA and EC
|
||||
*/
|
||||
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
|
||||
#define TEST_CA_KEY TEST_CA_KEY_RSA
|
||||
#define TEST_CA_PWD TEST_CA_PWD_RSA
|
||||
#define TEST_CA_CRT TEST_CA_CRT_RSA
|
||||
|
||||
#define TEST_SRV_KEY TEST_SRV_KEY_RSA
|
||||
#define TEST_SRV_PWD TEST_SRV_PWD_RSA
|
||||
#define TEST_SRV_CRT TEST_SRV_CRT_RSA
|
||||
|
||||
#define TEST_CLI_KEY TEST_CLI_KEY_RSA
|
||||
#define TEST_CLI_PWD TEST_CLI_PWD_RSA
|
||||
#define TEST_CLI_CRT TEST_CLI_CRT_RSA
|
||||
|
||||
#else /* no RSA, so assume ECDSA */
|
||||
|
||||
#define TEST_CA_KEY TEST_CA_KEY_EC
|
||||
#define TEST_CA_PWD TEST_CA_PWD_EC
|
||||
#define TEST_CA_CRT TEST_CA_CRT_EC
|
||||
|
||||
#define TEST_SRV_KEY TEST_SRV_KEY_EC
|
||||
#define TEST_SRV_PWD TEST_SRV_PWD_EC
|
||||
#define TEST_SRV_CRT TEST_SRV_CRT_EC
|
||||
|
||||
#define TEST_CLI_KEY TEST_CLI_KEY_EC
|
||||
#define TEST_CLI_PWD TEST_CLI_PWD_EC
|
||||
#define TEST_CLI_CRT TEST_CLI_CRT_EC
|
||||
#endif /* MBEDTLS_RSA_C */
|
||||
|
||||
/* API stability forces us to declare
|
||||
* mbedtls_test_{ca|srv|cli}_{key|pwd|crt}
|
||||
* as pointers. */
|
||||
static const char test_ca_key[] = TEST_CA_KEY;
|
||||
static const char test_ca_pwd[] = TEST_CA_PWD;
|
||||
static const char test_ca_crt[] = TEST_CA_CRT;
|
||||
|
||||
static const char test_srv_key[] = TEST_SRV_KEY;
|
||||
static const char test_srv_pwd[] = TEST_SRV_PWD;
|
||||
static const char test_srv_crt[] = TEST_SRV_CRT;
|
||||
|
||||
static const char test_cli_key[] = TEST_CLI_KEY;
|
||||
static const char test_cli_pwd[] = TEST_CLI_PWD;
|
||||
static const char test_cli_crt[] = TEST_CLI_CRT;
|
||||
|
||||
const char *mbedtls_test_ca_key = test_ca_key;
|
||||
const char *mbedtls_test_ca_pwd = test_ca_pwd;
|
||||
const char *mbedtls_test_ca_crt = test_ca_crt;
|
||||
|
||||
const char *mbedtls_test_srv_key = test_srv_key;
|
||||
const char *mbedtls_test_srv_pwd = test_srv_pwd;
|
||||
const char *mbedtls_test_srv_crt = test_srv_crt;
|
||||
|
||||
const char *mbedtls_test_cli_key = test_cli_key;
|
||||
const char *mbedtls_test_cli_pwd = test_cli_pwd;
|
||||
const char *mbedtls_test_cli_crt = test_cli_crt;
|
||||
|
||||
const size_t mbedtls_test_ca_key_len =
|
||||
sizeof(test_ca_key);
|
||||
const size_t mbedtls_test_ca_pwd_len =
|
||||
sizeof(test_ca_pwd) - 1;
|
||||
const size_t mbedtls_test_ca_crt_len =
|
||||
sizeof(test_ca_crt);
|
||||
|
||||
const size_t mbedtls_test_srv_key_len =
|
||||
sizeof(test_srv_key);
|
||||
const size_t mbedtls_test_srv_pwd_len =
|
||||
sizeof(test_srv_pwd) - 1;
|
||||
const size_t mbedtls_test_srv_crt_len =
|
||||
sizeof(test_srv_crt);
|
||||
|
||||
const size_t mbedtls_test_cli_key_len =
|
||||
sizeof(test_cli_key);
|
||||
const size_t mbedtls_test_cli_pwd_len =
|
||||
sizeof(test_cli_pwd) - 1;
|
||||
const size_t mbedtls_test_cli_crt_len =
|
||||
sizeof(test_cli_crt);
|
||||
|
||||
/*
|
||||
*
|
||||
* Lists of certificates
|
||||
*
|
||||
*/
|
||||
|
||||
/* List of CAs in PEM or DER, depending on config */
|
||||
const char *mbedtls_test_cas[] = {
|
||||
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_MD_CAN_SHA1)
|
||||
mbedtls_test_ca_crt_rsa_sha1,
|
||||
#endif
|
||||
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_MD_CAN_SHA256)
|
||||
mbedtls_test_ca_crt_rsa_sha256,
|
||||
#endif
|
||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
|
||||
mbedtls_test_ca_crt_ec,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
const size_t mbedtls_test_cas_len[] = {
|
||||
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_MD_CAN_SHA1)
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha1),
|
||||
#endif
|
||||
#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_MD_CAN_SHA256)
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha256),
|
||||
#endif
|
||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
|
||||
sizeof(mbedtls_test_ca_crt_ec),
|
||||
#endif
|
||||
0
|
||||
};
|
||||
|
||||
/* List of all available CA certificates in DER format */
|
||||
const unsigned char *mbedtls_test_cas_der[] = {
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
#if defined(MBEDTLS_MD_CAN_SHA256)
|
||||
mbedtls_test_ca_crt_rsa_sha256_der,
|
||||
#endif /* MBEDTLS_MD_CAN_SHA256 */
|
||||
#if defined(MBEDTLS_MD_CAN_SHA1)
|
||||
mbedtls_test_ca_crt_rsa_sha1_der,
|
||||
#endif /* MBEDTLS_MD_CAN_SHA1 */
|
||||
#endif /* MBEDTLS_RSA_C */
|
||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) && defined(MBEDTLS_ECP_HAVE_SECP384R1)
|
||||
mbedtls_test_ca_crt_ec_der,
|
||||
#endif /* MBEDTLS_PK_CAN_ECDSA_SOME */
|
||||
NULL
|
||||
};
|
||||
|
||||
const size_t mbedtls_test_cas_der_len[] = {
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
#if defined(MBEDTLS_MD_CAN_SHA256)
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha256_der),
|
||||
#endif /* MBEDTLS_MD_CAN_SHA256 */
|
||||
#if defined(MBEDTLS_MD_CAN_SHA1)
|
||||
sizeof(mbedtls_test_ca_crt_rsa_sha1_der),
|
||||
#endif /* MBEDTLS_MD_CAN_SHA1 */
|
||||
#endif /* MBEDTLS_RSA_C */
|
||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME) && defined(MBEDTLS_ECP_HAVE_SECP384R1)
|
||||
sizeof(mbedtls_test_ca_crt_ec_der),
|
||||
#endif /* MBEDTLS_PK_CAN_ECDSA_SOME */
|
||||
0
|
||||
};
|
||||
|
||||
/* Concatenation of all available CA certificates in PEM format */
|
||||
#if defined(MBEDTLS_PEM_PARSE_C)
|
||||
const char mbedtls_test_cas_pem[] =
|
||||
#if defined(MBEDTLS_RSA_C)
|
||||
#if defined(MBEDTLS_MD_CAN_SHA256)
|
||||
TEST_CA_CRT_RSA_SHA256_PEM
|
||||
#endif /* MBEDTLS_MD_CAN_SHA256 */
|
||||
#if defined(MBEDTLS_MD_CAN_SHA1)
|
||||
TEST_CA_CRT_RSA_SHA1_PEM
|
||||
#endif /* MBEDTLS_MD_CAN_SHA1 */
|
||||
#endif /* MBEDTLS_RSA_C */
|
||||
#if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
|
||||
TEST_CA_CRT_EC_PEM
|
||||
#endif /* MBEDTLS_PK_CAN_ECDSA_SOME */
|
||||
"";
|
||||
const size_t mbedtls_test_cas_pem_len = sizeof(mbedtls_test_cas_pem);
|
||||
#endif /* MBEDTLS_PEM_PARSE_C */
|
||||
1423
vendor/mbedtls/tests/src/psa_test_wrappers.c
vendored
Normal file
1423
vendor/mbedtls/tests/src/psa_test_wrappers.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2695
vendor/mbedtls/tests/src/test_helpers/ssl_helpers.c
vendored
Normal file
2695
vendor/mbedtls/tests/src/test_helpers/ssl_helpers.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15583
vendor/mbedtls/tests/ssl-opt.sh
vendored
Executable file
15583
vendor/mbedtls/tests/ssl-opt.sh
vendored
Executable file
File diff suppressed because it is too large
Load Diff
112
vendor/mbedtls/tests/suites/helpers.function
vendored
Normal file
112
vendor/mbedtls/tests/suites/helpers.function
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
#line 2 "suites/helpers.function"
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Headers */
|
||||
|
||||
#include <test/arguments.h>
|
||||
#include <test/helpers.h>
|
||||
#include <test/macros.h>
|
||||
#include <test/random.h>
|
||||
#include <test/bignum_helpers.h>
|
||||
#include <test/psa_crypto_helpers.h>
|
||||
#include <test/threading_helpers.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
#include "mbedtls/error.h"
|
||||
#endif
|
||||
#include "mbedtls/platform.h"
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
#include "mbedtls/memory_buffer_alloc.h"
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Status and error constants */
|
||||
|
||||
#define DEPENDENCY_SUPPORTED 0 /* Dependency supported by build */
|
||||
#define KEY_VALUE_MAPPING_FOUND 0 /* Integer expression found */
|
||||
#define DISPATCH_TEST_SUCCESS 0 /* Test dispatch successful */
|
||||
|
||||
#define KEY_VALUE_MAPPING_NOT_FOUND -1 /* Integer expression not found */
|
||||
#define DEPENDENCY_NOT_SUPPORTED -2 /* Dependency not supported */
|
||||
#define DISPATCH_TEST_FN_NOT_FOUND -3 /* Test function not found */
|
||||
#define DISPATCH_INVALID_TEST_DATA -4 /* Invalid test parameter type.
|
||||
Only int, string, binary data
|
||||
and integer expressions are
|
||||
allowed */
|
||||
#define DISPATCH_UNSUPPORTED_SUITE -5 /* Test suite not supported by the
|
||||
build */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Global variables */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Helper flags for complex dependencies */
|
||||
|
||||
/* Indicates whether we expect mbedtls_entropy_init
|
||||
* to initialize some strong entropy source. */
|
||||
#if !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) && \
|
||||
(!defined(MBEDTLS_NO_PLATFORM_ENTROPY) || \
|
||||
defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || \
|
||||
defined(ENTROPY_NV_SEED))
|
||||
#define ENTROPY_HAVE_STRONG
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
static int redirect_output(FILE *out_stream, const char *path)
|
||||
{
|
||||
int out_fd, dup_fd;
|
||||
FILE *path_stream;
|
||||
|
||||
out_fd = fileno(out_stream);
|
||||
dup_fd = dup(out_fd);
|
||||
|
||||
if (dup_fd == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
path_stream = fopen(path, "w");
|
||||
if (path_stream == NULL) {
|
||||
close(dup_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
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 dup_fd)
|
||||
{
|
||||
int out_fd = fileno(out_stream);
|
||||
|
||||
fflush(out_stream);
|
||||
if (dup2(dup_fd, out_fd) == -1) {
|
||||
close(out_fd);
|
||||
close(dup_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
close(dup_fd);
|
||||
return 0;
|
||||
}
|
||||
#endif /* __unix__ || __APPLE__ __MACH__ */
|
||||
795
vendor/mbedtls/tests/suites/host_test.function
vendored
Normal file
795
vendor/mbedtls/tests/suites/host_test.function
vendored
Normal file
@@ -0,0 +1,795 @@
|
||||
#line 2 "suites/host_test.function"
|
||||
|
||||
/**
|
||||
* \brief Verifies that string is in string parameter format i.e. "<str>"
|
||||
* It also strips enclosing '"' from the input string.
|
||||
*
|
||||
* \param str String parameter.
|
||||
*
|
||||
* \return 0 if success else 1
|
||||
*/
|
||||
static int verify_string(char **str)
|
||||
{
|
||||
if ((*str)[0] != '"' ||
|
||||
(*str)[strlen(*str) - 1] != '"') {
|
||||
mbedtls_fprintf(stderr,
|
||||
"Expected string (with \"\") for parameter and got: %s\n", *str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
(*str)++;
|
||||
(*str)[strlen(*str) - 1] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Verifies that string is an integer. Also gives the converted
|
||||
* integer value.
|
||||
*
|
||||
* \param str Input string.
|
||||
* \param p_value Pointer to output value.
|
||||
*
|
||||
* \return 0 if success else 1
|
||||
*/
|
||||
static int verify_int(char *str, intmax_t *p_value)
|
||||
{
|
||||
char *end = NULL;
|
||||
errno = 0;
|
||||
/* Limit the range to long: for large integers, the test framework will
|
||||
* use expressions anyway. */
|
||||
long value = strtol(str, &end, 0);
|
||||
if (errno == EINVAL || *end != '\0') {
|
||||
mbedtls_fprintf(stderr,
|
||||
"Expected integer for parameter and got: %s\n", str);
|
||||
return KEY_VALUE_MAPPING_NOT_FOUND;
|
||||
}
|
||||
if (errno == ERANGE) {
|
||||
mbedtls_fprintf(stderr, "Integer out of range: %s\n", str);
|
||||
return KEY_VALUE_MAPPING_NOT_FOUND;
|
||||
}
|
||||
*p_value = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Usage string.
|
||||
*
|
||||
*/
|
||||
#define USAGE \
|
||||
"Usage: %s [OPTIONS] files...\n\n" \
|
||||
" Command line arguments:\n" \
|
||||
" files... One or more test data files. If no file is\n" \
|
||||
" specified the following default test case\n" \
|
||||
" file is used:\n" \
|
||||
" %s\n\n" \
|
||||
" Options:\n" \
|
||||
" -v | --verbose Display full information about each test\n" \
|
||||
" -h | --help Display this information\n\n", \
|
||||
argv[0], \
|
||||
"TESTCASE_FILENAME"
|
||||
|
||||
|
||||
/**
|
||||
* \brief Read a line from the passed file pointer.
|
||||
*
|
||||
* \param f FILE pointer
|
||||
* \param buf Pointer to memory to hold read line.
|
||||
* \param len Length of the buf.
|
||||
*
|
||||
* \return 0 if success else -1
|
||||
*/
|
||||
static int get_line(FILE *f, char *buf, size_t len)
|
||||
{
|
||||
char *ret;
|
||||
int i = 0, str_len = 0, has_string = 0;
|
||||
|
||||
/* Read until we get a valid line */
|
||||
do {
|
||||
ret = fgets(buf, len, f);
|
||||
if (ret == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
str_len = strlen(buf);
|
||||
|
||||
/* Skip empty line and comment */
|
||||
if (str_len == 0 || buf[0] == '#') {
|
||||
continue;
|
||||
}
|
||||
has_string = 0;
|
||||
for (i = 0; i < str_len; i++) {
|
||||
char c = buf[i];
|
||||
if (c != ' ' && c != '\t' && c != '\n' &&
|
||||
c != '\v' && c != '\f' && c != '\r') {
|
||||
has_string = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (!has_string);
|
||||
|
||||
/* Strip new line and carriage return */
|
||||
ret = buf + strlen(buf);
|
||||
if (ret-- > buf && *ret == '\n') {
|
||||
*ret = '\0';
|
||||
}
|
||||
if (ret-- > buf && *ret == '\r') {
|
||||
*ret = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Splits string delimited by ':'. Ignores '\:'.
|
||||
*
|
||||
* \param buf Input string
|
||||
* \param len Input string length
|
||||
* \param params Out params found
|
||||
* \param params_len Out params array len
|
||||
*
|
||||
* \return Count of strings found.
|
||||
*/
|
||||
static int parse_arguments(char *buf, size_t len, char **params,
|
||||
size_t params_len)
|
||||
{
|
||||
size_t cnt = 0, i;
|
||||
char *cur = buf;
|
||||
char *p = buf, *q;
|
||||
|
||||
params[cnt++] = cur;
|
||||
|
||||
while (*p != '\0' && p < (buf + len)) {
|
||||
if (*p == '\\') {
|
||||
p++;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
if (*p == ':') {
|
||||
if (p + 1 < buf + len) {
|
||||
cur = p + 1;
|
||||
TEST_HELPER_ASSERT(cnt < params_len);
|
||||
params[cnt++] = cur;
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
/* Replace backslash escapes in strings */
|
||||
for (i = 0; i < cnt; i++) {
|
||||
p = params[i];
|
||||
q = params[i];
|
||||
|
||||
while (*p != '\0') {
|
||||
if (*p == '\\') {
|
||||
++p;
|
||||
switch (*p) {
|
||||
case 'n':
|
||||
*p = '\n';
|
||||
break;
|
||||
default:
|
||||
// Fall through to copying *p
|
||||
break;
|
||||
}
|
||||
}
|
||||
*(q++) = *(p++);
|
||||
}
|
||||
*q = '\0';
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Converts parameters into test function consumable parameters.
|
||||
* Example: Input: {"int", "0", "char*", "Hello",
|
||||
* "hex", "abef", "exp", "1"}
|
||||
* Output: {
|
||||
* 0, // Verified int
|
||||
* "Hello", // Verified string
|
||||
* 2, { 0xab, 0xef },// Converted len,hex pair
|
||||
* 9600 // Evaluated expression
|
||||
* }
|
||||
*
|
||||
*
|
||||
* \param cnt Parameter array count.
|
||||
* \param params Out array of found parameters.
|
||||
* \param int_params_store Memory for storing processed integer parameters.
|
||||
*
|
||||
* \return 0 for success else 1
|
||||
*/
|
||||
static int convert_params(size_t cnt, char **params,
|
||||
mbedtls_test_argument_t *int_params_store)
|
||||
{
|
||||
char **cur = params;
|
||||
char **out = params;
|
||||
int ret = DISPATCH_TEST_SUCCESS;
|
||||
|
||||
while (cur < params + cnt) {
|
||||
char *type = *cur++;
|
||||
char *val = *cur++;
|
||||
|
||||
if (strcmp(type, "char*") == 0) {
|
||||
if (verify_string(&val) == 0) {
|
||||
*out++ = val;
|
||||
} else {
|
||||
ret = (DISPATCH_INVALID_TEST_DATA);
|
||||
break;
|
||||
}
|
||||
} else if (strcmp(type, "int") == 0) {
|
||||
if (verify_int(val, &int_params_store->sint) == 0) {
|
||||
*out++ = (char *) int_params_store++;
|
||||
} else {
|
||||
ret = (DISPATCH_INVALID_TEST_DATA);
|
||||
break;
|
||||
}
|
||||
} else if (strcmp(type, "hex") == 0) {
|
||||
if (verify_string(&val) == 0) {
|
||||
size_t len;
|
||||
|
||||
TEST_HELPER_ASSERT(
|
||||
mbedtls_test_unhexify((unsigned char *) val, strlen(val),
|
||||
val, &len) == 0);
|
||||
|
||||
int_params_store->len = len;
|
||||
*out++ = val;
|
||||
*out++ = (char *) (int_params_store++);
|
||||
} else {
|
||||
ret = (DISPATCH_INVALID_TEST_DATA);
|
||||
break;
|
||||
}
|
||||
} else if (strcmp(type, "exp") == 0) {
|
||||
int exp_id = strtol(val, NULL, 10);
|
||||
if (get_expression(exp_id, &int_params_store->sint) == 0) {
|
||||
*out++ = (char *) int_params_store++;
|
||||
} else {
|
||||
ret = (DISPATCH_INVALID_TEST_DATA);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ret = (DISPATCH_INVALID_TEST_DATA);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tests snprintf implementation with test input.
|
||||
*
|
||||
* \note
|
||||
* At high optimization levels (e.g. gcc -O3), this function may be
|
||||
* inlined in run_test_snprintf. This can trigger a spurious warning about
|
||||
* potential misuse of snprintf from gcc -Wformat-truncation (observed with
|
||||
* gcc 7.2). This warning makes tests in run_test_snprintf redundant on gcc
|
||||
* only. They are still valid for other compilers. Avoid this warning by
|
||||
* forbidding inlining of this function by gcc.
|
||||
*
|
||||
* \param n Buffer test length.
|
||||
* \param ref_buf Expected buffer.
|
||||
* \param ref_ret Expected snprintf return value.
|
||||
*
|
||||
* \return 0 for success else 1
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
# if defined(__dietlibc__)
|
||||
/* __noinline__ is a macro in dietlibc... */
|
||||
__attribute__((noinline))
|
||||
# else
|
||||
__attribute__((__noinline__))
|
||||
# endif
|
||||
#endif
|
||||
static int test_snprintf(size_t n, const char *ref_buf, int ref_ret)
|
||||
{
|
||||
int ret;
|
||||
char buf[10] = "xxxxxxxxx";
|
||||
const char ref[10] = "xxxxxxxxx";
|
||||
|
||||
if (n >= sizeof(buf)) {
|
||||
return -1;
|
||||
}
|
||||
ret = mbedtls_snprintf(buf, n, "%s", "123");
|
||||
if (ret < 0 || (size_t) ret >= n) {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
if (strncmp(ref_buf, buf, sizeof(buf)) != 0 ||
|
||||
ref_ret != ret ||
|
||||
memcmp(buf + n, ref + n, sizeof(buf) - n) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Tests snprintf implementation.
|
||||
*
|
||||
* \return 0 for success else 1
|
||||
*/
|
||||
static int run_test_snprintf(void)
|
||||
{
|
||||
return test_snprintf(0, "xxxxxxxxx", -1) != 0 ||
|
||||
test_snprintf(1, "", -1) != 0 ||
|
||||
test_snprintf(2, "1", -1) != 0 ||
|
||||
test_snprintf(3, "12", -1) != 0 ||
|
||||
test_snprintf(4, "123", 3) != 0 ||
|
||||
test_snprintf(5, "123", 3) != 0;
|
||||
}
|
||||
|
||||
/** \brief Write the description of the test case to the outcome CSV file.
|
||||
*
|
||||
* \param outcome_file The file to write to.
|
||||
* If this is \c NULL, this function does nothing.
|
||||
* \param argv0 The test suite name.
|
||||
* \param test_case The test case description.
|
||||
*/
|
||||
static void write_outcome_entry(FILE *outcome_file,
|
||||
const char *argv0,
|
||||
const char *test_case)
|
||||
{
|
||||
/* The non-varying fields are initialized on first use. */
|
||||
static const char *platform = NULL;
|
||||
static const char *configuration = NULL;
|
||||
static const char *test_suite = NULL;
|
||||
|
||||
if (outcome_file == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform == NULL) {
|
||||
platform = getenv("MBEDTLS_TEST_PLATFORM");
|
||||
if (platform == NULL) {
|
||||
platform = "unknown";
|
||||
}
|
||||
}
|
||||
if (configuration == NULL) {
|
||||
configuration = getenv("MBEDTLS_TEST_CONFIGURATION");
|
||||
if (configuration == NULL) {
|
||||
configuration = "unknown";
|
||||
}
|
||||
}
|
||||
if (test_suite == NULL) {
|
||||
test_suite = strrchr(argv0, '/');
|
||||
if (test_suite != NULL) {
|
||||
test_suite += 1; // skip the '/'
|
||||
} else {
|
||||
test_suite = argv0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Write the beginning of the outcome line.
|
||||
* Ignore errors: writing the outcome file is on a best-effort basis. */
|
||||
mbedtls_fprintf(outcome_file, "%s;%s;%s;%s;",
|
||||
platform, configuration, test_suite, test_case);
|
||||
}
|
||||
|
||||
/** \brief Write the result of the test case to the outcome CSV file.
|
||||
*
|
||||
* \param outcome_file The file to write to.
|
||||
* If this is \c NULL, this function does nothing.
|
||||
* \param unmet_dep_count The number of unmet dependencies.
|
||||
* \param unmet_dependencies The array of unmet dependencies.
|
||||
* \param missing_unmet_dependencies Non-zero if there was a problem tracking
|
||||
* all unmet dependencies, 0 otherwise.
|
||||
* \param ret The test dispatch status (DISPATCH_xxx).
|
||||
*/
|
||||
static void write_outcome_result(FILE *outcome_file,
|
||||
size_t unmet_dep_count,
|
||||
int unmet_dependencies[],
|
||||
int missing_unmet_dependencies,
|
||||
int ret)
|
||||
{
|
||||
if (outcome_file == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write the end of the outcome line.
|
||||
* Ignore errors: writing the outcome file is on a best-effort basis. */
|
||||
switch (ret) {
|
||||
case DISPATCH_TEST_SUCCESS:
|
||||
if (unmet_dep_count > 0) {
|
||||
size_t i;
|
||||
mbedtls_fprintf(outcome_file, "SKIP");
|
||||
for (i = 0; i < unmet_dep_count; i++) {
|
||||
mbedtls_fprintf(outcome_file, "%c%d",
|
||||
i == 0 ? ';' : ':',
|
||||
unmet_dependencies[i]);
|
||||
}
|
||||
if (missing_unmet_dependencies) {
|
||||
mbedtls_fprintf(outcome_file, ":...");
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (mbedtls_test_get_result()) {
|
||||
case MBEDTLS_TEST_RESULT_SUCCESS:
|
||||
mbedtls_fprintf(outcome_file, "PASS;");
|
||||
break;
|
||||
case MBEDTLS_TEST_RESULT_SKIPPED:
|
||||
mbedtls_fprintf(outcome_file, "SKIP;Runtime skip");
|
||||
break;
|
||||
default:
|
||||
mbedtls_fprintf(outcome_file, "FAIL;%s:%d:%s",
|
||||
mbedtls_get_test_filename(),
|
||||
mbedtls_test_get_line_no(),
|
||||
mbedtls_test_get_test());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DISPATCH_TEST_FN_NOT_FOUND:
|
||||
mbedtls_fprintf(outcome_file, "FAIL;Test function not found");
|
||||
break;
|
||||
case DISPATCH_INVALID_TEST_DATA:
|
||||
mbedtls_fprintf(outcome_file, "FAIL;Invalid test data");
|
||||
break;
|
||||
case DISPATCH_UNSUPPORTED_SUITE:
|
||||
mbedtls_fprintf(outcome_file, "SKIP;Unsupported suite");
|
||||
break;
|
||||
default:
|
||||
mbedtls_fprintf(outcome_file, "FAIL;Unknown cause");
|
||||
break;
|
||||
}
|
||||
mbedtls_fprintf(outcome_file, "\n");
|
||||
fflush(outcome_file);
|
||||
}
|
||||
|
||||
#if defined(__unix__) || \
|
||||
(defined(__APPLE__) && defined(__MACH__))
|
||||
#define MBEDTLS_HAVE_CHDIR
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HAVE_CHDIR)
|
||||
/** Try chdir to the directory containing argv0.
|
||||
*
|
||||
* Failures are silent.
|
||||
*/
|
||||
static void try_chdir_if_supported(const char *argv0)
|
||||
{
|
||||
/* We might want to allow backslash as well, for Windows. But then we also
|
||||
* need to consider chdir() vs _chdir(), and different conventions
|
||||
* regarding paths in argv[0] (naively enabling this code with
|
||||
* backslash support on Windows leads to chdir into the wrong directory
|
||||
* on the CI). */
|
||||
const char *slash = strrchr(argv0, '/');
|
||||
if (slash == NULL) {
|
||||
return;
|
||||
}
|
||||
size_t path_size = slash - argv0 + 1;
|
||||
char *path = mbedtls_calloc(1, path_size);
|
||||
if (path == NULL) {
|
||||
return;
|
||||
}
|
||||
memcpy(path, argv0, path_size - 1);
|
||||
path[path_size - 1] = 0;
|
||||
int ret = chdir(path);
|
||||
if (ret != 0) {
|
||||
mbedtls_fprintf(stderr, "%s: note: chdir(\"%s\") failed.\n",
|
||||
__func__, path);
|
||||
}
|
||||
mbedtls_free(path);
|
||||
}
|
||||
#else /* MBEDTLS_HAVE_CHDIR */
|
||||
/* No chdir() or no support for parsing argv[0] on this platform. */
|
||||
static void try_chdir_if_supported(const char *argv0)
|
||||
{
|
||||
(void) argv0;
|
||||
return;
|
||||
}
|
||||
#endif /* MBEDTLS_HAVE_CHDIR */
|
||||
|
||||
/**
|
||||
* \brief Desktop implementation of execute_tests().
|
||||
* Parses command line and executes tests from
|
||||
* supplied or default data file.
|
||||
*
|
||||
* \param argc Command line argument count.
|
||||
* \param argv Argument array.
|
||||
*
|
||||
* \return Program exit status.
|
||||
*/
|
||||
static int execute_tests(int argc, const char **argv)
|
||||
{
|
||||
/* Local Configurations and options */
|
||||
const char *default_filename = "DATA_FILE";
|
||||
const char *test_filename = NULL;
|
||||
const char **test_files = NULL;
|
||||
size_t testfile_count = 0;
|
||||
int option_verbose = 0;
|
||||
size_t function_id = 0;
|
||||
|
||||
/* Other Local variables */
|
||||
int arg_index = 1;
|
||||
const char *next_arg;
|
||||
size_t testfile_index, i, cnt;
|
||||
int ret;
|
||||
unsigned total_errors = 0, total_tests = 0, total_skipped = 0;
|
||||
FILE *file;
|
||||
char buf[5000];
|
||||
char *params[50];
|
||||
/* Store for processed integer params. */
|
||||
mbedtls_test_argument_t int_params[50];
|
||||
void *pointer;
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
int stdout_fd = -1;
|
||||
#endif /* __unix__ || __APPLE__ __MACH__ */
|
||||
const char *outcome_file_name = getenv("MBEDTLS_TEST_OUTCOME_FILE");
|
||||
FILE *outcome_file = NULL;
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
|
||||
!defined(TEST_SUITE_MEMORY_BUFFER_ALLOC)
|
||||
unsigned char alloc_buf[1000000];
|
||||
mbedtls_memory_buffer_alloc_init(alloc_buf, sizeof(alloc_buf));
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
|
||||
mbedtls_test_mutex_usage_init();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The C standard doesn't guarantee that all-bits-0 is the representation
|
||||
* of a NULL pointer. We do however use that in our code for initializing
|
||||
* structures, which should work on every modern platform. Let's be sure.
|
||||
*/
|
||||
memset(&pointer, 0, sizeof(void *));
|
||||
if (pointer != NULL) {
|
||||
mbedtls_fprintf(stderr, "all-bits-zero is not a NULL pointer\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we have a snprintf that correctly zero-terminates
|
||||
*/
|
||||
if (run_test_snprintf() != 0) {
|
||||
mbedtls_fprintf(stderr, "the snprintf implementation is broken\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (outcome_file_name != NULL && *outcome_file_name != '\0') {
|
||||
outcome_file = fopen(outcome_file_name, "a");
|
||||
if (outcome_file == NULL) {
|
||||
mbedtls_fprintf(stderr, "Unable to open outcome file. Continuing anyway.\n");
|
||||
}
|
||||
}
|
||||
|
||||
while (arg_index < argc) {
|
||||
next_arg = argv[arg_index];
|
||||
|
||||
if (strcmp(next_arg, "--verbose") == 0 ||
|
||||
strcmp(next_arg, "-v") == 0) {
|
||||
option_verbose = 1;
|
||||
} else if (strcmp(next_arg, "--help") == 0 ||
|
||||
strcmp(next_arg, "-h") == 0) {
|
||||
mbedtls_fprintf(stdout, USAGE);
|
||||
mbedtls_exit(EXIT_SUCCESS);
|
||||
} else {
|
||||
/* Not an option, therefore treat all further arguments as the file
|
||||
* list.
|
||||
*/
|
||||
test_files = &argv[arg_index];
|
||||
testfile_count = argc - arg_index;
|
||||
break;
|
||||
}
|
||||
|
||||
arg_index++;
|
||||
}
|
||||
|
||||
/* If no files were specified, assume a default */
|
||||
if (test_files == NULL || testfile_count == 0) {
|
||||
test_files = &default_filename;
|
||||
testfile_count = 1;
|
||||
}
|
||||
|
||||
/* Initialize the struct that holds information about the last test */
|
||||
mbedtls_test_info_reset();
|
||||
|
||||
/* Now begin to execute the tests in the testfiles */
|
||||
for (testfile_index = 0;
|
||||
testfile_index < testfile_count;
|
||||
testfile_index++) {
|
||||
size_t unmet_dep_count = 0;
|
||||
int unmet_dependencies[20];
|
||||
int missing_unmet_dependencies = 0;
|
||||
|
||||
test_filename = test_files[testfile_index];
|
||||
|
||||
file = fopen(test_filename, "r");
|
||||
if (file == NULL) {
|
||||
mbedtls_fprintf(stderr, "Failed to open test file: %s\n",
|
||||
test_filename);
|
||||
if (outcome_file != NULL) {
|
||||
fclose(outcome_file);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (!feof(file)) {
|
||||
if (unmet_dep_count > 0) {
|
||||
mbedtls_fprintf(stderr,
|
||||
"FATAL: Dep count larger than zero at start of loop\n");
|
||||
mbedtls_exit(MBEDTLS_EXIT_FAILURE);
|
||||
}
|
||||
unmet_dep_count = 0;
|
||||
missing_unmet_dependencies = 0;
|
||||
|
||||
if ((ret = get_line(file, buf, sizeof(buf))) != 0) {
|
||||
break;
|
||||
}
|
||||
mbedtls_fprintf(stdout, "%s%.66s",
|
||||
mbedtls_test_get_result() == MBEDTLS_TEST_RESULT_FAILED ?
|
||||
"\n" : "", buf);
|
||||
mbedtls_fprintf(stdout, " ");
|
||||
for (i = strlen(buf) + 1; i < 67; i++) {
|
||||
mbedtls_fprintf(stdout, ".");
|
||||
}
|
||||
mbedtls_fprintf(stdout, " ");
|
||||
fflush(stdout);
|
||||
write_outcome_entry(outcome_file, argv[0], buf);
|
||||
|
||||
total_tests++;
|
||||
|
||||
if ((ret = get_line(file, buf, sizeof(buf))) != 0) {
|
||||
break;
|
||||
}
|
||||
cnt = parse_arguments(buf, strlen(buf), params,
|
||||
sizeof(params) / sizeof(params[0]));
|
||||
|
||||
if (strcmp(params[0], "depends_on") == 0) {
|
||||
for (i = 1; i < cnt; i++) {
|
||||
int dep_id = strtol(params[i], NULL, 10);
|
||||
if (dep_check(dep_id) != DEPENDENCY_SUPPORTED) {
|
||||
if (unmet_dep_count <
|
||||
ARRAY_LENGTH(unmet_dependencies)) {
|
||||
unmet_dependencies[unmet_dep_count] = dep_id;
|
||||
unmet_dep_count++;
|
||||
} else {
|
||||
missing_unmet_dependencies = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = get_line(file, buf, sizeof(buf))) != 0) {
|
||||
break;
|
||||
}
|
||||
cnt = parse_arguments(buf, strlen(buf), params,
|
||||
sizeof(params) / sizeof(params[0]));
|
||||
}
|
||||
|
||||
// If there are no unmet dependencies execute the test
|
||||
if (unmet_dep_count == 0) {
|
||||
mbedtls_test_info_reset();
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
/* Suppress all output from the library unless we're verbose
|
||||
* mode
|
||||
*/
|
||||
if (!option_verbose) {
|
||||
stdout_fd = redirect_output(stdout, "/dev/null");
|
||||
if (stdout_fd == -1) {
|
||||
/* Redirection has failed with no stdout so exit */
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#endif /* __unix__ || __APPLE__ __MACH__ */
|
||||
|
||||
function_id = strtoul(params[0], NULL, 10);
|
||||
if ((ret = check_test(function_id)) == DISPATCH_TEST_SUCCESS) {
|
||||
ret = convert_params(cnt - 1, params + 1, int_params);
|
||||
if (DISPATCH_TEST_SUCCESS == ret) {
|
||||
ret = dispatch_test(function_id, (void **) (params + 1));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
if (!option_verbose && restore_output(stdout, stdout_fd)) {
|
||||
/* Redirection has failed with no stdout so exit */
|
||||
exit(1);
|
||||
}
|
||||
#endif /* __unix__ || __APPLE__ __MACH__ */
|
||||
|
||||
}
|
||||
|
||||
write_outcome_result(outcome_file,
|
||||
unmet_dep_count, unmet_dependencies,
|
||||
missing_unmet_dependencies,
|
||||
ret);
|
||||
if (unmet_dep_count > 0 || ret == DISPATCH_UNSUPPORTED_SUITE) {
|
||||
total_skipped++;
|
||||
mbedtls_fprintf(stdout, "----");
|
||||
|
||||
if (1 == option_verbose && ret == DISPATCH_UNSUPPORTED_SUITE) {
|
||||
mbedtls_fprintf(stdout, "\n Test Suite not enabled");
|
||||
}
|
||||
|
||||
if (1 == option_verbose && unmet_dep_count > 0) {
|
||||
mbedtls_fprintf(stdout, "\n Unmet dependencies: ");
|
||||
for (i = 0; i < unmet_dep_count; i++) {
|
||||
mbedtls_fprintf(stdout, "%d ",
|
||||
unmet_dependencies[i]);
|
||||
}
|
||||
if (missing_unmet_dependencies) {
|
||||
mbedtls_fprintf(stdout, "...");
|
||||
}
|
||||
}
|
||||
mbedtls_fprintf(stdout, "\n");
|
||||
fflush(stdout);
|
||||
|
||||
unmet_dep_count = 0;
|
||||
missing_unmet_dependencies = 0;
|
||||
} else if (ret == DISPATCH_TEST_SUCCESS) {
|
||||
if (mbedtls_test_get_result() == MBEDTLS_TEST_RESULT_SUCCESS) {
|
||||
mbedtls_fprintf(stdout, "PASS\n");
|
||||
} else if (mbedtls_test_get_result() == MBEDTLS_TEST_RESULT_SKIPPED) {
|
||||
mbedtls_fprintf(stdout, "----\n");
|
||||
total_skipped++;
|
||||
} else {
|
||||
char line_buffer[MBEDTLS_TEST_LINE_LENGTH];
|
||||
|
||||
total_errors++;
|
||||
mbedtls_fprintf(stdout, "FAILED\n");
|
||||
mbedtls_fprintf(stdout, " %s\n at ",
|
||||
mbedtls_test_get_test());
|
||||
if (mbedtls_test_get_step() != (unsigned long) (-1)) {
|
||||
mbedtls_fprintf(stdout, "step %lu, ",
|
||||
mbedtls_test_get_step());
|
||||
}
|
||||
mbedtls_fprintf(stdout, "line %d, %s",
|
||||
mbedtls_test_get_line_no(),
|
||||
mbedtls_get_test_filename());
|
||||
|
||||
mbedtls_test_get_line1(line_buffer);
|
||||
if (line_buffer[0] != 0) {
|
||||
mbedtls_fprintf(stdout, "\n %s", line_buffer);
|
||||
}
|
||||
mbedtls_test_get_line2(line_buffer);
|
||||
if (line_buffer[0] != 0) {
|
||||
mbedtls_fprintf(stdout, "\n %s", line_buffer);
|
||||
}
|
||||
}
|
||||
fflush(stdout);
|
||||
} else if (ret == DISPATCH_INVALID_TEST_DATA) {
|
||||
mbedtls_fprintf(stderr, "FAILED: FATAL PARSE ERROR\n");
|
||||
fclose(file);
|
||||
mbedtls_exit(2);
|
||||
} else if (ret == DISPATCH_TEST_FN_NOT_FOUND) {
|
||||
mbedtls_fprintf(stderr, "FAILED: FATAL TEST FUNCTION NOT FOUND\n");
|
||||
fclose(file);
|
||||
mbedtls_exit(2);
|
||||
} else {
|
||||
total_errors++;
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
if (outcome_file != NULL) {
|
||||
fclose(outcome_file);
|
||||
}
|
||||
|
||||
mbedtls_fprintf(stdout,
|
||||
"\n----------------------------------------------------------------------------\n\n");
|
||||
if (total_errors == 0) {
|
||||
mbedtls_fprintf(stdout, "PASSED");
|
||||
} else {
|
||||
mbedtls_fprintf(stdout, "FAILED");
|
||||
}
|
||||
|
||||
mbedtls_fprintf(stdout, " (%u / %u tests (%u skipped))\n",
|
||||
total_tests - total_errors, total_tests, total_skipped);
|
||||
|
||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
|
||||
mbedtls_test_mutex_usage_end();
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
|
||||
!defined(TEST_SUITE_MEMORY_BUFFER_ALLOC)
|
||||
#if defined(MBEDTLS_MEMORY_DEBUG)
|
||||
mbedtls_memory_buffer_alloc_status();
|
||||
#endif
|
||||
mbedtls_memory_buffer_alloc_free();
|
||||
#endif
|
||||
|
||||
return total_errors != 0;
|
||||
}
|
||||
277
vendor/mbedtls/tests/suites/main_test.function
vendored
Normal file
277
vendor/mbedtls/tests/suites/main_test.function
vendored
Normal file
@@ -0,0 +1,277 @@
|
||||
#line 2 "suites/main_test.function"
|
||||
/*
|
||||
* *** THIS FILE HAS BEEN MACHINE GENERATED ***
|
||||
*
|
||||
* This file has been machine generated using the script:
|
||||
* __MBEDTLS_TEST_TEMPLATE__GENERATOR_SCRIPT
|
||||
*
|
||||
* Test file : __MBEDTLS_TEST_TEMPLATE__TEST_FILE
|
||||
*
|
||||
* The following files were used to create this file.
|
||||
*
|
||||
* Main code file : __MBEDTLS_TEST_TEMPLATE__TEST_MAIN_FILE
|
||||
* Platform code file : __MBEDTLS_TEST_TEMPLATE__TEST_PLATFORM_FILE
|
||||
* Helper file : __MBEDTLS_TEST_TEMPLATE__TEST_COMMON_HELPER_FILE
|
||||
* Test suite file : __MBEDTLS_TEST_TEMPLATE__TEST_CASE_FILE
|
||||
* Test suite data : __MBEDTLS_TEST_TEMPLATE__TEST_CASE_DATA_FILE
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#if !defined(_POSIX_C_SOURCE)
|
||||
#define _POSIX_C_SOURCE 200112L // for fileno() from <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
/* On FreeBSD as of 14.3, no value of _POSIX_C_SOURCE is enough for
|
||||
* gettimeofday(), you need _XOPEN_SOURCE (any value).
|
||||
* Furthermore, setting _XOPEN_SOURCE to 500 removes support for long long
|
||||
* in libc, so you need at least 600 for e.g. strtoull().
|
||||
*/
|
||||
#if !defined(_XOPEN_SOURCE)
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
/* Test code may use deprecated identifiers only if the preprocessor symbol
|
||||
* MBEDTLS_TEST_DEPRECATED is defined. When building tests, set
|
||||
* MBEDTLS_TEST_DEPRECATED explicitly if MBEDTLS_DEPRECATED_WARNING is
|
||||
* enabled but the corresponding warnings are not treated as errors.
|
||||
*/
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED) && !defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_TEST_DEPRECATED
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Common helper code */
|
||||
|
||||
__MBEDTLS_TEST_TEMPLATE__TEST_COMMON_HELPERS
|
||||
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Test Suite Code */
|
||||
|
||||
|
||||
#define TEST_SUITE_ACTIVE
|
||||
|
||||
__MBEDTLS_TEST_TEMPLATE__FUNCTIONS_CODE
|
||||
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Test dispatch code */
|
||||
|
||||
|
||||
/**
|
||||
* \brief Evaluates an expression/macro into its literal integer value.
|
||||
* For optimizing space for embedded targets each expression/macro
|
||||
* is identified by a unique identifier instead of string literals.
|
||||
* Identifiers and evaluation code is generated by script:
|
||||
* __MBEDTLS_TEST_TEMPLATE__GENERATOR_SCRIPT
|
||||
*
|
||||
* \param exp_id Expression identifier.
|
||||
* \param out_value Pointer to int to hold the integer.
|
||||
*
|
||||
* \return 0 if exp_id is found. 1 otherwise.
|
||||
*/
|
||||
static int get_expression(int32_t exp_id, intmax_t *out_value)
|
||||
{
|
||||
int ret = KEY_VALUE_MAPPING_FOUND;
|
||||
|
||||
(void) exp_id;
|
||||
(void) out_value;
|
||||
|
||||
switch (exp_id) {
|
||||
__MBEDTLS_TEST_TEMPLATE__EXPRESSION_CODE
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
default:
|
||||
{
|
||||
ret = KEY_VALUE_MAPPING_NOT_FOUND;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Checks if the dependency i.e. the compile flag is set.
|
||||
* For optimizing space for embedded targets each dependency
|
||||
* is identified by a unique identifier instead of string literals.
|
||||
* Identifiers and check code is generated by script:
|
||||
* __MBEDTLS_TEST_TEMPLATE__GENERATOR_SCRIPT
|
||||
*
|
||||
* \param dep_id Dependency identifier.
|
||||
*
|
||||
* \return DEPENDENCY_SUPPORTED if set else DEPENDENCY_NOT_SUPPORTED
|
||||
*/
|
||||
static int dep_check(int dep_id)
|
||||
{
|
||||
int ret = DEPENDENCY_NOT_SUPPORTED;
|
||||
|
||||
(void) dep_id;
|
||||
|
||||
switch (dep_id) {
|
||||
__MBEDTLS_TEST_TEMPLATE__DEP_CHECK_CODE
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Function pointer type for test function wrappers.
|
||||
*
|
||||
* A test function wrapper decodes the parameters and passes them to the
|
||||
* underlying test function. Both the wrapper and the underlying function
|
||||
* return void. Test wrappers assume that they are passed a suitable
|
||||
* parameter array and do not perform any error detection.
|
||||
*
|
||||
* \param param_array The array of parameters. Each element is a `void *`
|
||||
* which the wrapper casts to the correct type and
|
||||
* dereferences. Each wrapper function hard-codes the
|
||||
* number and types of the parameters.
|
||||
*/
|
||||
typedef void (*TestWrapper_t)(void **param_array);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Table of test function wrappers. Used by dispatch_test().
|
||||
* This table is populated by script:
|
||||
* __MBEDTLS_TEST_TEMPLATE__GENERATOR_SCRIPT
|
||||
*
|
||||
*/
|
||||
TestWrapper_t test_funcs[] =
|
||||
{
|
||||
__MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Dispatches test functions based on function index.
|
||||
*
|
||||
* \param func_idx Test function index.
|
||||
* \param params The array of parameters to pass to the test function.
|
||||
* It will be decoded by the #TestWrapper_t wrapper function.
|
||||
*
|
||||
* \return DISPATCH_TEST_SUCCESS if found
|
||||
* DISPATCH_TEST_FN_NOT_FOUND if not found
|
||||
* DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
|
||||
*/
|
||||
static int dispatch_test(size_t func_idx, void **params)
|
||||
{
|
||||
int ret = DISPATCH_TEST_SUCCESS;
|
||||
TestWrapper_t fp = NULL;
|
||||
|
||||
if (func_idx < (int) (sizeof(test_funcs) / sizeof(TestWrapper_t))) {
|
||||
fp = test_funcs[func_idx];
|
||||
if (fp) {
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
||||
mbedtls_test_enable_insecure_external_rng();
|
||||
#endif
|
||||
|
||||
fp(params);
|
||||
|
||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
|
||||
mbedtls_test_mutex_usage_check();
|
||||
#endif /* MBEDTLS_TEST_MUTEX_USAGE */
|
||||
} else {
|
||||
ret = DISPATCH_UNSUPPORTED_SUITE;
|
||||
}
|
||||
} else {
|
||||
ret = DISPATCH_TEST_FN_NOT_FOUND;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Checks if test function is supported in this build-time
|
||||
* configuration.
|
||||
*
|
||||
* \param func_idx Test function index.
|
||||
*
|
||||
* \return DISPATCH_TEST_SUCCESS if found
|
||||
* DISPATCH_TEST_FN_NOT_FOUND if not found
|
||||
* DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
|
||||
*/
|
||||
static int check_test(size_t func_idx)
|
||||
{
|
||||
int ret = DISPATCH_TEST_SUCCESS;
|
||||
TestWrapper_t fp = NULL;
|
||||
|
||||
if (func_idx < (int) (sizeof(test_funcs)/sizeof(TestWrapper_t))) {
|
||||
fp = test_funcs[func_idx];
|
||||
if (fp == NULL) {
|
||||
ret = DISPATCH_UNSUPPORTED_SUITE;
|
||||
}
|
||||
} else {
|
||||
ret = DISPATCH_TEST_FN_NOT_FOUND;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
__MBEDTLS_TEST_TEMPLATE__PLATFORM_CODE
|
||||
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Main Test code */
|
||||
|
||||
|
||||
/**
|
||||
* \brief Program main. Invokes platform specific execute_tests().
|
||||
*
|
||||
* \param argc Command line arguments count.
|
||||
* \param argv Array of command line arguments.
|
||||
*
|
||||
* \return Exit code.
|
||||
*/
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
#if defined(MBEDTLS_TEST_HOOKS)
|
||||
extern void (*mbedtls_test_hook_test_fail)(const char *test, int line, const char *file);
|
||||
mbedtls_test_hook_test_fail = &mbedtls_test_fail;
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Try changing to the directory containing the executable, if
|
||||
* using the default data file. This allows running the executable
|
||||
* from another directory (e.g. the project root) and still access
|
||||
* the .datax file as well as data files used by test cases
|
||||
* (typically from framework/data_files).
|
||||
*
|
||||
* Note that we do this before the platform setup (which may access
|
||||
* files such as a random seed). We also do this before accessing
|
||||
* test-specific files such as the outcome file, which is arguably
|
||||
* not desirable and should be fixed later.
|
||||
*/
|
||||
if (argc == 1) {
|
||||
try_chdir_if_supported(argv[0]);
|
||||
}
|
||||
|
||||
int ret = mbedtls_test_platform_setup();
|
||||
if (ret != 0) {
|
||||
mbedtls_fprintf(stderr,
|
||||
"FATAL: Failed to initialize platform - error %d\n",
|
||||
ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = execute_tests(argc, argv);
|
||||
mbedtls_test_platform_teardown();
|
||||
return ret;
|
||||
}
|
||||
263
vendor/mbedtls/tests/suites/test_suite_aes.cbc.data
vendored
Normal file
263
vendor/mbedtls/tests/suites/test_suite_aes.cbc.data
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
AES-128-CBC Encrypt NIST KAT #1
|
||||
aes_encrypt_cbc:"fffffffffffff8000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"8b527a6aebdaec9eaef8eda2cb7783e5":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #2
|
||||
aes_encrypt_cbc:"fffffffffffffc000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"43fdaf53ebbc9880c228617d6a9b548b":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #3
|
||||
aes_encrypt_cbc:"fffffffffffffe000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"53786104b9744b98f052c46f1c850d0b":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #4
|
||||
aes_encrypt_cbc:"e37b1c6aa2846f6fdb413f238b089f23":"00000000000000000000000000000000":"00000000000000000000000000000000":"43c9f7e62f5d288bb27aa40ef8fe1ea8":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #5
|
||||
aes_encrypt_cbc:"6c002b682483e0cabcc731c253be5674":"00000000000000000000000000000000":"00000000000000000000000000000000":"3580d19cff44f1014a7c966a69059de5":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #6
|
||||
aes_encrypt_cbc:"143ae8ed6555aba96110ab58893a8ae1":"00000000000000000000000000000000":"00000000000000000000000000000000":"806da864dd29d48deafbe764f8202aef":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #7
|
||||
aes_encrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"6a118a874519e64e9963798a503f1d35":"dc43be40be0e53712f7e2bf5ca707209":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #8
|
||||
aes_encrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"cb9fceec81286ca3e989bd979b0cb284":"92beedab1895a94faa69b632e5cc47ce":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #9
|
||||
aes_encrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"b26aeb1874e47ca8358ff22378f09144":"459264f4798f6a78bacb89c15ed3d601":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #10
|
||||
aes_encrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"ffffffffffffffffffffffc000000000":"90684a2ac55fe1ec2b8ebd5622520b73":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #11
|
||||
aes_encrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"ffffffffffffffffffffffe000000000":"7472f9a7988607ca79707795991035e6":0
|
||||
|
||||
AES-128-CBC Encrypt NIST KAT #12
|
||||
aes_encrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"fffffffffffffffffffffff000000000":"56aff089878bf3352f8df172a3ae47d8":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #1
|
||||
aes_decrypt_cbc:"ffffffffe00000000000000000000000":"00000000000000000000000000000000":"23f710842b9bb9c32f26648c786807ca":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #2
|
||||
aes_decrypt_cbc:"fffffffff00000000000000000000000":"00000000000000000000000000000000":"44a98bf11e163f632c47ec6a49683a89":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #3
|
||||
aes_decrypt_cbc:"fffffffff80000000000000000000000":"00000000000000000000000000000000":"0f18aff94274696d9b61848bd50ac5e5":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #4
|
||||
aes_decrypt_cbc:"e234cdca2606b81f29408d5f6da21206":"00000000000000000000000000000000":"fff60a4740086b3b9c56195b98d91a7b":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #5
|
||||
aes_decrypt_cbc:"13237c49074a3da078dc1d828bb78c6f":"00000000000000000000000000000000":"8146a08e2357f0caa30ca8c94d1a0544":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #6
|
||||
aes_decrypt_cbc:"3071a2a48fe6cbd04f1a129098e308f8":"00000000000000000000000000000000":"4b98e06d356deb07ebb824e5713f7be3":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #7
|
||||
aes_decrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"0336763e966d92595a567cc9ce537f5e":"f34481ec3cc627bacd5dc3fb08f273e6":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #8
|
||||
aes_decrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"a9a1631bf4996954ebc093957b234589":"9798c4640bad75c7c3227db910174e72":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #9
|
||||
aes_decrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"ff4f8391a6a40ca5b25d23bedd44a597":"96ab5c2ff612d9dfaae8c31f30c42168":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #10
|
||||
aes_decrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"f9b0fda0c4a898f5b9e6f661c4ce4d07":"fffffffffffffffffffffffffffffff0":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #11
|
||||
aes_decrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"8ade895913685c67c5269f8aae42983e":"fffffffffffffffffffffffffffffff8":0
|
||||
|
||||
AES-128-CBC Decrypt NIST KAT #12
|
||||
aes_decrypt_cbc:"00000000000000000000000000000000":"00000000000000000000000000000000":"39bde67d5c8ed8a8b1c37eb8fa9f5ac0":"fffffffffffffffffffffffffffffffc":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"fffffffffffffffffffffffffffffffffffffffffffffe00":"00000000000000000000000000000000":"00000000000000000000000000000000":"ddb505e6cc1384cbaec1df90b80beb20":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"ffffffffffffffffffffffffffffffffffffffffffffff00":"00000000000000000000000000000000":"00000000000000000000000000000000":"5674a3bed27bf4bd3622f9f5fe208306":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"ffffffffffffffffffffffffffffffffffffffffffffff80":"00000000000000000000000000000000":"00000000000000000000000000000000":"b687f26a89cfbfbb8e5eeac54055315e":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"25a39dbfd8034f71a81f9ceb55026e4037f8f6aa30ab44ce":"00000000000000000000000000000000":"00000000000000000000000000000000":"3608c344868e94555d23a120f8a5502d":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"e08c15411774ec4a908b64eadc6ac4199c7cd453f3aaef53":"00000000000000000000000000000000":"00000000000000000000000000000000":"77da2021935b840b7f5dcc39132da9e5":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"3b375a1ff7e8d44409696e6326ec9dec86138e2ae010b980":"00000000000000000000000000000000":"00000000000000000000000000000000":"3b7c24f825e3bf9873c9f14d39a0e6f4":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"51719783d3185a535bd75adc65071ce1":"4f354592ff7c8847d2d0870ca9481b7c":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"26aa49dcfe7629a8901a69a9914e6dfd":"d5e08bf9a182e857cf40b3a36ee248cc":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"941a4773058224e1ef66d10e0a6ee782":"067cd9d3749207791841562507fa9626":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ffc00000000000000000000000000000":"030d7e5b64f380a7e4ea5387b5cd7f49":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ffe00000000000000000000000000000":"0dc9a2610037009b698f11bb7e86c83e":0
|
||||
|
||||
AES-192-CBC Encrypt NIST KAT #12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"fff00000000000000000000000000000":"0046612c766d1840c226364f1fa7ed72":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"902d88d13eae52089abd6143cfe394e9":"ffffffffe00000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"d49bceb3b823fedd602c305345734bd2":"fffffffff00000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"707b1dbb0ffa40ef7d95def421233fae":"fffffffff80000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"fffffffffffffffffffc0000000000000000000000000000":"00000000000000000000000000000000":"8dfd999be5d0cfa35732c0ddc88ff5a5":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"fffffffffffffffffffe0000000000000000000000000000":"00000000000000000000000000000000":"02647c76a300c3173b841487eb2bae9f":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"ffffffffffffffffffff0000000000000000000000000000":"00000000000000000000000000000000":"172df8b02f04b53adab028b4e01acd87":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"b3ad5cea1dddc214ca969ac35f37dae1a9a9d1528f89bb35":"00000000000000000000000000000000":"3cf5e1d21a17956d1dffad6a7c41c659":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"45899367c3132849763073c435a9288a766c8b9ec2308516":"00000000000000000000000000000000":"69fd12e8505f8ded2fdcb197a121b362":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"ec250e04c3903f602647b85a401a1ae7ca2f02f67fa4253e":"00000000000000000000000000000000":"8aa584e2cc4d17417a97cb9a28ba29c8":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"c9b8135ff1b5adc413dfd053b21bd96d":"9c2d8842e5f48f57648205d39a239af1":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"4a3650c3371ce2eb35e389a171427440":"bff52510095f518ecca60af4205444bb":0
|
||||
|
||||
AES-192-CBC Decrypt NIST KAT #12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"4f354592ff7c8847d2d0870ca9481b7c":"51719783d3185a535bd75adc65071ce1":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"8000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"e35a6dcb19b201a01ebcfa8aa22b5759":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"c000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"b29169cdcf2d83e838125a12ee6aa400":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"e000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"d8f3a72fc3cdf74dfaf6c3e6b97b2fa6":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"dc0eba1f2232a7879ded34ed8428eeb8769b056bbaf8ad77cb65c3541430b4cf":"00000000000000000000000000000000":"00000000000000000000000000000000":"fc6aec906323480005c58e7e1ab004ad":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9":"00000000000000000000000000000000":"00000000000000000000000000000000":"a3944b95ca0b52043584ef02151926a8":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"797f8b3d176dac5b7e34a2d539c4ef367a16f8635f6264737591c5c07bf57a3e":"00000000000000000000000000000000":"00000000000000000000000000000000":"a74289fe73a4c123ca189ea1e1b49ad5":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"761c1fe41a18acf20d241650611d90f1":"623a52fcea5d443e48d9181ab32c7421":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"8a560769d605868ad80d819bdba03771":"38f2c7ae10612415d27ca190d27da8b4":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"91fbef2d15a97816060bee1feaa49afe":"1bc704f1bce135ceb810341b216d7abe":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ffffffffffffff800000000000000000":"0d9ac756eb297695eed4d382eb126d26":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ffffffffffffffc00000000000000000":"56ede9dda3f6f141bff1757fa689c3e1":0
|
||||
|
||||
AES-256-CBC Encrypt NIST KAT #12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ffffffffffffffe00000000000000000":"768f520efe0f23e61d3ec8ad9ce91774":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"49af6b372135acef10132e548f217b17":"ff000000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"8bcd40f94ebb63b9f7909676e667f1e7":"ff800000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"fe1cffb83f45dcfb38b29be438dbd3ab":"ffc00000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00":"00000000000000000000000000000000":"cca7c3086f5f9511b31233da7cab9160":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00":"00000000000000000000000000000000":"5b40ff4ec9be536ba23035fa4f06064c":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00":"00000000000000000000000000000000":"60eb5af8416b257149372194e8b88749":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"90143ae20cd78c5d8ebdd6cb9dc1762427a96c78c639bccc41a61424564eafe1":"00000000000000000000000000000000":"798c7c005dee432b2c8ea5dfa381ecc3":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"b7a5794d52737475d53d5a377200849be0260a67a2b22ced8bbef12882270d07":"00000000000000000000000000000000":"637c31dc2591a07636f646b72daabbe7":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"fca02f3d5011cfc5c1e23165d413a049d4526a991827424d896fe3435e0bf68e":"00000000000000000000000000000000":"179a49c712154bbffbe6e7a84a18e220":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"5c9d844ed46f9885085e5d6a4f94c7d7":"014730f80ac625fe84f026c60bfd547d":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"a9ff75bd7cf6613d3731c77c3b6d0c04":"0b24af36193ce4665f2825d7b4749c98":0
|
||||
|
||||
AES-256-CBC Decrypt NIST KAT #12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c7421":"761c1fe41a18acf20d241650611d90f1":0
|
||||
507
vendor/mbedtls/tests/suites/test_suite_aes.cfb.data
vendored
Normal file
507
vendor/mbedtls/tests/suites/test_suite_aes.cfb.data
vendored
Normal file
@@ -0,0 +1,507 @@
|
||||
AES-128-CFB128 Encrypt NIST KAT #1
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"f0000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"970014d634e2b7650777e8e84d03ccd8"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #2
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"f8000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"f17e79aed0db7e279e955b5f493875a7"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #3
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"fc000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"9ed5a75136a940d0963da379db4af26a"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #4
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"64cf9c7abc50b888af65f49d521944b2":"00000000000000000000000000000000":"00000000000000000000000000000000":"f7efc89d5dba578104016ce5ad659c05"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #5
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"47d6742eefcc0465dc96355e851b64d9":"00000000000000000000000000000000":"00000000000000000000000000000000":"0306194f666d183624aa230a8b264ae7"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #6
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"3eb39790678c56bee34bbcdeccf6cdb5":"00000000000000000000000000000000":"00000000000000000000000000000000":"858075d536d79ccee571f7d7204b1f67"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #7
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"00000000000000000000000000000000":"6a118a874519e64e9963798a503f1d35":"00000000000000000000000000000000":"dc43be40be0e53712f7e2bf5ca707209"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #8
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"00000000000000000000000000000000":"cb9fceec81286ca3e989bd979b0cb284":"00000000000000000000000000000000":"92beedab1895a94faa69b632e5cc47ce"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #9
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"00000000000000000000000000000000":"b26aeb1874e47ca8358ff22378f09144":"00000000000000000000000000000000":"459264f4798f6a78bacb89c15ed3d601"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #10
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"00000000000000000000000000000000":"fffffffffffffffffffffffffffffff0":"00000000000000000000000000000000":"f9b0fda0c4a898f5b9e6f661c4ce4d07"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #11
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"00000000000000000000000000000000":"fffffffffffffffffffffffffffffff8":"00000000000000000000000000000000":"8ade895913685c67c5269f8aae42983e"
|
||||
|
||||
AES-128-CFB128 Encrypt NIST KAT #12
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_encrypt_cfb128:"00000000000000000000000000000000":"fffffffffffffffffffffffffffffffc":"00000000000000000000000000000000":"39bde67d5c8ed8a8b1c37eb8fa9f5ac0"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #1
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"fffffffe000000000000000000000000":"00000000000000000000000000000000":"1114bc2028009b923f0b01915ce5e7c4":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #2
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"ffffffff000000000000000000000000":"00000000000000000000000000000000":"9c28524a16a1e1c1452971caa8d13476":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #3
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"ffffffff800000000000000000000000":"00000000000000000000000000000000":"ed62e16363638360fdd6ad62112794f0":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #4
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"3071a2a48fe6cbd04f1a129098e308f8":"00000000000000000000000000000000":"4b98e06d356deb07ebb824e5713f7be3":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #5
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"90f42ec0f68385f2ffc5dfc03a654dce":"00000000000000000000000000000000":"7a20a53d460fc9ce0423a7a0764c6cf2":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #6
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"febd9a24d8b65c1c787d50a4ed3619a9":"00000000000000000000000000000000":"f4a70d8af877f9b02b4c40df57d45b17":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #7
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"00000000000000000000000000000000":"f34481ec3cc627bacd5dc3fb08f273e6":"0336763e966d92595a567cc9ce537f5e":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #8
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"00000000000000000000000000000000":"9798c4640bad75c7c3227db910174e72":"a9a1631bf4996954ebc093957b234589":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #9
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"00000000000000000000000000000000":"96ab5c2ff612d9dfaae8c31f30c42168":"ff4f8391a6a40ca5b25d23bedd44a597":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #10
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"00000000000000000000000000000000":"ffffffffffffffff0000000000000000":"f807c3e7985fe0f5a50e2cdb25c5109e":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #11
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"00000000000000000000000000000000":"ffffffffffffffff8000000000000000":"41f992a856fb278b389a62f5d274d7e9":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB128 Decrypt NIST KAT #12
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB
|
||||
aes_decrypt_cfb128:"00000000000000000000000000000000":"ffffffffffffffffc000000000000000":"10d3ed7a6fe15ab4d91acbc7d0767ab1":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #1
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"fffffffffffffffffffc0000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"8dfd999be5d0cfa35732c0ddc88ff5a5"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #2
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"fffffffffffffffffffe0000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"02647c76a300c3173b841487eb2bae9f"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #3
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"ffffffffffffffffffff0000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"172df8b02f04b53adab028b4e01acd87"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #4
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"d184c36cf0dddfec39e654195006022237871a47c33d3198":"00000000000000000000000000000000":"00000000000000000000000000000000":"2e19fb60a3e1de0166f483c97824a978"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #5
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"4c6994ffa9dcdc805b60c2c0095334c42d95a8fc0ca5b080":"00000000000000000000000000000000":"00000000000000000000000000000000":"7656709538dd5fec41e0ce6a0f8e207d"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #6
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"c88f5b00a4ef9a6840e2acaf33f00a3bdc4e25895303fa72":"00000000000000000000000000000000":"00000000000000000000000000000000":"a67cf333b314d411d3c0ae6e1cfcd8f5"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #7
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"9c2d8842e5f48f57648205d39a239af1":"00000000000000000000000000000000":"c9b8135ff1b5adc413dfd053b21bd96d"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #8
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"bff52510095f518ecca60af4205444bb":"00000000000000000000000000000000":"4a3650c3371ce2eb35e389a171427440"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #9
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"51719783d3185a535bd75adc65071ce1":"00000000000000000000000000000000":"4f354592ff7c8847d2d0870ca9481b7c"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #10
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"ffffffffffffffe00000000000000000":"00000000000000000000000000000000":"f34e4a6324ea4a5c39a661c8fe5ada8f"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #11
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"fffffffffffffff00000000000000000":"00000000000000000000000000000000":"0882a16f44088d42447a29ac090ec17e"
|
||||
|
||||
AES-192-CFB128 Encrypt NIST KAT #12
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"000000000000000000000000000000000000000000000000":"fffffffffffffff80000000000000000":"00000000000000000000000000000000":"3a3c15bfc11a9537c130687004e136ee"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #1
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"ffffffffffffffffffffffffffffffffffffffffffe00000":"00000000000000000000000000000000":"60136703374f64e860b48ce31f930716":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #2
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"fffffffffffffffffffffffffffffffffffffffffff00000":"00000000000000000000000000000000":"8d63a269b14d506ccc401ab8a9f1b591":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #3
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"fffffffffffffffffffffffffffffffffffffffffff80000":"00000000000000000000000000000000":"d317f81dc6aa454aee4bd4a5a5cff4bd":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #4
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9":"00000000000000000000000000000000":"19c80ec4a6deb7e5ed1033dda933498f":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #5
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"b3ad5cea1dddc214ca969ac35f37dae1a9a9d1528f89bb35":"00000000000000000000000000000000":"3cf5e1d21a17956d1dffad6a7c41c659":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #6
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"45899367c3132849763073c435a9288a766c8b9ec2308516":"00000000000000000000000000000000":"69fd12e8505f8ded2fdcb197a121b362":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #7
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"1b077a6af4b7f98229de786d7516b639":"275cfc0413d8ccb70513c3859b1d0f72":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #8
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"9c2d8842e5f48f57648205d39a239af1":"c9b8135ff1b5adc413dfd053b21bd96d":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #9
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"bff52510095f518ecca60af4205444bb":"4a3650c3371ce2eb35e389a171427440":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #10
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"ffffffffffffffffffff000000000000":"54d632d03aba0bd0f91877ebdd4d09cb":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #11
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"ffffffffffffffffffff800000000000":"d3427be7e4d27cd54f5fe37b03cf0897":"00000000000000000000000000000000"
|
||||
|
||||
AES-192-CFB128 Decrypt NIST KAT #12
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"000000000000000000000000000000000000000000000000":"ffffffffffffffffffffc00000000000":"b2099795e88cc158fd75ea133d7e7fbe":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #1
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"ffffffe000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"bbd1097a62433f79449fa97d4ee80dbf"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #2
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"fffffff000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"07058e408f5b99b0e0f061a1761b5b3b"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #3
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"fffffff800000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"00000000000000000000000000000000":"5fd1f13fa0f31e37fabde328f894eac2"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #4
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"13428b5e4c005e0636dd338405d173ab135dec2a25c22c5df0722d69dcc43887":"00000000000000000000000000000000":"00000000000000000000000000000000":"649a71545378c783e368c9ade7114f6c"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #5
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"07eb03a08d291d1b07408bf3512ab40c91097ac77461aad4bb859647f74f00ee":"00000000000000000000000000000000":"00000000000000000000000000000000":"47cb030da2ab051dfc6c4bf6910d12bb"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #6
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"90143ae20cd78c5d8ebdd6cb9dc1762427a96c78c639bccc41a61424564eafe1":"00000000000000000000000000000000":"00000000000000000000000000000000":"798c7c005dee432b2c8ea5dfa381ecc3"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #7
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"0b24af36193ce4665f2825d7b4749c98":"00000000000000000000000000000000":"a9ff75bd7cf6613d3731c77c3b6d0c04"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #8
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"761c1fe41a18acf20d241650611d90f1":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c7421"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #9
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"8a560769d605868ad80d819bdba03771":"00000000000000000000000000000000":"38f2c7ae10612415d27ca190d27da8b4"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #10
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"ffffffffffffffffffffffffe0000000":"00000000000000000000000000000000":"2be1fae5048a25582a679ca10905eb80"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #11
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"fffffffffffffffffffffffff0000000":"00000000000000000000000000000000":"da86f292c6f41ea34fb2068df75ecc29"
|
||||
|
||||
AES-256-CFB128 Encrypt NIST KAT #12
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"fffffffffffffffffffffffff8000000":"00000000000000000000000000000000":"220df19f85d69b1b562fa69a3c5beca5"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #1
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"ffffffffff800000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"be66cfea2fecd6bf0ec7b4352c99bcaa":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #2
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"ffffffffffc00000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"df31144f87a2ef523facdcf21a427804":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #3
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"ffffffffffe00000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"b5bb0f5629fb6aae5e1839a3c3625d63":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #4
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"1d85a181b54cde51f0e098095b2962fdc93b51fe9b88602b3f54130bf76a5bd9":"00000000000000000000000000000000":"531c2c38344578b84d50b3c917bbb6e1":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #5
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"dc0eba1f2232a7879ded34ed8428eeb8769b056bbaf8ad77cb65c3541430b4cf":"00000000000000000000000000000000":"fc6aec906323480005c58e7e1ab004ad":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #6
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9":"00000000000000000000000000000000":"a3944b95ca0b52043584ef02151926a8":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #7
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"761c1fe41a18acf20d241650611d90f1":"623a52fcea5d443e48d9181ab32c7421":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #8
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"8a560769d605868ad80d819bdba03771":"38f2c7ae10612415d27ca190d27da8b4":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #9
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"91fbef2d15a97816060bee1feaa49afe":"1bc704f1bce135ceb810341b216d7abe":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #10
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"e0000000000000000000000000000000":"9b80eefb7ebe2d2b16247aa0efc72f5d":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #11
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"f0000000000000000000000000000000":"7f2c5ece07a98d8bee13c51177395ff7":"00000000000000000000000000000000"
|
||||
|
||||
AES-256-CFB128 Decrypt NIST KAT #12
|
||||
depends_on:MBEDTLS_CIPHER_MODE_CFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb128:"0000000000000000000000000000000000000000000000000000000000000000":"f8000000000000000000000000000000":"7818d800dcf6f4be1e0e94f403d1e4c2":"00000000000000000000000000000000"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #0
|
||||
aes_encrypt_cfb8:"c57d699d89df7cfbef71c080a6b10ac3":"fcb2bc4c006b87483978796a2ae2c42e":"61":"24"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #1
|
||||
aes_encrypt_cfb8:"0d8f3dc3edee60db658bb97faf46fba3":"e481fdc42e606b96a383c0a1a5520ebb":"aacd":"5066"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #2
|
||||
aes_encrypt_cfb8:"c8fe9bf77b930f46d2078b8c0e657cd4":"f475c64991b20eaee183a22629e21e22":"c90635":"d27691"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #3
|
||||
aes_encrypt_cfb8:"280cf81af5cc7e7363579c1da03390e6":"5d6cf4722d0e21f1d9ced53a0e36c342":"b2a22ced":"73f3aebf"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #4
|
||||
aes_encrypt_cfb8:"5d5e7f20e0a66d3e09e0e5a9912f8a46":"052d7ea0ad1f2956a23b27afe1d87b6b":"b84a90fc6d":"1a9a61c307"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #5
|
||||
aes_encrypt_cfb8:"ec89fb348787cf902ca973c47081438d":"528fe95c711bd13f37bc52cc9e96d45c":"14253472e99d":"cfc247e33a3b"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #6
|
||||
aes_encrypt_cfb8:"6607987c354809cba818639dcd185147":"552c101a0b7c0ca143af258453937fa3":"9b1a5a1369166e":"b7ab2a4cc71904"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #7
|
||||
aes_encrypt_cfb8:"c028e6bf2b749ffa86759f2f84e93cb0":"288c752d9faccf367e5d0cca1fa6ec3b":"324015878cdc82bf":"873250152fc6a5bb"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #8
|
||||
aes_encrypt_cfb8:"d01da95d2c2a61da06ea78cfba59cc30":"f9a393ad90814faf262e3a5b1d97592e":"57c1a30e48166d9640":"e9a8c3b776edd39e3d"
|
||||
|
||||
AES-128-CFB8 Encrypt NIST MMT #9
|
||||
aes_encrypt_cfb8:"3a6f9159263fa6cef2a075caface5817":"0fc23662b7dbf73827f0c7de321ca36e":"87efeb8d559ed3367728":"8e9c50425614d540ce11"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #0
|
||||
aes_decrypt_cfb8:"03edfe082550bd5ac8ddf64f42a0547f":"52acd8dab62c981da08e51939cc08dab":"21":"09"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #1
|
||||
aes_decrypt_cfb8:"38cf776750162edc63c3b5dbe311ab9f":"98fbbd288872c40f1926b16ecaec1561":"4878":"eb24"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #2
|
||||
aes_decrypt_cfb8:"c9053c87c3e56bc5e52bd31f6545f991":"b8f9640d0923da13fe6eb87b01f0cfa0":"aeb6d2":"910949"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #3
|
||||
aes_decrypt_cfb8:"e96771f5f20a89ee871261d2d18e1e46":"6e86403e33396655907ae06ef192262f":"83cab2f3":"3b7f1f1c"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #4
|
||||
aes_decrypt_cfb8:"92ad13ecb60bde1bb3b34ce07867672b":"f95a4060b8f80e3f839d4c3ca33dad94":"49f73e652b":"17b9b9e16d"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #5
|
||||
aes_decrypt_cfb8:"eb57b8dd076e7bbb33d4bfc4d7ecb27e":"51135997a067dcd2e016c57134c5fa52":"b0eacbf2ca46":"ca989fa4e818"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #6
|
||||
aes_decrypt_cfb8:"70abc48bb1be490183f0fe3df56195ff":"e251f179174b71ee1e488ab3dd200483":"08fbef9b2a369a":"5405da1186b7e0"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #7
|
||||
aes_decrypt_cfb8:"1273b8e0eee1a1ca827059b4d0a3a55d":"622cab49092d026f554dd98a6441dc26":"b3cb9d8892423aeb":"d497df73afb9787c"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #8
|
||||
aes_decrypt_cfb8:"49437e06b6faa5f20fd98bf71f8ff554":"63c818e0d3cb5b7054ef3e1e87df0e12":"01992a986279c3685e":"f203bcd402b65919da"
|
||||
|
||||
AES-128-CFB8 Decrypt NIST MMT #9
|
||||
aes_decrypt_cfb8:"6399c1dc068ba3509845628fa9ed1a96":"1157c2766c86b754df485be9dd5851df":"c9c284e9abbfe6fb11fe":"feff4e2e2458addf2a54"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #0
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"32a1b0e3da368db563d7316b9779d3327e53d9a6d287ed97":"3dd0e7e21f09d5842f3a699da9b57346":"54":"6d"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"a6381dcc18dd85d7729c1dce90743bbe1df580d857f5b9c4":"c0ac501fad7f4a1465daf32e18fc1a4f":"a456":"8fb6"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"d08dbee4732c7ffc544c1695b201d30e795037325ef0aa18":"a1e39aeeb972a8d70aa0fc7d6fac6eac":"fd115d":"c4c016"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"277185a4a440869920f523c4d578fc5bedd33aee8d2ebaf7":"67be00572f82aabc13d6e5a2e51d1f08":"88e07061":"8bb630ba"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"83f70fdce47306fcbb8c21b6a8b3209f7ec185fef4deebd4":"ff73b310cf7e62ce6f501092fa6cc888":"36664e222d":"20855555d1"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"c5be271a29f4a29e085e8e98196601dcb88ccc03e559a304":"9f51fa2eb8a084718f7240e47d135dce":"b57f12342a62":"73ff9bf3ec4b"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"9c55322e6d495be01076d4b80371ad1479ae5636ff9861f5":"2b79cfc1ff37254dedf5924a6b61e3e0":"6dcede43c2ee65":"7c897658282220"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"6e78ccece7d1b2a3c08cf0de738bee33cbbbf78d9bf4922c":"4bbe15b1e94a7b97250a2136d8804e46":"ceda42527871f802":"d92ff89045b1917f"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"13c98665746f7825b37b404916240adbd1e4364be1d05c63":"0e479fbd5f3961f38b8a26be1f2d65c5":"1b0a63d73464ab3c8a":"5485847e5d3c2e2cc4"
|
||||
|
||||
AES-192-CFB8 Encrypt NIST MMT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"537e7bf661fd4024a024613f15b13690f7d0c847c1e18965":"3a81f9d9d3c155b0caad5d73349476fc":"d3d8b9b984adc24237ee":"3879fea72ac99929e53a"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #0
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"7dbdc15ad4034ed828dc862799b7adc9abd68eaf9d526d5d":"4359683af5a3a85c248fb7f5506f317b":"25":"2d"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"3a2cdf9c9608c1dd6233d03dd855293b0885915114b25279":"e7a28ee34acc52128ddae658ec6398a2":"0678":"7b04"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"c984b99a6cc5bc88003143cbe4b755e6e30ba94114f7ad1e":"41e3b8fd138f8c358dfeef420302f634":"037cf6":"658d0a"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"39747da225bdc0c53c3463fd686dbe19d14157535171f91d":"77d3a5ad8bbdb169f8d29e5f21798651":"0fb0cee2":"2d191f2f"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"4cd13179dfa16d01c6a8633dfc8783e723e72114c9b0d50a":"6657c46c99d642474c330d8016b71dbe":"09d914cf0b":"105a64c872"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"5dcc9b8d8a456e9917cd8d54d7f7100b34964b4ed2d398a0":"4fa295a8987f1b010ce4e011fbf94156":"288c752d9fac":"98f332d37b78"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"c8baf0204ef80b8e0125efe43a0bccdfd0f356b62e6c75fe":"e9144bf2cbc5720a1b4cb6f37d11edff":"c9981a34b7aa89":"56bb4c3cae53b3"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"64e40763f38a63ae378c32052b0ae3aa538bb868a04ac985":"aacf65089e4b285438451ffdcd0f6389":"d8fcf83a88510a0d":"b567411bc61b0a76"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"7bfdca9605f17253f203efffc92da96fde023007d22cdad0":"45c09e44036070f8a7737a5176b8cf26":"9c195b1944c4af5bfb":"89358df65c3ef14d26"
|
||||
|
||||
AES-192-CFB8 Decrypt NIST MMT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"baf08b76317a65c5f07ae6f57eb0e65488659324d29709e3":"0a02846b62abb693ef31d754842eed29":"729c0b6deb75fa6eb5e8":"9895932402393dc33a60"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #0
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"34e8091cee09f1bd3ebf1e8f05f51bfbd4899ef2ae006a3a0f7875052cdd46c8":"43eb4dcc4b04a80216a20e4a09a7abb5":"f9":"28"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"e04e43173113109e1343393842fe6caef3f8a2e506d7f55f83dcb10444c6ad23":"a38b88a293b077fb5546636aad90d663":"2914":"69a6"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"064874092f7a13cc4462247ad423d0e96edf42e8b67a5a23b7a0a6477b098e66":"338c552ff1eca14408e05d8cf9f3b31b":"b974fa":"1cff95"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"56794adb0ef04aeddeabd650de736531d408837954b919002c33edfdff976cc2":"71b5526facea4236d33f1f4107e4b04f":"db774912":"f04d9d4f"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"dddd7f234e7d0e6ec64560b96430986a856f2ee9805443a7946e31601ef6679d":"e20f39db0025eb24491bd06012887108":"ad1d5311ea":"19cc97a662"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"ec73a760272c83f91771b3ab7b188715c6d6afb9c554feae83856e966a3863d0":"ae7bfa38fd25778fcf66ce8157f6e42e":"02fe724fbc5d":"b0eca63405f4"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"a66874ca0b70fb98b37c033ec96413f339adae02acade015b9f016b459db3309":"6ed480d9e4ed031cf66bb1e07f8d5514":"b4777e6bcd9a05":"8c017397ad5bab"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"a3dbbb775ada92b0b8ed1632444e21c1c86ff3eba8f628307306e766b8c15b5c":"4ec56a8e541f5cfe7b8ab947bfa4fd08":"1d70a5a82badf5ea":"1e22bebebeacd81d"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"64135e67c0ca1acef3360d930afcd726c5b04861a69c1b6a48bde1daf20f3b1f":"5377a154d5f948189f9aa57b466c16b2":"a36ca5ea382a322eef":"3105016567d3174aed"
|
||||
|
||||
AES-256-CFB8 Encrypt NIST MMT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cfb8:"ebbb4566b5e182e0f072466b0b311df38f9175bc0213a5530bce2ec4d74f400d":"0956a48e01002c9e16376d6e308dbad1":"b0fe25ac8d3d28a2f471":"638c6823e7256fb5626e"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #0
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"1687831580cb764321a9d674dbd0a9640f668b0f58ef01b87a710b3095d5f855":"6cd5bec6d6e1fd23afc543b8f80d3f89":"6f":"98"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"b6b504e8b7065373ea31cd549e52eda7cb96fd1db14eddacbc420085ab48b747":"870ecd45b1241803ddaf8bad15a025d7":"17d4":"3572"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"6ad3105e15fb5b742bf4fe1eb8e98c6c1ffea653107c84f6b42ed1232a0bbc21":"17534c89c4eae5dea6ea353dde7b1623":"a9841e":"f9411a"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"758f3fa8b2b289f19fd59e7316be40b904eff7f565caac4570f972360e0da787":"b21335ae980898fa92c4b3069e532973":"84b35e25":"47887872"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"802e854eb799500975d960a67885820d195e02ab23d51f15e5cdbcee86a1580c":"94478c4e44e2fa8d2e6bc43d384597e6":"d1e96bf1e8":"ed414b5689"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"3a0c03ca9d1e5d49bb37f9041f88d159c3f1d5ce26c798f59ed54a93f0a0e600":"9aae38ba832e4b093b50444074517d20":"74410ccd12da":"8207eee2a7ab"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"ee05462128fea75e919f6f436cb198f222847d698a283f5767df682d33d3ce77":"d2ad55e41887075184635112a22fc093":"ff039e89877b44":"aff3aa4c24e353"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"08abbdcc3eb9c1717db1faa38dcd0893afd5e16e2596747af58f8d61ebedf9cd":"b925c8dc9a9b55a4372ea6d37d21c1eb":"e176ba99ea602fd9":"b7370050288bf600"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"56d404a893fb3b3f594aab18939230b096646a37a781629fbd9270f3891a5cea":"e5906b36f2d97e6f2db19b6c7a3ce319":"c55a9a917a809a784b":"e44995bbb0fff40fee"
|
||||
|
||||
AES-256-CFB8 Decrypt NIST MMT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cfb8:"ec13062551e4d7291e320f565b749eea1809b663b26f2c4d53b52058b833e0ad":"fbfa5a528e20863012790c2abafb5a0c":"2bfc3f0209307140101a":"547bfd642cf6e12ed942"
|
||||
137
vendor/mbedtls/tests/suites/test_suite_aes.ctr.data
vendored
Normal file
137
vendor/mbedtls/tests/suites/test_suite_aes.ctr.data
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
# Test vectors from NIST Special Publication 800-38A 2001 Edition
|
||||
# Recommendation for Block Edition Cipher Modes of Operation
|
||||
|
||||
# as below, but corrupt the key to check the test catches it
|
||||
AES-CTR NIST 128 bad
|
||||
aes_ctr:"00000000000000000000000000000000":"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710":"874d6191b620e3261bef6864990db6ce9806f66b7970fdff8617187bb9fffdff5ae4df3edbd5d35e5b4f09020db03eab1e031dda2fbe03d1792170a0f3009cee":1
|
||||
|
||||
AES-CTR NIST 128
|
||||
aes_ctr:"2b7e151628aed2a6abf7158809cf4f3c":"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710":"874d6191b620e3261bef6864990db6ce9806f66b7970fdff8617187bb9fffdff5ae4df3edbd5d35e5b4f09020db03eab1e031dda2fbe03d1792170a0f3009cee":0
|
||||
|
||||
AES-CTR NIST 192
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_ctr:"8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b":"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710":"1abc932417521ca24f2b0459fe7e6e0b090339ec0aa6faefd5ccc2c6f4ce8e941e36b26bd1ebc670d1bd1d665620abf74f78a7f6d29809585a97daec58c6b050":0
|
||||
|
||||
AES-CTR NIST 256
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_ctr:"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4":"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710":"601ec313775789a5b7a7f504bbf3d228f443e3ca4d62b59aca84e990cacaf5c52b0930daa23de94ce87017ba2d84988ddfc9c58db67aada613c2dd08457941a6":0
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1 1
|
||||
aes_encrypt_ctr_multipart:1:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 2 1
|
||||
aes_encrypt_ctr_multipart:2:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 2 2
|
||||
aes_encrypt_ctr_multipart:2:2
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 4 1
|
||||
aes_encrypt_ctr_multipart:4:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 4 2
|
||||
aes_encrypt_ctr_multipart:4:2
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 15 1
|
||||
aes_encrypt_ctr_multipart:15:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 15 2
|
||||
aes_encrypt_ctr_multipart:15:2
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 15 8
|
||||
aes_encrypt_ctr_multipart:15:8
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 15 15
|
||||
aes_encrypt_ctr_multipart:15:15
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 16 1
|
||||
aes_encrypt_ctr_multipart:16:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 16 2
|
||||
aes_encrypt_ctr_multipart:16:2
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 16 8
|
||||
aes_encrypt_ctr_multipart:16:8
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 16 15
|
||||
aes_encrypt_ctr_multipart:16:15
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 16 16
|
||||
aes_encrypt_ctr_multipart:16:16
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 17 1
|
||||
aes_encrypt_ctr_multipart:17:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 17 2
|
||||
aes_encrypt_ctr_multipart:17:2
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 17 8
|
||||
aes_encrypt_ctr_multipart:17:8
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 17 15
|
||||
aes_encrypt_ctr_multipart:17:15
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 17 16
|
||||
aes_encrypt_ctr_multipart:17:16
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 63 1
|
||||
aes_encrypt_ctr_multipart:63:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 63 2
|
||||
aes_encrypt_ctr_multipart:63:2
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 63 8
|
||||
aes_encrypt_ctr_multipart:63:8
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 63 15
|
||||
aes_encrypt_ctr_multipart:63:15
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 63 16
|
||||
aes_encrypt_ctr_multipart:63:16
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 63 17
|
||||
aes_encrypt_ctr_multipart:63:17
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 64 1
|
||||
aes_encrypt_ctr_multipart:64:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 64 2
|
||||
aes_encrypt_ctr_multipart:64:2
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 64 8
|
||||
aes_encrypt_ctr_multipart:64:8
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 64 15
|
||||
aes_encrypt_ctr_multipart:64:15
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 64 16
|
||||
aes_encrypt_ctr_multipart:64:16
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 64 17
|
||||
aes_encrypt_ctr_multipart:64:17
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 1
|
||||
aes_encrypt_ctr_multipart:1024:1
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 10
|
||||
aes_encrypt_ctr_multipart:1024:10
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 15
|
||||
aes_encrypt_ctr_multipart:1024:15
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 16
|
||||
aes_encrypt_ctr_multipart:1024:16
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 63
|
||||
aes_encrypt_ctr_multipart:1024:63
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 64
|
||||
aes_encrypt_ctr_multipart:1024:64
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 65
|
||||
aes_encrypt_ctr_multipart:1024:65
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 1023
|
||||
aes_encrypt_ctr_multipart:1024:1023
|
||||
|
||||
AES-CTR aes_encrypt_ctr_multipart 1024 1024
|
||||
aes_encrypt_ctr_multipart:1024:1024
|
||||
289
vendor/mbedtls/tests/suites/test_suite_aes.ecb.data
vendored
Normal file
289
vendor/mbedtls/tests/suites/test_suite_aes.ecb.data
vendored
Normal file
@@ -0,0 +1,289 @@
|
||||
AES-128-ECB Encrypt NIST KAT #1
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"f34481ec3cc627bacd5dc3fb08f273e6":"0336763e966d92595a567cc9ce537f5e":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #2
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"9798c4640bad75c7c3227db910174e72":"a9a1631bf4996954ebc093957b234589":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #3
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"96ab5c2ff612d9dfaae8c31f30c42168":"ff4f8391a6a40ca5b25d23bedd44a597":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #4
|
||||
aes_encrypt_ecb:"e0000000000000000000000000000000":"00000000000000000000000000000000":"72a1da770f5d7ac4c9ef94d822affd97":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #5
|
||||
aes_encrypt_ecb:"f0000000000000000000000000000000":"00000000000000000000000000000000":"970014d634e2b7650777e8e84d03ccd8":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #6
|
||||
aes_encrypt_ecb:"f8000000000000000000000000000000":"00000000000000000000000000000000":"f17e79aed0db7e279e955b5f493875a7":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #7
|
||||
aes_encrypt_ecb:"fffffffffffff0000000000000000000":"00000000000000000000000000000000":"7b90785125505fad59b13c186dd66ce3":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #8
|
||||
aes_encrypt_ecb:"fffffffffffff8000000000000000000":"00000000000000000000000000000000":"8b527a6aebdaec9eaef8eda2cb7783e5":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #9
|
||||
aes_encrypt_ecb:"fffffffffffffc000000000000000000":"00000000000000000000000000000000":"43fdaf53ebbc9880c228617d6a9b548b":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #10
|
||||
aes_encrypt_ecb:"ffffffffffffffffffffffffffffc000":"00000000000000000000000000000000":"70c46bb30692be657f7eaa93ebad9897":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #11
|
||||
aes_encrypt_ecb:"ffffffffffffffffffffffffffffe000":"00000000000000000000000000000000":"323994cfb9da285a5d9642e1759b224a":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #12
|
||||
aes_encrypt_ecb:"fffffffffffffffffffffffffffff000":"00000000000000000000000000000000":"1dbf57877b7b17385c85d0b54851e371":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #13
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"ffffffffffffffc00000000000000000":"3a4d354f02bb5a5e47d39666867f246a":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #14
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"ffffffffffffffe00000000000000000":"d451b8d6e1e1a0ebb155fbbf6e7b7dc3":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #15
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"fffffffffffffff00000000000000000":"6898d4f42fa7ba6a10ac05e87b9f2080":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #16
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"ffffffffffffffffffffffffe0000000":"082eb8be35f442fb52668e16a591d1d6":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #17
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"fffffffffffffffffffffffff0000000":"e656f9ecf5fe27ec3e4a73d00c282fb3":0
|
||||
|
||||
AES-128-ECB Encrypt NIST KAT #18
|
||||
aes_encrypt_ecb:"00000000000000000000000000000000":"fffffffffffffffffffffffff8000000":"2ca8209d63274cd9a29bb74bcd77683a":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #1
|
||||
aes_decrypt_ecb:"00000000000000000000000000000000":"db4f1aa530967d6732ce4715eb0ee24b":"ff000000000000000000000000000000":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #2
|
||||
aes_decrypt_ecb:"00000000000000000000000000000000":"a81738252621dd180a34f3455b4baa2f":"ff800000000000000000000000000000":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #3
|
||||
aes_decrypt_ecb:"00000000000000000000000000000000":"77e2b508db7fd89234caf7939ee5621a":"ffc00000000000000000000000000000":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #4
|
||||
aes_decrypt_ecb:"00000000000000000000000000000000":"dc43be40be0e53712f7e2bf5ca707209":"6a118a874519e64e9963798a503f1d35":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #5
|
||||
aes_decrypt_ecb:"00000000000000000000000000000000":"92beedab1895a94faa69b632e5cc47ce":"cb9fceec81286ca3e989bd979b0cb284":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #6
|
||||
aes_decrypt_ecb:"00000000000000000000000000000000":"459264f4798f6a78bacb89c15ed3d601":"b26aeb1874e47ca8358ff22378f09144":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #7
|
||||
aes_decrypt_ecb:"b69418a85332240dc82492353956ae0c":"a303d940ded8f0baff6f75414cac5243":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #8
|
||||
aes_decrypt_ecb:"71b5c08a1993e1362e4d0ce9b22b78d5":"c2dabd117f8a3ecabfbb11d12194d9d0":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #9
|
||||
aes_decrypt_ecb:"e234cdca2606b81f29408d5f6da21206":"fff60a4740086b3b9c56195b98d91a7b":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #10
|
||||
aes_decrypt_ecb:"ffffffffffffffff0000000000000000":"84be19e053635f09f2665e7bae85b42d":"00000000000000000000000000000000":0
|
||||
|
||||
AES-128-ECB Decrypt NIST KAT #11
|
||||
aes_decrypt_ecb:"ffffffffffffffff8000000000000000":"32cd652842926aea4aa6137bb2be2b5e":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"000000000000000000000000000000000000000000000000":"fffffffffffffffffffff80000000000":"156f07767a85a4312321f63968338a01":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"000000000000000000000000000000000000000000000000":"fffffffffffffffffffffc0000000000":"15eec9ebf42b9ca76897d2cd6c5a12e2":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"000000000000000000000000000000000000000000000000":"fffffffffffffffffffffe0000000000":"db0d3a6fdcc13f915e2b302ceeb70fd8":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"000000000000000000000000000000000000000000000000":"51719783d3185a535bd75adc65071ce1":"4f354592ff7c8847d2d0870ca9481b7c":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"000000000000000000000000000000000000000000000000":"26aa49dcfe7629a8901a69a9914e6dfd":"d5e08bf9a182e857cf40b3a36ee248cc":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"000000000000000000000000000000000000000000000000":"941a4773058224e1ef66d10e0a6ee782":"067cd9d3749207791841562507fa9626":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"d2926527e0aa9f37b45e2ec2ade5853ef807576104c7ace3":"00000000000000000000000000000000":"dd619e1cf204446112e0af2b9afa8f8c":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"982215f4e173dfa0fcffe5d3da41c4812c7bcc8ed3540f93":"00000000000000000000000000000000":"d4f0aae13c8fe9339fbf9e69ed0ad74d":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"98c6b8e01e379fbd14e61af6af891596583565f2a27d59e9":"00000000000000000000000000000000":"19c80ec4a6deb7e5ed1033dda933498f":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"fffffffffffffffffffffffffff800000000000000000000":"00000000000000000000000000000000":"8dd274bd0f1b58ae345d9e7233f9b8f3":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"fffffffffffffffffffffffffffc00000000000000000000":"00000000000000000000000000000000":"9d6bdc8f4ce5feb0f3bed2e4b9a9bb0b":0
|
||||
|
||||
AES-192-ECB Encrypt NIST KAT #12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"fffffffffffffffffffffffffffe00000000000000000000":"00000000000000000000000000000000":"fd5548bcf3f42565f7efa94562528d46":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"fffffffffffffffffffffffffffffffff000000000000000":"bb2852c891c5947d2ed44032c421b85f":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"fffffffffffffffffffffffffffffffff800000000000000":"1b9f5fbd5e8a4264c0a85b80409afa5e":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"fffffffffffffffffffffffffffffffffc00000000000000":"30dab809f85a917fe924733f424ac589":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"61257134a518a0d57d9d244d45f6498cbc32f2bafc522d79":"cfe4d74002696ccf7d87b14a2f9cafc9":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"b0ab0a6a818baef2d11fa33eac947284fb7d748cfb75e570":"d2eafd86f63b109b91f5dbb3a3fb7e13":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"ee053aa011c8b428cdcc3636313c54d6a03cac01c71579d6":"9b9fdd1c5975655f539998b306a324af":"00000000000000000000000000000000":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"000000000000000000000000000000000000000000000000":"275cfc0413d8ccb70513c3859b1d0f72":"1b077a6af4b7f98229de786d7516b639":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"000000000000000000000000000000000000000000000000":"c9b8135ff1b5adc413dfd053b21bd96d":"9c2d8842e5f48f57648205d39a239af1":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"000000000000000000000000000000000000000000000000":"4a3650c3371ce2eb35e389a171427440":"bff52510095f518ecca60af4205444bb":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"000000000000000000000000000000000000000000000000":"b2099795e88cc158fd75ea133d7e7fbe":"ffffffffffffffffffffc00000000000":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"000000000000000000000000000000000000000000000000":"a6cae46fb6fadfe7a2c302a34242817b":"ffffffffffffffffffffe00000000000":0
|
||||
|
||||
AES-192-ECB Decrypt NIST KAT #12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"000000000000000000000000000000000000000000000000":"026a7024d6a902e0b3ffccbaa910cc3f":"fffffffffffffffffffff00000000000":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"c1cc358b449909a19436cfbb3f852ef8bcb5ed12ac7058325f56e6099aab1a1c":"00000000000000000000000000000000":"352065272169abf9856843927d0674fd":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"984ca75f4ee8d706f46c2d98c0bf4a45f5b00d791c2dfeb191b5ed8e420fd627":"00000000000000000000000000000000":"4307456a9e67813b452e15fa8fffe398":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"b43d08a447ac8609baadae4ff12918b9f68fc1653f1269222f123981ded7a92f":"00000000000000000000000000000000":"4663446607354989477a5c6f0f007ef4":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"0b24af36193ce4665f2825d7b4749c98":"a9ff75bd7cf6613d3731c77c3b6d0c04":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"761c1fe41a18acf20d241650611d90f1":"623a52fcea5d443e48d9181ab32c7421":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"8a560769d605868ad80d819bdba03771":"38f2c7ae10612415d27ca190d27da8b4":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"ffffff80000000000000000000000000":"36aff0ef7bf3280772cf4cac80a0d2b2":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"ffffffc0000000000000000000000000":"1f8eedea0f62a1406d58cfc3ecea72cf":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"ffffffe0000000000000000000000000":"abf4154a3375a1d3e6b1d454438f95a6":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"ffffffffffffffffffffffffffffffffffff8000000000000000000000000000":"00000000000000000000000000000000":"45d089c36d5c5a4efc689e3b0de10dd5":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"ffffffffffffffffffffffffffffffffffffc000000000000000000000000000":"00000000000000000000000000000000":"b4da5df4becb5462e03a0ed00d295629":0
|
||||
|
||||
AES-256-ECB Encrypt NIST KAT #12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ecb:"ffffffffffffffffffffffffffffffffffffe000000000000000000000000000":"00000000000000000000000000000000":"dcf4e129136c1a4b7a0f38935cc34b2b":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #1
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"fffffffffffffffffffffffffffffffffffffffffffffff00000000000000000":"edf61ae362e882ddc0167474a7a77f3a":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #2
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"fffffffffffffffffffffffffffffffffffffffffffffff80000000000000000":"6168b00ba7859e0970ecfd757efecf7c":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #3
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"fffffffffffffffffffffffffffffffffffffffffffffffc0000000000000000":"d1415447866230d28bb1ea18a4cdfd02":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #4
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"f8be9ba615c5a952cabbca24f68f8593039624d524c816acda2c9183bd917cb9":"a3944b95ca0b52043584ef02151926a8":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #5
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"797f8b3d176dac5b7e34a2d539c4ef367a16f8635f6264737591c5c07bf57a3e":"a74289fe73a4c123ca189ea1e1b49ad5":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #6
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"6838d40caf927749c13f0329d331f448e202c73ef52c5f73a37ca635d4c47707":"b91d4ea4488644b56cf0812fa7fcf5fc":"00000000000000000000000000000000":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #7
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c7421":"761c1fe41a18acf20d241650611d90f1":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #8
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"38f2c7ae10612415d27ca190d27da8b4":"8a560769d605868ad80d819bdba03771":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #9
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"1bc704f1bce135ceb810341b216d7abe":"91fbef2d15a97816060bee1feaa49afe":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"ddc6bf790c15760d8d9aeb6f9a75fd4e":"80000000000000000000000000000000":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"0a6bdc6d4c1e6280301fd8e97ddbe601":"c0000000000000000000000000000000":0
|
||||
|
||||
AES-256-ECB Decrypt NIST KAT #12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_ecb:"0000000000000000000000000000000000000000000000000000000000000000":"9b80eefb7ebe2d2b16247aa0efc72f5d":"e0000000000000000000000000000000":0
|
||||
|
||||
AES-128-ECB Copy context
|
||||
aes_ecb_copy_context:"000102030405060708090a0b0c0d0e0f"
|
||||
|
||||
AES-192-ECB Copy context
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_ecb_copy_context:"000102030405060708090a0b0c0d0e0f1011121314151617"
|
||||
|
||||
AES-256-ECB Copy context
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_ecb_copy_context:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
|
||||
738
vendor/mbedtls/tests/suites/test_suite_aes.function
vendored
Normal file
738
vendor/mbedtls/tests/suites/test_suite_aes.function
vendored
Normal file
@@ -0,0 +1,738 @@
|
||||
/* BEGIN_HEADER */
|
||||
#include "mbedtls/aes.h"
|
||||
|
||||
/* Test AES with a copied context.
|
||||
*
|
||||
* master, enc and dec must be AES context objects. They don't need to
|
||||
* be initialized, and are left freed.
|
||||
*/
|
||||
#if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
|
||||
static int test_copy(const data_t *key,
|
||||
mbedtls_aes_context *master,
|
||||
mbedtls_aes_context *enc,
|
||||
mbedtls_aes_context *dec)
|
||||
{
|
||||
unsigned char plaintext[16] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
};
|
||||
unsigned char ciphertext[16];
|
||||
unsigned char output[16];
|
||||
|
||||
// Set key and encrypt with original context
|
||||
mbedtls_aes_init(master);
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(master, key->x,
|
||||
key->len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_ecb(master, MBEDTLS_AES_ENCRYPT,
|
||||
plaintext, ciphertext) == 0);
|
||||
*enc = *master;
|
||||
|
||||
// Set key for decryption with original context
|
||||
mbedtls_aes_init(master);
|
||||
TEST_ASSERT(mbedtls_aes_setkey_dec(master, key->x,
|
||||
key->len * 8) == 0);
|
||||
*dec = *master;
|
||||
|
||||
// Wipe the original context to make sure nothing from it is used
|
||||
memset(master, 0, sizeof(*master));
|
||||
|
||||
// Encrypt with copied context
|
||||
TEST_ASSERT(mbedtls_aes_crypt_ecb(enc, MBEDTLS_AES_ENCRYPT,
|
||||
plaintext, output) == 0);
|
||||
TEST_MEMORY_COMPARE(ciphertext, 16, output, 16);
|
||||
mbedtls_aes_free(enc);
|
||||
|
||||
// Decrypt with copied context
|
||||
TEST_ASSERT(mbedtls_aes_crypt_ecb(dec, MBEDTLS_AES_DECRYPT,
|
||||
ciphertext, output) == 0);
|
||||
TEST_MEMORY_COMPARE(plaintext, 16, output, 16);
|
||||
mbedtls_aes_free(dec);
|
||||
|
||||
return 1;
|
||||
|
||||
exit:
|
||||
/* Bug: we may be leaving something unfreed. This is harmless
|
||||
* in our built-in implementations, but might cause a memory leak
|
||||
* with alternative implementations. */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
* depends_on:MBEDTLS_AES_C
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void aes_encrypt_ecb(data_t *key_str, data_t *src_str,
|
||||
data_t *dst, int setkey_result)
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
|
||||
memset(output, 0x00, 100);
|
||||
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == setkey_result);
|
||||
if (setkey_result == 0) {
|
||||
TEST_ASSERT(mbedtls_aes_crypt_ecb(&ctx, MBEDTLS_AES_ENCRYPT, src_str->x, output) == 0);
|
||||
|
||||
TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
|
||||
void aes_ctr(data_t *key, data_t *ictr, data_t *pt, data_t *ct, int expected)
|
||||
{
|
||||
unsigned char *output = NULL;
|
||||
unsigned char ctr[16];
|
||||
unsigned char stream_block[16];
|
||||
mbedtls_aes_context ctx;
|
||||
|
||||
// sanity checks on test input
|
||||
TEST_ASSERT(pt->len == ct->len);
|
||||
TEST_ASSERT(key->len == 16 || key->len == 24 || key->len == 32);
|
||||
|
||||
TEST_CALLOC(output, pt->len);
|
||||
|
||||
// expected result is always success on zero-length input, so skip len == 0 if expecting failure
|
||||
for (size_t len = (expected == 0 ? 0 : 1); len <= pt->len; len++) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mbedtls_aes_init(&ctx);
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key->x, key->len * 8) == 0);
|
||||
|
||||
memcpy(ctr, ictr->x, 16);
|
||||
memset(stream_block, 0, 16);
|
||||
memset(output, 0, pt->len);
|
||||
|
||||
size_t nc_off = 0;
|
||||
|
||||
if (i == 0) {
|
||||
// encrypt
|
||||
TEST_EQUAL(mbedtls_aes_crypt_ctr(&ctx, len, &nc_off, ctr,
|
||||
stream_block, pt->x, output), 0);
|
||||
TEST_ASSERT(!!memcmp(output, ct->x, len) == expected);
|
||||
} else {
|
||||
// decrypt
|
||||
TEST_EQUAL(mbedtls_aes_crypt_ctr(&ctx, len, &nc_off, ctr,
|
||||
stream_block, ct->x, output), 0);
|
||||
TEST_ASSERT(!!memcmp(output, pt->x, len) == expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(output);
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
|
||||
void aes_encrypt_ctr_multipart(int length, int step_size)
|
||||
{
|
||||
unsigned char key[16];
|
||||
unsigned char ctr_a[16];
|
||||
unsigned char ctr_b[16];
|
||||
unsigned char stream_block_a[16];
|
||||
unsigned char stream_block_b[16];
|
||||
unsigned char *input = NULL;
|
||||
unsigned char *output_a = NULL;
|
||||
unsigned char *output_b = NULL;
|
||||
mbedtls_aes_context ctx;
|
||||
size_t nc_off_a, nc_off_b;
|
||||
|
||||
TEST_ASSERT(length >= 0);
|
||||
TEST_ASSERT(step_size > 0);
|
||||
|
||||
TEST_CALLOC(input, length);
|
||||
TEST_CALLOC(output_a, length);
|
||||
TEST_CALLOC(output_b, length);
|
||||
|
||||
// set up a random key
|
||||
mbedtls_test_rnd_std_rand(NULL, key, sizeof(key));
|
||||
|
||||
// random input
|
||||
mbedtls_test_rnd_std_rand(NULL, input, length);
|
||||
|
||||
|
||||
// complete encryption in one call
|
||||
mbedtls_aes_init(&ctx);
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key, sizeof(key) * 8) == 0);
|
||||
memset(ctr_a, 0, sizeof(ctr_a));
|
||||
memset(stream_block_a, 0, sizeof(stream_block_a));
|
||||
nc_off_a = 0;
|
||||
TEST_EQUAL(mbedtls_aes_crypt_ctr(&ctx, length, &nc_off_a, ctr_a,
|
||||
stream_block_a, input, output_a), 0);
|
||||
mbedtls_aes_free(&ctx);
|
||||
|
||||
|
||||
// encrypt in multiple steps of varying size
|
||||
mbedtls_aes_init(&ctx);
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key, sizeof(key) * 8) == 0);
|
||||
memset(ctr_b, 0, sizeof(ctr_b));
|
||||
memset(stream_block_b, 0, sizeof(stream_block_b));
|
||||
nc_off_b = 0;
|
||||
size_t remaining = length;
|
||||
unsigned char *ip = input, *op = output_b;
|
||||
while (remaining != 0) {
|
||||
size_t l = MIN(remaining, (size_t) step_size);
|
||||
step_size *= 2;
|
||||
remaining -= l;
|
||||
TEST_EQUAL(mbedtls_aes_crypt_ctr(&ctx, l, &nc_off_b, ctr_b, stream_block_b, ip, op), 0);
|
||||
ip += l;
|
||||
op += l;
|
||||
}
|
||||
|
||||
// finally, validate that multiple steps produced same result as single-pass
|
||||
TEST_MEMORY_COMPARE(output_a, length, output_b, length);
|
||||
TEST_MEMORY_COMPARE(ctr_a, sizeof(ctr_a), ctr_b, sizeof(ctr_b));
|
||||
TEST_MEMORY_COMPARE(stream_block_a, sizeof(stream_block_a),
|
||||
stream_block_b, sizeof(stream_block_b));
|
||||
TEST_EQUAL(nc_off_a, nc_off_b);
|
||||
|
||||
exit:
|
||||
mbedtls_free(input);
|
||||
mbedtls_free(output_a);
|
||||
mbedtls_free(output_b);
|
||||
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:!MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
|
||||
void aes_decrypt_ecb(data_t *key_str, data_t *src_str,
|
||||
data_t *dst, int setkey_result)
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
|
||||
memset(output, 0x00, 100);
|
||||
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_dec(&ctx, key_str->x, key_str->len * 8) == setkey_result);
|
||||
if (setkey_result == 0) {
|
||||
TEST_ASSERT(mbedtls_aes_crypt_ecb(&ctx, MBEDTLS_AES_DECRYPT, src_str->x, output) == 0);
|
||||
|
||||
TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
|
||||
void aes_encrypt_cbc(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *dst,
|
||||
int cbc_result)
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
|
||||
memset(output, 0x00, 100);
|
||||
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_ENCRYPT, src_str->len, iv_str->x,
|
||||
src_str->x, output) == cbc_result);
|
||||
if (cbc_result == 0) {
|
||||
|
||||
TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
|
||||
src_str->len, dst->len) == 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
|
||||
void aes_decrypt_cbc(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *dst,
|
||||
int cbc_result)
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
|
||||
memset(output, 0x00, 100);
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_dec(&ctx, key_str->x, key_str->len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_DECRYPT, src_str->len, iv_str->x,
|
||||
src_str->x, output) == cbc_result);
|
||||
if (cbc_result == 0) {
|
||||
|
||||
TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
|
||||
src_str->len, dst->len) == 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
|
||||
void aes_encrypt_xts(char *hex_key_string, char *hex_data_unit_string,
|
||||
char *hex_src_string, char *hex_dst_string)
|
||||
{
|
||||
enum { AES_BLOCK_SIZE = 16 };
|
||||
unsigned char *data_unit = NULL;
|
||||
unsigned char *key = NULL;
|
||||
unsigned char *src = NULL;
|
||||
unsigned char *dst = NULL;
|
||||
unsigned char *output = NULL;
|
||||
mbedtls_aes_xts_context ctx;
|
||||
size_t key_len, src_len, dst_len, data_unit_len;
|
||||
|
||||
mbedtls_aes_xts_init(&ctx);
|
||||
|
||||
data_unit = mbedtls_test_unhexify_alloc(hex_data_unit_string,
|
||||
&data_unit_len);
|
||||
TEST_ASSERT(data_unit_len == AES_BLOCK_SIZE);
|
||||
|
||||
key = mbedtls_test_unhexify_alloc(hex_key_string, &key_len);
|
||||
TEST_ASSERT(key_len % 2 == 0);
|
||||
|
||||
src = mbedtls_test_unhexify_alloc(hex_src_string, &src_len);
|
||||
dst = mbedtls_test_unhexify_alloc(hex_dst_string, &dst_len);
|
||||
TEST_ASSERT(src_len == dst_len);
|
||||
|
||||
output = mbedtls_test_zero_alloc(dst_len);
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_xts_setkey_enc(&ctx, key, key_len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_xts(&ctx, MBEDTLS_AES_ENCRYPT, src_len,
|
||||
data_unit, src, output) == 0);
|
||||
|
||||
TEST_ASSERT(memcmp(output, dst, dst_len) == 0);
|
||||
|
||||
exit:
|
||||
mbedtls_aes_xts_free(&ctx);
|
||||
mbedtls_free(data_unit);
|
||||
mbedtls_free(key);
|
||||
mbedtls_free(src);
|
||||
mbedtls_free(dst);
|
||||
mbedtls_free(output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
|
||||
void aes_decrypt_xts(char *hex_key_string, char *hex_data_unit_string,
|
||||
char *hex_dst_string, char *hex_src_string)
|
||||
{
|
||||
enum { AES_BLOCK_SIZE = 16 };
|
||||
unsigned char *data_unit = NULL;
|
||||
unsigned char *key = NULL;
|
||||
unsigned char *src = NULL;
|
||||
unsigned char *dst = NULL;
|
||||
unsigned char *output = NULL;
|
||||
mbedtls_aes_xts_context ctx;
|
||||
size_t key_len, src_len, dst_len, data_unit_len;
|
||||
|
||||
mbedtls_aes_xts_init(&ctx);
|
||||
|
||||
data_unit = mbedtls_test_unhexify_alloc(hex_data_unit_string,
|
||||
&data_unit_len);
|
||||
TEST_ASSERT(data_unit_len == AES_BLOCK_SIZE);
|
||||
|
||||
key = mbedtls_test_unhexify_alloc(hex_key_string, &key_len);
|
||||
TEST_ASSERT(key_len % 2 == 0);
|
||||
|
||||
src = mbedtls_test_unhexify_alloc(hex_src_string, &src_len);
|
||||
dst = mbedtls_test_unhexify_alloc(hex_dst_string, &dst_len);
|
||||
TEST_ASSERT(src_len == dst_len);
|
||||
|
||||
output = mbedtls_test_zero_alloc(dst_len);
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_xts_setkey_dec(&ctx, key, key_len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_xts(&ctx, MBEDTLS_AES_DECRYPT, src_len,
|
||||
data_unit, src, output) == 0);
|
||||
|
||||
TEST_ASSERT(memcmp(output, dst, dst_len) == 0);
|
||||
|
||||
exit:
|
||||
mbedtls_aes_xts_free(&ctx);
|
||||
mbedtls_free(data_unit);
|
||||
mbedtls_free(key);
|
||||
mbedtls_free(src);
|
||||
mbedtls_free(dst);
|
||||
mbedtls_free(output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
|
||||
void aes_crypt_xts_size(int size, int retval)
|
||||
{
|
||||
mbedtls_aes_xts_context ctx;
|
||||
const unsigned char src[16] = { 0 };
|
||||
unsigned char output[16];
|
||||
unsigned char data_unit[16];
|
||||
size_t length = size;
|
||||
|
||||
mbedtls_aes_xts_init(&ctx);
|
||||
memset(data_unit, 0x00, sizeof(data_unit));
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_crypt_xts(&ctx, MBEDTLS_AES_ENCRYPT, length, data_unit, src,
|
||||
output) == retval);
|
||||
exit:
|
||||
mbedtls_aes_xts_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
|
||||
void aes_crypt_xts_keysize(int size, int retval)
|
||||
{
|
||||
mbedtls_aes_xts_context ctx;
|
||||
const unsigned char key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
|
||||
size_t key_len = size;
|
||||
|
||||
mbedtls_aes_xts_init(&ctx);
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_xts_setkey_enc(&ctx, key, key_len * 8) == retval);
|
||||
TEST_ASSERT(mbedtls_aes_xts_setkey_dec(&ctx, key, key_len * 8) == retval);
|
||||
exit:
|
||||
mbedtls_aes_xts_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aes_encrypt_cfb128(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *dst)
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
size_t iv_offset = 0;
|
||||
|
||||
memset(output, 0x00, 100);
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_ENCRYPT, 16, &iv_offset, iv_str->x,
|
||||
src_str->x, output) == 0);
|
||||
|
||||
TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aes_decrypt_cfb128(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *dst)
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
size_t iv_offset = 0;
|
||||
|
||||
memset(output, 0x00, 100);
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_DECRYPT, 16, &iv_offset, iv_str->x,
|
||||
src_str->x, output) == 0);
|
||||
|
||||
TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aes_encrypt_cfb8(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *dst)
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
|
||||
memset(output, 0x00, 100);
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_ENCRYPT, src_str->len, iv_str->x,
|
||||
src_str->x, output) == 0);
|
||||
|
||||
TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
|
||||
src_str->len, dst->len) == 0);
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aes_decrypt_cfb8(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *dst)
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
|
||||
memset(output, 0x00, 100);
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_DECRYPT, src_str->len, iv_str->x,
|
||||
src_str->x, output) == 0);
|
||||
|
||||
TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
|
||||
src_str->len, dst->len) == 0);
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_OFB */
|
||||
void aes_encrypt_ofb(int fragment_size, data_t *key_str,
|
||||
data_t *iv_str, data_t *src_str,
|
||||
data_t *expected_output)
|
||||
{
|
||||
unsigned char output[32];
|
||||
mbedtls_aes_context ctx;
|
||||
size_t iv_offset = 0;
|
||||
int in_buffer_len;
|
||||
unsigned char *src_str_next;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
TEST_ASSERT((size_t) fragment_size < sizeof(output));
|
||||
|
||||
TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x,
|
||||
key_str->len * 8) == 0);
|
||||
in_buffer_len = src_str->len;
|
||||
src_str_next = src_str->x;
|
||||
|
||||
while (in_buffer_len > 0) {
|
||||
TEST_ASSERT(mbedtls_aes_crypt_ofb(&ctx, fragment_size, &iv_offset,
|
||||
iv_str->x, src_str_next, output) == 0);
|
||||
|
||||
TEST_ASSERT(memcmp(output, expected_output->x, fragment_size) == 0);
|
||||
|
||||
in_buffer_len -= fragment_size;
|
||||
expected_output->x += fragment_size;
|
||||
src_str_next += fragment_size;
|
||||
|
||||
if (in_buffer_len < fragment_size) {
|
||||
fragment_size = in_buffer_len;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void aes_invalid_mode()
|
||||
{
|
||||
mbedtls_aes_context aes_ctx;
|
||||
const unsigned char in[16] = { 0 };
|
||||
unsigned char out[16];
|
||||
const int invalid_mode = 42;
|
||||
|
||||
TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
|
||||
mbedtls_aes_crypt_ecb(&aes_ctx, invalid_mode, in, out));
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
|
||||
mbedtls_aes_crypt_cbc(&aes_ctx, invalid_mode, 16,
|
||||
out, in, out));
|
||||
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||
mbedtls_aes_xts_context xts_ctx;
|
||||
|
||||
TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
|
||||
mbedtls_aes_crypt_xts(&xts_ctx, invalid_mode, 16,
|
||||
in, in, out));
|
||||
#endif /* MBEDTLS_CIPHER_MODE_XTS */
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
size_t size;
|
||||
|
||||
TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
|
||||
mbedtls_aes_crypt_cfb128(&aes_ctx, invalid_mode, 16,
|
||||
&size, out, in, out));
|
||||
TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
|
||||
mbedtls_aes_crypt_cfb8(&aes_ctx, invalid_mode, 16,
|
||||
out, in, out));
|
||||
#endif /* MBEDTLS_CIPHER_MODE_CFB */
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void aes_misc_params()
|
||||
{
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CBC) || \
|
||||
defined(MBEDTLS_CIPHER_MODE_XTS) || \
|
||||
defined(MBEDTLS_CIPHER_MODE_CFB) || \
|
||||
defined(MBEDTLS_CIPHER_MODE_OFB)
|
||||
const unsigned char in[16] = { 0 };
|
||||
unsigned char out[16];
|
||||
#endif
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CBC) || \
|
||||
defined(MBEDTLS_CIPHER_MODE_CFB) || \
|
||||
defined(MBEDTLS_CIPHER_MODE_OFB)
|
||||
mbedtls_aes_context aes_ctx;
|
||||
#endif
|
||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||
mbedtls_aes_xts_context xts_ctx;
|
||||
#endif
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CFB) || \
|
||||
defined(MBEDTLS_CIPHER_MODE_OFB)
|
||||
size_t size;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cbc(&aes_ctx, MBEDTLS_AES_ENCRYPT,
|
||||
15,
|
||||
out, in, out)
|
||||
== MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cbc(&aes_ctx, MBEDTLS_AES_ENCRYPT,
|
||||
17,
|
||||
out, in, out)
|
||||
== MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH);
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_XTS)
|
||||
TEST_ASSERT(mbedtls_aes_crypt_xts(&xts_ctx, MBEDTLS_AES_ENCRYPT,
|
||||
15,
|
||||
in, in, out)
|
||||
== MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH);
|
||||
TEST_ASSERT(mbedtls_aes_crypt_xts(&xts_ctx, MBEDTLS_AES_ENCRYPT,
|
||||
(1 << 24) + 1,
|
||||
in, in, out)
|
||||
== MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH);
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
size = 16;
|
||||
TEST_ASSERT(mbedtls_aes_crypt_cfb128(&aes_ctx, MBEDTLS_AES_ENCRYPT, 16,
|
||||
&size, out, in, out)
|
||||
== MBEDTLS_ERR_AES_BAD_INPUT_DATA);
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_OFB)
|
||||
size = 16;
|
||||
TEST_ASSERT(mbedtls_aes_crypt_ofb(&aes_ctx, 16, &size, out, in, out)
|
||||
== MBEDTLS_ERR_AES_BAD_INPUT_DATA);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following line needs to be added to make the code compilable
|
||||
* when all the conditions above will be not define in a specific
|
||||
* choice of features.
|
||||
*/
|
||||
TEST_ASSERT(1);
|
||||
/* TODO: It will be removed when the whole test will be reworked */
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:!MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
|
||||
void aes_ecb_copy_context(data_t *key)
|
||||
{
|
||||
/* We test context copying multiple times, with different alignments
|
||||
* of the original and of the copies. */
|
||||
|
||||
struct align0 {
|
||||
mbedtls_aes_context ctx;
|
||||
};
|
||||
struct align0 *src0 = NULL;
|
||||
struct align0 *enc0 = NULL;
|
||||
struct align0 *dec0 = NULL;
|
||||
|
||||
struct align1 {
|
||||
char bump;
|
||||
mbedtls_aes_context ctx;
|
||||
};
|
||||
struct align1 *src1 = NULL;
|
||||
struct align1 *enc1 = NULL;
|
||||
struct align1 *dec1 = NULL;
|
||||
|
||||
/* All peak alignment */
|
||||
TEST_CALLOC(src0, 1);
|
||||
TEST_CALLOC(enc0, 1);
|
||||
TEST_CALLOC(dec0, 1);
|
||||
if (!test_copy(key, &src0->ctx, &enc0->ctx, &dec0->ctx)) {
|
||||
goto exit;
|
||||
}
|
||||
mbedtls_free(src0);
|
||||
src0 = NULL;
|
||||
mbedtls_free(enc0);
|
||||
enc0 = NULL;
|
||||
mbedtls_free(dec0);
|
||||
dec0 = NULL;
|
||||
|
||||
/* Original shifted */
|
||||
TEST_CALLOC(src1, 1);
|
||||
TEST_CALLOC(enc0, 1);
|
||||
TEST_CALLOC(dec0, 1);
|
||||
if (!test_copy(key, &src1->ctx, &enc0->ctx, &dec0->ctx)) {
|
||||
goto exit;
|
||||
}
|
||||
mbedtls_free(src1);
|
||||
src1 = NULL;
|
||||
mbedtls_free(enc0);
|
||||
enc0 = NULL;
|
||||
mbedtls_free(dec0);
|
||||
dec0 = NULL;
|
||||
|
||||
/* Copies shifted */
|
||||
TEST_CALLOC(src0, 1);
|
||||
TEST_CALLOC(enc1, 1);
|
||||
TEST_CALLOC(dec1, 1);
|
||||
if (!test_copy(key, &src0->ctx, &enc1->ctx, &dec1->ctx)) {
|
||||
goto exit;
|
||||
}
|
||||
mbedtls_free(src0);
|
||||
src0 = NULL;
|
||||
mbedtls_free(enc1);
|
||||
enc1 = NULL;
|
||||
mbedtls_free(dec1);
|
||||
dec1 = NULL;
|
||||
|
||||
/* Source and copies shifted */
|
||||
TEST_CALLOC(src1, 1);
|
||||
TEST_CALLOC(enc1, 1);
|
||||
TEST_CALLOC(dec1, 1);
|
||||
if (!test_copy(key, &src1->ctx, &enc1->ctx, &dec1->ctx)) {
|
||||
goto exit;
|
||||
}
|
||||
mbedtls_free(src1);
|
||||
src1 = NULL;
|
||||
mbedtls_free(enc1);
|
||||
enc1 = NULL;
|
||||
mbedtls_free(dec1);
|
||||
dec1 = NULL;
|
||||
|
||||
exit:
|
||||
mbedtls_free(src0);
|
||||
mbedtls_free(enc0);
|
||||
mbedtls_free(dec0);
|
||||
mbedtls_free(src1);
|
||||
mbedtls_free(enc1);
|
||||
mbedtls_free(dec1);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
|
||||
void aes_selftest()
|
||||
{
|
||||
TEST_ASSERT(mbedtls_aes_self_test(1) == 0);
|
||||
}
|
||||
/* END_CASE */
|
||||
35
vendor/mbedtls/tests/suites/test_suite_aes.ofb.data
vendored
Normal file
35
vendor/mbedtls/tests/suites/test_suite_aes.ofb.data
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# NIST Special Publication 800-38A
|
||||
# Recommendation for Block Cipher Modes of Operation
|
||||
# Test Vectors - Appendix F, Section F.4
|
||||
OFB-AES128.Encrypt - Single block
|
||||
depends_on:MBEDTLS_CIPHER_MODE_OFB
|
||||
aes_encrypt_ofb:16:"2b7e151628aed2a6abf7158809cf4f3c":"000102030405060708090a0b0c0d0e0f":"6bc1bee22e409f96e93d7e117393172a":"3b3fd92eb72dad20333449f8e83cfb4a"
|
||||
|
||||
OFB-AES128.Encrypt - Partial blocks - 7 bytes
|
||||
depends_on:MBEDTLS_CIPHER_MODE_OFB
|
||||
aes_encrypt_ofb:5:"2b7e151628aed2a6abf7158809cf4f3c":"000102030405060708090a0b0c0d0e0f":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710":"3b3fd92eb72dad20333449f8e83cfb4a7789508d16918f03f53c52dac54ed8259740051e9c5fecf64344f7a82260edcc304c6528f659c77866a510d9c1d6ae5e"
|
||||
|
||||
OFB-AES128.Encrypt - Test NIST SP800-38A - F.4.1
|
||||
depends_on:MBEDTLS_CIPHER_MODE_OFB
|
||||
aes_encrypt_ofb:16:"2b7e151628aed2a6abf7158809cf4f3c":"000102030405060708090a0b0c0d0e0f":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710":"3b3fd92eb72dad20333449f8e83cfb4a7789508d16918f03f53c52dac54ed8259740051e9c5fecf64344f7a82260edcc304c6528f659c77866a510d9c1d6ae5e"
|
||||
|
||||
OFB-AES128.Decrypt - Test NIST SP800-38A - F.4.2
|
||||
depends_on:MBEDTLS_CIPHER_MODE_OFB
|
||||
aes_encrypt_ofb:16:"2b7e151628aed2a6abf7158809cf4f3c":"000102030405060708090a0b0c0d0e0f":"3b3fd92eb72dad20333449f8e83cfb4a7789508d16918f03f53c52dac54ed8259740051e9c5fecf64344f7a82260edcc304c6528f659c77866a510d9c1d6ae5e":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710"
|
||||
|
||||
OFB-AES192.Encrypt - Test NIST SP800-38A - F.4.3
|
||||
depends_on:MBEDTLS_CIPHER_MODE_OFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ofb:16:"8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b":"000102030405060708090a0b0c0d0e0f":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710":"cdc80d6fddf18cab34c25909c99a4174fcc28b8d4c63837c09e81700c11004018d9a9aeac0f6596f559c6d4daf59a5f26d9f200857ca6c3e9cac524bd9acc92a"
|
||||
|
||||
OFB-AES192.Decrypt - Test NIST SP800-38A - F.4.4
|
||||
depends_on:MBEDTLS_CIPHER_MODE_OFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ofb:16:"8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b":"000102030405060708090a0b0c0d0e0f":"cdc80d6fddf18cab34c25909c99a4174fcc28b8d4c63837c09e81700c11004018d9a9aeac0f6596f559c6d4daf59a5f26d9f200857ca6c3e9cac524bd9acc92a":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710"
|
||||
|
||||
OFB-AES256.Encrypt - Test NIST SP800-38A - F.4.5
|
||||
depends_on:MBEDTLS_CIPHER_MODE_OFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ofb:16:"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4":"000102030405060708090a0b0c0d0e0f":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710":"dc7e84bfda79164b7ecd8486985d38604febdc6740d20b3ac88f6ad82a4fb08d71ab47a086e86eedf39d1c5bba97c4080126141d67f37be8538f5a8be740e484"
|
||||
|
||||
OFB-AES256.Decrypt - Test NIST SP800-38A - F.4.6
|
||||
depends_on:MBEDTLS_CIPHER_MODE_OFB:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_ofb:16:"603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4":"000102030405060708090a0b0c0d0e0f":"dc7e84bfda79164b7ecd8486985d38604febdc6740d20b3ac88f6ad82a4fb08d71ab47a086e86eedf39d1c5bba97c4080126141d67f37be8538f5a8be740e484":"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710"
|
||||
|
||||
23
vendor/mbedtls/tests/suites/test_suite_aes.rest.data
vendored
Normal file
23
vendor/mbedtls/tests/suites/test_suite_aes.rest.data
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
AES-ECB Encrypt (Invalid keylength)
|
||||
aes_encrypt_ecb:"000000000000000000000000000000":"f34481ec3cc627bacd5dc3fb08f273e6":"0336763e966d92595a567cc9ce537f5e":MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-ECB Decrypt (Invalid keylength)
|
||||
aes_decrypt_ecb:"000000000000000000000000000000":"f34481ec3cc627bacd5dc3fb08f273e6":"0336763e966d92595a567cc9ce537f5e":MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-256-CBC Encrypt (Invalid input length)
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"ffffffffffffffe000000000000000":"":MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
|
||||
AES-256-CBC Decrypt (Invalid input length)
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_cbc:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"623a52fcea5d443e48d9181ab32c74":"":MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
|
||||
AES - Mode Parameter Validation
|
||||
aes_invalid_mode:
|
||||
|
||||
AES - Mandatory Parameter Validation and Valid Parameters
|
||||
aes_misc_params:
|
||||
|
||||
AES Selftest
|
||||
depends_on:MBEDTLS_SELF_TEST
|
||||
aes_selftest:
|
||||
169
vendor/mbedtls/tests/suites/test_suite_aes.xts.data
vendored
Normal file
169
vendor/mbedtls/tests/suites/test_suite_aes.xts.data
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
#
|
||||
# Tests for expected errors (negative tests)
|
||||
#
|
||||
AES-128-XTS Encrypt Fail Sector Too Small (by 16 bytes)
|
||||
aes_crypt_xts_size:0:MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
|
||||
AES-128-XTS Encrypt Fail Sector Too Small (by 1 byte)
|
||||
aes_crypt_xts_size:15:MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
|
||||
AES-128-XTS Encrypt Fail Sector Too Large (by 1 byte)
|
||||
aes_crypt_xts_size:16777217:MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
|
||||
AES-128-XTS Encrypt Fail Sector Too Large (by 1 block)
|
||||
aes_crypt_xts_size:16777232:MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
|
||||
|
||||
AES-0-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:0:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-4-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:1:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-64-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:16:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-192-XTS Setkey Fail Invalid Key Length
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_crypt_xts_keysize:48:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
AES-384-XTS Setkey Fail Invalid Key Length
|
||||
aes_crypt_xts_keysize:96:MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
|
||||
|
||||
#
|
||||
# IEEE P1619/D16 Annex B Test Vectors
|
||||
# http://grouper.ieee.org/groups/1619/email/pdf00086.pdf
|
||||
#
|
||||
# 128-bit keys with 32 byte sector
|
||||
#
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 1
|
||||
aes_encrypt_xts:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"0000000000000000000000000000000000000000000000000000000000000000":"917cf69ebd68b2ec9b9fe9a3eadda692cd43d2f59598ed858c02c2652fbf922e"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 2
|
||||
aes_encrypt_xts:"1111111111111111111111111111111122222222222222222222222222222222":"33333333330000000000000000000000":"4444444444444444444444444444444444444444444444444444444444444444":"c454185e6a16936e39334038acef838bfb186fff7480adc4289382ecd6d394f0"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 3
|
||||
aes_encrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f022222222222222222222222222222222":"33333333330000000000000000000000":"4444444444444444444444444444444444444444444444444444444444444444":"af85336b597afc1a900b2eb21ec949d292df4c047e0b21532186a5971a227a89"
|
||||
|
||||
#
|
||||
# 128-bit keys with 512 byte sector
|
||||
#
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 4
|
||||
aes_encrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"00000000000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89cc78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad02655ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f4341332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203ebb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18deb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 5
|
||||
aes_encrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"01000000000000000000000000000000":"27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89cc78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad02655ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f4341332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203ebb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18deb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568":"264d3ca8512194fec312c8c9891f279fefdd608d0c027b60483a3fa811d65ee59d52d9e40ec5672d81532b38b6b089ce951f0f9c35590b8b978d175213f329bb1c2fd30f2f7f30492a61a532a79f51d36f5e31a7c9a12c286082ff7d2394d18f783e1a8e72c722caaaa52d8f065657d2631fd25bfd8e5baad6e527d763517501c68c5edc3cdd55435c532d7125c8614deed9adaa3acade5888b87bef641c4c994c8091b5bcd387f3963fb5bc37aa922fbfe3df4e5b915e6eb514717bdd2a74079a5073f5c4bfd46adf7d282e7a393a52579d11a028da4d9cd9c77124f9648ee383b1ac763930e7162a8d37f350b2f74b8472cf09902063c6b32e8c2d9290cefbd7346d1c779a0df50edcde4531da07b099c638e83a755944df2aef1aa31752fd323dcb710fb4bfbb9d22b925bc3577e1b8949e729a90bbafeacf7f7879e7b1147e28ba0bae940db795a61b15ecf4df8db07b824bb062802cc98a9545bb2aaeed77cb3fc6db15dcd7d80d7d5bc406c4970a3478ada8899b329198eb61c193fb6275aa8ca340344a75a862aebe92eee1ce032fd950b47d7704a3876923b4ad62844bf4a09c4dbe8b4397184b7471360c9564880aedddb9baa4af2e75394b08cd32ff479c57a07d3eab5d54de5f9738b8d27f27a9f0ab11799d7b7ffefb2704c95c6ad12c39f1e867a4b7b1d7818a4b753dfd2a89ccb45e001a03a867b187f225dd"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 6
|
||||
aes_encrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"02000000000000000000000000000000":"264d3ca8512194fec312c8c9891f279fefdd608d0c027b60483a3fa811d65ee59d52d9e40ec5672d81532b38b6b089ce951f0f9c35590b8b978d175213f329bb1c2fd30f2f7f30492a61a532a79f51d36f5e31a7c9a12c286082ff7d2394d18f783e1a8e72c722caaaa52d8f065657d2631fd25bfd8e5baad6e527d763517501c68c5edc3cdd55435c532d7125c8614deed9adaa3acade5888b87bef641c4c994c8091b5bcd387f3963fb5bc37aa922fbfe3df4e5b915e6eb514717bdd2a74079a5073f5c4bfd46adf7d282e7a393a52579d11a028da4d9cd9c77124f9648ee383b1ac763930e7162a8d37f350b2f74b8472cf09902063c6b32e8c2d9290cefbd7346d1c779a0df50edcde4531da07b099c638e83a755944df2aef1aa31752fd323dcb710fb4bfbb9d22b925bc3577e1b8949e729a90bbafeacf7f7879e7b1147e28ba0bae940db795a61b15ecf4df8db07b824bb062802cc98a9545bb2aaeed77cb3fc6db15dcd7d80d7d5bc406c4970a3478ada8899b329198eb61c193fb6275aa8ca340344a75a862aebe92eee1ce032fd950b47d7704a3876923b4ad62844bf4a09c4dbe8b4397184b7471360c9564880aedddb9baa4af2e75394b08cd32ff479c57a07d3eab5d54de5f9738b8d27f27a9f0ab11799d7b7ffefb2704c95c6ad12c39f1e867a4b7b1d7818a4b753dfd2a89ccb45e001a03a867b187f225dd":"fa762a3680b76007928ed4a4f49a9456031b704782e65e16cecb54ed7d017b5e18abd67b338e81078f21edb7868d901ebe9c731a7c18b5e6dec1d6a72e078ac9a4262f860beefa14f4e821018272e411a951502b6e79066e84252c3346f3aa62344351a291d4bedc7a07618bdea2af63145cc7a4b8d4070691ae890cd65733e7946e9021a1dffc4c59f159425ee6d50ca9b135fa6162cea18a939838dc000fb386fad086acce5ac07cb2ece7fd580b00cfa5e98589631dc25e8e2a3daf2ffdec26531659912c9d8f7a15e5865ea8fb5816d6207052bd7128cd743c12c8118791a4736811935eb982a532349e31dd401e0b660a568cb1a4711f552f55ded59f1f15bf7196b3ca12a91e488ef59d64f3a02bf45239499ac6176ae321c4a211ec545365971c5d3f4f09d4eb139bfdf2073d33180b21002b65cc9865e76cb24cd92c874c24c18350399a936ab3637079295d76c417776b94efce3a0ef7206b15110519655c956cbd8b2489405ee2b09a6b6eebe0c53790a12a8998378b33a5b71159625f4ba49d2a2fdba59fbf0897bc7aabd8d707dc140a80f0f309f835d3da54ab584e501dfa0ee977fec543f74186a802b9a37adb3e8291eca04d66520d229e60401e7282bef486ae059aa70696e0e305d777140a7a883ecdcb69b9ff938e8a4231864c69ca2c2043bed007ff3e605e014bcf518138dc3a25c5e236171a2d01d6"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 7
|
||||
aes_encrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"fd000000000000000000000000000000":"8e41b78c390b5af9d758bb214a67e9f6bf7727b09ac6124084c37611398fa45daad94868600ed391fb1acd4857a95b466e62ef9f4b377244d1c152e7b30d731aad30c716d214b707aed99eb5b5e580b3e887cf7497465651d4b60e6042051da3693c3b78c14489543be8b6ad0ba629565bba202313ba7b0d0c94a3252b676f46cc02ce0f8a7d34c0ed229129673c1f61aed579d08a9203a25aac3a77e9db60267996db38df637356d9dcd1632e369939f2a29d89345c66e05066f1a3677aef18dea4113faeb629e46721a66d0a7e785d3e29af2594eb67dfa982affe0aac058f6e15864269b135418261fc3afb089472cf68c45dd7f231c6249ba0255e1e033833fc4d00a3fe02132d7bc3873614b8aee34273581ea0325c81f0270affa13641d052d36f0757d484014354d02d6883ca15c24d8c3956b1bd027bcf41f151fd8023c5340e5606f37e90fdb87c86fb4fa634b3718a30bace06a66eaf8f63c4aa3b637826a87fe8cfa44282e92cb1615af3a28e53bc74c7cba1a0977be9065d0c1a5dec6c54ae38d37f37aa35283e048e5530a85c4e7a29d7b92ec0c3169cdf2a805c7604bce60049b9fb7b8eaac10f51ae23794ceba68bb58112e293b9b692ca721b37c662f8574ed4dba6f88e170881c82cddc1034a0ca7e284bf0962b6b26292d836fa9f73c1ac770eef0f2d3a1eaf61d3e03555fd424eedd67e18a18094f888":"d55f684f81f4426e9fde92a5ff02df2ac896af63962888a97910c1379e20b0a3b1db613fb7fe2e07004329ea5c22bfd33e3dbe4cf58cc608c2c26c19a2e2fe22f98732c2b5cb844cc6c0702d91e1d50fc4382a7eba5635cd602432a2306ac4ce82f8d70c8d9bc15f918fe71e74c622d5cf71178bf6e0b9cc9f2b41dd8dbe441c41cd0c73a6dc47a348f6702f9d0e9b1b1431e948e299b9ec2272ab2c5f0c7be86affa5dec87a0bee81d3d50007edaa2bcfccb35605155ff36ed8edd4a40dcd4b243acd11b2b987bdbfaf91a7cac27e9c5aea525ee53de7b2d3332c8644402b823e94a7db26276d2d23aa07180f76b4fd29b9c0823099c9d62c519880aee7e9697617c1497d47bf3e571950311421b6b734d38b0db91eb85331b91ea9f61530f54512a5a52a4bad589eb69781d537f23297bb459bdad2948a29e1550bf4787e0be95bb173cf5fab17dab7a13a052a63453d97ccec1a321954886b7a1299faaeecae35c6eaaca753b041b5e5f093bf83397fd21dd6b3012066fcc058cc32c3b09d7562dee29509b5839392c9ff05f51f3166aaac4ac5f238038a3045e6f72e48ef0fe8bc675e82c318a268e43970271bf119b81bf6a982746554f84e72b9f00280a320a08142923c23c883423ff949827f29bbacdc1ccdb04938ce6098c95ba6b32528f4ef78eed778b2e122ddfd1cbdd11d1c0a6783e011fc536d63d053260637"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 8
|
||||
aes_encrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"fe000000000000000000000000000000":"d55f684f81f4426e9fde92a5ff02df2ac896af63962888a97910c1379e20b0a3b1db613fb7fe2e07004329ea5c22bfd33e3dbe4cf58cc608c2c26c19a2e2fe22f98732c2b5cb844cc6c0702d91e1d50fc4382a7eba5635cd602432a2306ac4ce82f8d70c8d9bc15f918fe71e74c622d5cf71178bf6e0b9cc9f2b41dd8dbe441c41cd0c73a6dc47a348f6702f9d0e9b1b1431e948e299b9ec2272ab2c5f0c7be86affa5dec87a0bee81d3d50007edaa2bcfccb35605155ff36ed8edd4a40dcd4b243acd11b2b987bdbfaf91a7cac27e9c5aea525ee53de7b2d3332c8644402b823e94a7db26276d2d23aa07180f76b4fd29b9c0823099c9d62c519880aee7e9697617c1497d47bf3e571950311421b6b734d38b0db91eb85331b91ea9f61530f54512a5a52a4bad589eb69781d537f23297bb459bdad2948a29e1550bf4787e0be95bb173cf5fab17dab7a13a052a63453d97ccec1a321954886b7a1299faaeecae35c6eaaca753b041b5e5f093bf83397fd21dd6b3012066fcc058cc32c3b09d7562dee29509b5839392c9ff05f51f3166aaac4ac5f238038a3045e6f72e48ef0fe8bc675e82c318a268e43970271bf119b81bf6a982746554f84e72b9f00280a320a08142923c23c883423ff949827f29bbacdc1ccdb04938ce6098c95ba6b32528f4ef78eed778b2e122ddfd1cbdd11d1c0a6783e011fc536d63d053260637":"72efc1ebfe1ee25975a6eb3aa8589dda2b261f1c85bdab442a9e5b2dd1d7c3957a16fc08e526d4b1223f1b1232a11af274c3d70dac57f83e0983c498f1a6f1aecb021c3e70085a1e527f1ce41ee5911a82020161529cd82773762daf5459de94a0a82adae7e1703c808543c29ed6fb32d9e004327c1355180c995a07741493a09c21ba01a387882da4f62534b87bb15d60d197201c0fd3bf30c1500a3ecfecdd66d8721f90bcc4c17ee925c61b0a03727a9c0d5f5ca462fbfa0af1c2513a9d9d4b5345bd27a5f6e653f751693e6b6a2b8ead57d511e00e58c45b7b8d005af79288f5c7c22fd4f1bf7a898b03a5634c6a1ae3f9fae5de4f296a2896b23e7ed43ed14fa5a2803f4d28f0d3ffcf24757677aebdb47bb388378708948a8d4126ed1839e0da29a537a8c198b3c66ab00712dd261674bf45a73d67f76914f830ca014b65596f27e4cf62de66125a5566df9975155628b400fbfb3a29040ed50faffdbb18aece7c5c44693260aab386c0a37b11b114f1c415aebb653be468179428d43a4d8bc3ec38813eca30a13cf1bb18d524f1992d44d8b1a42ea30b22e6c95b199d8d182f8840b09d059585c31ad691fa0619ff038aca2c39a943421157361717c49d322028a74648113bd8c9d7ec77cf3c89c1ec8718ceff8516d96b34c3c614f10699c9abc4ed0411506223bea16af35c883accdbe1104eef0cfdb54e12fb230a"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 9
|
||||
aes_encrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"ff000000000000000000000000000000":"72efc1ebfe1ee25975a6eb3aa8589dda2b261f1c85bdab442a9e5b2dd1d7c3957a16fc08e526d4b1223f1b1232a11af274c3d70dac57f83e0983c498f1a6f1aecb021c3e70085a1e527f1ce41ee5911a82020161529cd82773762daf5459de94a0a82adae7e1703c808543c29ed6fb32d9e004327c1355180c995a07741493a09c21ba01a387882da4f62534b87bb15d60d197201c0fd3bf30c1500a3ecfecdd66d8721f90bcc4c17ee925c61b0a03727a9c0d5f5ca462fbfa0af1c2513a9d9d4b5345bd27a5f6e653f751693e6b6a2b8ead57d511e00e58c45b7b8d005af79288f5c7c22fd4f1bf7a898b03a5634c6a1ae3f9fae5de4f296a2896b23e7ed43ed14fa5a2803f4d28f0d3ffcf24757677aebdb47bb388378708948a8d4126ed1839e0da29a537a8c198b3c66ab00712dd261674bf45a73d67f76914f830ca014b65596f27e4cf62de66125a5566df9975155628b400fbfb3a29040ed50faffdbb18aece7c5c44693260aab386c0a37b11b114f1c415aebb653be468179428d43a4d8bc3ec38813eca30a13cf1bb18d524f1992d44d8b1a42ea30b22e6c95b199d8d182f8840b09d059585c31ad691fa0619ff038aca2c39a943421157361717c49d322028a74648113bd8c9d7ec77cf3c89c1ec8718ceff8516d96b34c3c614f10699c9abc4ed0411506223bea16af35c883accdbe1104eef0cfdb54e12fb230a":"3260ae8dad1f4a32c5cafe3ab0eb95549d461a67ceb9e5aa2d3afb62dece0553193ba50c75be251e08d1d08f1088576c7efdfaaf3f459559571e12511753b07af073f35da06af0ce0bbf6b8f5ccc5cea500ec1b211bd51f63b606bf6528796ca12173ba39b8935ee44ccce646f90a45bf9ccc567f0ace13dc2d53ebeedc81f58b2e41179dddf0d5a5c42f5d8506c1a5d2f8f59f3ea873cbcd0eec19acbf325423bd3dcb8c2b1bf1d1eaed0eba7f0698e4314fbeb2f1566d1b9253008cbccf45a2b0d9c5c9c21474f4076e02be26050b99dee4fd68a4cf890e496e4fcae7b70f94ea5a9062da0daeba1993d2ccd1dd3c244b8428801495a58b216547e7e847c46d1d756377b6242d2e5fb83bf752b54e0df71e889f3a2bb0f4c10805bf3c590376e3c24e22ff57f7fa965577375325cea5d920db94b9c336b455f6e894c01866fe9fbb8c8d3f70a2957285f6dfb5dcd8cbf54782f8fe7766d4723819913ac773421e3a31095866bad22c86a6036b2518b2059b4229d18c8c2ccbdf906c6cc6e82464ee57bddb0bebcb1dc645325bfb3e665ef7251082c88ebb1cf203bd779fdd38675713c8daadd17e1cabee432b09787b6ddf3304e38b731b45df5df51b78fcfb3d32466028d0ba36555e7e11ab0ee0666061d1645d962444bc47a38188930a84b4d561395c73c087021927ca638b7afc8a8679ccb84c26555440ec7f10445cd"
|
||||
|
||||
#
|
||||
# 256-bit keys with 512 byte sector
|
||||
#
|
||||
AES-256-XTS Encrypt IEEE P1619/D16 Vector 10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ff000000000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"1c3b3a102f770386e4836c99e370cf9bea00803f5e482357a4ae12d414a3e63b5d31e276f8fe4a8d66b317f9ac683f44680a86ac35adfc3345befecb4bb188fd5776926c49a3095eb108fd1098baec70aaa66999a72a82f27d848b21d4a741b0c5cd4d5fff9dac89aeba122961d03a757123e9870f8acf1000020887891429ca2a3e7a7d7df7b10355165c8b9a6d0a7de8b062c4500dc4cd120c0f7418dae3d0b5781c34803fa75421c790dfe1de1834f280d7667b327f6c8cd7557e12ac3a0f93ec05c52e0493ef31a12d3d9260f79a289d6a379bc70c50841473d1a8cc81ec583e9645e07b8d9670655ba5bbcfecc6dc3966380ad8fecb17b6ba02469a020a84e18e8f84252070c13e9f1f289be54fbc481457778f616015e1327a02b140f1505eb309326d68378f8374595c849d84f4c333ec4423885143cb47bd71c5edae9be69a2ffeceb1bec9de244fbe15992b11b77c040f12bd8f6a975a44a0f90c29a9abc3d4d893927284c58754cce294529f8614dcd2aba991925fedc4ae74ffac6e333b93eb4aff0479da9a410e4450e0dd7ae4c6e2910900575da401fc07059f645e8b7e9bfdef33943054ff84011493c27b3429eaedb4ed5376441a77ed43851ad77f16f541dfd269d50d6a5f14fb0aab1cbb4c1550be97f7ab4066193c4caa773dad38014bd2092fa755c824bb5e54c4f36ffda9fcea70b9c6e693e148c151"
|
||||
|
||||
AES-256-XTS Encrypt IEEE P1619/D16 Vector 11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ffff0000000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"77a31251618a15e6b92d1d66dffe7b50b50bad552305ba0217a610688eff7e11e1d0225438e093242d6db274fde801d4cae06f2092c728b2478559df58e837c2469ee4a4fa794e4bbc7f39bc026e3cb72c33b0888f25b4acf56a2a9804f1ce6d3d6e1dc6ca181d4b546179d55544aa7760c40d06741539c7e3cd9d2f6650b2013fd0eeb8c2b8e3d8d240ccae2d4c98320a7442e1c8d75a42d6e6cfa4c2eca1798d158c7aecdf82490f24bb9b38e108bcda12c3faf9a21141c3613b58367f922aaa26cd22f23d708dae699ad7cb40a8ad0b6e2784973dcb605684c08b8d6998c69aac049921871ebb65301a4619ca80ecb485a31d744223ce8ddc2394828d6a80470c092f5ba413c3378fa6054255c6f9df4495862bbb3287681f931b687c888abf844dfc8fc28331e579928cd12bd2390ae123cf03818d14dedde5c0c24c8ab018bfca75ca096f2d531f3d1619e785f1ada437cab92e980558b3dce1474afb75bfedbf8ff54cb2618e0244c9ac0d3c66fb51598cd2db11f9be39791abe447c63094f7c453b7ff87cb5bb36b7c79efb0872d17058b83b15ab0866ad8a58656c5a7e20dbdf308b2461d97c0ec0024a2715055249cf3b478ddd4740de654f75ca686e0d7345c69ed50cdc2a8b332b1f8824108ac937eb050585608ee734097fc09054fbff89eeaeea791f4a7ab1f9868294a4f9e27b42af8100cb9d59cef9645803"
|
||||
|
||||
AES-256-XTS Encrypt IEEE P1619/D16 Vector 12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ffffff00000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"e387aaa58ba483afa7e8eb469778317ecf4cf573aa9d4eac23f2cdf914e4e200a8b490e42ee646802dc6ee2b471b278195d60918ececb44bf79966f83faba0499298ebc699c0c8634715a320bb4f075d622e74c8c932004f25b41e361025b5a87815391f6108fc4afa6a05d9303c6ba68a128a55705d415985832fdeaae6c8e19110e84d1b1f199a2692119edc96132658f09da7c623efcec712537a3d94c0bf5d7e352ec94ae5797fdb377dc1551150721adf15bd26a8efc2fcaad56881fa9e62462c28f30ae1ceaca93c345cf243b73f542e2074a705bd2643bb9f7cc79bb6e7091ea6e232df0f9ad0d6cf502327876d82207abf2115cdacf6d5a48f6c1879a65b115f0f8b3cb3c59d15dd8c769bc014795a1837f3901b5845eb491adfefe097b1fa30a12fc1f65ba22905031539971a10f2f36c321bb51331cdefb39e3964c7ef079994f5b69b2edd83a71ef549971ee93f44eac3938fcdd61d01fa71799da3a8091c4c48aa9ed263ff0749df95d44fef6a0bb578ec69456aa5408ae32c7af08ad7ba8921287e3bbee31b767be06a0e705c864a769137df28292283ea81a2480241b44d9921cdbec1bc28dc1fda114bd8e5217ac9d8ebafa720e9da4f9ace231cc949e5b96fe76ffc21063fddc83a6b8679c00d35e09576a875305bed5f36ed242c8900dd1fa965bc950dfce09b132263a1eef52dd6888c309f5a7d712826"
|
||||
|
||||
AES-256-XTS Encrypt IEEE P1619/D16 Vector 13
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ffffffff000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"bf53d2dade78e822a4d949a9bc6766b01b06a8ef70d26748c6a7fc36d80ae4c5520f7c4ab0ac8544424fa405162fef5a6b7f229498063618d39f0003cb5fb8d1c86b643497da1ff945c8d3bedeca4f479702a7a735f043ddb1d6aaade3c4a0ac7ca7f3fa5279bef56f82cd7a2f38672e824814e10700300a055e1630b8f1cb0e919f5e942010a416e2bf48cb46993d3cb6a51c19bacf864785a00bc2ecff15d350875b246ed53e68be6f55bd7e05cfc2b2ed6432198a6444b6d8c247fab941f569768b5c429366f1d3f00f0345b96123d56204c01c63b22ce78baf116e525ed90fdea39fa469494d3866c31e05f295ff21fea8d4e6e13d67e47ce722e9698a1c1048d68ebcde76b86fcf976eab8aa9790268b7068e017a8b9b749409514f1053027fd16c3786ea1bac5f15cb79711ee2abe82f5cf8b13ae73030ef5b9e4457e75d1304f988d62dd6fc4b94ed38ba831da4b7634971b6cd8ec325d9c61c00f1df73627ed3745a5e8489f3a95c69639c32cd6e1d537a85f75cc844726e8a72fc0077ad22000f1d5078f6b866318c668f1ad03d5a5fced5219f2eabbd0aa5c0f460d183f04404a0d6f469558e81fab24a167905ab4c7878502ad3e38fdbe62a41556cec37325759533ce8f25f367c87bb5578d667ae93f9e2fd99bcbc5f2fbba88cf6516139420fcff3b7361d86322c4bd84c82f335abb152c4a93411373aaa8220"
|
||||
|
||||
AES-256-XTS Encrypt IEEE P1619/D16 Vector 14
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_encrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ffffffffff0000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"64497e5a831e4a932c09be3e5393376daa599548b816031d224bbf50a818ed2350eae7e96087c8a0db51ad290bd00c1ac1620857635bf246c176ab463be30b808da548081ac847b158e1264be25bb0910bbc92647108089415d45fab1b3d2604e8a8eff1ae4020cfa39936b66827b23f371b92200be90251e6d73c5f86de5fd4a950781933d79a28272b782a2ec313efdfcc0628f43d744c2dc2ff3dcb66999b50c7ca895b0c64791eeaa5f29499fb1c026f84ce5b5c72ba1083cddb5ce45434631665c333b60b11593fb253c5179a2c8db813782a004856a1653011e93fb6d876c18366dd8683f53412c0c180f9c848592d593f8609ca736317d356e13e2bff3a9f59cd9aeb19cd482593d8c46128bb32423b37a9adfb482b99453fbe25a41bf6feb4aa0bef5ed24bf73c762978025482c13115e4015aac992e5613a3b5c2f685b84795cb6e9b2656d8c88157e52c42f978d8634c43d06fea928f2822e465aa6576e9bf419384506cc3ce3c54ac1a6f67dc66f3b30191e698380bc999b05abce19dc0c6dcc2dd001ec535ba18deb2df1a101023108318c75dc98611a09dc48a0acdec676fabdf222f07e026f059b672b56e5cbc8e1d21bbd867dd927212054681d70ea737134cdfce93b6f82ae22423274e58a0821cc5502e2d0ab4585e94de6975be5e0b4efce51cd3e70c25a1fbbbd609d273ad5b0d59631c531f6a0a57b9"
|
||||
|
||||
#
|
||||
# 128-bit keys with sector size not evenly divisible by 16 bytes
|
||||
#
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 15
|
||||
aes_encrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0":"9a785634120000000000000000000000":"000102030405060708090a0b0c0d0e0f10":"6c1625db4671522d3d7599601de7ca09ed"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 16
|
||||
aes_encrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0":"9a785634120000000000000000000000":"000102030405060708090a0b0c0d0e0f1011":"d069444b7a7e0cab09e24447d24deb1fedbf"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 17
|
||||
aes_encrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0":"9a785634120000000000000000000000":"000102030405060708090a0b0c0d0e0f101112":"e5df1351c0544ba1350b3363cd8ef4beedbf9d"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 18
|
||||
aes_encrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0":"9a785634120000000000000000000000":"000102030405060708090a0b0c0d0e0f10111213":"9d84c813f719aa2c7be3f66171c7c5c2edbf9dac"
|
||||
|
||||
AES-128-XTS Encrypt IEEE P1619/D16 Vector 19
|
||||
aes_encrypt_xts:"e0e1e2e3e4e5e6e7e8e9eaebecedeeefc0c1c2c3c4c5c6c7c8c9cacbcccdcecf":"21436587a90000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"38b45812ef43a05bd957e545907e223b954ab4aaf088303ad910eadf14b42be68b2461149d8c8ba85f992be970bc621f1b06573f63e867bf5875acafa04e42ccbd7bd3c2a0fb1fff791ec5ec36c66ae4ac1e806d81fbf709dbe29e471fad38549c8e66f5345d7c1eb94f405d1ec785cc6f6a68f6254dd8339f9d84057e01a17741990482999516b5611a38f41bb6478e6f173f320805dd71b1932fc333cb9ee39936beea9ad96fa10fb4112b901734ddad40bc1878995f8e11aee7d141a2f5d48b7a4e1e7f0b2c04830e69a4fd1378411c2f287edf48c6c4e5c247a19680f7fe41cefbd49b582106e3616cbbe4dfb2344b2ae9519391f3e0fb4922254b1d6d2d19c6d4d537b3a26f3bcc51588b32f3eca0829b6a5ac72578fb814fb43cf80d64a233e3f997a3f02683342f2b33d25b492536b93becb2f5e1a8b82f5b883342729e8ae09d16938841a21a97fb543eea3bbff59f13c1a18449e398701c1ad51648346cbc04c27bb2da3b93a1372ccae548fb53bee476f9e9c91773b1bb19828394d55d3e1a20ed69113a860b6829ffa847224604435070221b257e8dff783615d2cae4803a93aa4334ab482a0afac9c0aeda70b45a481df5dec5df8cc0f423c77a5fd46cd312021d4b438862419a791be03bb4d97c0e59578542531ba466a83baf92cefc151b5cc1611a167893819b63fb8a6b18e86de60290fa72b797b0ce59f3"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 1
|
||||
aes_decrypt_xts:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000":"0000000000000000000000000000000000000000000000000000000000000000":"917cf69ebd68b2ec9b9fe9a3eadda692cd43d2f59598ed858c02c2652fbf922e"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 2
|
||||
aes_decrypt_xts:"1111111111111111111111111111111122222222222222222222222222222222":"33333333330000000000000000000000":"4444444444444444444444444444444444444444444444444444444444444444":"c454185e6a16936e39334038acef838bfb186fff7480adc4289382ecd6d394f0"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 3
|
||||
aes_decrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"00000000000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89cc78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad02655ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f4341332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203ebb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18deb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 4
|
||||
aes_decrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"00000000000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89cc78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad02655ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f4341332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203ebb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18deb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 5
|
||||
aes_decrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"01000000000000000000000000000000":"27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89cc78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad02655ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f4341332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203ebb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18deb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568":"264d3ca8512194fec312c8c9891f279fefdd608d0c027b60483a3fa811d65ee59d52d9e40ec5672d81532b38b6b089ce951f0f9c35590b8b978d175213f329bb1c2fd30f2f7f30492a61a532a79f51d36f5e31a7c9a12c286082ff7d2394d18f783e1a8e72c722caaaa52d8f065657d2631fd25bfd8e5baad6e527d763517501c68c5edc3cdd55435c532d7125c8614deed9adaa3acade5888b87bef641c4c994c8091b5bcd387f3963fb5bc37aa922fbfe3df4e5b915e6eb514717bdd2a74079a5073f5c4bfd46adf7d282e7a393a52579d11a028da4d9cd9c77124f9648ee383b1ac763930e7162a8d37f350b2f74b8472cf09902063c6b32e8c2d9290cefbd7346d1c779a0df50edcde4531da07b099c638e83a755944df2aef1aa31752fd323dcb710fb4bfbb9d22b925bc3577e1b8949e729a90bbafeacf7f7879e7b1147e28ba0bae940db795a61b15ecf4df8db07b824bb062802cc98a9545bb2aaeed77cb3fc6db15dcd7d80d7d5bc406c4970a3478ada8899b329198eb61c193fb6275aa8ca340344a75a862aebe92eee1ce032fd950b47d7704a3876923b4ad62844bf4a09c4dbe8b4397184b7471360c9564880aedddb9baa4af2e75394b08cd32ff479c57a07d3eab5d54de5f9738b8d27f27a9f0ab11799d7b7ffefb2704c95c6ad12c39f1e867a4b7b1d7818a4b753dfd2a89ccb45e001a03a867b187f225dd"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 6
|
||||
aes_decrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"02000000000000000000000000000000":"264d3ca8512194fec312c8c9891f279fefdd608d0c027b60483a3fa811d65ee59d52d9e40ec5672d81532b38b6b089ce951f0f9c35590b8b978d175213f329bb1c2fd30f2f7f30492a61a532a79f51d36f5e31a7c9a12c286082ff7d2394d18f783e1a8e72c722caaaa52d8f065657d2631fd25bfd8e5baad6e527d763517501c68c5edc3cdd55435c532d7125c8614deed9adaa3acade5888b87bef641c4c994c8091b5bcd387f3963fb5bc37aa922fbfe3df4e5b915e6eb514717bdd2a74079a5073f5c4bfd46adf7d282e7a393a52579d11a028da4d9cd9c77124f9648ee383b1ac763930e7162a8d37f350b2f74b8472cf09902063c6b32e8c2d9290cefbd7346d1c779a0df50edcde4531da07b099c638e83a755944df2aef1aa31752fd323dcb710fb4bfbb9d22b925bc3577e1b8949e729a90bbafeacf7f7879e7b1147e28ba0bae940db795a61b15ecf4df8db07b824bb062802cc98a9545bb2aaeed77cb3fc6db15dcd7d80d7d5bc406c4970a3478ada8899b329198eb61c193fb6275aa8ca340344a75a862aebe92eee1ce032fd950b47d7704a3876923b4ad62844bf4a09c4dbe8b4397184b7471360c9564880aedddb9baa4af2e75394b08cd32ff479c57a07d3eab5d54de5f9738b8d27f27a9f0ab11799d7b7ffefb2704c95c6ad12c39f1e867a4b7b1d7818a4b753dfd2a89ccb45e001a03a867b187f225dd":"fa762a3680b76007928ed4a4f49a9456031b704782e65e16cecb54ed7d017b5e18abd67b338e81078f21edb7868d901ebe9c731a7c18b5e6dec1d6a72e078ac9a4262f860beefa14f4e821018272e411a951502b6e79066e84252c3346f3aa62344351a291d4bedc7a07618bdea2af63145cc7a4b8d4070691ae890cd65733e7946e9021a1dffc4c59f159425ee6d50ca9b135fa6162cea18a939838dc000fb386fad086acce5ac07cb2ece7fd580b00cfa5e98589631dc25e8e2a3daf2ffdec26531659912c9d8f7a15e5865ea8fb5816d6207052bd7128cd743c12c8118791a4736811935eb982a532349e31dd401e0b660a568cb1a4711f552f55ded59f1f15bf7196b3ca12a91e488ef59d64f3a02bf45239499ac6176ae321c4a211ec545365971c5d3f4f09d4eb139bfdf2073d33180b21002b65cc9865e76cb24cd92c874c24c18350399a936ab3637079295d76c417776b94efce3a0ef7206b15110519655c956cbd8b2489405ee2b09a6b6eebe0c53790a12a8998378b33a5b71159625f4ba49d2a2fdba59fbf0897bc7aabd8d707dc140a80f0f309f835d3da54ab584e501dfa0ee977fec543f74186a802b9a37adb3e8291eca04d66520d229e60401e7282bef486ae059aa70696e0e305d777140a7a883ecdcb69b9ff938e8a4231864c69ca2c2043bed007ff3e605e014bcf518138dc3a25c5e236171a2d01d6"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 7
|
||||
aes_decrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"fd000000000000000000000000000000":"8e41b78c390b5af9d758bb214a67e9f6bf7727b09ac6124084c37611398fa45daad94868600ed391fb1acd4857a95b466e62ef9f4b377244d1c152e7b30d731aad30c716d214b707aed99eb5b5e580b3e887cf7497465651d4b60e6042051da3693c3b78c14489543be8b6ad0ba629565bba202313ba7b0d0c94a3252b676f46cc02ce0f8a7d34c0ed229129673c1f61aed579d08a9203a25aac3a77e9db60267996db38df637356d9dcd1632e369939f2a29d89345c66e05066f1a3677aef18dea4113faeb629e46721a66d0a7e785d3e29af2594eb67dfa982affe0aac058f6e15864269b135418261fc3afb089472cf68c45dd7f231c6249ba0255e1e033833fc4d00a3fe02132d7bc3873614b8aee34273581ea0325c81f0270affa13641d052d36f0757d484014354d02d6883ca15c24d8c3956b1bd027bcf41f151fd8023c5340e5606f37e90fdb87c86fb4fa634b3718a30bace06a66eaf8f63c4aa3b637826a87fe8cfa44282e92cb1615af3a28e53bc74c7cba1a0977be9065d0c1a5dec6c54ae38d37f37aa35283e048e5530a85c4e7a29d7b92ec0c3169cdf2a805c7604bce60049b9fb7b8eaac10f51ae23794ceba68bb58112e293b9b692ca721b37c662f8574ed4dba6f88e170881c82cddc1034a0ca7e284bf0962b6b26292d836fa9f73c1ac770eef0f2d3a1eaf61d3e03555fd424eedd67e18a18094f888":"d55f684f81f4426e9fde92a5ff02df2ac896af63962888a97910c1379e20b0a3b1db613fb7fe2e07004329ea5c22bfd33e3dbe4cf58cc608c2c26c19a2e2fe22f98732c2b5cb844cc6c0702d91e1d50fc4382a7eba5635cd602432a2306ac4ce82f8d70c8d9bc15f918fe71e74c622d5cf71178bf6e0b9cc9f2b41dd8dbe441c41cd0c73a6dc47a348f6702f9d0e9b1b1431e948e299b9ec2272ab2c5f0c7be86affa5dec87a0bee81d3d50007edaa2bcfccb35605155ff36ed8edd4a40dcd4b243acd11b2b987bdbfaf91a7cac27e9c5aea525ee53de7b2d3332c8644402b823e94a7db26276d2d23aa07180f76b4fd29b9c0823099c9d62c519880aee7e9697617c1497d47bf3e571950311421b6b734d38b0db91eb85331b91ea9f61530f54512a5a52a4bad589eb69781d537f23297bb459bdad2948a29e1550bf4787e0be95bb173cf5fab17dab7a13a052a63453d97ccec1a321954886b7a1299faaeecae35c6eaaca753b041b5e5f093bf83397fd21dd6b3012066fcc058cc32c3b09d7562dee29509b5839392c9ff05f51f3166aaac4ac5f238038a3045e6f72e48ef0fe8bc675e82c318a268e43970271bf119b81bf6a982746554f84e72b9f00280a320a08142923c23c883423ff949827f29bbacdc1ccdb04938ce6098c95ba6b32528f4ef78eed778b2e122ddfd1cbdd11d1c0a6783e011fc536d63d053260637"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 8
|
||||
aes_decrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"fe000000000000000000000000000000":"d55f684f81f4426e9fde92a5ff02df2ac896af63962888a97910c1379e20b0a3b1db613fb7fe2e07004329ea5c22bfd33e3dbe4cf58cc608c2c26c19a2e2fe22f98732c2b5cb844cc6c0702d91e1d50fc4382a7eba5635cd602432a2306ac4ce82f8d70c8d9bc15f918fe71e74c622d5cf71178bf6e0b9cc9f2b41dd8dbe441c41cd0c73a6dc47a348f6702f9d0e9b1b1431e948e299b9ec2272ab2c5f0c7be86affa5dec87a0bee81d3d50007edaa2bcfccb35605155ff36ed8edd4a40dcd4b243acd11b2b987bdbfaf91a7cac27e9c5aea525ee53de7b2d3332c8644402b823e94a7db26276d2d23aa07180f76b4fd29b9c0823099c9d62c519880aee7e9697617c1497d47bf3e571950311421b6b734d38b0db91eb85331b91ea9f61530f54512a5a52a4bad589eb69781d537f23297bb459bdad2948a29e1550bf4787e0be95bb173cf5fab17dab7a13a052a63453d97ccec1a321954886b7a1299faaeecae35c6eaaca753b041b5e5f093bf83397fd21dd6b3012066fcc058cc32c3b09d7562dee29509b5839392c9ff05f51f3166aaac4ac5f238038a3045e6f72e48ef0fe8bc675e82c318a268e43970271bf119b81bf6a982746554f84e72b9f00280a320a08142923c23c883423ff949827f29bbacdc1ccdb04938ce6098c95ba6b32528f4ef78eed778b2e122ddfd1cbdd11d1c0a6783e011fc536d63d053260637":"72efc1ebfe1ee25975a6eb3aa8589dda2b261f1c85bdab442a9e5b2dd1d7c3957a16fc08e526d4b1223f1b1232a11af274c3d70dac57f83e0983c498f1a6f1aecb021c3e70085a1e527f1ce41ee5911a82020161529cd82773762daf5459de94a0a82adae7e1703c808543c29ed6fb32d9e004327c1355180c995a07741493a09c21ba01a387882da4f62534b87bb15d60d197201c0fd3bf30c1500a3ecfecdd66d8721f90bcc4c17ee925c61b0a03727a9c0d5f5ca462fbfa0af1c2513a9d9d4b5345bd27a5f6e653f751693e6b6a2b8ead57d511e00e58c45b7b8d005af79288f5c7c22fd4f1bf7a898b03a5634c6a1ae3f9fae5de4f296a2896b23e7ed43ed14fa5a2803f4d28f0d3ffcf24757677aebdb47bb388378708948a8d4126ed1839e0da29a537a8c198b3c66ab00712dd261674bf45a73d67f76914f830ca014b65596f27e4cf62de66125a5566df9975155628b400fbfb3a29040ed50faffdbb18aece7c5c44693260aab386c0a37b11b114f1c415aebb653be468179428d43a4d8bc3ec38813eca30a13cf1bb18d524f1992d44d8b1a42ea30b22e6c95b199d8d182f8840b09d059585c31ad691fa0619ff038aca2c39a943421157361717c49d322028a74648113bd8c9d7ec77cf3c89c1ec8718ceff8516d96b34c3c614f10699c9abc4ed0411506223bea16af35c883accdbe1104eef0cfdb54e12fb230a"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 9
|
||||
aes_decrypt_xts:"2718281828459045235360287471352631415926535897932384626433832795":"ff000000000000000000000000000000":"72efc1ebfe1ee25975a6eb3aa8589dda2b261f1c85bdab442a9e5b2dd1d7c3957a16fc08e526d4b1223f1b1232a11af274c3d70dac57f83e0983c498f1a6f1aecb021c3e70085a1e527f1ce41ee5911a82020161529cd82773762daf5459de94a0a82adae7e1703c808543c29ed6fb32d9e004327c1355180c995a07741493a09c21ba01a387882da4f62534b87bb15d60d197201c0fd3bf30c1500a3ecfecdd66d8721f90bcc4c17ee925c61b0a03727a9c0d5f5ca462fbfa0af1c2513a9d9d4b5345bd27a5f6e653f751693e6b6a2b8ead57d511e00e58c45b7b8d005af79288f5c7c22fd4f1bf7a898b03a5634c6a1ae3f9fae5de4f296a2896b23e7ed43ed14fa5a2803f4d28f0d3ffcf24757677aebdb47bb388378708948a8d4126ed1839e0da29a537a8c198b3c66ab00712dd261674bf45a73d67f76914f830ca014b65596f27e4cf62de66125a5566df9975155628b400fbfb3a29040ed50faffdbb18aece7c5c44693260aab386c0a37b11b114f1c415aebb653be468179428d43a4d8bc3ec38813eca30a13cf1bb18d524f1992d44d8b1a42ea30b22e6c95b199d8d182f8840b09d059585c31ad691fa0619ff038aca2c39a943421157361717c49d322028a74648113bd8c9d7ec77cf3c89c1ec8718ceff8516d96b34c3c614f10699c9abc4ed0411506223bea16af35c883accdbe1104eef0cfdb54e12fb230a":"3260ae8dad1f4a32c5cafe3ab0eb95549d461a67ceb9e5aa2d3afb62dece0553193ba50c75be251e08d1d08f1088576c7efdfaaf3f459559571e12511753b07af073f35da06af0ce0bbf6b8f5ccc5cea500ec1b211bd51f63b606bf6528796ca12173ba39b8935ee44ccce646f90a45bf9ccc567f0ace13dc2d53ebeedc81f58b2e41179dddf0d5a5c42f5d8506c1a5d2f8f59f3ea873cbcd0eec19acbf325423bd3dcb8c2b1bf1d1eaed0eba7f0698e4314fbeb2f1566d1b9253008cbccf45a2b0d9c5c9c21474f4076e02be26050b99dee4fd68a4cf890e496e4fcae7b70f94ea5a9062da0daeba1993d2ccd1dd3c244b8428801495a58b216547e7e847c46d1d756377b6242d2e5fb83bf752b54e0df71e889f3a2bb0f4c10805bf3c590376e3c24e22ff57f7fa965577375325cea5d920db94b9c336b455f6e894c01866fe9fbb8c8d3f70a2957285f6dfb5dcd8cbf54782f8fe7766d4723819913ac773421e3a31095866bad22c86a6036b2518b2059b4229d18c8c2ccbdf906c6cc6e82464ee57bddb0bebcb1dc645325bfb3e665ef7251082c88ebb1cf203bd779fdd38675713c8daadd17e1cabee432b09787b6ddf3304e38b731b45df5df51b78fcfb3d32466028d0ba36555e7e11ab0ee0666061d1645d962444bc47a38188930a84b4d561395c73c087021927ca638b7afc8a8679ccb84c26555440ec7f10445cd"
|
||||
|
||||
AES-256-XTS Decrypt IEEE P1619/D16 Vector 10
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ff000000000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"1c3b3a102f770386e4836c99e370cf9bea00803f5e482357a4ae12d414a3e63b5d31e276f8fe4a8d66b317f9ac683f44680a86ac35adfc3345befecb4bb188fd5776926c49a3095eb108fd1098baec70aaa66999a72a82f27d848b21d4a741b0c5cd4d5fff9dac89aeba122961d03a757123e9870f8acf1000020887891429ca2a3e7a7d7df7b10355165c8b9a6d0a7de8b062c4500dc4cd120c0f7418dae3d0b5781c34803fa75421c790dfe1de1834f280d7667b327f6c8cd7557e12ac3a0f93ec05c52e0493ef31a12d3d9260f79a289d6a379bc70c50841473d1a8cc81ec583e9645e07b8d9670655ba5bbcfecc6dc3966380ad8fecb17b6ba02469a020a84e18e8f84252070c13e9f1f289be54fbc481457778f616015e1327a02b140f1505eb309326d68378f8374595c849d84f4c333ec4423885143cb47bd71c5edae9be69a2ffeceb1bec9de244fbe15992b11b77c040f12bd8f6a975a44a0f90c29a9abc3d4d893927284c58754cce294529f8614dcd2aba991925fedc4ae74ffac6e333b93eb4aff0479da9a410e4450e0dd7ae4c6e2910900575da401fc07059f645e8b7e9bfdef33943054ff84011493c27b3429eaedb4ed5376441a77ed43851ad77f16f541dfd269d50d6a5f14fb0aab1cbb4c1550be97f7ab4066193c4caa773dad38014bd2092fa755c824bb5e54c4f36ffda9fcea70b9c6e693e148c151"
|
||||
|
||||
AES-256-XTS Decrypt IEEE P1619/D16 Vector 11
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ffff0000000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"77a31251618a15e6b92d1d66dffe7b50b50bad552305ba0217a610688eff7e11e1d0225438e093242d6db274fde801d4cae06f2092c728b2478559df58e837c2469ee4a4fa794e4bbc7f39bc026e3cb72c33b0888f25b4acf56a2a9804f1ce6d3d6e1dc6ca181d4b546179d55544aa7760c40d06741539c7e3cd9d2f6650b2013fd0eeb8c2b8e3d8d240ccae2d4c98320a7442e1c8d75a42d6e6cfa4c2eca1798d158c7aecdf82490f24bb9b38e108bcda12c3faf9a21141c3613b58367f922aaa26cd22f23d708dae699ad7cb40a8ad0b6e2784973dcb605684c08b8d6998c69aac049921871ebb65301a4619ca80ecb485a31d744223ce8ddc2394828d6a80470c092f5ba413c3378fa6054255c6f9df4495862bbb3287681f931b687c888abf844dfc8fc28331e579928cd12bd2390ae123cf03818d14dedde5c0c24c8ab018bfca75ca096f2d531f3d1619e785f1ada437cab92e980558b3dce1474afb75bfedbf8ff54cb2618e0244c9ac0d3c66fb51598cd2db11f9be39791abe447c63094f7c453b7ff87cb5bb36b7c79efb0872d17058b83b15ab0866ad8a58656c5a7e20dbdf308b2461d97c0ec0024a2715055249cf3b478ddd4740de654f75ca686e0d7345c69ed50cdc2a8b332b1f8824108ac937eb050585608ee734097fc09054fbff89eeaeea791f4a7ab1f9868294a4f9e27b42af8100cb9d59cef9645803"
|
||||
|
||||
AES-256-XTS Decrypt IEEE P1619/D16 Vector 12
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ffffff00000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"e387aaa58ba483afa7e8eb469778317ecf4cf573aa9d4eac23f2cdf914e4e200a8b490e42ee646802dc6ee2b471b278195d60918ececb44bf79966f83faba0499298ebc699c0c8634715a320bb4f075d622e74c8c932004f25b41e361025b5a87815391f6108fc4afa6a05d9303c6ba68a128a55705d415985832fdeaae6c8e19110e84d1b1f199a2692119edc96132658f09da7c623efcec712537a3d94c0bf5d7e352ec94ae5797fdb377dc1551150721adf15bd26a8efc2fcaad56881fa9e62462c28f30ae1ceaca93c345cf243b73f542e2074a705bd2643bb9f7cc79bb6e7091ea6e232df0f9ad0d6cf502327876d82207abf2115cdacf6d5a48f6c1879a65b115f0f8b3cb3c59d15dd8c769bc014795a1837f3901b5845eb491adfefe097b1fa30a12fc1f65ba22905031539971a10f2f36c321bb51331cdefb39e3964c7ef079994f5b69b2edd83a71ef549971ee93f44eac3938fcdd61d01fa71799da3a8091c4c48aa9ed263ff0749df95d44fef6a0bb578ec69456aa5408ae32c7af08ad7ba8921287e3bbee31b767be06a0e705c864a769137df28292283ea81a2480241b44d9921cdbec1bc28dc1fda114bd8e5217ac9d8ebafa720e9da4f9ace231cc949e5b96fe76ffc21063fddc83a6b8679c00d35e09576a875305bed5f36ed242c8900dd1fa965bc950dfce09b132263a1eef52dd6888c309f5a7d712826"
|
||||
|
||||
AES-256-XTS Decrypt IEEE P1619/D16 Vector 13
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ffffffff000000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"bf53d2dade78e822a4d949a9bc6766b01b06a8ef70d26748c6a7fc36d80ae4c5520f7c4ab0ac8544424fa405162fef5a6b7f229498063618d39f0003cb5fb8d1c86b643497da1ff945c8d3bedeca4f479702a7a735f043ddb1d6aaade3c4a0ac7ca7f3fa5279bef56f82cd7a2f38672e824814e10700300a055e1630b8f1cb0e919f5e942010a416e2bf48cb46993d3cb6a51c19bacf864785a00bc2ecff15d350875b246ed53e68be6f55bd7e05cfc2b2ed6432198a6444b6d8c247fab941f569768b5c429366f1d3f00f0345b96123d56204c01c63b22ce78baf116e525ed90fdea39fa469494d3866c31e05f295ff21fea8d4e6e13d67e47ce722e9698a1c1048d68ebcde76b86fcf976eab8aa9790268b7068e017a8b9b749409514f1053027fd16c3786ea1bac5f15cb79711ee2abe82f5cf8b13ae73030ef5b9e4457e75d1304f988d62dd6fc4b94ed38ba831da4b7634971b6cd8ec325d9c61c00f1df73627ed3745a5e8489f3a95c69639c32cd6e1d537a85f75cc844726e8a72fc0077ad22000f1d5078f6b866318c668f1ad03d5a5fced5219f2eabbd0aa5c0f460d183f04404a0d6f469558e81fab24a167905ab4c7878502ad3e38fdbe62a41556cec37325759533ce8f25f367c87bb5578d667ae93f9e2fd99bcbc5f2fbba88cf6516139420fcff3b7361d86322c4bd84c82f335abb152c4a93411373aaa8220"
|
||||
|
||||
AES-256-XTS Decrypt IEEE P1619/D16 Vector 14
|
||||
depends_on:!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
aes_decrypt_xts:"27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592":"ffffffffff0000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"64497e5a831e4a932c09be3e5393376daa599548b816031d224bbf50a818ed2350eae7e96087c8a0db51ad290bd00c1ac1620857635bf246c176ab463be30b808da548081ac847b158e1264be25bb0910bbc92647108089415d45fab1b3d2604e8a8eff1ae4020cfa39936b66827b23f371b92200be90251e6d73c5f86de5fd4a950781933d79a28272b782a2ec313efdfcc0628f43d744c2dc2ff3dcb66999b50c7ca895b0c64791eeaa5f29499fb1c026f84ce5b5c72ba1083cddb5ce45434631665c333b60b11593fb253c5179a2c8db813782a004856a1653011e93fb6d876c18366dd8683f53412c0c180f9c848592d593f8609ca736317d356e13e2bff3a9f59cd9aeb19cd482593d8c46128bb32423b37a9adfb482b99453fbe25a41bf6feb4aa0bef5ed24bf73c762978025482c13115e4015aac992e5613a3b5c2f685b84795cb6e9b2656d8c88157e52c42f978d8634c43d06fea928f2822e465aa6576e9bf419384506cc3ce3c54ac1a6f67dc66f3b30191e698380bc999b05abce19dc0c6dcc2dd001ec535ba18deb2df1a101023108318c75dc98611a09dc48a0acdec676fabdf222f07e026f059b672b56e5cbc8e1d21bbd867dd927212054681d70ea737134cdfce93b6f82ae22423274e58a0821cc5502e2d0ab4585e94de6975be5e0b4efce51cd3e70c25a1fbbbd609d273ad5b0d59631c531f6a0a57b9"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 15
|
||||
aes_decrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0":"9a785634120000000000000000000000":"000102030405060708090a0b0c0d0e0f10":"6c1625db4671522d3d7599601de7ca09ed"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 16
|
||||
aes_decrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0":"9a785634120000000000000000000000":"000102030405060708090a0b0c0d0e0f1011":"d069444b7a7e0cab09e24447d24deb1fedbf"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 17
|
||||
aes_decrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0":"9a785634120000000000000000000000":"000102030405060708090a0b0c0d0e0f101112":"e5df1351c0544ba1350b3363cd8ef4beedbf9d"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 18
|
||||
aes_decrypt_xts:"fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0":"9a785634120000000000000000000000":"000102030405060708090a0b0c0d0e0f10111213":"9d84c813f719aa2c7be3f66171c7c5c2edbf9dac"
|
||||
|
||||
AES-128-XTS Decrypt IEEE P1619/D16 Vector 19
|
||||
aes_decrypt_xts:"e0e1e2e3e4e5e6e7e8e9eaebecedeeefc0c1c2c3c4c5c6c7c8c9cacbcccdcecf":"21436587a90000000000000000000000":"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"38b45812ef43a05bd957e545907e223b954ab4aaf088303ad910eadf14b42be68b2461149d8c8ba85f992be970bc621f1b06573f63e867bf5875acafa04e42ccbd7bd3c2a0fb1fff791ec5ec36c66ae4ac1e806d81fbf709dbe29e471fad38549c8e66f5345d7c1eb94f405d1ec785cc6f6a68f6254dd8339f9d84057e01a17741990482999516b5611a38f41bb6478e6f173f320805dd71b1932fc333cb9ee39936beea9ad96fa10fb4112b901734ddad40bc1878995f8e11aee7d141a2f5d48b7a4e1e7f0b2c04830e69a4fd1378411c2f287edf48c6c4e5c247a19680f7fe41cefbd49b582106e3616cbbe4dfb2344b2ae9519391f3e0fb4922254b1d6d2d19c6d4d537b3a26f3bcc51588b32f3eca0829b6a5ac72578fb814fb43cf80d64a233e3f997a3f02683342f2b33d25b492536b93becb2f5e1a8b82f5b883342729e8ae09d16938841a21a97fb543eea3bbff59f13c1a18449e398701c1ad51648346cbc04c27bb2da3b93a1372ccae548fb53bee476f9e9c91773b1bb19828394d55d3e1a20ed69113a860b6829ffa847224604435070221b257e8dff783615d2cae4803a93aa4334ab482a0afac9c0aeda70b45a481df5dec5df8cc0f423c77a5fd46cd312021d4b438862419a791be03bb4d97c0e59578542531ba466a83baf92cefc151b5cc1611a167893819b63fb8a6b18e86de60290fa72b797b0ce59f3"
|
||||
119
vendor/mbedtls/tests/suites/test_suite_alignment.data
vendored
Normal file
119
vendor/mbedtls/tests/suites/test_suite_alignment.data
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
Aligned 16-bit access
|
||||
mbedtls_unaligned_access:16:0
|
||||
|
||||
Aligned 32-bit access
|
||||
mbedtls_unaligned_access:32:0
|
||||
|
||||
Aligned 64-bit access
|
||||
mbedtls_unaligned_access:64:0
|
||||
|
||||
Unaligned 16-bit access offset=1
|
||||
mbedtls_unaligned_access:16:1
|
||||
|
||||
Unaligned 32-bit access offset=1
|
||||
mbedtls_unaligned_access:32:1
|
||||
|
||||
Unaligned 64-bit access offset=1
|
||||
mbedtls_unaligned_access:64:1
|
||||
|
||||
Unaligned 16-bit access offset=4
|
||||
mbedtls_unaligned_access:16:4
|
||||
|
||||
Unaligned 32-bit access offset=4
|
||||
mbedtls_unaligned_access:32:4
|
||||
|
||||
Unaligned 64-bit access offset=4
|
||||
mbedtls_unaligned_access:64:4
|
||||
|
||||
Unaligned 16-bit access offset=7
|
||||
mbedtls_unaligned_access:16:7
|
||||
|
||||
Unaligned 32-bit access offset=7
|
||||
mbedtls_unaligned_access:32:7
|
||||
|
||||
Unaligned 64-bit access offset=7
|
||||
mbedtls_unaligned_access:64:7
|
||||
|
||||
Unaligned 16-bit access offset=8
|
||||
mbedtls_unaligned_access:16:8
|
||||
|
||||
Unaligned 32-bit access offset=8
|
||||
mbedtls_unaligned_access:32:8
|
||||
|
||||
Unaligned 64-bit access offset=8
|
||||
mbedtls_unaligned_access:64:8
|
||||
|
||||
Byteswap 16
|
||||
mbedtls_byteswap:"0100":16:"0001"
|
||||
|
||||
Byteswap 16 with truncation
|
||||
mbedtls_byteswap:"0706050403020100":16:"0001"
|
||||
|
||||
Byteswap 16 all-zero
|
||||
mbedtls_byteswap:"0000":16:"0000"
|
||||
|
||||
Byteswap 16 all-ones
|
||||
mbedtls_byteswap:"ffffffffffffffff":16:"ffff"
|
||||
|
||||
Byteswap 32
|
||||
mbedtls_byteswap:"03020100":32:"00010203"
|
||||
|
||||
Byteswap 32 with truncation
|
||||
mbedtls_byteswap:"0706050403020100":32:"00010203"
|
||||
|
||||
Byteswap 32 all-zero
|
||||
mbedtls_byteswap:"00000000":32:"00000000"
|
||||
|
||||
Byteswap 32 all-ones
|
||||
mbedtls_byteswap:"ffffffffffffffff":32:"ffffffff"
|
||||
|
||||
Byteswap 64
|
||||
mbedtls_byteswap:"0706050403020100":64:"01020304050607"
|
||||
|
||||
Byteswap 64 all-zero
|
||||
mbedtls_byteswap:"0000000000000000":64:"0000000000000000"
|
||||
|
||||
Byteswap 64 all-ones
|
||||
mbedtls_byteswap:"ffffffffffffffff":64:"ffffffffffffffff"
|
||||
|
||||
Get individual bytes
|
||||
get_byte
|
||||
|
||||
Endian-aware unaligned 16-bit BE offset=0
|
||||
unaligned_access_endian_aware:16:0:1
|
||||
|
||||
Endian-aware unaligned 16-bit BE offset=3
|
||||
unaligned_access_endian_aware:16:3:1
|
||||
|
||||
Endian-aware unaligned 16-bit LE offset=0
|
||||
unaligned_access_endian_aware:16:0:0
|
||||
|
||||
Endian-aware unaligned 16-bit LE offset=3
|
||||
unaligned_access_endian_aware:16:3:0
|
||||
|
||||
Endian-aware unaligned 32-bit BE offset=0
|
||||
unaligned_access_endian_aware:32:0:1
|
||||
|
||||
Endian-aware unaligned 32-bit BE offset=3
|
||||
unaligned_access_endian_aware:32:3:1
|
||||
|
||||
Endian-aware unaligned 32-bit LE offset=0
|
||||
unaligned_access_endian_aware:32:0:0
|
||||
|
||||
Endian-aware unaligned 32-bit LE offset=3
|
||||
unaligned_access_endian_aware:32:3:0
|
||||
|
||||
Endian-aware unaligned 64-bit BE offset=0
|
||||
unaligned_access_endian_aware:64:0:1
|
||||
|
||||
Endian-aware unaligned 64-bit BE offset=3
|
||||
unaligned_access_endian_aware:64:3:1
|
||||
|
||||
Endian-aware unaligned 64-bit LE offset=0
|
||||
unaligned_access_endian_aware:64:0:0
|
||||
|
||||
Endian-aware unaligned 64-bit LE offset=3
|
||||
unaligned_access_endian_aware:64:3:0
|
||||
|
||||
Big-endian check
|
||||
mbedtls_is_big_endian
|
||||
360
vendor/mbedtls/tests/suites/test_suite_alignment.function
vendored
Normal file
360
vendor/mbedtls/tests/suites/test_suite_alignment.function
vendored
Normal file
@@ -0,0 +1,360 @@
|
||||
/* BEGIN_HEADER */
|
||||
#include <alignment.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wunreachable-code"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convert a string of the form "abcd" (case-insensitive) to a uint64_t.
|
||||
*/
|
||||
static int parse_hex_string(char *hex_string, uint64_t *result)
|
||||
{
|
||||
uint8_t raw[8] = { 0 };
|
||||
size_t olen;
|
||||
if (mbedtls_test_unhexify(raw, sizeof(raw), hex_string, &olen) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*result = 0;
|
||||
for (size_t i = 0; i < olen; i++) {
|
||||
*result |= ((uint64_t) raw[i]) << ((olen - i - 1) * 8);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_unaligned_access(int size, int offset)
|
||||
{
|
||||
/* Define 64-bit aligned raw byte array */
|
||||
uint64_t raw[2];
|
||||
|
||||
/* Populate with known data */
|
||||
uint8_t *x = (uint8_t *) raw;
|
||||
for (size_t i = 0; i < sizeof(raw); i++) {
|
||||
x[i] = (uint8_t) i;
|
||||
}
|
||||
|
||||
TEST_ASSERT(size == 16 || size == 32 || size == 64);
|
||||
|
||||
uint64_t r = 0;
|
||||
switch (size) {
|
||||
case 16:
|
||||
r = mbedtls_get_unaligned_uint16(x + offset);
|
||||
break;
|
||||
case 32:
|
||||
r = mbedtls_get_unaligned_uint32(x + offset);
|
||||
break;
|
||||
case 64:
|
||||
r = mbedtls_get_unaligned_uint64(x + offset);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Define expected result by manually aligning the raw bytes, and
|
||||
* reading back with a normal pointer access. */
|
||||
uint64_t raw_aligned_64;
|
||||
uint16_t *raw_aligned_16 = (uint16_t *) &raw_aligned_64;
|
||||
uint32_t *raw_aligned_32 = (uint32_t *) &raw_aligned_64;
|
||||
memcpy(&raw_aligned_64, ((uint8_t *) &raw) + offset, size / 8);
|
||||
/* Make a 16/32/64 byte read from the aligned location, and copy to expected */
|
||||
uint64_t expected = 0;
|
||||
switch (size) {
|
||||
case 16:
|
||||
expected = *raw_aligned_16;
|
||||
break;
|
||||
case 32:
|
||||
expected = *raw_aligned_32;
|
||||
break;
|
||||
case 64:
|
||||
expected = raw_aligned_64;
|
||||
break;
|
||||
}
|
||||
|
||||
TEST_EQUAL(r, expected);
|
||||
|
||||
/* Write sentinel to the part of the array we will test writing to */
|
||||
for (size_t i = 0; i < (size_t) (size / 8); i++) {
|
||||
x[i + offset] = 0xff;
|
||||
}
|
||||
/*
|
||||
* Write back to the array with mbedtls_put_unaligned_uint16 and validate
|
||||
* that the array is unchanged as a result.
|
||||
*/
|
||||
switch (size) {
|
||||
case 16:
|
||||
mbedtls_put_unaligned_uint16(x + offset, r);
|
||||
break;
|
||||
case 32:
|
||||
mbedtls_put_unaligned_uint32(x + offset, r);
|
||||
break;
|
||||
case 64:
|
||||
mbedtls_put_unaligned_uint64(x + offset, r);
|
||||
break;
|
||||
}
|
||||
for (size_t i = 0; i < sizeof(x); i++) {
|
||||
TEST_EQUAL(x[i], (uint8_t) i);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_byteswap(char *input_str, int size, char *expected_str)
|
||||
{
|
||||
uint64_t input = 0, expected = 0;
|
||||
TEST_ASSERT(parse_hex_string(input_str, &input));
|
||||
TEST_ASSERT(parse_hex_string(expected_str, &expected));
|
||||
|
||||
/* Check against expected result */
|
||||
uint64_t r = 0;
|
||||
switch (size) {
|
||||
case 16:
|
||||
r = MBEDTLS_BSWAP16(input);
|
||||
break;
|
||||
case 32:
|
||||
r = MBEDTLS_BSWAP32(input);
|
||||
break;
|
||||
case 64:
|
||||
r = MBEDTLS_BSWAP64(input);
|
||||
break;
|
||||
default:
|
||||
TEST_FAIL("size must be 16, 32 or 64");
|
||||
}
|
||||
TEST_EQUAL(r, expected);
|
||||
|
||||
/*
|
||||
* Check byte by byte by extracting bytes from opposite ends of
|
||||
* input and r.
|
||||
*/
|
||||
for (size_t i = 0; i < (size_t) (size / 8); i++) {
|
||||
size_t s1 = i * 8;
|
||||
size_t s2 = ((size / 8 - 1) - i) * 8;
|
||||
uint64_t a = (input & ((uint64_t) 0xff << s1)) >> s1;
|
||||
uint64_t b = (r & ((uint64_t) 0xff << s2)) >> s2;
|
||||
TEST_EQUAL(a, b);
|
||||
}
|
||||
|
||||
/* Check BSWAP(BSWAP(x)) == x */
|
||||
switch (size) {
|
||||
case 16:
|
||||
r = MBEDTLS_BSWAP16(r);
|
||||
TEST_EQUAL(r, input & 0xffff);
|
||||
break;
|
||||
case 32:
|
||||
r = MBEDTLS_BSWAP32(r);
|
||||
TEST_EQUAL(r, input & 0xffffffff);
|
||||
break;
|
||||
case 64:
|
||||
r = MBEDTLS_BSWAP64(r);
|
||||
TEST_EQUAL(r, input);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void get_byte()
|
||||
{
|
||||
uint8_t data[16];
|
||||
|
||||
for (size_t i = 0; i < sizeof(data); i++) {
|
||||
data[i] = (uint8_t) i;
|
||||
}
|
||||
|
||||
uint64_t u64 = 0x0706050403020100;
|
||||
for (size_t b = 0; b < 8; b++) {
|
||||
uint8_t expected = b;
|
||||
uint8_t actual = b + 1;
|
||||
switch (b) {
|
||||
case 0:
|
||||
actual = MBEDTLS_BYTE_0(u64);
|
||||
break;
|
||||
case 1:
|
||||
actual = MBEDTLS_BYTE_1(u64);
|
||||
break;
|
||||
case 2:
|
||||
actual = MBEDTLS_BYTE_2(u64);
|
||||
break;
|
||||
case 3:
|
||||
actual = MBEDTLS_BYTE_3(u64);
|
||||
break;
|
||||
case 4:
|
||||
actual = MBEDTLS_BYTE_4(u64);
|
||||
break;
|
||||
case 5:
|
||||
actual = MBEDTLS_BYTE_5(u64);
|
||||
break;
|
||||
case 6:
|
||||
actual = MBEDTLS_BYTE_6(u64);
|
||||
break;
|
||||
case 7:
|
||||
actual = MBEDTLS_BYTE_7(u64);
|
||||
break;
|
||||
}
|
||||
TEST_EQUAL(actual, expected);
|
||||
}
|
||||
|
||||
uint32_t u32 = 0x03020100;
|
||||
for (size_t b = 0; b < 4; b++) {
|
||||
uint8_t expected = b;
|
||||
uint8_t actual = b + 1;
|
||||
switch (b) {
|
||||
case 0:
|
||||
actual = MBEDTLS_BYTE_0(u32);
|
||||
break;
|
||||
case 1:
|
||||
actual = MBEDTLS_BYTE_1(u32);
|
||||
break;
|
||||
case 2:
|
||||
actual = MBEDTLS_BYTE_2(u32);
|
||||
break;
|
||||
case 3:
|
||||
actual = MBEDTLS_BYTE_3(u32);
|
||||
break;
|
||||
}
|
||||
TEST_EQUAL(actual, expected);
|
||||
}
|
||||
|
||||
uint16_t u16 = 0x0100;
|
||||
for (size_t b = 0; b < 2; b++) {
|
||||
uint8_t expected = b;
|
||||
uint8_t actual = b + 1;
|
||||
switch (b) {
|
||||
case 0:
|
||||
actual = MBEDTLS_BYTE_0(u16);
|
||||
break;
|
||||
case 1:
|
||||
actual = MBEDTLS_BYTE_1(u16);
|
||||
break;
|
||||
}
|
||||
TEST_EQUAL(actual, expected);
|
||||
}
|
||||
|
||||
uint8_t u8 = 0x01;
|
||||
uint8_t actual = MBEDTLS_BYTE_0(u8);
|
||||
TEST_EQUAL(actual, u8);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void unaligned_access_endian_aware(int size, int offset, int big_endian)
|
||||
{
|
||||
TEST_ASSERT(size == 16 || size == 24 || size == 32 || size == 64);
|
||||
TEST_ASSERT(offset >= 0 && offset < 8);
|
||||
|
||||
/* Define 64-bit aligned raw byte array */
|
||||
uint64_t raw[2];
|
||||
/* Populate with known data: x == { 0, 1, 2, ... } */
|
||||
uint8_t *x = (uint8_t *) raw;
|
||||
for (size_t i = 0; i < sizeof(raw); i++) {
|
||||
x[i] = (uint8_t) i;
|
||||
}
|
||||
|
||||
uint64_t read = 0;
|
||||
if (big_endian) {
|
||||
switch (size) {
|
||||
case 16:
|
||||
read = MBEDTLS_GET_UINT16_BE(x, offset);
|
||||
break;
|
||||
case 24:
|
||||
read = MBEDTLS_GET_UINT24_BE(x, offset);
|
||||
break;
|
||||
case 32:
|
||||
read = MBEDTLS_GET_UINT32_BE(x, offset);
|
||||
break;
|
||||
case 64:
|
||||
read = MBEDTLS_GET_UINT64_BE(x, offset);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (size) {
|
||||
case 16:
|
||||
read = MBEDTLS_GET_UINT16_LE(x, offset);
|
||||
break;
|
||||
case 24:
|
||||
read = MBEDTLS_GET_UINT24_LE(x, offset);
|
||||
break;
|
||||
case 32:
|
||||
read = MBEDTLS_GET_UINT32_LE(x, offset);
|
||||
break;
|
||||
case 64:
|
||||
read = MBEDTLS_GET_UINT64_LE(x, offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Build up expected value byte by byte, in either big or little endian format */
|
||||
uint64_t expected = 0;
|
||||
for (size_t i = 0; i < (size_t) (size / 8); i++) {
|
||||
uint64_t b = x[i + offset];
|
||||
uint8_t shift = (big_endian) ? (8 * ((size / 8 - 1) - i)) : (8 * i);
|
||||
expected |= b << shift;
|
||||
}
|
||||
|
||||
/* Verify read */
|
||||
TEST_EQUAL(read, expected);
|
||||
|
||||
/* Test writing back to memory. First write sentinel */
|
||||
for (size_t i = 0; i < (size_t) (size / 8); i++) {
|
||||
x[i + offset] = 0xff;
|
||||
}
|
||||
/* Overwrite sentinel with endian-aware write macro */
|
||||
if (big_endian) {
|
||||
switch (size) {
|
||||
case 16:
|
||||
MBEDTLS_PUT_UINT16_BE(read, x, offset);
|
||||
break;
|
||||
case 24:
|
||||
MBEDTLS_PUT_UINT24_BE(read, x, offset);
|
||||
break;
|
||||
case 32:
|
||||
MBEDTLS_PUT_UINT32_BE(read, x, offset);
|
||||
break;
|
||||
case 64:
|
||||
MBEDTLS_PUT_UINT64_BE(read, x, offset);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (size) {
|
||||
case 16:
|
||||
MBEDTLS_PUT_UINT16_LE(read, x, offset);
|
||||
break;
|
||||
case 24:
|
||||
MBEDTLS_PUT_UINT24_LE(read, x, offset);
|
||||
break;
|
||||
case 32:
|
||||
MBEDTLS_PUT_UINT32_LE(read, x, offset);
|
||||
break;
|
||||
case 64:
|
||||
MBEDTLS_PUT_UINT64_LE(read, x, offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Verify write - check memory is correct */
|
||||
for (size_t i = 0; i < sizeof(raw); i++) {
|
||||
TEST_EQUAL(x[i], (uint8_t) i);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_is_big_endian()
|
||||
{
|
||||
uint16_t check = 0x1234;
|
||||
uint8_t *p = (uint8_t *) ✓
|
||||
|
||||
if (MBEDTLS_IS_BIG_ENDIAN) {
|
||||
/* Big-endian: data stored MSB first, i.e. p == { 0x12, 0x34 } */
|
||||
TEST_EQUAL(p[0], 0x12);
|
||||
TEST_EQUAL(p[1], 0x34);
|
||||
} else {
|
||||
/* Little-endian: data stored LSB first, i.e. p == { 0x34, 0x12 } */
|
||||
TEST_EQUAL(p[0], 0x34);
|
||||
TEST_EQUAL(p[1], 0x12);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
92
vendor/mbedtls/tests/suites/test_suite_aria.data
vendored
Normal file
92
vendor/mbedtls/tests/suites/test_suite_aria.data
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
ARIA - Invalid parameters
|
||||
aria_invalid_param:
|
||||
|
||||
ARIA-128-ECB Encrypt - RFC 5794
|
||||
aria_encrypt_ecb:"000102030405060708090a0b0c0d0e0f":"00112233445566778899aabbccddeeff":"d718fbd6ab644c739da95f3be6451778":0
|
||||
|
||||
ARIA-128-ECB Decrypt - RFC 5794
|
||||
aria_decrypt_ecb:"000102030405060708090a0b0c0d0e0f":"d718fbd6ab644c739da95f3be6451778":"00112233445566778899aabbccddeeff":0
|
||||
|
||||
ARIA-192-ECB Encrypt - RFC 5794
|
||||
aria_encrypt_ecb:"000102030405060708090a0b0c0d0e0f1011121314151617":"00112233445566778899aabbccddeeff":"26449c1805dbe7aa25a468ce263a9e79":0
|
||||
|
||||
ARIA-192-ECB Decrypt - RFC 5794
|
||||
aria_decrypt_ecb:"000102030405060708090a0b0c0d0e0f1011121314151617":"26449c1805dbe7aa25a468ce263a9e79":"00112233445566778899aabbccddeeff":0
|
||||
|
||||
ARIA-256-ECB Encrypt - RFC 5794
|
||||
aria_encrypt_ecb:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f":"00112233445566778899aabbccddeeff":"f92bd7c79fb72e2f2b8f80c1972d24fc":0
|
||||
|
||||
ARIA-256-ECB Decrypt - RFC 5794
|
||||
aria_decrypt_ecb:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f":"f92bd7c79fb72e2f2b8f80c1972d24fc":"00112233445566778899aabbccddeeff":0
|
||||
|
||||
ARIA-128-ECB Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_ecb:"00112233445566778899aabbccddeeff":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"c6ecd08e22c30abdb215cf74e2075e6e29ccaac63448708d331b2f816c51b17d9e133d1528dbf0af5787c7f3a3f5c2bf6b6f345907a3055612ce072ff54de7d788424da6e8ccfe8172b391be499354165665ba7864917000a6eeb2ecb4a698edfc7887e7f556377614ab0a282293e6d884dbb84206cdb16ed1754e77a1f243fd086953f752cc1e46c7c794ae85537dcaec8dd721f55c93b6edfe2adea43873e8":0
|
||||
|
||||
ARIA-128-ECB Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_ecb:"00112233445566778899aabbccddeeff":"c6ecd08e22c30abdb215cf74e2075e6e29ccaac63448708d331b2f816c51b17d9e133d1528dbf0af5787c7f3a3f5c2bf6b6f345907a3055612ce072ff54de7d788424da6e8ccfe8172b391be499354165665ba7864917000a6eeb2ecb4a698edfc7887e7f556377614ab0a282293e6d884dbb84206cdb16ed1754e77a1f243fd086953f752cc1e46c7c794ae85537dcaec8dd721f55c93b6edfe2adea43873e8":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-192-ECB Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_ecb:"00112233445566778899aabbccddeeff0011223344556677":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"8d1470625f59ebacb0e55b534b3e462b5f23d33bff78f46c3c15911f4a21809aaccad80b4bda915aa9dae6bcebe06a6c83f77fd5391acfe61de2f646b5d447edbfd5bb49b12fbb9145b227895a757b2af1f7188734863d7b8b6ede5a5b2f06a0a233c8523d2db778fb31b0e311f32700152f33861e9d040c83b5eb40cd88ea49975709dc629365a189f78a3ec40345fc6a5a307a8f9a4413091e007eca5645a0":0
|
||||
|
||||
ARIA-192-ECB Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_ecb:"00112233445566778899aabbccddeeff0011223344556677":"8d1470625f59ebacb0e55b534b3e462b5f23d33bff78f46c3c15911f4a21809aaccad80b4bda915aa9dae6bcebe06a6c83f77fd5391acfe61de2f646b5d447edbfd5bb49b12fbb9145b227895a757b2af1f7188734863d7b8b6ede5a5b2f06a0a233c8523d2db778fb31b0e311f32700152f33861e9d040c83b5eb40cd88ea49975709dc629365a189f78a3ec40345fc6a5a307a8f9a4413091e007eca5645a0":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-256-ECB Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_ecb:"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"58a875e6044ad7fffa4f58420f7f442d8e191016f28e79aefc01e204773280d7018e5f7a938ec30711719953bae86542cd7ebc752474c1a5f6eaaace2a7e29462ee7dfa5afdb84177ead95ccd4b4bb6e1ed17b9534cff0a5fc2941429cfee2ee49c7adbeb7e9d1b0d2a8531d942079596a27ed79f5b1dd13ecd604b07a48885a3afa0627a0e4e60a3c703af292f1baa77b702f16c54aa74bc727ea95c7468b00":0
|
||||
|
||||
ARIA-256-ECB Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_ecb:"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff":"58a875e6044ad7fffa4f58420f7f442d8e191016f28e79aefc01e204773280d7018e5f7a938ec30711719953bae86542cd7ebc752474c1a5f6eaaace2a7e29462ee7dfa5afdb84177ead95ccd4b4bb6e1ed17b9534cff0a5fc2941429cfee2ee49c7adbeb7e9d1b0d2a8531d942079596a27ed79f5b1dd13ecd604b07a48885a3afa0627a0e4e60a3c703af292f1baa77b702f16c54aa74bc727ea95c7468b00":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-128-CBC Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_cbc:"00112233445566778899aabbccddeeff":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"49d61860b14909109cef0d22a9268134fadf9fb23151e9645fba75018bdb1538b53334634bbf7d4cd4b5377033060c155fe3948ca75de1031e1d85619e0ad61eb419a866b3c2dbfd10a4ed18b22149f75897f0b8668b0c1c542c687778835fb7cd46e45f85eaa7072437dd9fa6793d6f8d4ccefc4eb1ac641ac1bd30b18c6d64c49bca137eb21c2e04da62712ca2b4f540c57112c38791852cfac7a5d19ed83a":0
|
||||
|
||||
ARIA-128-CBC Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_cbc:"00112233445566778899aabbccddeeff":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"49d61860b14909109cef0d22a9268134fadf9fb23151e9645fba75018bdb1538b53334634bbf7d4cd4b5377033060c155fe3948ca75de1031e1d85619e0ad61eb419a866b3c2dbfd10a4ed18b22149f75897f0b8668b0c1c542c687778835fb7cd46e45f85eaa7072437dd9fa6793d6f8d4ccefc4eb1ac641ac1bd30b18c6d64c49bca137eb21c2e04da62712ca2b4f540c57112c38791852cfac7a5d19ed83a":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-192-CBC Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_cbc:"00112233445566778899aabbccddeeff0011223344556677":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"afe6cf23974b533c672a826264ea785f4e4f7f780dc7f3f1e0962b80902386d514e9c3e77259de92dd1102ffab086c1ea52a71260db5920a83295c25320e421147ca45d532f327b856ea947cd2196ae2e040826548b4c891b0ed0ca6e714dbc4631998d548110d666b3d54c2a091955c6f05beb4f62309368696c9791fc4c551564a2637f194346ec45fbca6c72a5b4612e208d531d6c34cc5c64eac6bd0cf8c":0
|
||||
|
||||
ARIA-192-CBC Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_cbc:"00112233445566778899aabbccddeeff0011223344556677":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"afe6cf23974b533c672a826264ea785f4e4f7f780dc7f3f1e0962b80902386d514e9c3e77259de92dd1102ffab086c1ea52a71260db5920a83295c25320e421147ca45d532f327b856ea947cd2196ae2e040826548b4c891b0ed0ca6e714dbc4631998d548110d666b3d54c2a091955c6f05beb4f62309368696c9791fc4c551564a2637f194346ec45fbca6c72a5b4612e208d531d6c34cc5c64eac6bd0cf8c":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-256-CBC Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_cbc:"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"523a8a806ae621f155fdd28dbc34e1ab7b9b42432ad8b2efb96e23b13f0a6e52f36185d50ad002c5f601bee5493f118b243ee2e313642bffc3902e7b2efd9a12fa682edd2d23c8b9c5f043c18b17c1ec4b5867918270fbec1027c19ed6af833da5d620994668ca22f599791d292dd6273b2959082aafb7a996167cce1eec5f0cfd15f610d87e2dda9ba68ce1260ca54b222491418374294e7909b1e8551cd8de":0
|
||||
|
||||
ARIA-256-CBC Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_cbc:"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"523a8a806ae621f155fdd28dbc34e1ab7b9b42432ad8b2efb96e23b13f0a6e52f36185d50ad002c5f601bee5493f118b243ee2e313642bffc3902e7b2efd9a12fa682edd2d23c8b9c5f043c18b17c1ec4b5867918270fbec1027c19ed6af833da5d620994668ca22f599791d292dd6273b2959082aafb7a996167cce1eec5f0cfd15f610d87e2dda9ba68ce1260ca54b222491418374294e7909b1e8551cd8de":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-128-CTR Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_ctr:"00112233445566778899aabbccddeeff":"00000000000000000000000000000000":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"ac5d7de805a0bf1c57c854501af60fa11497e2a34519dea1569e91e5b5ccae2ff3bfa1bf975f4571f48be191613546c3911163c085f871f0e7ae5f2a085b81851c2a3ddf20ecb8fa51901aec8ee4ba32a35dab67bb72cd9140ad188a967ac0fbbdfa94ea6cce47dcf8525ab5a814cfeb2bb60ee2b126e2d9d847c1a9e96f9019e3e6a7fe40d3829afb73db1cc245646addb62d9b907baaafbe46a73dbc131d3d":0
|
||||
|
||||
ARIA-192-CTR Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_ctr:"00112233445566778899aabbccddeeff0011223344556677":"00000000000000000000000000000000":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"08625ca8fe569c19ba7af3760a6ed1cef4d199263e999dde14082dbba7560b79a4c6b456b8707dce751f9854f18893dfdb3f4e5afa539733e6f1e70b98ba37891f8f81e95df8efc26c7ce043504cb18958b865e4e316cd2aa1c97f31bf23dc046ef326b95a692a191ba0f2a41c5fe9ae070f236ff7078e703b42666caafbdd20bad74ac4c20c0f46c7ca24c151716575c947da16c90cfe1bf217a41cfebe7531":0
|
||||
|
||||
ARIA-192-CTR Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_ctr:"00112233445566778899aabbccddeeff0011223344556677":"00000000000000000000000000000000":"08625ca8fe569c19ba7af3760a6ed1cef4d199263e999dde14082dbba7560b79a4c6b456b8707dce751f9854f18893dfdb3f4e5afa539733e6f1e70b98ba37891f8f81e95df8efc26c7ce043504cb18958b865e4e316cd2aa1c97f31bf23dc046ef326b95a692a191ba0f2a41c5fe9ae070f236ff7078e703b42666caafbdd20bad74ac4c20c0f46c7ca24c151716575c947da16c90cfe1bf217a41cfebe7531":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-256-CTR Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_ctr:"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff":"00000000000000000000000000000000":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"30026c329666141721178b99c0a1f1b2f06940253f7b3089e2a30ea86aa3c88f5940f05ad7ee41d71347bb7261e348f18360473fdf7d4e7723bffb4411cc13f6cdd89f3bc7b9c768145022c7a74f14d7c305cd012a10f16050c23f1ae5c23f45998d13fbaa041e51619577e0772764896a5d4516d8ffceb3bf7e05f613edd9a60cdcedaff9cfcaf4e00d445a54334f73ab2cad944e51d266548e61c6eb0aa1cd":0
|
||||
|
||||
ARIA-256-CTR Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_ctr:"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff":"00000000000000000000000000000000":"30026c329666141721178b99c0a1f1b2f06940253f7b3089e2a30ea86aa3c88f5940f05ad7ee41d71347bb7261e348f18360473fdf7d4e7723bffb4411cc13f6cdd89f3bc7b9c768145022c7a74f14d7c305cd012a10f16050c23f1ae5c23f45998d13fbaa041e51619577e0772764896a5d4516d8ffceb3bf7e05f613edd9a60cdcedaff9cfcaf4e00d445a54334f73ab2cad944e51d266548e61c6eb0aa1cd":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-128-CFB128 Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_cfb128:"00112233445566778899aabbccddeeff":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"3720e53ba7d615383406b09f0a05a200c07c21e6370f413a5d132500a68285017c61b434c7b7ca9685a51071861e4d4bb873b599b479e2d573dddeafba89f812ac6a9e44d554078eb3be94839db4b33da3f59c063123a7ef6f20e10579fa4fd239100ca73b52d4fcafeadee73f139f78f9b7614c2b3b9dbe010f87db06a89a9435f79ce8121431371f4e87b984e0230c22a6dacb32fc42dcc6accef33285bf11":0
|
||||
|
||||
ARIA-128-CFB128 Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_cfb128:"00112233445566778899aabbccddeeff":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"3720e53ba7d615383406b09f0a05a200c07c21e6370f413a5d132500a68285017c61b434c7b7ca9685a51071861e4d4bb873b599b479e2d573dddeafba89f812ac6a9e44d554078eb3be94839db4b33da3f59c063123a7ef6f20e10579fa4fd239100ca73b52d4fcafeadee73f139f78f9b7614c2b3b9dbe010f87db06a89a9435f79ce8121431371f4e87b984e0230c22a6dacb32fc42dcc6accef33285bf11":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-192-CFB128 Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_cfb128:"00112233445566778899aabbccddeeff0011223344556677":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"4171f7192bf4495494d2736129640f5c4d87a9a213664c9448477c6ecc2013598d9766952dd8c3868f17e36ef66fd84bfa45d1593d2d6ee3ea2115047d710d4fb66187caa3a315b3c8ea2d313962edcfe5a3e2028d5ba9a09fd5c65c19d3440e477f0cab0628ec6902c73ee02f1afee9f80115be7b9df82d1e28228e28581a20560e195cbb9e2b327bf56fd2d0ae5502e42c13e9b4015d4da42dc859252e7da4":0
|
||||
|
||||
ARIA-192-CFB128 Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_cfb128:"00112233445566778899aabbccddeeff0011223344556677":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"4171f7192bf4495494d2736129640f5c4d87a9a213664c9448477c6ecc2013598d9766952dd8c3868f17e36ef66fd84bfa45d1593d2d6ee3ea2115047d710d4fb66187caa3a315b3c8ea2d313962edcfe5a3e2028d5ba9a09fd5c65c19d3440e477f0cab0628ec6902c73ee02f1afee9f80115be7b9df82d1e28228e28581a20560e195cbb9e2b327bf56fd2d0ae5502e42c13e9b4015d4da42dc859252e7da4":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA-256-CFB128 Encrypt - Official Test Vectors 1.0
|
||||
aria_encrypt_cfb128:"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":"26834705b0f2c0e2588d4a7f09009635f28bb93d8c31f870ec1e0bdb082b66fa402dd9c202be300c4517d196b14d4ce11dce97f7aaba54341b0d872cc9b63753a3e8556a14be6f7b3e27e3cfc39caf80f2a355aa50dc83c09c7b11828694f8e4aa726c528976b53f2c877f4991a3a8d28adb63bd751846ffb2350265e179d4990753ae8485ff9b4133ddad5875b84a90cbcfa62a045d726df71b6bda0eeca0be":0
|
||||
|
||||
ARIA-256-CFB128 Decrypt - Official Test Vectors 1.0
|
||||
aria_decrypt_cfb128:"00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff":"0f1e2d3c4b5a69788796a5b4c3d2e1f0":"26834705b0f2c0e2588d4a7f09009635f28bb93d8c31f870ec1e0bdb082b66fa402dd9c202be300c4517d196b14d4ce11dce97f7aaba54341b0d872cc9b63753a3e8556a14be6f7b3e27e3cfc39caf80f2a355aa50dc83c09c7b11828694f8e4aa726c528976b53f2c877f4991a3a8d28adb63bd751846ffb2350265e179d4990753ae8485ff9b4133ddad5875b84a90cbcfa62a045d726df71b6bda0eeca0be":"11111111aaaaaaaa11111111bbbbbbbb11111111cccccccc11111111dddddddd22222222aaaaaaaa22222222bbbbbbbb22222222cccccccc22222222dddddddd33333333aaaaaaaa33333333bbbbbbbb33333333cccccccc33333333dddddddd44444444aaaaaaaa44444444bbbbbbbb44444444cccccccc44444444dddddddd55555555aaaaaaaa55555555bbbbbbbb55555555cccccccc55555555dddddddd":0
|
||||
|
||||
ARIA Selftest
|
||||
aria_selftest:
|
||||
278
vendor/mbedtls/tests/suites/test_suite_aria.function
vendored
Normal file
278
vendor/mbedtls/tests/suites/test_suite_aria.function
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
/* BEGIN_HEADER */
|
||||
#include "mbedtls/aria.h"
|
||||
|
||||
/* Maximum size of data used by test vectors
|
||||
* WARNING: to be adapted if and when adding larger test cases */
|
||||
#define ARIA_MAX_DATASIZE 160
|
||||
|
||||
/* Maximum sizes of hexified things */
|
||||
#define ARIA_MAX_KEY_STR (2 * MBEDTLS_ARIA_MAX_KEYSIZE + 1)
|
||||
#define ARIA_BLOCK_STR (2 * MBEDTLS_ARIA_BLOCKSIZE + 1)
|
||||
#define ARIA_MAX_DATA_STR (2 * ARIA_MAX_DATASIZE + 1)
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
* depends_on:MBEDTLS_ARIA_C
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void aria_invalid_param()
|
||||
{
|
||||
mbedtls_aria_context ctx;
|
||||
unsigned char input[MBEDTLS_ARIA_BLOCKSIZE] = { 0 };
|
||||
unsigned char output[MBEDTLS_ARIA_BLOCKSIZE] = { 0 };
|
||||
unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE] = { 0 };
|
||||
size_t iv_off = 0;
|
||||
|
||||
((void) iv_off);
|
||||
((void) iv);
|
||||
((void) ctx);
|
||||
((void) input);
|
||||
((void) output);
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
TEST_EQUAL(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
|
||||
mbedtls_aria_crypt_cbc(&ctx,
|
||||
42 /* invalid mode */,
|
||||
sizeof(input),
|
||||
iv,
|
||||
input,
|
||||
output));
|
||||
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
TEST_EQUAL(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
|
||||
mbedtls_aria_crypt_cfb128(&ctx,
|
||||
42, /* invalid mode */
|
||||
sizeof(input),
|
||||
&iv_off,
|
||||
iv,
|
||||
input,
|
||||
output));
|
||||
#endif /* MBEDTLS_CIPHER_MODE_CFB */
|
||||
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CBC) || defined(MBEDTLS_CIPHER_MODE_CFB)
|
||||
exit:
|
||||
return;
|
||||
#endif
|
||||
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void aria_encrypt_ecb(data_t *key_str, data_t *src_str,
|
||||
data_t *expected_output, int setkey_result)
|
||||
{
|
||||
unsigned char output[ARIA_MAX_DATASIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
size_t i;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aria_init(&ctx);
|
||||
|
||||
TEST_ASSERT(mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8)
|
||||
== setkey_result);
|
||||
if (setkey_result == 0) {
|
||||
for (i = 0; i < src_str->len; i += MBEDTLS_ARIA_BLOCKSIZE) {
|
||||
TEST_ASSERT(mbedtls_aria_crypt_ecb(&ctx, src_str->x + i,
|
||||
output + i) == 0);
|
||||
}
|
||||
|
||||
TEST_MEMORY_COMPARE(output, expected_output->len,
|
||||
expected_output->x, expected_output->len);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:!MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
|
||||
void aria_decrypt_ecb(data_t *key_str, data_t *src_str,
|
||||
data_t *expected_output, int setkey_result)
|
||||
{
|
||||
unsigned char output[ARIA_MAX_DATASIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
size_t i;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aria_init(&ctx);
|
||||
|
||||
TEST_ASSERT(mbedtls_aria_setkey_dec(&ctx, key_str->x, key_str->len * 8)
|
||||
== setkey_result);
|
||||
if (setkey_result == 0) {
|
||||
for (i = 0; i < src_str->len; i += MBEDTLS_ARIA_BLOCKSIZE) {
|
||||
TEST_ASSERT(mbedtls_aria_crypt_ecb(&ctx, src_str->x + i,
|
||||
output + i) == 0);
|
||||
}
|
||||
|
||||
TEST_MEMORY_COMPARE(output, expected_output->len,
|
||||
expected_output->x, expected_output->len);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
|
||||
void aria_encrypt_cbc(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *expected_output,
|
||||
int cbc_result)
|
||||
{
|
||||
unsigned char output[ARIA_MAX_DATASIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aria_init(&ctx);
|
||||
|
||||
mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
|
||||
TEST_ASSERT(mbedtls_aria_crypt_cbc(&ctx, MBEDTLS_ARIA_ENCRYPT,
|
||||
src_str->len, iv_str->x, src_str->x,
|
||||
output) == cbc_result);
|
||||
if (cbc_result == 0) {
|
||||
TEST_MEMORY_COMPARE(output, expected_output->len,
|
||||
expected_output->x, expected_output->len);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
|
||||
void aria_decrypt_cbc(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *expected_output,
|
||||
int cbc_result)
|
||||
{
|
||||
unsigned char output[ARIA_MAX_DATASIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aria_init(&ctx);
|
||||
|
||||
mbedtls_aria_setkey_dec(&ctx, key_str->x, key_str->len * 8);
|
||||
TEST_ASSERT(mbedtls_aria_crypt_cbc(&ctx, MBEDTLS_ARIA_DECRYPT,
|
||||
src_str->len, iv_str->x, src_str->x,
|
||||
output) == cbc_result);
|
||||
if (cbc_result == 0) {
|
||||
TEST_MEMORY_COMPARE(output, expected_output->len,
|
||||
expected_output->x, expected_output->len);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aria_encrypt_cfb128(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *expected_output,
|
||||
int result)
|
||||
{
|
||||
unsigned char output[ARIA_MAX_DATASIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
size_t iv_offset = 0;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aria_init(&ctx);
|
||||
|
||||
mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
|
||||
TEST_ASSERT(mbedtls_aria_crypt_cfb128(&ctx, MBEDTLS_ARIA_ENCRYPT,
|
||||
src_str->len, &iv_offset,
|
||||
iv_str->x, src_str->x, output)
|
||||
== result);
|
||||
|
||||
TEST_MEMORY_COMPARE(output, expected_output->len,
|
||||
expected_output->x, expected_output->len);
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aria_decrypt_cfb128(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *expected_output,
|
||||
int result)
|
||||
{
|
||||
unsigned char output[ARIA_MAX_DATASIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
size_t iv_offset = 0;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aria_init(&ctx);
|
||||
|
||||
mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
|
||||
TEST_ASSERT(mbedtls_aria_crypt_cfb128(&ctx, MBEDTLS_ARIA_DECRYPT,
|
||||
src_str->len, &iv_offset,
|
||||
iv_str->x, src_str->x, output)
|
||||
== result);
|
||||
|
||||
TEST_MEMORY_COMPARE(output, expected_output->len,
|
||||
expected_output->x, expected_output->len);
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
|
||||
void aria_encrypt_ctr(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *expected_output,
|
||||
int result)
|
||||
{
|
||||
unsigned char output[ARIA_MAX_DATASIZE];
|
||||
unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
size_t iv_offset = 0;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aria_init(&ctx);
|
||||
|
||||
mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
|
||||
TEST_ASSERT(mbedtls_aria_crypt_ctr(&ctx, src_str->len, &iv_offset,
|
||||
iv_str->x, blk, src_str->x, output)
|
||||
== result);
|
||||
|
||||
TEST_MEMORY_COMPARE(output, expected_output->len,
|
||||
expected_output->x, expected_output->len);
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
|
||||
void aria_decrypt_ctr(data_t *key_str, data_t *iv_str,
|
||||
data_t *src_str, data_t *expected_output,
|
||||
int result)
|
||||
{
|
||||
unsigned char output[ARIA_MAX_DATASIZE];
|
||||
unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
size_t iv_offset = 0;
|
||||
|
||||
memset(output, 0x00, sizeof(output));
|
||||
mbedtls_aria_init(&ctx);
|
||||
|
||||
mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
|
||||
TEST_ASSERT(mbedtls_aria_crypt_ctr(&ctx, src_str->len, &iv_offset,
|
||||
iv_str->x, blk, src_str->x, output)
|
||||
== result);
|
||||
|
||||
TEST_MEMORY_COMPARE(output, expected_output->len,
|
||||
expected_output->x, expected_output->len);
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free(&ctx);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
|
||||
void aria_selftest()
|
||||
{
|
||||
TEST_ASSERT(mbedtls_aria_self_test(1) == 0);
|
||||
}
|
||||
/* END_CASE */
|
||||
637
vendor/mbedtls/tests/suites/test_suite_asn1parse.data
vendored
Normal file
637
vendor/mbedtls/tests/suites/test_suite_asn1parse.data
vendored
Normal file
@@ -0,0 +1,637 @@
|
||||
Empty length
|
||||
parse_prefixes:"04":MBEDTLS_ERR_ASN1_OUT_OF_DATA:UNPREDICTABLE_RESULT
|
||||
|
||||
Incomplete length
|
||||
parse_prefixes:"0481":MBEDTLS_ERR_ASN1_OUT_OF_DATA:UNPREDICTABLE_RESULT
|
||||
|
||||
Prefixes of OCTET STRING, length=0
|
||||
parse_prefixes:"0400":0:0
|
||||
|
||||
Prefixes of OCTET STRING, length=0 (0 length bytes)
|
||||
parse_prefixes:"0480":MBEDTLS_ERR_ASN1_INVALID_LENGTH:MBEDTLS_ERR_ASN1_INVALID_LENGTH
|
||||
|
||||
Prefixes of OCTET STRING, length=1
|
||||
parse_prefixes:"040141":0:0
|
||||
|
||||
Prefixes of OCTET STRING, length=2
|
||||
parse_prefixes:"04024142":0:0
|
||||
|
||||
Prefixes of BOOLEAN, length=0
|
||||
parse_prefixes:"0100":MBEDTLS_ERR_ASN1_INVALID_LENGTH:MBEDTLS_ERR_ASN1_INVALID_LENGTH
|
||||
|
||||
Prefixes of BOOLEAN, length=1
|
||||
parse_prefixes:"010100":0:0
|
||||
|
||||
Prefixes of BOOLEAN, length=2
|
||||
parse_prefixes:"01020000":MBEDTLS_ERR_ASN1_INVALID_LENGTH:MBEDTLS_ERR_ASN1_INVALID_LENGTH
|
||||
|
||||
Prefixes of INTEGER, length=1
|
||||
parse_prefixes:"020141":0:0
|
||||
|
||||
Prefixes of INTEGER, length=2
|
||||
parse_prefixes:"02024142":0:0
|
||||
|
||||
Prefixes of INTEGER, length=5
|
||||
parse_prefixes:"02054142434445":0:0
|
||||
|
||||
Prefixes of empty BIT STRING
|
||||
parse_prefixes:"0300":MBEDTLS_ERR_ASN1_OUT_OF_DATA:UNPREDICTABLE_RESULT
|
||||
|
||||
Prefixes of BIT STRING, unused_bits=0, payload_length=0
|
||||
parse_prefixes:"030100":0:MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
|
||||
Prefixes of BIT STRING, unused_bits=0, payload_length=1
|
||||
parse_prefixes:"0302002a":0:MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
|
||||
Prefixes of BIT STRING, unused_bits=1, payload_length=1
|
||||
parse_prefixes:"0302012a":0:MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
|
||||
Prefixes of empty SEQUENCE
|
||||
parse_prefixes:"3000":0:0
|
||||
|
||||
Prefixes of SEQUENCE of BOOLEAN, INTEGER, INTEGER
|
||||
parse_prefixes:"300b01010102012a0203123456":0:0
|
||||
|
||||
Prefixes of SEQUENCE of (SEQUENCE of INTEGER, INTEGER), INTEGER
|
||||
parse_prefixes:"300b3006020141020142020161":0:0
|
||||
|
||||
length=0 (short form)
|
||||
get_len:"00":0
|
||||
|
||||
length=0 (1 length byte)
|
||||
get_len:"8100":0
|
||||
|
||||
length=0 (2 length bytes)
|
||||
get_len:"820000":0
|
||||
|
||||
length=1 (short form)
|
||||
get_len:"01":1
|
||||
|
||||
length=1 (1 length byte)
|
||||
get_len:"8101":1
|
||||
|
||||
length=1 (2 length bytes)
|
||||
get_len:"820001":1
|
||||
|
||||
length=1 (3 length bytes)
|
||||
get_len:"83000001":1
|
||||
|
||||
length=1 (4 length bytes)
|
||||
get_len:"8400000001":1
|
||||
|
||||
length=2 (short form)
|
||||
get_len:"02":2
|
||||
|
||||
length=2 (1 length byte)
|
||||
get_len:"8102":2
|
||||
|
||||
length=2 (2 length bytes)
|
||||
get_len:"820002":2
|
||||
|
||||
length=2 (3 length bytes)
|
||||
get_len:"83000002":2
|
||||
|
||||
length=2 (4 length bytes)
|
||||
get_len:"8400000002":2
|
||||
|
||||
length=127 (short form)
|
||||
get_len:"7f":127
|
||||
|
||||
length=128 (1 length byte)
|
||||
get_len:"8180":128
|
||||
|
||||
length=128 (2 length bytes)
|
||||
get_len:"820080":128
|
||||
|
||||
length=255 (1 length byte)
|
||||
get_len:"81ff":255
|
||||
|
||||
length=255 (2 length bytes)
|
||||
get_len:"8200ff":255
|
||||
|
||||
length=256 (2 length bytes)
|
||||
get_len:"820100":256
|
||||
|
||||
length=256 (3 length bytes)
|
||||
get_len:"83000100":256
|
||||
|
||||
length=258 (2 length bytes)
|
||||
get_len:"820102":258
|
||||
|
||||
length=258 (3 length bytes)
|
||||
get_len:"83000102":258
|
||||
|
||||
length=65535 (2 length bytes)
|
||||
get_len:"82ffff":65535
|
||||
|
||||
length=65535 (3 length bytes)
|
||||
get_len:"8300ffff":65535
|
||||
|
||||
length=65535 (4 length bytes)
|
||||
get_len:"840000ffff":65535
|
||||
|
||||
length=65536 (3 length bytes)
|
||||
get_len:"83010000":65536
|
||||
|
||||
length=65536 (4 length bytes)
|
||||
get_len:"8400010000":65536
|
||||
|
||||
length=16777215 (3 length bytes)
|
||||
get_len:"83ffffff":16777215
|
||||
|
||||
length=16777215 (4 length bytes)
|
||||
get_len:"8400ffffff":16777215
|
||||
|
||||
length=16777216 (4 length bytes)
|
||||
get_len:"8401000000":16777216
|
||||
|
||||
length=16909060 (4 length bytes)
|
||||
get_len:"8401020304":16909060
|
||||
|
||||
BOOLEAN FALSE
|
||||
get_boolean:"010100":0:0
|
||||
|
||||
BOOLEAN TRUE (1)
|
||||
get_boolean:"010101":1:0
|
||||
|
||||
BOOLEAN TRUE (2)
|
||||
get_boolean:"010101":1:0
|
||||
|
||||
BOOLEAN TRUE (128)
|
||||
get_boolean:"010180":1:0
|
||||
|
||||
BOOLEAN TRUE (255)
|
||||
get_boolean:"0101ff":1:0
|
||||
|
||||
Not BOOLEAN
|
||||
get_boolean:"020101":0:MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Empty INTEGER
|
||||
empty_integer:"0200"
|
||||
|
||||
INTEGER 0
|
||||
get_integer:"020100":"0":0
|
||||
|
||||
INTEGER 0, extra leading 0
|
||||
get_integer:"02020000":"0":0
|
||||
|
||||
INTEGER 1
|
||||
get_integer:"020101":"1":0:
|
||||
|
||||
INTEGER 1, extra leading 0
|
||||
get_integer:"02020001":"1":0:
|
||||
|
||||
INTEGER 0x7f
|
||||
get_integer:"02017f":"7f":0
|
||||
|
||||
INTEGER 0x80
|
||||
get_integer:"02020080":"80":0
|
||||
|
||||
INTEGER 0x80, extra leading 0
|
||||
get_integer:"0203000080":"80":0
|
||||
|
||||
INTEGER 0xff
|
||||
get_integer:"020200ff":"ff":0
|
||||
|
||||
INTEGER 0x7fff
|
||||
get_integer:"02027fff":"7fff":0
|
||||
|
||||
INTEGER 0x12345678
|
||||
get_integer:"020412345678":"12345678":0
|
||||
|
||||
INTEGER 0x12345678, extra leading 0
|
||||
get_integer:"02050012345678":"12345678":0
|
||||
|
||||
INTEGER 0x7fffffff
|
||||
get_integer:"02047fffffff":"7fffffff":0
|
||||
|
||||
INTEGER 0x7fffffff, extra leading 0
|
||||
get_integer:"0205007fffffff":"7fffffff":0
|
||||
|
||||
INTEGER 0x80000000
|
||||
get_integer:"02050080000000":"80000000":0
|
||||
|
||||
INTEGER 0xffffffff
|
||||
get_integer:"020500ffffffff":"ffffffff":0
|
||||
|
||||
INTEGER 0x100000000
|
||||
get_integer:"02050100000000":"0100000000":0
|
||||
|
||||
INTEGER 0x123456789abcdef0
|
||||
get_integer:"0208123456789abcdef0":"123456789abcdef0":0
|
||||
|
||||
INTEGER 0xfedcab9876543210
|
||||
get_integer:"020900fedcab9876543210":"fedcab9876543210":0
|
||||
|
||||
INTEGER 0x1fedcab9876543210
|
||||
get_integer:"020901fedcab9876543210":"1fedcab9876543210":0
|
||||
|
||||
INTEGER with 127 value octets
|
||||
get_integer:"027f0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd":0
|
||||
|
||||
INTEGER with 127 value octets (long length encoding)
|
||||
get_integer:"02817f0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd":0
|
||||
|
||||
INTEGER with 128 value octets
|
||||
get_integer:"0281800123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef":0
|
||||
|
||||
INTEGER with 128 value octets (leading 0 in length)
|
||||
get_integer:"028200800123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef":0
|
||||
|
||||
INTEGER -1
|
||||
get_integer:"0201ff":"-1":0
|
||||
|
||||
INTEGER -1, extra leading ff
|
||||
get_integer:"0202ffff":"-1":0
|
||||
|
||||
INTEGER -0x7f
|
||||
get_integer:"020181":"-7f":0
|
||||
|
||||
INTEGER -0x80
|
||||
get_integer:"020180":"-80":0
|
||||
|
||||
INTEGER -0x81
|
||||
get_integer:"0202ff7f":"-81":0
|
||||
|
||||
INTEGER -0xff
|
||||
get_integer:"0202ff01":"-ff":0
|
||||
|
||||
INTEGER -0x100
|
||||
get_integer:"0202ff00":"-100":0
|
||||
|
||||
INTEGER -0x7fffffff
|
||||
get_integer:"020480000001":"-7fffffff":0
|
||||
|
||||
INTEGER -0x80000000
|
||||
get_integer:"020480000000":"-80000000":0
|
||||
|
||||
INTEGER -0x80000001
|
||||
get_integer:"0205ff7fffffff":"-80000001":0
|
||||
|
||||
INTEGER -0xffffffff
|
||||
get_integer:"0205ff00000001":"-ffffffff":0
|
||||
|
||||
INTEGER -0x100000000
|
||||
get_integer:"0205ff00000000":"-100000000":0
|
||||
|
||||
INTEGER -0x123456789abcdef0
|
||||
get_integer:"0208edcba98765432110":"-123456789abcdef0":0
|
||||
|
||||
INTEGER -0xfedcba9876543210
|
||||
get_integer:"0209ff0123456789abcdf0":"-fedcba9876543210":0
|
||||
|
||||
INTEGER -0x1fedcab9876543210
|
||||
get_integer:"0209fe0123546789abcdf0":"-1fedcab9876543210":0
|
||||
|
||||
Not INTEGER
|
||||
get_integer:"010101":"":MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
INTEGER too large for mpi
|
||||
get_mpi_too_large:
|
||||
|
||||
ENUMERATED 0
|
||||
get_enum:"0A0100":"0":0
|
||||
|
||||
ENUMERATED 0, extra leading 0
|
||||
get_enum:"0A020000":"0":0
|
||||
|
||||
ENUMERATED 1
|
||||
get_enum:"0A0101":"1":0
|
||||
|
||||
ENUMERATED 1, extra leading 0
|
||||
get_enum:"0A020001":"1":0
|
||||
|
||||
ENUMERATED 0x7f
|
||||
get_enum:"0A017f":"7f":0
|
||||
|
||||
ENUMERATED 0x80
|
||||
get_enum:"0A020080":"80":0
|
||||
|
||||
ENUMERATED 0x80, extra leading 0
|
||||
get_enum:"0A03000080":"80":0
|
||||
|
||||
ENUMERATED 0xff
|
||||
get_enum:"0A0200ff":"ff":0
|
||||
|
||||
ENUMERATED 0x7fff
|
||||
get_enum:"0A027fff":"7fff":0
|
||||
|
||||
ENUMERATED 0x12345678
|
||||
get_enum:"0A0412345678":"12345678":0
|
||||
|
||||
ENUMERATED 0x12345678, extra leading 0
|
||||
get_enum:"0A050012345678":"12345678":0
|
||||
|
||||
ENUMERATED 0x7fffffff
|
||||
get_enum:"0A047fffffff":"7fffffff":0
|
||||
|
||||
ENUMERATED 0x7fffffff, extra leading 0
|
||||
get_enum:"0A05007fffffff":"7fffffff":0
|
||||
|
||||
ENUMERATED 0x80000000
|
||||
get_enum:"0A050080000000":"80000000":0
|
||||
|
||||
ENUMERATED 0xffffffff
|
||||
get_enum:"0A0500ffffffff":"ffffffff":0
|
||||
|
||||
ENUMERATED 0x100000000
|
||||
get_enum:"0A050100000000":"0100000000":0
|
||||
|
||||
ENUMERATED -1
|
||||
get_enum:"0A01ff":"-1":0
|
||||
|
||||
ENUMERATED -1, extra leading ff
|
||||
get_enum:"0A02ffff":"-1":0
|
||||
|
||||
ENUMERATED -0x7f
|
||||
get_enum:"0A0181":"-7f":0
|
||||
|
||||
ENUMERATED -0x80
|
||||
get_enum:"0A0180":"-80":0
|
||||
|
||||
ENUMERATED -0x81
|
||||
get_enum:"0A02ff7f":"-81":0
|
||||
|
||||
ENUMERATED -0xff
|
||||
get_enum:"0A02ff01":"-ff":0
|
||||
|
||||
ENUMERATED -0x100
|
||||
get_enum:"0A02ff00":"-100":0
|
||||
|
||||
ENUMERATED -0x7fffffff
|
||||
get_enum:"0A0480000001":"-7fffffff":0
|
||||
|
||||
ENUMERATED -0x80000000
|
||||
get_enum:"0A0480000000":"-80000000":0
|
||||
|
||||
ENUMERATED -0x80000001
|
||||
get_enum:"0A05ff7fffffff":"-80000001":0
|
||||
|
||||
ENUMERATED -0xffffffff
|
||||
get_enum:"0A05ff00000001":"-ffffffff":0
|
||||
|
||||
ENUMERATED -0x100000000
|
||||
get_enum:"0A05ff00000000":"-100000000":0
|
||||
|
||||
BIT STRING: empty
|
||||
get_bitstring:"0300":0:0:MBEDTLS_ERR_ASN1_OUT_OF_DATA:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
BIT STRING: octets=0, unused_bits=0
|
||||
get_bitstring:"030100":0:0:0:0
|
||||
|
||||
BIT STRING: octets=0, unused_bits=7
|
||||
get_bitstring:"030107":0:7:0:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
BIT STRING: octets=0, unused_bits=8
|
||||
get_bitstring:"030108":0:0:MBEDTLS_ERR_ASN1_INVALID_LENGTH:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
BIT STRING: octets=1, unused_bits=0
|
||||
get_bitstring:"03020041":1:0:0:0
|
||||
|
||||
BIT STRING: octets=1, unused_bits=7
|
||||
get_bitstring:"03020741":1:7:0:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
BIT STRING: octets=1, unused_bits=8
|
||||
get_bitstring:"03020841":1:8:MBEDTLS_ERR_ASN1_INVALID_LENGTH:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
BIT STRING: octets=2, unused_bits=0
|
||||
get_bitstring:"0303004142":2:0:0:0
|
||||
|
||||
BIT STRING: octets=2, unused_bits=7
|
||||
get_bitstring:"0303074142":2:7:0:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
BIT STRING: octets=2, unused_bits=8
|
||||
get_bitstring:"0303084142":2:8:MBEDTLS_ERR_ASN1_INVALID_LENGTH:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
BIT STRING with trailing garbage, unused_bits=0
|
||||
get_bitstring:"030200417e":1:0:MBEDTLS_ERR_ASN1_LENGTH_MISMATCH:0
|
||||
|
||||
BIT STRING with trailing garbage, unused_bits=7
|
||||
get_bitstring:"030207417e":1:7:MBEDTLS_ERR_ASN1_LENGTH_MISMATCH:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
BIT STRING with trailing garbage, unused_bits=8
|
||||
get_bitstring:"030208417e":1:8:MBEDTLS_ERR_ASN1_INVALID_LENGTH:MBEDTLS_ERR_ASN1_INVALID_DATA
|
||||
|
||||
Not BIT STRING
|
||||
get_bitstring:"04020100":0:0:MBEDTLS_ERR_ASN1_UNEXPECTED_TAG:MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
SEQUENCE OF 0 OCTET STRING
|
||||
get_sequence_of:"3000":0x04:"":0
|
||||
|
||||
SEQUENCE OF 0 OCTET STRING plus trailing garbage
|
||||
get_sequence_of:"30007e":0x04:"":MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
|
||||
SEQUENCE of 1 OCTET STRING truncated after tag
|
||||
get_sequence_of:"300104":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 1 OCTET STRING truncated in length #1
|
||||
get_sequence_of:"30020481":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 1 OCTET STRING truncated in length #2
|
||||
get_sequence_of:"3003048201":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 1 OCTET STRING truncated in content #1
|
||||
get_sequence_of:"30020401":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 1 OCTET STRING truncated in content #2
|
||||
get_sequence_of:"3003040241":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 1 OCTET STRING truncated in content #3
|
||||
get_sequence_of:"300404034142":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 1 OCTET STRING (0)
|
||||
get_sequence_of:"30020400":0x04:"4,0":0
|
||||
|
||||
SEQUENCE of 1 OCTET STRING (1)
|
||||
get_sequence_of:"3003040141":0x04:"4,1":0
|
||||
|
||||
SEQUENCE of 1 OCTET STRING (126)
|
||||
get_sequence_of:"308180047e414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141":0x04:"5,126":0
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs, second truncated after tag
|
||||
get_sequence_of:"30050402414104":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs, second truncated in length #1
|
||||
get_sequence_of:"3006040241410481":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs, second truncated in length #2
|
||||
get_sequence_of:"300704024141048201":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs, second truncated in content #1
|
||||
get_sequence_of:"3006040241410401":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs, second truncated in content #2
|
||||
get_sequence_of:"300704024141040241":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs, second truncated in content #3
|
||||
get_sequence_of:"30080402414104034142":0x04:"":MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs (2, 0)
|
||||
get_sequence_of:"3006040241410400":0x04:"4,2,8,0":0
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs (2, 1)
|
||||
get_sequence_of:"300704024141040142":0x04:"4,2,8,1":0
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs (0, 2)
|
||||
get_sequence_of:"3006040004024141":0x04:"4,0,6,2":0
|
||||
|
||||
SEQUENCE of 2 OCTET STRINGs (1, 2)
|
||||
get_sequence_of:"300704014104024242":0x04:"4,1,7,2":0
|
||||
|
||||
Not a SEQUENCE (not CONSTRUCTED)
|
||||
get_sequence_of:"1000":0x04:"":MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Not a SEQUENCE (not SEQUENCE)
|
||||
get_sequence_of:"3100":0x04:"":MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Traverse empty SEQUENCE
|
||||
traverse_sequence_of:"3000":0:0:0:0:"":0
|
||||
|
||||
Traverse empty SEQUENCE plus trailing garbage
|
||||
traverse_sequence_of:"30007e":0:0:0:0:"":MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
|
||||
Traverse SEQUENCE of INTEGER: 1 INTEGER
|
||||
traverse_sequence_of:"30050203123456":0xff:0x02:0:0:"4,0x02,3":0
|
||||
|
||||
Traverse SEQUENCE of INTEGER: 2 INTEGERs
|
||||
traverse_sequence_of:"30080203123456020178":0xff:0x02:0:0:"4,0x02,3,9,0x02,1":0
|
||||
|
||||
Traverse SEQUENCE of INTEGER: INTEGER, NULL
|
||||
traverse_sequence_of:"300702031234560500":0xff:0x02:0:0:"4,0x02,3":MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Traverse SEQUENCE of INTEGER: NULL, INTEGER
|
||||
traverse_sequence_of:"300705000203123456":0xff:0x02:0:0:"":MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Traverse SEQUENCE of ANY: NULL, INTEGER
|
||||
traverse_sequence_of:"300705000203123456":0:0:0:0:"4,0x05,0,6,0x02,3":0
|
||||
|
||||
Traverse SEQUENCE of ANY, skip non-INTEGER: INTEGER, NULL
|
||||
traverse_sequence_of:"300702031234560500":0:0:0xff:0x02:"4,0x02,3":0
|
||||
|
||||
Traverse SEQUENCE of ANY, skip non-INTEGER: NULL, INTEGER
|
||||
traverse_sequence_of:"300705000203123456":0:0:0xff:0x02:"6,0x02,3":0
|
||||
|
||||
Traverse SEQUENCE of INTEGER, skip everything
|
||||
traverse_sequence_of:"30080203123456020178":0xff:0x02:0:1:"":0
|
||||
|
||||
Traverse SEQUENCE of {NULL, OCTET STRING}, skip NULL: OS, NULL
|
||||
traverse_sequence_of:"300704031234560500":0xfe:0x04:0xff:0x04:"4,0x04,3":0
|
||||
|
||||
Traverse SEQUENCE of {NULL, OCTET STRING}, skip NULL: NULL, OS
|
||||
traverse_sequence_of:"300705000403123456":0xfe:0x04:0xff:0x04:"6,0x04,3":0
|
||||
|
||||
Traverse SEQUENCE of {NULL, OCTET STRING}, skip everything
|
||||
traverse_sequence_of:"300705000403123456":0xfe:0x04:0:1:"":0
|
||||
|
||||
Traverse SEQUENCE of INTEGER, stop at 0: NULL
|
||||
traverse_sequence_of:"30020500":0xff:0x02:0:0:"":MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Traverse SEQUENCE of INTEGER, stop at 0: INTEGER
|
||||
traverse_sequence_of:"30050203123456":0xff:0x02:0:0:"":RET_TRAVERSE_STOP
|
||||
|
||||
Traverse SEQUENCE of INTEGER, stop at 0: INTEGER, NULL
|
||||
traverse_sequence_of:"300702031234560500":0xff:0x02:0:0:"":RET_TRAVERSE_STOP
|
||||
|
||||
Traverse SEQUENCE of INTEGER, stop at 1: INTEGER, NULL
|
||||
traverse_sequence_of:"300702031234560500":0xff:0x02:0:0:"4,0x02,3":MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Traverse SEQUENCE of INTEGER, stop at 1: INTEGER, INTEGER
|
||||
traverse_sequence_of:"30080203123456020178":0xff:0x02:0:0:"4,0x02,3":RET_TRAVERSE_STOP
|
||||
|
||||
AlgorithmIdentifier, no params
|
||||
get_alg:"300506034f4944":4:3:0:0:0:7:0
|
||||
|
||||
AlgorithmIdentifier, no params, trailing garbage
|
||||
get_alg:"300506034f49447e":4:3:0:0:0:7:0
|
||||
|
||||
AlgorithmIdentifier, null params
|
||||
get_alg:"300706034f49440500":4:3:0x05:9:0:9:0
|
||||
|
||||
AlgorithmIdentifier, null params, trailing garbage
|
||||
get_alg:"300706034f494405007e":4:3:0x05:9:0:9:0
|
||||
|
||||
AlgorithmIdentifier, OCTET STRING params
|
||||
get_alg:"300c06034f494404056162636465":4:3:0x04:9:5:14:0
|
||||
|
||||
AlgorithmIdentifier, truncated before OID
|
||||
get_alg:"3000":4:3:0:0:0:2:MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
AlgorithmIdentifier, truncated in OID after tag
|
||||
get_alg:"300106":0:0:0:0:0:3:MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
AlgorithmIdentifier, truncated in OID after length
|
||||
get_alg:"30020603":4:3:0:0:0:4:MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
AlgorithmIdentifier, truncated inside OID content
|
||||
get_alg:"300406034f49":4:3:0:0:0:6:MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
AlgorithmIdentifier, truncated in params after tag
|
||||
get_alg:"300606034f494404":4:3:0x04:0:0:8:MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
AlgorithmIdentifier, truncated in params after length
|
||||
get_alg:"300706034f49440405":4:3:0x04:9:0:9:MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
AlgorithmIdentifier, truncated inside params content
|
||||
get_alg:"300806034f4944040561":4:3:0x04:9:5:10:MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
Not an AlgorithmIdentifier (not a SEQUENCE)
|
||||
get_alg:"310506034f4944":0:0:0:0:0:0:MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Not an AlgorithmIdentifier (empty SEQUENCE)
|
||||
get_alg:"3000":0:0:0:0:0:0:MBEDTLS_ERR_ASN1_OUT_OF_DATA
|
||||
|
||||
Not an AlgorithmIdentifier (not an OID)
|
||||
get_alg:"3006050006034f4944":0:0:0:0:0:0:MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
Not an AlgorithmIdentifier (too many elements)
|
||||
get_alg:"300f06034f494406034f494406034f4944":0:0:0:0:0:0:MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
|
||||
Find named data: not found
|
||||
find_named_data:"414141":"424242":"434343":"444444":"7f7f7f":0:4
|
||||
|
||||
Find named data: empty haystack
|
||||
find_named_data:"414141":"424242":"434343":"444444":"7f7f7f":4:4
|
||||
|
||||
Find named data: first
|
||||
find_named_data:"414141":"424242":"434343":"444444":"414141":0:0
|
||||
|
||||
Find named data: last
|
||||
find_named_data:"414141":"424242":"434343":"444444":"444444":0:3
|
||||
|
||||
Find named data: skip suffix
|
||||
find_named_data:"41414141":"414141":"434343":"444444":"414141":0:1
|
||||
|
||||
Find named data: skip prefix
|
||||
find_named_data:"4141":"414141":"434343":"444444":"414141":0:1
|
||||
|
||||
Find named data: first match
|
||||
find_named_data:"414141":"414141":"434343":"444444":"414141":0:0
|
||||
|
||||
Free named data: null pointer
|
||||
depends_on:MBEDTLS_TEST_DEPRECATED
|
||||
free_named_data_null:
|
||||
|
||||
Free named data: all null
|
||||
depends_on:MBEDTLS_TEST_DEPRECATED
|
||||
free_named_data:0:0:0
|
||||
|
||||
Free named data: with oid
|
||||
depends_on:MBEDTLS_TEST_DEPRECATED
|
||||
free_named_data:1:0:0
|
||||
|
||||
Free named data: with val
|
||||
depends_on:MBEDTLS_TEST_DEPRECATED
|
||||
free_named_data:0:1:0
|
||||
|
||||
Free named data: with next
|
||||
depends_on:MBEDTLS_TEST_DEPRECATED
|
||||
free_named_data:0:0:1
|
||||
|
||||
Free named data list (empty)
|
||||
free_named_data_list:0
|
||||
|
||||
Free named data list (1)
|
||||
free_named_data_list:1
|
||||
|
||||
Free named data list (2)
|
||||
free_named_data_list:2
|
||||
774
vendor/mbedtls/tests/suites/test_suite_asn1parse.function
vendored
Normal file
774
vendor/mbedtls/tests/suites/test_suite_asn1parse.function
vendored
Normal file
@@ -0,0 +1,774 @@
|
||||
/* BEGIN_HEADER */
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "mbedtls/bignum.h"
|
||||
#include "mbedtls/asn1.h"
|
||||
#if defined(MBEDTLS_ASN1_WRITE_C)
|
||||
#include "mbedtls/asn1write.h"
|
||||
#endif
|
||||
|
||||
/* Used internally to report an error that indicates a bug in a parsing function. */
|
||||
#define ERR_PARSE_INCONSISTENCY INT_MAX
|
||||
|
||||
/* Use this magic value in some tests to indicate that the expected result
|
||||
* should not be checked. */
|
||||
#define UNPREDICTABLE_RESULT 0x5552
|
||||
|
||||
static int nested_parse(unsigned char **const p,
|
||||
const unsigned char *const end)
|
||||
{
|
||||
int ret;
|
||||
size_t len = 0;
|
||||
size_t len2 = 0;
|
||||
unsigned char *const start = *p;
|
||||
unsigned char *content_start;
|
||||
unsigned char tag;
|
||||
|
||||
/* First get the length, skipping over the tag. */
|
||||
content_start = start + 1;
|
||||
ret = mbedtls_asn1_get_len(&content_start, end, &len);
|
||||
TEST_ASSERT(content_start <= end);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Since we have a valid element start (tag and length), retrieve and
|
||||
* check the tag. */
|
||||
tag = start[0];
|
||||
TEST_EQUAL(mbedtls_asn1_get_tag(p, end, &len2, tag ^ 1),
|
||||
MBEDTLS_ERR_ASN1_UNEXPECTED_TAG);
|
||||
*p = start;
|
||||
TEST_EQUAL(mbedtls_asn1_get_tag(p, end, &len2, tag), 0);
|
||||
TEST_EQUAL(len, len2);
|
||||
TEST_ASSERT(*p == content_start);
|
||||
*p = content_start;
|
||||
|
||||
switch (tag & 0x1f) {
|
||||
case MBEDTLS_ASN1_BOOLEAN:
|
||||
{
|
||||
int val = -257;
|
||||
*p = start;
|
||||
ret = mbedtls_asn1_get_bool(p, end, &val);
|
||||
if (ret == 0) {
|
||||
TEST_ASSERT(val == 0 || val == 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MBEDTLS_ASN1_INTEGER:
|
||||
{
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
mbedtls_mpi mpi;
|
||||
mbedtls_mpi_init(&mpi);
|
||||
*p = start;
|
||||
ret = mbedtls_asn1_get_mpi(p, end, &mpi);
|
||||
mbedtls_mpi_free(&mpi);
|
||||
#else
|
||||
*p = start + 1;
|
||||
ret = mbedtls_asn1_get_len(p, end, &len);
|
||||
*p += len;
|
||||
#endif
|
||||
/* If we're sure that the number fits in an int, also
|
||||
* call mbedtls_asn1_get_int(). */
|
||||
if (ret == 0 && len < sizeof(int)) {
|
||||
int val = -257;
|
||||
unsigned char *q = start;
|
||||
ret = mbedtls_asn1_get_int(&q, end, &val);
|
||||
TEST_ASSERT(*p == q);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MBEDTLS_ASN1_BIT_STRING:
|
||||
{
|
||||
mbedtls_asn1_bitstring bs;
|
||||
*p = start;
|
||||
ret = mbedtls_asn1_get_bitstring(p, end, &bs);
|
||||
break;
|
||||
}
|
||||
|
||||
case MBEDTLS_ASN1_SEQUENCE:
|
||||
{
|
||||
while (*p <= end && *p < content_start + len && ret == 0) {
|
||||
ret = nested_parse(p, content_start + len);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MBEDTLS_ASN1_OCTET_STRING:
|
||||
case MBEDTLS_ASN1_NULL:
|
||||
case MBEDTLS_ASN1_OID:
|
||||
case MBEDTLS_ASN1_UTF8_STRING:
|
||||
case MBEDTLS_ASN1_SET:
|
||||
case MBEDTLS_ASN1_PRINTABLE_STRING:
|
||||
case MBEDTLS_ASN1_T61_STRING:
|
||||
case MBEDTLS_ASN1_IA5_STRING:
|
||||
case MBEDTLS_ASN1_UTC_TIME:
|
||||
case MBEDTLS_ASN1_GENERALIZED_TIME:
|
||||
case MBEDTLS_ASN1_UNIVERSAL_STRING:
|
||||
case MBEDTLS_ASN1_BMP_STRING:
|
||||
default:
|
||||
/* No further testing implemented for this tag. */
|
||||
*p += len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
TEST_ASSERT(*p <= end);
|
||||
return ret;
|
||||
|
||||
exit:
|
||||
return ERR_PARSE_INCONSISTENCY;
|
||||
}
|
||||
|
||||
static int get_len_step(const data_t *input, size_t buffer_size,
|
||||
size_t actual_length)
|
||||
{
|
||||
unsigned char *buf = NULL;
|
||||
unsigned char *p = NULL;
|
||||
unsigned char *end;
|
||||
size_t parsed_length;
|
||||
int ret;
|
||||
|
||||
mbedtls_test_set_step(buffer_size);
|
||||
/* Allocate a new buffer of exactly the length to parse each time.
|
||||
* This gives memory sanitizers a chance to catch buffer overreads. */
|
||||
if (buffer_size == 0) {
|
||||
TEST_CALLOC(buf, 1);
|
||||
end = buf + 1;
|
||||
p = end;
|
||||
} else {
|
||||
TEST_CALLOC_OR_SKIP(buf, buffer_size);
|
||||
if (buffer_size > input->len) {
|
||||
memcpy(buf, input->x, input->len);
|
||||
memset(buf + input->len, 'A', buffer_size - input->len);
|
||||
} else {
|
||||
memcpy(buf, input->x, buffer_size);
|
||||
}
|
||||
p = buf;
|
||||
end = buf + buffer_size;
|
||||
}
|
||||
|
||||
ret = mbedtls_asn1_get_len(&p, end, &parsed_length);
|
||||
|
||||
if (buffer_size >= input->len + actual_length) {
|
||||
TEST_EQUAL(ret, 0);
|
||||
TEST_ASSERT(p == buf + input->len);
|
||||
TEST_EQUAL(parsed_length, actual_length);
|
||||
} else {
|
||||
TEST_EQUAL(ret, MBEDTLS_ERR_ASN1_OUT_OF_DATA);
|
||||
}
|
||||
mbedtls_free(buf);
|
||||
return 1;
|
||||
|
||||
exit:
|
||||
mbedtls_free(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *input_start;
|
||||
const char *description;
|
||||
} traverse_state_t;
|
||||
|
||||
/* Value returned by traverse_callback if description runs out. */
|
||||
#define RET_TRAVERSE_STOP 1
|
||||
/* Value returned by traverse_callback if description has an invalid format
|
||||
* (see traverse_sequence_of). */
|
||||
#define RET_TRAVERSE_ERROR 2
|
||||
|
||||
|
||||
static int traverse_callback(void *ctx, int tag,
|
||||
unsigned char *content, size_t len)
|
||||
{
|
||||
traverse_state_t *state = ctx;
|
||||
size_t offset;
|
||||
const char *rest = state->description;
|
||||
unsigned long n;
|
||||
|
||||
TEST_ASSERT(content > state->input_start);
|
||||
offset = content - state->input_start;
|
||||
mbedtls_test_set_step(offset);
|
||||
|
||||
if (*rest == 0) {
|
||||
return RET_TRAVERSE_STOP;
|
||||
}
|
||||
n = strtoul(rest, (char **) &rest, 0);
|
||||
TEST_EQUAL(n, offset);
|
||||
TEST_EQUAL(*rest, ',');
|
||||
++rest;
|
||||
n = strtoul(rest, (char **) &rest, 0);
|
||||
TEST_EQUAL(n, (unsigned) tag);
|
||||
TEST_EQUAL(*rest, ',');
|
||||
++rest;
|
||||
n = strtoul(rest, (char **) &rest, 0);
|
||||
TEST_EQUAL(n, len);
|
||||
if (*rest == ',') {
|
||||
++rest;
|
||||
}
|
||||
|
||||
state->description = rest;
|
||||
return 0;
|
||||
|
||||
exit:
|
||||
return RET_TRAVERSE_ERROR;
|
||||
}
|
||||
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
* depends_on:MBEDTLS_ASN1_PARSE_C
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void parse_prefixes(const data_t *input,
|
||||
int full_result,
|
||||
int overfull_result)
|
||||
{
|
||||
/* full_result: expected result from parsing the given string. */
|
||||
/* overfull_result: expected_result from parsing the given string plus
|
||||
* some trailing garbage. This may be UNPREDICTABLE_RESULT to accept
|
||||
* any result: use this for invalid inputs that may or may not become
|
||||
* valid depending on what the trailing garbage is. */
|
||||
|
||||
unsigned char *buf = NULL;
|
||||
unsigned char *p = NULL;
|
||||
size_t buffer_size;
|
||||
int ret;
|
||||
|
||||
/* Test every prefix of the input, except the empty string.
|
||||
* The first byte of the string is the tag. Without a tag byte,
|
||||
* we wouldn't know what to parse the input as.
|
||||
* Also test the input followed by an extra byte.
|
||||
*/
|
||||
for (buffer_size = 1; buffer_size <= input->len + 1; buffer_size++) {
|
||||
mbedtls_test_set_step(buffer_size);
|
||||
/* Allocate a new buffer of exactly the length to parse each time.
|
||||
* This gives memory sanitizers a chance to catch buffer overreads. */
|
||||
TEST_CALLOC(buf, buffer_size);
|
||||
memcpy(buf, input->x, buffer_size);
|
||||
p = buf;
|
||||
ret = nested_parse(&p, buf + buffer_size);
|
||||
|
||||
if (ret == ERR_PARSE_INCONSISTENCY) {
|
||||
goto exit;
|
||||
}
|
||||
if (buffer_size < input->len) {
|
||||
TEST_EQUAL(ret, MBEDTLS_ERR_ASN1_OUT_OF_DATA);
|
||||
} else if (buffer_size == input->len) {
|
||||
TEST_EQUAL(ret, full_result);
|
||||
} else { /* ( buffer_size > input->len ) */
|
||||
if (overfull_result != UNPREDICTABLE_RESULT) {
|
||||
TEST_EQUAL(ret, overfull_result);
|
||||
}
|
||||
}
|
||||
if (ret == 0) {
|
||||
TEST_ASSERT(p == buf + input->len);
|
||||
}
|
||||
|
||||
mbedtls_free(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(buf);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void get_len(const data_t *input, int actual_length_arg)
|
||||
{
|
||||
size_t actual_length = actual_length_arg;
|
||||
size_t buffer_size;
|
||||
|
||||
/* Test prefixes of a buffer containing the given length string
|
||||
* followed by `actual_length` bytes of payload. To save a bit of
|
||||
* time, we skip some "boring" prefixes: we don't test prefixes where
|
||||
* the payload is truncated more than one byte away from either end,
|
||||
* and we only test the empty string on a 1-byte input.
|
||||
*/
|
||||
for (buffer_size = 1; buffer_size <= input->len + 1; buffer_size++) {
|
||||
if (!get_len_step(input, buffer_size, actual_length)) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
if (!get_len_step(input, input->len + actual_length - 1, actual_length)) {
|
||||
goto exit;
|
||||
}
|
||||
if (!get_len_step(input, input->len + actual_length, actual_length)) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void get_boolean(const data_t *input,
|
||||
int expected_value, int expected_result)
|
||||
{
|
||||
unsigned char *p = input->x;
|
||||
int val;
|
||||
int ret;
|
||||
ret = mbedtls_asn1_get_bool(&p, input->x + input->len, &val);
|
||||
TEST_EQUAL(ret, expected_result);
|
||||
if (expected_result == 0) {
|
||||
TEST_EQUAL(val, expected_value);
|
||||
TEST_ASSERT(p == input->x + input->len);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void empty_integer(const data_t *input)
|
||||
{
|
||||
unsigned char *p;
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
mbedtls_mpi actual_mpi;
|
||||
#endif
|
||||
int val;
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
mbedtls_mpi_init(&actual_mpi);
|
||||
#endif
|
||||
|
||||
/* An INTEGER with no content is not valid. */
|
||||
p = input->x;
|
||||
TEST_EQUAL(mbedtls_asn1_get_int(&p, input->x + input->len, &val),
|
||||
MBEDTLS_ERR_ASN1_INVALID_LENGTH);
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
/* INTEGERs are sometimes abused as bitstrings, so the library accepts
|
||||
* an INTEGER with empty content and gives it the value 0. */
|
||||
p = input->x;
|
||||
TEST_EQUAL(mbedtls_asn1_get_mpi(&p, input->x + input->len, &actual_mpi),
|
||||
0);
|
||||
TEST_EQUAL(mbedtls_mpi_cmp_int(&actual_mpi, 0), 0);
|
||||
#endif
|
||||
|
||||
exit:
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
mbedtls_mpi_free(&actual_mpi);
|
||||
#endif
|
||||
/*empty cleanup in some configurations*/;
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void get_integer(const data_t *input,
|
||||
const char *expected_hex, int expected_result)
|
||||
{
|
||||
unsigned char *p;
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
mbedtls_mpi expected_mpi;
|
||||
mbedtls_mpi actual_mpi;
|
||||
mbedtls_mpi complement;
|
||||
int expected_result_for_mpi = expected_result;
|
||||
#endif
|
||||
long expected_value;
|
||||
int expected_result_for_int = expected_result;
|
||||
int val;
|
||||
int ret;
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
mbedtls_mpi_init(&expected_mpi);
|
||||
mbedtls_mpi_init(&actual_mpi);
|
||||
mbedtls_mpi_init(&complement);
|
||||
#endif
|
||||
|
||||
errno = 0;
|
||||
expected_value = strtol(expected_hex, NULL, 16);
|
||||
if (expected_result == 0 &&
|
||||
(errno == ERANGE
|
||||
#if LONG_MAX > INT_MAX
|
||||
|| expected_value > INT_MAX || expected_value < INT_MIN
|
||||
#endif
|
||||
)) {
|
||||
/* The library returns the dubious error code INVALID_LENGTH
|
||||
* for integers that are out of range. */
|
||||
expected_result_for_int = MBEDTLS_ERR_ASN1_INVALID_LENGTH;
|
||||
}
|
||||
if (expected_result == 0 && expected_value < 0) {
|
||||
/* The library does not support negative INTEGERs and
|
||||
* returns the dubious error code INVALID_LENGTH.
|
||||
* Test that we preserve the historical behavior. If we
|
||||
* decide to change the behavior, we'll also change this test. */
|
||||
expected_result_for_int = MBEDTLS_ERR_ASN1_INVALID_LENGTH;
|
||||
}
|
||||
|
||||
p = input->x;
|
||||
ret = mbedtls_asn1_get_int(&p, input->x + input->len, &val);
|
||||
TEST_EQUAL(ret, expected_result_for_int);
|
||||
if (ret == 0) {
|
||||
TEST_EQUAL(val, expected_value);
|
||||
TEST_ASSERT(p == input->x + input->len);
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
ret = mbedtls_test_read_mpi(&expected_mpi, expected_hex);
|
||||
TEST_ASSERT(ret == 0 || ret == MBEDTLS_ERR_MPI_BAD_INPUT_DATA);
|
||||
if (ret == MBEDTLS_ERR_MPI_BAD_INPUT_DATA) {
|
||||
/* The data overflows the maximum MPI size. */
|
||||
expected_result_for_mpi = MBEDTLS_ERR_MPI_BAD_INPUT_DATA;
|
||||
}
|
||||
p = input->x;
|
||||
ret = mbedtls_asn1_get_mpi(&p, input->x + input->len, &actual_mpi);
|
||||
TEST_EQUAL(ret, expected_result_for_mpi);
|
||||
if (ret == 0) {
|
||||
if (expected_value >= 0) {
|
||||
TEST_ASSERT(mbedtls_mpi_cmp_mpi(&actual_mpi,
|
||||
&expected_mpi) == 0);
|
||||
} else {
|
||||
/* The library ignores the sign bit in ASN.1 INTEGERs
|
||||
* (which makes sense insofar as INTEGERs are sometimes
|
||||
* abused as bit strings), so the result of parsing them
|
||||
* is a positive integer such that expected_mpi +
|
||||
* actual_mpi = 2^n where n is the length of the content
|
||||
* of the INTEGER. (Leading ff octets don't matter for the
|
||||
* expected value, but they matter for the actual value.)
|
||||
* Test that we don't change from this behavior. If we
|
||||
* decide to fix the library to change the behavior on
|
||||
* negative INTEGERs, we'll fix this test code. */
|
||||
unsigned char *q = input->x + 1;
|
||||
size_t len;
|
||||
TEST_ASSERT(mbedtls_asn1_get_len(&q, input->x + input->len,
|
||||
&len) == 0);
|
||||
TEST_ASSERT(mbedtls_mpi_lset(&complement, 1) == 0);
|
||||
TEST_ASSERT(mbedtls_mpi_shift_l(&complement, len * 8) == 0);
|
||||
TEST_ASSERT(mbedtls_mpi_add_mpi(&complement, &complement,
|
||||
&expected_mpi) == 0);
|
||||
TEST_ASSERT(mbedtls_mpi_cmp_mpi(&complement,
|
||||
&actual_mpi) == 0);
|
||||
}
|
||||
TEST_ASSERT(p == input->x + input->len);
|
||||
}
|
||||
#endif
|
||||
|
||||
exit:
|
||||
#if defined(MBEDTLS_BIGNUM_C)
|
||||
mbedtls_mpi_free(&expected_mpi);
|
||||
mbedtls_mpi_free(&actual_mpi);
|
||||
mbedtls_mpi_free(&complement);
|
||||
#endif
|
||||
/*empty cleanup in some configurations*/;
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void get_enum(const data_t *input,
|
||||
const char *expected_hex, int expected_result)
|
||||
{
|
||||
unsigned char *p;
|
||||
long expected_value;
|
||||
int expected_result_for_enum = expected_result;
|
||||
int val;
|
||||
int ret;
|
||||
|
||||
errno = 0;
|
||||
expected_value = strtol(expected_hex, NULL, 16);
|
||||
if (expected_result == 0 &&
|
||||
(errno == ERANGE
|
||||
#if LONG_MAX > INT_MAX
|
||||
|| expected_value > INT_MAX || expected_value < INT_MIN
|
||||
#endif
|
||||
)) {
|
||||
/* The library returns the dubious error code INVALID_LENGTH
|
||||
* for integers that are out of range. */
|
||||
expected_result_for_enum = MBEDTLS_ERR_ASN1_INVALID_LENGTH;
|
||||
}
|
||||
if (expected_result == 0 && expected_value < 0) {
|
||||
/* The library does not support negative INTEGERs and
|
||||
* returns the dubious error code INVALID_LENGTH.
|
||||
* Test that we preserve the historical behavior. If we
|
||||
* decide to change the behavior, we'll also change this test. */
|
||||
expected_result_for_enum = MBEDTLS_ERR_ASN1_INVALID_LENGTH;
|
||||
}
|
||||
|
||||
p = input->x;
|
||||
ret = mbedtls_asn1_get_enum(&p, input->x + input->len, &val);
|
||||
TEST_EQUAL(ret, expected_result_for_enum);
|
||||
if (ret == 0) {
|
||||
TEST_EQUAL(val, expected_value);
|
||||
TEST_ASSERT(p == input->x + input->len);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_BIGNUM_C */
|
||||
void get_mpi_too_large()
|
||||
{
|
||||
unsigned char *buf = NULL;
|
||||
unsigned char *p;
|
||||
mbedtls_mpi actual_mpi;
|
||||
size_t too_many_octets =
|
||||
MBEDTLS_MPI_MAX_LIMBS * sizeof(mbedtls_mpi_uint) + 1;
|
||||
size_t size = too_many_octets + 6;
|
||||
|
||||
mbedtls_mpi_init(&actual_mpi);
|
||||
|
||||
TEST_CALLOC(buf, size);
|
||||
buf[0] = 0x02; /* tag: INTEGER */
|
||||
buf[1] = 0x84; /* 4-octet length */
|
||||
buf[2] = (too_many_octets >> 24) & 0xff;
|
||||
buf[3] = (too_many_octets >> 16) & 0xff;
|
||||
buf[4] = (too_many_octets >> 8) & 0xff;
|
||||
buf[5] = too_many_octets & 0xff;
|
||||
buf[6] = 0x01; /* most significant octet */
|
||||
|
||||
p = buf;
|
||||
TEST_EQUAL(mbedtls_asn1_get_mpi(&p, buf + size, &actual_mpi),
|
||||
MBEDTLS_ERR_MPI_ALLOC_FAILED);
|
||||
|
||||
exit:
|
||||
mbedtls_mpi_free(&actual_mpi);
|
||||
mbedtls_free(buf);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void get_bitstring(const data_t *input,
|
||||
int expected_length, int expected_unused_bits,
|
||||
int expected_result, int expected_result_null)
|
||||
{
|
||||
mbedtls_asn1_bitstring bs = { 0xdead, 0x21, NULL };
|
||||
unsigned char *p = input->x;
|
||||
|
||||
TEST_EQUAL(mbedtls_asn1_get_bitstring(&p, input->x + input->len, &bs),
|
||||
expected_result);
|
||||
if (expected_result == 0) {
|
||||
TEST_EQUAL(bs.len, (size_t) expected_length);
|
||||
TEST_EQUAL(bs.unused_bits, expected_unused_bits);
|
||||
TEST_ASSERT(bs.p != NULL);
|
||||
TEST_EQUAL(bs.p - input->x + bs.len, input->len);
|
||||
TEST_ASSERT(p == input->x + input->len);
|
||||
}
|
||||
|
||||
p = input->x;
|
||||
TEST_EQUAL(mbedtls_asn1_get_bitstring_null(&p, input->x + input->len,
|
||||
&bs.len),
|
||||
expected_result_null);
|
||||
if (expected_result_null == 0) {
|
||||
TEST_EQUAL(bs.len, (size_t) expected_length);
|
||||
if (expected_result == 0) {
|
||||
TEST_ASSERT(p == input->x + input->len - bs.len);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void get_sequence_of(const data_t *input, int tag,
|
||||
const char *description,
|
||||
int expected_result)
|
||||
{
|
||||
/* The description string is a comma-separated list of integers.
|
||||
* For each element in the SEQUENCE in input, description contains
|
||||
* two integers: the offset of the element (offset from the start
|
||||
* of input to the tag of the element) and the length of the
|
||||
* element's contents.
|
||||
* "offset1,length1,..." */
|
||||
|
||||
mbedtls_asn1_sequence head = { { 0, 0, NULL }, NULL };
|
||||
mbedtls_asn1_sequence *cur;
|
||||
unsigned char *p = input->x;
|
||||
const char *rest = description;
|
||||
unsigned long n;
|
||||
unsigned int step = 0;
|
||||
|
||||
TEST_EQUAL(mbedtls_asn1_get_sequence_of(&p, input->x + input->len,
|
||||
&head, tag),
|
||||
expected_result);
|
||||
if (expected_result == 0) {
|
||||
TEST_ASSERT(p == input->x + input->len);
|
||||
|
||||
if (!*rest) {
|
||||
TEST_EQUAL(head.buf.tag, 0);
|
||||
TEST_ASSERT(head.buf.p == NULL);
|
||||
TEST_EQUAL(head.buf.len, 0);
|
||||
TEST_ASSERT(head.next == NULL);
|
||||
} else {
|
||||
cur = &head;
|
||||
while (*rest) {
|
||||
mbedtls_test_set_step(step);
|
||||
TEST_ASSERT(cur != NULL);
|
||||
TEST_EQUAL(cur->buf.tag, tag);
|
||||
n = strtoul(rest, (char **) &rest, 0);
|
||||
TEST_EQUAL(n, (size_t) (cur->buf.p - input->x));
|
||||
++rest;
|
||||
n = strtoul(rest, (char **) &rest, 0);
|
||||
TEST_EQUAL(n, cur->buf.len);
|
||||
if (*rest) {
|
||||
++rest;
|
||||
}
|
||||
cur = cur->next;
|
||||
++step;
|
||||
}
|
||||
TEST_ASSERT(cur == NULL);
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_asn1_sequence_free(head.next);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void traverse_sequence_of(const data_t *input,
|
||||
int tag_must_mask, int tag_must_val,
|
||||
int tag_may_mask, int tag_may_val,
|
||||
const char *description,
|
||||
int expected_result)
|
||||
{
|
||||
/* The description string is a comma-separated list of integers.
|
||||
* For each element in the SEQUENCE in input, description contains
|
||||
* three integers: the offset of the element's content (offset from
|
||||
* the start of input to the content of the element), the element's tag,
|
||||
* and the length of the element's contents.
|
||||
* "offset1,tag1,length1,..." */
|
||||
|
||||
unsigned char *p = input->x;
|
||||
traverse_state_t traverse_state = { input->x, description };
|
||||
int ret;
|
||||
|
||||
ret = mbedtls_asn1_traverse_sequence_of(&p, input->x + input->len,
|
||||
(uint8_t) tag_must_mask, (uint8_t) tag_must_val,
|
||||
(uint8_t) tag_may_mask, (uint8_t) tag_may_val,
|
||||
traverse_callback, &traverse_state);
|
||||
if (ret == RET_TRAVERSE_ERROR) {
|
||||
goto exit;
|
||||
}
|
||||
TEST_EQUAL(ret, expected_result);
|
||||
TEST_EQUAL(*traverse_state.description, 0);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void get_alg(const data_t *input,
|
||||
int oid_offset, int oid_length,
|
||||
int params_tag, int params_offset, int params_length,
|
||||
int total_length,
|
||||
int expected_result)
|
||||
{
|
||||
mbedtls_asn1_buf oid = { -1, 0, NULL };
|
||||
mbedtls_asn1_buf params = { -1, 0, NULL };
|
||||
unsigned char *p = input->x;
|
||||
int ret;
|
||||
|
||||
TEST_EQUAL(mbedtls_asn1_get_alg(&p, input->x + input->len,
|
||||
&oid, ¶ms),
|
||||
expected_result);
|
||||
if (expected_result == 0) {
|
||||
TEST_EQUAL(oid.tag, MBEDTLS_ASN1_OID);
|
||||
TEST_EQUAL(oid.p - input->x, oid_offset);
|
||||
TEST_EQUAL(oid.len, (size_t) oid_length);
|
||||
TEST_EQUAL(params.tag, params_tag);
|
||||
if (params_offset != 0) {
|
||||
TEST_EQUAL(params.p - input->x, params_offset);
|
||||
} else {
|
||||
TEST_ASSERT(params.p == NULL);
|
||||
}
|
||||
TEST_EQUAL(params.len, (size_t) params_length);
|
||||
TEST_EQUAL(p - input->x, total_length);
|
||||
}
|
||||
|
||||
ret = mbedtls_asn1_get_alg_null(&p, input->x + input->len, &oid);
|
||||
if (expected_result == 0 && params_offset == 0) {
|
||||
TEST_EQUAL(oid.tag, MBEDTLS_ASN1_OID);
|
||||
TEST_EQUAL(oid.p - input->x, oid_offset);
|
||||
TEST_EQUAL(oid.len, (size_t) oid_length);
|
||||
TEST_EQUAL(p - input->x, total_length);
|
||||
} else {
|
||||
TEST_ASSERT(ret != 0);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void find_named_data(data_t *oid0, data_t *oid1, data_t *oid2, data_t *oid3,
|
||||
data_t *needle, int from, int position)
|
||||
{
|
||||
mbedtls_asn1_named_data nd[] = {
|
||||
{ { 0x06, oid0->len, oid0->x }, { 0, 0, NULL }, NULL, 0 },
|
||||
{ { 0x06, oid1->len, oid1->x }, { 0, 0, NULL }, NULL, 0 },
|
||||
{ { 0x06, oid2->len, oid2->x }, { 0, 0, NULL }, NULL, 0 },
|
||||
{ { 0x06, oid3->len, oid3->x }, { 0, 0, NULL }, NULL, 0 },
|
||||
};
|
||||
mbedtls_asn1_named_data *pointers[ARRAY_LENGTH(nd) + 1];
|
||||
size_t i;
|
||||
const mbedtls_asn1_named_data *found;
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(nd); i++) {
|
||||
pointers[i] = &nd[i];
|
||||
}
|
||||
pointers[ARRAY_LENGTH(nd)] = NULL;
|
||||
for (i = 0; i < ARRAY_LENGTH(nd); i++) {
|
||||
nd[i].next = pointers[i+1];
|
||||
}
|
||||
|
||||
found = mbedtls_asn1_find_named_data((const mbedtls_asn1_named_data *) pointers[from],
|
||||
(const char *) needle->x,
|
||||
needle->len);
|
||||
TEST_ASSERT(found == pointers[position]);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:!MBEDTLS_DEPRECATED_REMOVED:!MBEDTLS_DEPRECATED_WARNING */
|
||||
void free_named_data_null()
|
||||
{
|
||||
mbedtls_asn1_free_named_data(NULL);
|
||||
goto exit; /* Silence unused label warning */
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:!MBEDTLS_DEPRECATED_REMOVED:!MBEDTLS_DEPRECATED_WARNING */
|
||||
void free_named_data(int with_oid, int with_val, int with_next)
|
||||
{
|
||||
mbedtls_asn1_named_data next =
|
||||
{ { 0x06, 0, NULL }, { 0, 0xcafe, NULL }, NULL, 0 };
|
||||
mbedtls_asn1_named_data head =
|
||||
{ { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 };
|
||||
|
||||
if (with_oid) {
|
||||
TEST_CALLOC(head.oid.p, 1);
|
||||
}
|
||||
if (with_val) {
|
||||
TEST_CALLOC(head.val.p, 1);
|
||||
}
|
||||
if (with_next) {
|
||||
head.next = &next;
|
||||
}
|
||||
|
||||
mbedtls_asn1_free_named_data(&head);
|
||||
TEST_ASSERT(head.oid.p == NULL);
|
||||
TEST_ASSERT(head.val.p == NULL);
|
||||
TEST_ASSERT(head.next == NULL);
|
||||
TEST_ASSERT(next.val.len == 0xcafe);
|
||||
|
||||
exit:
|
||||
mbedtls_free(head.oid.p);
|
||||
mbedtls_free(head.val.p);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void free_named_data_list(int length)
|
||||
{
|
||||
mbedtls_asn1_named_data *head = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
mbedtls_asn1_named_data *new = NULL;
|
||||
TEST_CALLOC(new, 1);
|
||||
new->next = head;
|
||||
head = new;
|
||||
}
|
||||
|
||||
mbedtls_asn1_free_named_data_list(&head);
|
||||
TEST_ASSERT(head == NULL);
|
||||
/* Most of the point of the test is that it doesn't leak memory.
|
||||
* So this test is only really useful under a memory leak detection
|
||||
* framework. */
|
||||
exit:
|
||||
mbedtls_asn1_free_named_data_list(&head);
|
||||
}
|
||||
/* END_CASE */
|
||||
395
vendor/mbedtls/tests/suites/test_suite_asn1write.data
vendored
Normal file
395
vendor/mbedtls/tests/suites/test_suite_asn1write.data
vendored
Normal file
@@ -0,0 +1,395 @@
|
||||
ASN.1 Write NULL
|
||||
mbedtls_asn1_write_null:"0500"
|
||||
|
||||
ASN.1 Write BOOLEAN FALSE
|
||||
mbedtls_asn1_write_bool:0:"010100"
|
||||
|
||||
ASN.1 Write BOOLEAN TRUE
|
||||
mbedtls_asn1_write_bool:1:"0101ff"
|
||||
|
||||
ASN.1 Write int 0
|
||||
mbedtls_asn1_write_int:0:"020100"
|
||||
|
||||
ASN.1 Write int 1
|
||||
mbedtls_asn1_write_int:1:"020101"
|
||||
|
||||
ASN.1 Write int 127
|
||||
mbedtls_asn1_write_int:0x7f:"02017f"
|
||||
|
||||
ASN.1 Write int 128
|
||||
mbedtls_asn1_write_int:0x80:"02020080"
|
||||
|
||||
ASN.1 Write int 255
|
||||
mbedtls_asn1_write_int:0xff:"020200ff"
|
||||
|
||||
ASN.1 Write int 256
|
||||
mbedtls_asn1_write_int:0x100:"02020100"
|
||||
|
||||
ASN.1 Write int 32767
|
||||
mbedtls_asn1_write_int:0x7fff:"02027fff"
|
||||
|
||||
ASN.1 Write int 32768
|
||||
mbedtls_asn1_write_int:0x8000:"0203008000"
|
||||
|
||||
ASN.1 Write int 65535
|
||||
mbedtls_asn1_write_int:0xffff:"020300ffff"
|
||||
|
||||
ASN.1 Write int 65536
|
||||
mbedtls_asn1_write_int:0x10000:"0203010000"
|
||||
|
||||
ASN.1 Write int 8388607
|
||||
mbedtls_asn1_write_int:0x7fffff:"02037fffff"
|
||||
|
||||
ASN.1 Write int 8388608
|
||||
mbedtls_asn1_write_int:0x800000:"020400800000"
|
||||
|
||||
ASN.1 Write int 0x12345678
|
||||
mbedtls_asn1_write_int:0x12345678:"020412345678"
|
||||
|
||||
ASN.1 Write int 2147483647
|
||||
mbedtls_asn1_write_int:0x7fffffff:"02047fffffff"
|
||||
|
||||
ASN.1 Write enum 0
|
||||
mbedtls_asn1_write_enum:0:"0A0100"
|
||||
|
||||
ASN.1 Write enum 1
|
||||
mbedtls_asn1_write_enum:1:"0A0101"
|
||||
|
||||
ASN.1 Write enum 127
|
||||
mbedtls_asn1_write_enum:0x7f:"0A017f"
|
||||
|
||||
ASN.1 Write enum 128
|
||||
mbedtls_asn1_write_enum:0x80:"0A020080"
|
||||
|
||||
ASN.1 Write enum 255
|
||||
mbedtls_asn1_write_enum:0xff:"0A0200ff"
|
||||
|
||||
ASN.1 Write enum 256
|
||||
mbedtls_asn1_write_enum:0x100:"0A020100"
|
||||
|
||||
ASN.1 Write enum 32767
|
||||
mbedtls_asn1_write_enum:0x7fff:"0A027fff"
|
||||
|
||||
ASN.1 Write enum 32768
|
||||
mbedtls_asn1_write_enum:0x8000:"0A03008000"
|
||||
|
||||
ASN.1 Write enum 65535
|
||||
mbedtls_asn1_write_enum:0xffff:"0A0300ffff"
|
||||
|
||||
ASN.1 Write enum 65536
|
||||
mbedtls_asn1_write_enum:0x10000:"0A03010000"
|
||||
|
||||
ASN.1 Write enum 8388607
|
||||
mbedtls_asn1_write_enum:0x7fffff:"0A037fffff"
|
||||
|
||||
ASN.1 Write enum 8388608
|
||||
mbedtls_asn1_write_enum:0x800000:"0A0400800000"
|
||||
|
||||
ASN.1 Write enum 0x12345678
|
||||
mbedtls_asn1_write_enum:0x12345678:"0A0412345678"
|
||||
|
||||
ASN.1 Write enum 2147483647
|
||||
mbedtls_asn1_write_enum:0x7fffffff:"0A047fffffff"
|
||||
|
||||
ASN.1 Write mpi 0 (null)
|
||||
mbedtls_asn1_write_mpi:"":"020100"
|
||||
|
||||
ASN.1 Write mpi 0 (1 limb)
|
||||
mbedtls_asn1_write_mpi:"00":"020100"
|
||||
|
||||
ASN.1 Write mpi 1
|
||||
mbedtls_asn1_write_mpi:"01":"020101"
|
||||
|
||||
ASN.1 Write mpi 0x7f
|
||||
mbedtls_asn1_write_mpi:"7f":"02017f"
|
||||
|
||||
ASN.1 Write mpi 0x7f with leading 0 limb
|
||||
mbedtls_asn1_write_mpi:"00000000000000007f":"02017f"
|
||||
|
||||
ASN.1 Write mpi 0x80
|
||||
mbedtls_asn1_write_mpi:"80":"02020080"
|
||||
|
||||
ASN.1 Write mpi 0x80 with leading 0 limb
|
||||
mbedtls_asn1_write_mpi:"000000000000000080":"02020080"
|
||||
|
||||
ASN.1 Write mpi 0xff
|
||||
mbedtls_asn1_write_mpi:"ff":"020200ff"
|
||||
|
||||
ASN.1 Write mpi 0x100
|
||||
mbedtls_asn1_write_mpi:"0100":"02020100"
|
||||
|
||||
ASN.1 Write mpi, 127*8-1 bits
|
||||
mbedtls_asn1_write_mpi:"7f7b16e05c1537de7c41cef1a0985d6a3ced98aec28e091874cbad6b5e40a5c956258f18861c28bed8ba808259339ee34b2e509c4080149474d5d5b86093f90c475a6443fc87e1a293d4151be625d652f1c32a00a018bba10c8a2ae5b2b0ee4be64e053dce9d07ec7919526c9dfcf2ec9fc3db485caa8e5a68a2cd0a427de8":"027f7f7b16e05c1537de7c41cef1a0985d6a3ced98aec28e091874cbad6b5e40a5c956258f18861c28bed8ba808259339ee34b2e509c4080149474d5d5b86093f90c475a6443fc87e1a293d4151be625d652f1c32a00a018bba10c8a2ae5b2b0ee4be64e053dce9d07ec7919526c9dfcf2ec9fc3db485caa8e5a68a2cd0a427de8"
|
||||
|
||||
ASN.1 Write mpi, 127*8 bits
|
||||
mbedtls_asn1_write_mpi:"e77b16e05c1537de7c41cef1a0985d6a3ced98aec28e091874cbad6b5e40a5c956258f18861c28bed8ba808259339ee34b2e509c4080149474d5d5b86093f90c475a6443fc87e1a293d4151be625d652f1c32a00a018bba10c8a2ae5b2b0ee4be64e053dce9d07ec7919526c9dfcf2ec9fc3db485caa8e5a68a2cd0a427de8":"02818000e77b16e05c1537de7c41cef1a0985d6a3ced98aec28e091874cbad6b5e40a5c956258f18861c28bed8ba808259339ee34b2e509c4080149474d5d5b86093f90c475a6443fc87e1a293d4151be625d652f1c32a00a018bba10c8a2ae5b2b0ee4be64e053dce9d07ec7919526c9dfcf2ec9fc3db485caa8e5a68a2cd0a427de8"
|
||||
|
||||
ASN.1 Write mpi, 127*8+1 bits
|
||||
mbedtls_asn1_write_mpi:"018446d68934cc1af23c4cd909884d4bd737a1890e12f5ef8bf3d807d72feffa63c0bf2633345f8b8418d144617c871a7a0277ac0150eed4b3db7f9dff21114cd0d7f282400f03c931cb00c367550e374a1ed3762a1801ca714cfc8d5aac69707ca81e0661400ed0014d97cba48f94d835dd681fc3053c51958afbf7583cf49c":"028180018446d68934cc1af23c4cd909884d4bd737a1890e12f5ef8bf3d807d72feffa63c0bf2633345f8b8418d144617c871a7a0277ac0150eed4b3db7f9dff21114cd0d7f282400f03c931cb00c367550e374a1ed3762a1801ca714cfc8d5aac69707ca81e0661400ed0014d97cba48f94d835dd681fc3053c51958afbf7583cf49c"
|
||||
|
||||
ASN.1 Write mpi, 255*8-1 bits
|
||||
mbedtls_asn1_write_mpi:"7bd1913fcfb652896209ad3e62f5d04a8dfc71eb1698543c52200bd7bbf3c11dd9ff57c299a2f4da172b3d5bd7e29affddf8859be7d50a45537a0df15b17af603d18803fd17134847cba78d83e64bf9fee58364d6124add0541da7bad331cd35fb48186a74bc502ddb967602401c0db02b19e5d38f09e8618fa7f6a1a3f738629baffdc63d9d70d396007d943fd64ae696e5b7e88f2c6d6ec322b461dbddd36efa91d990343b66419cf4832a22dc9ad13021185a1bf007989a50ba3bfd1152b8db899482d3ed498d1b9fae243a3cdae9530d8b29fdb684f70cdc0c9b8527265312603b405e67d59d4b1d654ddc3b7fd5515acb32440dc80903c8474a2c136c":"0281ff7bd1913fcfb652896209ad3e62f5d04a8dfc71eb1698543c52200bd7bbf3c11dd9ff57c299a2f4da172b3d5bd7e29affddf8859be7d50a45537a0df15b17af603d18803fd17134847cba78d83e64bf9fee58364d6124add0541da7bad331cd35fb48186a74bc502ddb967602401c0db02b19e5d38f09e8618fa7f6a1a3f738629baffdc63d9d70d396007d943fd64ae696e5b7e88f2c6d6ec322b461dbddd36efa91d990343b66419cf4832a22dc9ad13021185a1bf007989a50ba3bfd1152b8db899482d3ed498d1b9fae243a3cdae9530d8b29fdb684f70cdc0c9b8527265312603b405e67d59d4b1d654ddc3b7fd5515acb32440dc80903c8474a2c136c"
|
||||
|
||||
ASN.1 Write mpi, 255*8 bits
|
||||
mbedtls_asn1_write_mpi:"fbd1913fcfb652896209ad3e62f5d04a8dfc71eb1698543c52200bd7bbf3c11dd9ff57c299a2f4da172b3d5bd7e29affddf8859be7d50a45537a0df15b17af603d18803fd17134847cba78d83e64bf9fee58364d6124add0541da7bad331cd35fb48186a74bc502ddb967602401c0db02b19e5d38f09e8618fa7f6a1a3f738629baffdc63d9d70d396007d943fd64ae696e5b7e88f2c6d6ec322b461dbddd36efa91d990343b66419cf4832a22dc9ad13021185a1bf007989a50ba3bfd1152b8db899482d3ed498d1b9fae243a3cdae9530d8b29fdb684f70cdc0c9b8527265312603b405e67d59d4b1d654ddc3b7fd5515acb32440dc80903c8474a2c136c":"0282010000fbd1913fcfb652896209ad3e62f5d04a8dfc71eb1698543c52200bd7bbf3c11dd9ff57c299a2f4da172b3d5bd7e29affddf8859be7d50a45537a0df15b17af603d18803fd17134847cba78d83e64bf9fee58364d6124add0541da7bad331cd35fb48186a74bc502ddb967602401c0db02b19e5d38f09e8618fa7f6a1a3f738629baffdc63d9d70d396007d943fd64ae696e5b7e88f2c6d6ec322b461dbddd36efa91d990343b66419cf4832a22dc9ad13021185a1bf007989a50ba3bfd1152b8db899482d3ed498d1b9fae243a3cdae9530d8b29fdb684f70cdc0c9b8527265312603b405e67d59d4b1d654ddc3b7fd5515acb32440dc80903c8474a2c136c"
|
||||
|
||||
ASN.1 Write mpi, 256*8-1 bits
|
||||
mbedtls_asn1_write_mpi:"7bd1913fcfb652896209ad3e62f5d04a8dfc71eb1698543c52200bd7bbf3c11dd9ff57c299a2f4da172b3d5bd7e29affddf8859be7d50a45537a0df15b17af603d18803fd17134847cba78d83e64bf9fee58364d6124add0541da7bad331cd35fb48186a74bc502ddb967602401c0db02b19e5d38f09e8618fa7f6a1a3f738629baffdc63d9d70d396007d943fd64ae696e5b7e88f2c6d6ec322b461dbddd36efa91d990343b66419cf4832a22dc9ad13021185a1bf007989a50ba3bfd1152b8db899482d3ed498d1b9fae243a3cdae9530d8b29fdb684f70cdc0c9b8527265312603b405e67d59d4b1d654ddc3b7fd5515acb32440dc80903c8474a2c136c89":"028201007bd1913fcfb652896209ad3e62f5d04a8dfc71eb1698543c52200bd7bbf3c11dd9ff57c299a2f4da172b3d5bd7e29affddf8859be7d50a45537a0df15b17af603d18803fd17134847cba78d83e64bf9fee58364d6124add0541da7bad331cd35fb48186a74bc502ddb967602401c0db02b19e5d38f09e8618fa7f6a1a3f738629baffdc63d9d70d396007d943fd64ae696e5b7e88f2c6d6ec322b461dbddd36efa91d990343b66419cf4832a22dc9ad13021185a1bf007989a50ba3bfd1152b8db899482d3ed498d1b9fae243a3cdae9530d8b29fdb684f70cdc0c9b8527265312603b405e67d59d4b1d654ddc3b7fd5515acb32440dc80903c8474a2c136c89"
|
||||
|
||||
ASN.1 Write OCTET STRING: length=0
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OCTET_STRING:"":"0400"
|
||||
|
||||
ASN.1 Write OCTET STRING: length=1
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OCTET_STRING:"41":"040141"
|
||||
|
||||
ASN.1 Write OCTET STRING: length=2
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OCTET_STRING:"4142":"04024142"
|
||||
|
||||
ASN.1 Write OCTET STRING: length=127
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OCTET_STRING:"99a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38":"047f99a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38"
|
||||
|
||||
ASN.1 Write OCTET STRING: length=128
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OCTET_STRING:"0199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38":"0481800199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38"
|
||||
|
||||
ASN.1 Write OCTET STRING: length=255
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OCTET_STRING:"633ed2cb0a2915dc4438a4c063017eb336cd9571d2a0585522c5073ca22a30ca7b8c9bd167d89ba1827bc6fb5d6ef6dcc52ee6eecc47e84ee0dd18fa3ebbdb6edfc679f037160d48d46a0d7e571335b24a28c8fd29b7f4a93d013b74e522bc1f5f605096bb99d438814b77b54d6dde608417b0a0ce9a8cb507fbeb95e9926b4bb6eec725599493d4b156ef3a5fd701426456029111c20f1d03c5d8999d2c042277ef91c5114a6c06218c1ba28d41ef08e4870d0cef260cba9de16d7d11ed5889b88fb93073746ebb158a4246cdb8a4ce403a5d1d598a0d11548f22070f833c1344d15e7a1445c133d19b8295b7c071bf2227178938031249d22d21c6f8e53d":"0481ff633ed2cb0a2915dc4438a4c063017eb336cd9571d2a0585522c5073ca22a30ca7b8c9bd167d89ba1827bc6fb5d6ef6dcc52ee6eecc47e84ee0dd18fa3ebbdb6edfc679f037160d48d46a0d7e571335b24a28c8fd29b7f4a93d013b74e522bc1f5f605096bb99d438814b77b54d6dde608417b0a0ce9a8cb507fbeb95e9926b4bb6eec725599493d4b156ef3a5fd701426456029111c20f1d03c5d8999d2c042277ef91c5114a6c06218c1ba28d41ef08e4870d0cef260cba9de16d7d11ed5889b88fb93073746ebb158a4246cdb8a4ce403a5d1d598a0d11548f22070f833c1344d15e7a1445c133d19b8295b7c071bf2227178938031249d22d21c6f8e53d"
|
||||
|
||||
ASN.1 Write OCTET STRING: length=256
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OCTET_STRING:"5a633ed2cb0a2915dc4438a4c063017eb336cd9571d2a0585522c5073ca22a30ca7b8c9bd167d89ba1827bc6fb5d6ef6dcc52ee6eecc47e84ee0dd18fa3ebbdb6edfc679f037160d48d46a0d7e571335b24a28c8fd29b7f4a93d013b74e522bc1f5f605096bb99d438814b77b54d6dde608417b0a0ce9a8cb507fbeb95e9926b4bb6eec725599493d4b156ef3a5fd701426456029111c20f1d03c5d8999d2c042277ef91c5114a6c06218c1ba28d41ef08e4870d0cef260cba9de16d7d11ed5889b88fb93073746ebb158a4246cdb8a4ce403a5d1d598a0d11548f22070f833c1344d15e7a1445c133d19b8295b7c071bf2227178938031249d22d21c6f8e53d":"048201005a633ed2cb0a2915dc4438a4c063017eb336cd9571d2a0585522c5073ca22a30ca7b8c9bd167d89ba1827bc6fb5d6ef6dcc52ee6eecc47e84ee0dd18fa3ebbdb6edfc679f037160d48d46a0d7e571335b24a28c8fd29b7f4a93d013b74e522bc1f5f605096bb99d438814b77b54d6dde608417b0a0ce9a8cb507fbeb95e9926b4bb6eec725599493d4b156ef3a5fd701426456029111c20f1d03c5d8999d2c042277ef91c5114a6c06218c1ba28d41ef08e4870d0cef260cba9de16d7d11ed5889b88fb93073746ebb158a4246cdb8a4ce403a5d1d598a0d11548f22070f833c1344d15e7a1445c133d19b8295b7c071bf2227178938031249d22d21c6f8e53d"
|
||||
|
||||
ASN.1 Write UTF8 STRING: length=0
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_UTF8_STRING:"":"0c00"
|
||||
|
||||
ASN.1 Write UTF8 STRING: length=1
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_UTF8_STRING:"41":"0c0141"
|
||||
|
||||
ASN.1 Write UTF8 STRING: length=128
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_UTF8_STRING:"0199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38":"0c81800199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38"
|
||||
|
||||
ASN.1 Write PRINTABLE STRING: length=0
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_PRINTABLE_STRING:"":"1300"
|
||||
|
||||
ASN.1 Write PRINTABLE STRING: length=1
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_PRINTABLE_STRING:"41":"130141"
|
||||
|
||||
ASN.1 Write PRINTABLE STRING: length=128
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_PRINTABLE_STRING:"0199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38":"1381800199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38"
|
||||
|
||||
ASN.1 Write IA5 STRING: length=0
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_IA5_STRING:"":"1600"
|
||||
|
||||
ASN.1 Write IA5 STRING: length=1
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_IA5_STRING:"41":"160141"
|
||||
|
||||
ASN.1 Write IA5 STRING: length=128
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_IA5_STRING:"0199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38":"1681800199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38"
|
||||
|
||||
ASN.1 Write tagged string: length=0
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_IA5_STRING | MBEDTLS_ASN1_CONTEXT_SPECIFIC:"":"9600"
|
||||
|
||||
ASN.1 Write tagged string: length=1
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_IA5_STRING | MBEDTLS_ASN1_CONTEXT_SPECIFIC:"41":"960141"
|
||||
|
||||
ASN.1 Write tagged string: length=128
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_IA5_STRING | MBEDTLS_ASN1_CONTEXT_SPECIFIC:"0199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38":"9681800199a66790856f7199641f55cadabb660aaed6aa0d9ef8cef4417118c6e8c6e15becbaa21c63faf48726e92357a38b3079a0b9d60be7457ec6552f900dd032577167c91e829927343c3a769b362db4de0ad2ffb8f13cc2eeca9e52dc557118baa88b857477595622bc301a1ae2150030d652c4a482cf88d0ded85d6731ff2d38"
|
||||
|
||||
ASN.1 Write OID: length=0
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OID:"":"0600"
|
||||
|
||||
ASN.1 Write OID: length=1
|
||||
mbedtls_asn1_write_string:MBEDTLS_ASN1_OID:"41":"060141"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, null parameters
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0:"300706034f49440500"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, parameters (8 bytes)
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":8:"300d06034f4944"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, total length=0x7f
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0x7a:"307f06034f4944"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, total length=0x80
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0x7b:"30818006034f4944"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, total length=0xff
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0xfa:"3081ff06034f4944"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, total length=0x100
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0xfb:"3082010006034f4944"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, total length=0xffff
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0xfffa:"3082ffff06034f4944"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, total length=0x10000
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0xfffb:"308301000006034f4944"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, total length=0xffffff
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0xfffffa:"3083ffffff06034f4944"
|
||||
|
||||
ASN.1 Write AlgorithmIdentifier, total length=0x1000000
|
||||
mbedtls_asn1_write_algorithm_identifier:"4f4944":0xfffffb:"30840100000006034f4944"
|
||||
|
||||
ASN.1 Write / Read Length #0 (Len = 0, short form)
|
||||
mbedtls_asn1_write_len:0:"00":1:1
|
||||
|
||||
ASN.1 Write / Read Length #1 (Len = 127, short form)
|
||||
mbedtls_asn1_write_len:127:"7F":1:1
|
||||
|
||||
ASN.1 Write / Read Length #2 (Len = 127, buffer too small)
|
||||
mbedtls_asn1_write_len:127:"7F":0:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL
|
||||
|
||||
ASN.1 Write / Read Length #3 (Len = 128, long form)
|
||||
mbedtls_asn1_write_len:128:"8180":2:2
|
||||
|
||||
ASN.1 Write / Read Length #4 (Len = 255, long form)
|
||||
mbedtls_asn1_write_len:255:"81FF":2:2
|
||||
|
||||
ASN.1 Write / Read Length #5 (Len = 255, buffer too small)
|
||||
mbedtls_asn1_write_len:255:"81FF":1:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL
|
||||
|
||||
ASN.1 Write / Read Length #6 (Len = 258, byte order)
|
||||
mbedtls_asn1_write_len:258:"820102":3:3
|
||||
|
||||
ASN.1 Write / Read Length #7 (Len = 65535, long form)
|
||||
mbedtls_asn1_write_len:65535:"82FFFF":3:3
|
||||
|
||||
ASN.1 Write / Read Length #8 (Len = 65535, buffer too small)
|
||||
mbedtls_asn1_write_len:65535:"82FFFF":2:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL
|
||||
|
||||
ASN.1 Write / Read Length #9 (Len = 66051, byte order)
|
||||
mbedtls_asn1_write_len:66051:"83010203":4:4
|
||||
|
||||
ASN.1 Write / Read Length #10 (Len = 16777215, long form)
|
||||
mbedtls_asn1_write_len:16777215:"83FFFFFF":4:4
|
||||
|
||||
ASN.1 Write / Read Length #11 (Len = 16777215, buffer too small)
|
||||
mbedtls_asn1_write_len:16777215:"83FFFFFF":3:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL
|
||||
|
||||
ASN.1 Write / Read Length #12 (Len = 16909060, byte order)
|
||||
mbedtls_asn1_write_len:16909060:"8401020304":5:5
|
||||
|
||||
ASN.1 Write / Read Length #12 (Len = 16909060, buffer too small)
|
||||
mbedtls_asn1_write_len:16909060:"8401020304":4:MBEDTLS_ERR_ASN1_BUF_TOO_SMALL
|
||||
|
||||
ASN.1 Write Named Bitstring / Unused bits #0
|
||||
test_asn1_write_bitstrings:"FF":8:"030200FF":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Unused bits #1
|
||||
test_asn1_write_bitstrings:"FE":8:"030201FE":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Unused bits #2
|
||||
test_asn1_write_bitstrings:"FC":7:"030202FC":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Unused bits #3
|
||||
test_asn1_write_bitstrings:"F8":8:"030203F8":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Unused bits #4
|
||||
test_asn1_write_bitstrings:"F0":6:"030204F0":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Unused bits #5
|
||||
test_asn1_write_bitstrings:"E0":6:"030205E0":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Unused bits #6
|
||||
test_asn1_write_bitstrings:"C0":8:"030206C0":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Unused bits #7
|
||||
test_asn1_write_bitstrings:"80":8:"03020780":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Empty bitstring
|
||||
test_asn1_write_bitstrings:"00":7:"030100":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Empty bitstring (bits = 16)
|
||||
test_asn1_write_bitstrings:"0000":16:"030100":1
|
||||
|
||||
ASN.1 Write Named Bitstring / Empty bitstring (bits = 24)
|
||||
test_asn1_write_bitstrings:"FFFFFF":0:"030100":1
|
||||
|
||||
ASN.1 Write Named Bitstring / 15 trailing bits all unset
|
||||
test_asn1_write_bitstrings:"F88000":24:"030307F880":1
|
||||
|
||||
ASN.1 Write Named Bitstring / 15 trailing bits all set
|
||||
test_asn1_write_bitstrings:"F8FFFF":9:"030307F880":1
|
||||
|
||||
ASN.1 Write Bitstring / Unused bits #0
|
||||
test_asn1_write_bitstrings:"FF":8:"030200FF":0
|
||||
|
||||
ASN.1 Write Bitstring / Unused bits #1
|
||||
test_asn1_write_bitstrings:"FF":7:"030201FE":0
|
||||
|
||||
ASN.1 Write Bitstring / Unused bits #2
|
||||
test_asn1_write_bitstrings:"FF":6:"030202FC":0
|
||||
|
||||
ASN.1 Write Bitstring / Unused bits #3
|
||||
test_asn1_write_bitstrings:"FF":5:"030203F8":0
|
||||
|
||||
ASN.1 Write Bitstring / Unused bits #4
|
||||
test_asn1_write_bitstrings:"FF":4:"030204F0":0
|
||||
|
||||
ASN.1 Write Bitstring / Unused bits #5
|
||||
test_asn1_write_bitstrings:"FF":3:"030205E0":0
|
||||
|
||||
ASN.1 Write Bitstring / Unused bits #6
|
||||
test_asn1_write_bitstrings:"FF":2:"030206C0":0
|
||||
|
||||
ASN.1 Write Bitstring / Unused bits #7
|
||||
test_asn1_write_bitstrings:"FF":1:"03020780":0
|
||||
|
||||
ASN.1 Write Bitstring / 1 trailing bit (bits 15)
|
||||
test_asn1_write_bitstrings:"0003":15:"0303010002":0
|
||||
|
||||
ASN.1 Write Bitstring / 0 bits
|
||||
test_asn1_write_bitstrings:"":0:"030100":0
|
||||
|
||||
ASN.1 Write Bitstring / long string all bits unset except trailing bits
|
||||
test_asn1_write_bitstrings:"000000000007":45:"030703000000000000":0
|
||||
|
||||
Store named data: not found
|
||||
store_named_data_find:"414141":"424242":"434343":"444444":"7f7f7f":0:-1
|
||||
|
||||
Store named data: empty haystack
|
||||
store_named_data_find:"414141":"424242":"434343":"444444":"7f7f7f":4:-1
|
||||
|
||||
Store named data: first
|
||||
store_named_data_find:"414141":"424242":"434343":"444444":"414141":0:0
|
||||
|
||||
Store named data: last
|
||||
store_named_data_find:"414141":"424242":"434343":"444444":"444444":0:3
|
||||
|
||||
Store named data: skip suffix
|
||||
store_named_data_find:"41414141":"414141":"434343":"444444":"414141":0:1
|
||||
|
||||
Store named data: skip prefix
|
||||
store_named_data_find:"4141":"414141":"434343":"444444":"414141":0:1
|
||||
|
||||
Store named data: first match
|
||||
store_named_data_find:"414141":"414141":"434343":"444444":"414141":0:0
|
||||
|
||||
Store named data: found, null to zero
|
||||
store_named_data_val_found:0:0
|
||||
|
||||
Store named data: found, null to data
|
||||
store_named_data_val_found:0:9
|
||||
|
||||
Store named data: found, data to zero
|
||||
store_named_data_val_found:9:0
|
||||
|
||||
Store named data: found, smaller data
|
||||
store_named_data_val_found:9:2
|
||||
|
||||
Store named data: found, same-size data
|
||||
store_named_data_val_found:9:9
|
||||
|
||||
Store named data: found, larger data
|
||||
store_named_data_val_found:4:9
|
||||
|
||||
Store named data: new, val_len=0
|
||||
store_named_data_val_new:0:1
|
||||
|
||||
Stored named data: new, val_len=0, val=NULL
|
||||
store_named_data_val_new:0:0
|
||||
|
||||
Store named data: new, val_len=4
|
||||
store_named_data_val_new:4:1
|
||||
|
||||
Store named data: new, val_len=4, val=NULL
|
||||
store_named_data_val_new:4:0
|
||||
606
vendor/mbedtls/tests/suites/test_suite_asn1write.function
vendored
Normal file
606
vendor/mbedtls/tests/suites/test_suite_asn1write.function
vendored
Normal file
@@ -0,0 +1,606 @@
|
||||
/* BEGIN_HEADER */
|
||||
#include "mbedtls/asn1write.h"
|
||||
|
||||
#define GUARD_LEN 4
|
||||
#define GUARD_VAL 0x2a
|
||||
|
||||
typedef struct {
|
||||
unsigned char *output;
|
||||
unsigned char *start;
|
||||
unsigned char *end;
|
||||
unsigned char *p;
|
||||
size_t size;
|
||||
} generic_write_data_t;
|
||||
|
||||
static int generic_write_start_step(generic_write_data_t *data)
|
||||
{
|
||||
mbedtls_test_set_step(data->size);
|
||||
mbedtls_free(data->output);
|
||||
data->output = NULL;
|
||||
TEST_CALLOC(data->output, data->size == 0 ? 1 : data->size);
|
||||
data->end = data->output + data->size;
|
||||
data->p = data->end;
|
||||
data->start = data->end - data->size;
|
||||
return 1;
|
||||
exit:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int generic_write_finish_step(generic_write_data_t *data,
|
||||
const data_t *expected, int ret)
|
||||
{
|
||||
int ok = 0;
|
||||
|
||||
if (data->size < expected->len) {
|
||||
TEST_EQUAL(ret, MBEDTLS_ERR_ASN1_BUF_TOO_SMALL);
|
||||
} else {
|
||||
TEST_EQUAL(ret, data->end - data->p);
|
||||
TEST_ASSERT(data->p >= data->start);
|
||||
TEST_ASSERT(data->p <= data->end);
|
||||
TEST_MEMORY_COMPARE(data->p, (size_t) (data->end - data->p),
|
||||
expected->x, expected->len);
|
||||
}
|
||||
ok = 1;
|
||||
|
||||
exit:
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
* depends_on:MBEDTLS_ASN1_WRITE_C
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_asn1_write_null(data_t *expected)
|
||||
{
|
||||
generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
|
||||
int ret;
|
||||
|
||||
for (data.size = 0; data.size <= expected->len + 1; data.size++) {
|
||||
if (!generic_write_start_step(&data)) {
|
||||
goto exit;
|
||||
}
|
||||
ret = mbedtls_asn1_write_null(&data.p, data.start);
|
||||
if (!generic_write_finish_step(&data, expected, ret)) {
|
||||
goto exit;
|
||||
}
|
||||
/* There's no parsing function for NULL. */
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(data.output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_asn1_write_bool(int val, data_t *expected)
|
||||
{
|
||||
generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
|
||||
int ret;
|
||||
|
||||
for (data.size = 0; data.size <= expected->len + 1; data.size++) {
|
||||
if (!generic_write_start_step(&data)) {
|
||||
goto exit;
|
||||
}
|
||||
ret = mbedtls_asn1_write_bool(&data.p, data.start, val);
|
||||
if (!generic_write_finish_step(&data, expected, ret)) {
|
||||
goto exit;
|
||||
}
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
if (ret >= 0) {
|
||||
int read = 0xdeadbeef;
|
||||
TEST_EQUAL(mbedtls_asn1_get_bool(&data.p, data.end, &read), 0);
|
||||
TEST_EQUAL(val, read);
|
||||
}
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(data.output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_asn1_write_int(int val, data_t *expected)
|
||||
{
|
||||
generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
|
||||
int ret;
|
||||
|
||||
for (data.size = 0; data.size <= expected->len + 1; data.size++) {
|
||||
if (!generic_write_start_step(&data)) {
|
||||
goto exit;
|
||||
}
|
||||
ret = mbedtls_asn1_write_int(&data.p, data.start, val);
|
||||
if (!generic_write_finish_step(&data, expected, ret)) {
|
||||
goto exit;
|
||||
}
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
if (ret >= 0) {
|
||||
int read = 0xdeadbeef;
|
||||
TEST_EQUAL(mbedtls_asn1_get_int(&data.p, data.end, &read), 0);
|
||||
TEST_EQUAL(val, read);
|
||||
}
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(data.output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_asn1_write_enum(int val, data_t *expected)
|
||||
{
|
||||
generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
|
||||
int ret;
|
||||
|
||||
for (data.size = 0; data.size <= expected->len + 1; data.size++) {
|
||||
if (!generic_write_start_step(&data)) {
|
||||
goto exit;
|
||||
}
|
||||
ret = mbedtls_asn1_write_enum(&data.p, data.start, val);
|
||||
if (!generic_write_finish_step(&data, expected, ret)) {
|
||||
goto exit;
|
||||
}
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
if (ret >= 0) {
|
||||
int read = 0xdeadbeef;
|
||||
TEST_EQUAL(mbedtls_asn1_get_enum(&data.p, data.end, &read), 0);
|
||||
TEST_EQUAL(val, read);
|
||||
}
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(data.output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_BIGNUM_C */
|
||||
void mbedtls_asn1_write_mpi(data_t *val, data_t *expected)
|
||||
{
|
||||
generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
|
||||
mbedtls_mpi mpi, read;
|
||||
int ret;
|
||||
|
||||
mbedtls_mpi_init(&mpi);
|
||||
mbedtls_mpi_init(&read);
|
||||
TEST_ASSERT(mbedtls_mpi_read_binary(&mpi, val->x, val->len) == 0);
|
||||
|
||||
for (data.size = 0; data.size <= expected->len + 1; data.size++) {
|
||||
if (!generic_write_start_step(&data)) {
|
||||
goto exit;
|
||||
}
|
||||
ret = mbedtls_asn1_write_mpi(&data.p, data.start, &mpi);
|
||||
if (!generic_write_finish_step(&data, expected, ret)) {
|
||||
goto exit;
|
||||
}
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
if (ret >= 0) {
|
||||
TEST_EQUAL(mbedtls_asn1_get_mpi(&data.p, data.end, &read), 0);
|
||||
TEST_EQUAL(0, mbedtls_mpi_cmp_mpi(&mpi, &read));
|
||||
}
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
/* Skip some intermediate lengths, they're boring. */
|
||||
if (expected->len > 10 && data.size == 8) {
|
||||
data.size = expected->len - 2;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_mpi_free(&mpi);
|
||||
mbedtls_mpi_free(&read);
|
||||
mbedtls_free(data.output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_asn1_write_string(int tag, data_t *content, data_t *expected)
|
||||
{
|
||||
generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
|
||||
int ret;
|
||||
|
||||
for (data.size = 0; data.size <= expected->len + 1; data.size++) {
|
||||
if (!generic_write_start_step(&data)) {
|
||||
goto exit;
|
||||
}
|
||||
switch (tag) {
|
||||
case MBEDTLS_ASN1_OCTET_STRING:
|
||||
ret = mbedtls_asn1_write_octet_string(
|
||||
&data.p, data.start, content->x, content->len);
|
||||
break;
|
||||
case MBEDTLS_ASN1_OID:
|
||||
ret = mbedtls_asn1_write_oid(
|
||||
&data.p, data.start,
|
||||
(const char *) content->x, content->len);
|
||||
break;
|
||||
case MBEDTLS_ASN1_UTF8_STRING:
|
||||
ret = mbedtls_asn1_write_utf8_string(
|
||||
&data.p, data.start,
|
||||
(const char *) content->x, content->len);
|
||||
break;
|
||||
case MBEDTLS_ASN1_PRINTABLE_STRING:
|
||||
ret = mbedtls_asn1_write_printable_string(
|
||||
&data.p, data.start,
|
||||
(const char *) content->x, content->len);
|
||||
break;
|
||||
case MBEDTLS_ASN1_IA5_STRING:
|
||||
ret = mbedtls_asn1_write_ia5_string(
|
||||
&data.p, data.start,
|
||||
(const char *) content->x, content->len);
|
||||
break;
|
||||
default:
|
||||
ret = mbedtls_asn1_write_tagged_string(
|
||||
&data.p, data.start, tag,
|
||||
(const char *) content->x, content->len);
|
||||
}
|
||||
if (!generic_write_finish_step(&data, expected, ret)) {
|
||||
goto exit;
|
||||
}
|
||||
/* There's no parsing function for octet or character strings. */
|
||||
/* Skip some intermediate lengths, they're boring. */
|
||||
if (expected->len > 10 && data.size == 8) {
|
||||
data.size = expected->len - 2;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(data.output);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_asn1_write_algorithm_identifier(data_t *oid,
|
||||
int par_len,
|
||||
data_t *expected)
|
||||
{
|
||||
generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
|
||||
int ret;
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
unsigned char *buf_complete = NULL;
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
|
||||
for (data.size = 0; data.size <= expected->len + 1; data.size++) {
|
||||
if (!generic_write_start_step(&data)) {
|
||||
goto exit;
|
||||
}
|
||||
ret = mbedtls_asn1_write_algorithm_identifier(
|
||||
&data.p, data.start,
|
||||
(const char *) oid->x, oid->len, par_len);
|
||||
/* If params_len != 0, mbedtls_asn1_write_algorithm_identifier()
|
||||
* assumes that the parameters are already present in the buffer
|
||||
* and returns a length that accounts for this, but our test
|
||||
* data omits the parameters. */
|
||||
if (ret >= 0) {
|
||||
ret -= par_len;
|
||||
}
|
||||
if (!generic_write_finish_step(&data, expected, ret)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
/* Only do a parse-back test if the parameters aren't too large for
|
||||
* a small-heap environment. The boundary is somewhat arbitrary. */
|
||||
if (ret >= 0 && par_len <= 1234) {
|
||||
mbedtls_asn1_buf alg = { 0, 0, NULL };
|
||||
mbedtls_asn1_buf params = { 0, 0, NULL };
|
||||
/* The writing function doesn't write the parameters unless
|
||||
* they're null: it only takes their length as input. But the
|
||||
* parsing function requires the parameters to be present.
|
||||
* Thus make up parameters. */
|
||||
size_t data_len = data.end - data.p;
|
||||
size_t len_complete = data_len + par_len;
|
||||
unsigned char expected_params_tag;
|
||||
size_t expected_params_len;
|
||||
TEST_CALLOC(buf_complete, len_complete);
|
||||
unsigned char *end_complete = buf_complete + len_complete;
|
||||
memcpy(buf_complete, data.p, data_len);
|
||||
if (par_len == 0) {
|
||||
/* mbedtls_asn1_write_algorithm_identifier() wrote a NULL */
|
||||
expected_params_tag = 0x05;
|
||||
expected_params_len = 0;
|
||||
} else if (par_len >= 2 && par_len < 2 + 128) {
|
||||
/* Write an OCTET STRING with a short length encoding */
|
||||
expected_params_tag = buf_complete[data_len] = 0x04;
|
||||
expected_params_len = par_len - 2;
|
||||
buf_complete[data_len + 1] = (unsigned char) expected_params_len;
|
||||
} else if (par_len >= 4 + 128 && par_len < 3 + 256 * 256) {
|
||||
/* Write an OCTET STRING with a two-byte length encoding */
|
||||
expected_params_tag = buf_complete[data_len] = 0x04;
|
||||
expected_params_len = par_len - 4;
|
||||
buf_complete[data_len + 1] = 0x82;
|
||||
buf_complete[data_len + 2] = (unsigned char) (expected_params_len >> 8);
|
||||
buf_complete[data_len + 3] = (unsigned char) (expected_params_len);
|
||||
} else {
|
||||
TEST_FAIL("Bad test data: invalid length of ASN.1 element");
|
||||
}
|
||||
unsigned char *p = buf_complete;
|
||||
TEST_EQUAL(mbedtls_asn1_get_alg(&p, end_complete,
|
||||
&alg, ¶ms), 0);
|
||||
TEST_EQUAL(alg.tag, MBEDTLS_ASN1_OID);
|
||||
TEST_MEMORY_COMPARE(alg.p, alg.len, oid->x, oid->len);
|
||||
TEST_EQUAL(params.tag, expected_params_tag);
|
||||
TEST_EQUAL(params.len, expected_params_len);
|
||||
mbedtls_free(buf_complete);
|
||||
buf_complete = NULL;
|
||||
}
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(data.output);
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
mbedtls_free(buf_complete);
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_ASN1_PARSE_C */
|
||||
void mbedtls_asn1_write_len(int len, data_t *asn1, int buf_len,
|
||||
int result)
|
||||
{
|
||||
int ret;
|
||||
unsigned char buf[150];
|
||||
unsigned char *p;
|
||||
size_t i;
|
||||
size_t read_len;
|
||||
|
||||
memset(buf, GUARD_VAL, sizeof(buf));
|
||||
|
||||
p = buf + GUARD_LEN + buf_len;
|
||||
|
||||
ret = mbedtls_asn1_write_len(&p, buf + GUARD_LEN, (size_t) len);
|
||||
|
||||
TEST_ASSERT(ret == result);
|
||||
|
||||
/* Check for buffer overwrite on both sides */
|
||||
for (i = 0; i < GUARD_LEN; i++) {
|
||||
TEST_ASSERT(buf[i] == GUARD_VAL);
|
||||
TEST_ASSERT(buf[GUARD_LEN + buf_len + i] == GUARD_VAL);
|
||||
}
|
||||
|
||||
if (result >= 0) {
|
||||
TEST_ASSERT(p + asn1->len == buf + GUARD_LEN + buf_len);
|
||||
|
||||
TEST_ASSERT(memcmp(p, asn1->x, asn1->len) == 0);
|
||||
|
||||
/* Read back with mbedtls_asn1_get_len() to check */
|
||||
ret = mbedtls_asn1_get_len(&p, buf + GUARD_LEN + buf_len, &read_len);
|
||||
|
||||
if (len == 0) {
|
||||
TEST_ASSERT(ret == 0);
|
||||
} else {
|
||||
/* Return will be MBEDTLS_ERR_ASN1_OUT_OF_DATA because the rest of
|
||||
* the buffer is missing
|
||||
*/
|
||||
TEST_ASSERT(ret == MBEDTLS_ERR_ASN1_OUT_OF_DATA);
|
||||
}
|
||||
TEST_ASSERT(read_len == (size_t) len);
|
||||
TEST_ASSERT(p == buf + GUARD_LEN + buf_len);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void test_asn1_write_bitstrings(data_t *bitstring, int bits,
|
||||
data_t *expected, int is_named)
|
||||
{
|
||||
generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
|
||||
int ret;
|
||||
int (*func)(unsigned char **p, const unsigned char *start,
|
||||
const unsigned char *buf, size_t bits) =
|
||||
(is_named ? mbedtls_asn1_write_named_bitstring :
|
||||
mbedtls_asn1_write_bitstring);
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
unsigned char *masked_bitstring = NULL;
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
|
||||
/* The API expects `bitstring->x` to contain `bits` bits. */
|
||||
size_t byte_length = (bits + 7) / 8;
|
||||
TEST_ASSERT(bitstring->len >= byte_length);
|
||||
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
TEST_CALLOC(masked_bitstring, byte_length);
|
||||
if (byte_length != 0) {
|
||||
memcpy(masked_bitstring, bitstring->x, byte_length);
|
||||
if (bits % 8 != 0) {
|
||||
masked_bitstring[byte_length - 1] &= ~(0xff >> (bits % 8));
|
||||
}
|
||||
}
|
||||
size_t value_bits = bits;
|
||||
if (is_named) {
|
||||
/* In a named bit string, all trailing 0 bits are removed. */
|
||||
while (byte_length > 0 && masked_bitstring[byte_length - 1] == 0) {
|
||||
--byte_length;
|
||||
}
|
||||
value_bits = 8 * byte_length;
|
||||
if (byte_length > 0) {
|
||||
unsigned char last_byte = masked_bitstring[byte_length - 1];
|
||||
for (unsigned b = 1; b < 0xff && (last_byte & b) == 0; b <<= 1) {
|
||||
--value_bits;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
|
||||
for (data.size = 0; data.size <= expected->len + 1; data.size++) {
|
||||
if (!generic_write_start_step(&data)) {
|
||||
goto exit;
|
||||
}
|
||||
ret = (*func)(&data.p, data.start, bitstring->x, bits);
|
||||
if (!generic_write_finish_step(&data, expected, ret)) {
|
||||
goto exit;
|
||||
}
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
if (ret >= 0) {
|
||||
mbedtls_asn1_bitstring read = { 0, 0, NULL };
|
||||
TEST_EQUAL(mbedtls_asn1_get_bitstring(&data.p, data.end,
|
||||
&read), 0);
|
||||
TEST_MEMORY_COMPARE(read.p, read.len,
|
||||
masked_bitstring, byte_length);
|
||||
TEST_EQUAL(read.unused_bits, 8 * byte_length - value_bits);
|
||||
}
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(data.output);
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
mbedtls_free(masked_bitstring);
|
||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void store_named_data_find(data_t *oid0, data_t *oid1,
|
||||
data_t *oid2, data_t *oid3,
|
||||
data_t *needle, int from, int position)
|
||||
{
|
||||
data_t *oid[4] = { oid0, oid1, oid2, oid3 };
|
||||
mbedtls_asn1_named_data nd[] = {
|
||||
{ { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 },
|
||||
{ { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 },
|
||||
{ { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 },
|
||||
{ { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 },
|
||||
};
|
||||
mbedtls_asn1_named_data *pointers[ARRAY_LENGTH(nd) + 1];
|
||||
size_t i;
|
||||
mbedtls_asn1_named_data *head = NULL;
|
||||
mbedtls_asn1_named_data *found = NULL;
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(nd); i++) {
|
||||
pointers[i] = &nd[i];
|
||||
}
|
||||
pointers[ARRAY_LENGTH(nd)] = NULL;
|
||||
for (i = 0; i < ARRAY_LENGTH(nd); i++) {
|
||||
TEST_CALLOC(nd[i].oid.p, oid[i]->len);
|
||||
memcpy(nd[i].oid.p, oid[i]->x, oid[i]->len);
|
||||
nd[i].oid.len = oid[i]->len;
|
||||
nd[i].next = pointers[i+1];
|
||||
}
|
||||
|
||||
head = pointers[from];
|
||||
found = mbedtls_asn1_store_named_data(&head,
|
||||
(const char *) needle->x,
|
||||
needle->len,
|
||||
NULL, 0);
|
||||
|
||||
/* In any case, the existing list structure must be unchanged. */
|
||||
for (i = 0; i < ARRAY_LENGTH(nd); i++) {
|
||||
TEST_ASSERT(nd[i].next == pointers[i+1]);
|
||||
}
|
||||
|
||||
if (position >= 0) {
|
||||
/* position should have been found and modified. */
|
||||
TEST_ASSERT(head == pointers[from]);
|
||||
TEST_ASSERT(found == pointers[position]);
|
||||
} else {
|
||||
/* A new entry should have been created. */
|
||||
TEST_ASSERT(found == head);
|
||||
TEST_ASSERT(head->next == pointers[from]);
|
||||
for (i = 0; i < ARRAY_LENGTH(nd); i++) {
|
||||
TEST_ASSERT(found != &nd[i]);
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
if (found != NULL && found == head && found != pointers[from]) {
|
||||
mbedtls_free(found->oid.p);
|
||||
mbedtls_free(found);
|
||||
}
|
||||
for (i = 0; i < ARRAY_LENGTH(nd); i++) {
|
||||
mbedtls_free(nd[i].oid.p);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void store_named_data_val_found(int old_len, int new_len)
|
||||
{
|
||||
mbedtls_asn1_named_data nd =
|
||||
{ { 0x06, 3, (unsigned char *) "OID" }, { 0, 0, NULL }, NULL, 0 };
|
||||
mbedtls_asn1_named_data *head = &nd;
|
||||
mbedtls_asn1_named_data *found = NULL;
|
||||
unsigned char *old_val = NULL;
|
||||
unsigned char *new_val = (unsigned char *) "new value";
|
||||
|
||||
if (old_len != 0) {
|
||||
TEST_CALLOC(nd.val.p, (size_t) old_len);
|
||||
old_val = nd.val.p;
|
||||
nd.val.len = old_len;
|
||||
memset(old_val, 'x', old_len);
|
||||
}
|
||||
if (new_len <= 0) {
|
||||
new_len = -new_len;
|
||||
new_val = NULL;
|
||||
}
|
||||
|
||||
found = mbedtls_asn1_store_named_data(&head, "OID", 3,
|
||||
new_val, new_len);
|
||||
TEST_ASSERT(head == &nd);
|
||||
TEST_ASSERT(found == head);
|
||||
|
||||
if (new_val != NULL) {
|
||||
TEST_MEMORY_COMPARE(found->val.p, found->val.len,
|
||||
new_val, (size_t) new_len);
|
||||
}
|
||||
if (new_len == 0) {
|
||||
TEST_ASSERT(found->val.p == NULL);
|
||||
/* If new_len != 0, then new_val != NULL and the length has been checked
|
||||
* above by TEST_MEMORY_COMPARE(). But not here, so we need to check. */
|
||||
TEST_EQUAL(found->val.len, 0);
|
||||
} else if (new_len == old_len) {
|
||||
TEST_ASSERT(found->val.p == old_val);
|
||||
} else {
|
||||
TEST_ASSERT(found->val.p != old_val);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(nd.val.p);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void store_named_data_val_new(int new_len, int set_new_val)
|
||||
{
|
||||
mbedtls_asn1_named_data *head = NULL;
|
||||
mbedtls_asn1_named_data *found = NULL;
|
||||
const unsigned char *oid = (unsigned char *) "OID";
|
||||
size_t oid_len = strlen((const char *) oid);
|
||||
const unsigned char *new_val = (unsigned char *) "new value";
|
||||
|
||||
if (set_new_val == 0) {
|
||||
new_val = NULL;
|
||||
}
|
||||
|
||||
found = mbedtls_asn1_store_named_data(&head,
|
||||
(const char *) oid, oid_len,
|
||||
new_val, (size_t) new_len);
|
||||
TEST_ASSERT(found != NULL);
|
||||
TEST_ASSERT(found == head);
|
||||
TEST_ASSERT(found->oid.p != oid);
|
||||
TEST_MEMORY_COMPARE(found->oid.p, found->oid.len, oid, oid_len);
|
||||
if (new_len == 0) {
|
||||
TEST_ASSERT(found->val.p == NULL);
|
||||
TEST_EQUAL(found->val.len, 0);
|
||||
} else if (new_val == NULL) {
|
||||
TEST_ASSERT(found->val.p != NULL);
|
||||
TEST_EQUAL(found->val.len, new_len);
|
||||
} else {
|
||||
TEST_ASSERT(found->val.p != new_val);
|
||||
TEST_MEMORY_COMPARE(found->val.p, found->val.len,
|
||||
new_val, (size_t) new_len);
|
||||
}
|
||||
|
||||
exit:
|
||||
if (found != NULL) {
|
||||
mbedtls_free(found->oid.p);
|
||||
mbedtls_free(found->val.p);
|
||||
}
|
||||
mbedtls_free(found);
|
||||
}
|
||||
/* END_CASE */
|
||||
296
vendor/mbedtls/tests/suites/test_suite_base64.data
vendored
Normal file
296
vendor/mbedtls/tests/suites/test_suite_base64.data
vendored
Normal file
@@ -0,0 +1,296 @@
|
||||
enc_char (all digits)
|
||||
enc_chars:
|
||||
|
||||
dec_value (all characters)
|
||||
dec_chars:
|
||||
|
||||
Test case mbedtls_base64_encode #1 buffer just right
|
||||
mbedtls_base64_encode:"":"":0:0
|
||||
|
||||
Test case mbedtls_base64_encode #2 buffer just right
|
||||
mbedtls_base64_encode:"f":"Zg==":5:0
|
||||
|
||||
Test case mbedtls_base64_encode #2 buffer too small
|
||||
mbedtls_base64_encode:"f":"Zg==":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Test case mbedtls_base64_encode #3 buffer just right
|
||||
mbedtls_base64_encode:"fo":"Zm8=":5:0
|
||||
|
||||
Test case mbedtls_base64_encode #3 buffer too small
|
||||
mbedtls_base64_encode:"fo":"Zm8=":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Test case mbedtls_base64_encode #4 buffer just right
|
||||
mbedtls_base64_encode:"foo":"Zm9v":5:0
|
||||
|
||||
Test case mbedtls_base64_encode #4 buffer too small
|
||||
mbedtls_base64_encode:"foo":"Zm9v":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Test case mbedtls_base64_encode #5 buffer just right
|
||||
mbedtls_base64_encode:"foob":"Zm9vYg==":9:0
|
||||
|
||||
Test case mbedtls_base64_encode #5 buffer too small
|
||||
mbedtls_base64_encode:"foob":"Zm9vYg==":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Test case mbedtls_base64_encode #6 buffer just right
|
||||
mbedtls_base64_encode:"fooba":"Zm9vYmE=":9:0
|
||||
|
||||
Test case mbedtls_base64_encode #6 buffer too small
|
||||
mbedtls_base64_encode:"fooba":"Zm9vYmE=":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Test case mbedtls_base64_encode #7 buffer just right
|
||||
mbedtls_base64_encode:"foobar":"Zm9vYmFy":9:0
|
||||
|
||||
Test case mbedtls_base64_encode #7 buffer too small
|
||||
mbedtls_base64_encode:"foobar":"Zm9vYmFy":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Test case mbedtls_base64_decode #1
|
||||
mbedtls_base64_decode:"":"":0
|
||||
|
||||
Test case mbedtls_base64_decode #2
|
||||
mbedtls_base64_decode:"Zg==":"f":0
|
||||
|
||||
Test case mbedtls_base64_decode #3
|
||||
mbedtls_base64_decode:"Zm8=":"fo":0
|
||||
|
||||
Test case mbedtls_base64_decode #4
|
||||
mbedtls_base64_decode:"Zm9v":"foo":0
|
||||
|
||||
Test case mbedtls_base64_decode #5
|
||||
mbedtls_base64_decode:"Zm9vYg==":"foob":0
|
||||
|
||||
Test case mbedtls_base64_decode #6
|
||||
mbedtls_base64_decode:"Zm9vYmE=":"fooba":0
|
||||
|
||||
Test case mbedtls_base64_decode #7
|
||||
mbedtls_base64_decode:"Zm9vYmFy":"foobar":0
|
||||
|
||||
Base64 decode (Illegal character)
|
||||
mbedtls_base64_decode:"zm#=":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode (Too much equal signs)
|
||||
mbedtls_base64_decode:"zm===":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode (Invalid char after equal signs)
|
||||
mbedtls_base64_decode:"zm=masd":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode (Space inside string)
|
||||
mbedtls_base64_decode:"zm masd":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
# The next few test cases validate systematically for short inputs that
|
||||
# we require the correct number of trailing equal signs.
|
||||
|
||||
# 4k+1 digits is always wrong (wouldn't encode more bytes than 4k digits)
|
||||
Base64 decode: 1 digit, 0 equals (bad)
|
||||
mbedtls_base64_decode:"Y":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 1 digit, 1 equals (bad)
|
||||
mbedtls_base64_decode:"Y=":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 1 digit, 2 equals (bad)
|
||||
mbedtls_base64_decode:"Y==":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 1 digit, 3 equals (bad)
|
||||
mbedtls_base64_decode:"Y===":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 2 digits, 0 equals (bad)
|
||||
mbedtls_base64_decode:"Yw":"c":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 2 digits, 1 equals (bad)
|
||||
mbedtls_base64_decode:"Yw=":"c":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 2 digits, 2 equals (good)
|
||||
mbedtls_base64_decode:"Yw==":"c":0
|
||||
|
||||
Base64 decode: 2 digits, 3 equals (bad)
|
||||
mbedtls_base64_decode:"Yw===":"c":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 3 digits, 0 equals (bad)
|
||||
mbedtls_base64_decode:"Y28":"co":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 3 digits, 1 equals (good)
|
||||
mbedtls_base64_decode:"Y28=":"co":0
|
||||
|
||||
Base64 decode: 3 digits, 2 equals (bad)
|
||||
mbedtls_base64_decode:"Y28==":"co":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 3 digits, 3 equals (bad)
|
||||
mbedtls_base64_decode:"Y28===":"co":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 4 digits, 0 equals (good)
|
||||
mbedtls_base64_decode:"Y29t":"com":0
|
||||
|
||||
Base64 decode: 4 digits, 1 equals (bad)
|
||||
mbedtls_base64_decode:"Y29t=":"com":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 4 digits, 2 equals (bad)
|
||||
mbedtls_base64_decode:"Y29t==":"com":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 4 digits, 3 equals (bad)
|
||||
mbedtls_base64_decode:"Y29t===":"com":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
# 4k+1 digits is always wrong (wouldn't encode more bytes than 4k digits)
|
||||
Base64 decode: 5 digits, 0 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tc":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 5 digits, 1 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tc=":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 5 digits, 2 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tc==":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 5 digits, 3 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tc===":"com":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 6 digits, 0 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcA":"comp":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 6 digits, 1 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcA=":"comp":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 6 digits, 2 equals (good)
|
||||
mbedtls_base64_decode:"Y29tcA==":"comp":0
|
||||
|
||||
Base64 decode: 6 digits, 3 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcA===":"comp":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 7 digits, 0 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcG8":"compo":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 7 digits, 1 equals (good)
|
||||
mbedtls_base64_decode:"Y29tcG8=":"compo":0
|
||||
|
||||
Base64 decode: 7 digits, 2 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcG8==":"compo":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 7 digits, 3 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcG8===":"compo":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 8 digits, 0 equals (good)
|
||||
mbedtls_base64_decode:"Y29tcG9z":"compos":0
|
||||
|
||||
Base64 decode: 8 digits, 1 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcG9z=":"compos":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 8 digits, 2 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcG9z==":"compos":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode: 8 digits, 3 equals (bad)
|
||||
mbedtls_base64_decode:"Y29tcG9z===":"compos":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode "Zm9vYmFy" (no newline nor '\0' at end)
|
||||
base64_decode_hex_src:"5a6d3976596d4679":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy\n" (LF at end)
|
||||
base64_decode_hex_src:"5a6d3976596d46790a":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy\r\n" (CRLF at end)
|
||||
base64_decode_hex_src:"5a6d3976596d46790d0a":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy\r" (CR at end)
|
||||
base64_decode_hex_src:"5a6d3976596d46790d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode "Zm9vYmFy " (SP at end)
|
||||
base64_decode_hex_src:"5a6d3976596d467920":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy \n" (SP+LF at end)
|
||||
base64_decode_hex_src:"5a6d3976596d4679200a":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy \r\n" (SP+CRLF at end)
|
||||
base64_decode_hex_src:"5a6d3976596d4679200d0a":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy \r" (SP+CR at end)
|
||||
base64_decode_hex_src:"5a6d3976596d4679200d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode "Zm9vYmFy " (2SP at end)
|
||||
base64_decode_hex_src:"5a6d3976596d46792020":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy \n" (2SP+LF at end)
|
||||
base64_decode_hex_src:"5a6d3976596d467920200a":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy \r\n" (2SP+CRLF at end)
|
||||
base64_decode_hex_src:"5a6d3976596d467920200d0a":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmFy \r" (2SP+CR at end)
|
||||
base64_decode_hex_src:"5a6d3976596d467920200d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode "Zm9vYmF\ny" (LF inside)
|
||||
base64_decode_hex_src:"5a6d3976596d460a79":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmF\ry" (CRLF inside)
|
||||
base64_decode_hex_src:"5a6d3976596d460d0a79":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmF\ry" (CR inside)
|
||||
base64_decode_hex_src:"5a6d3976596d460d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode "Zm9vYmF y" (SP inside)
|
||||
base64_decode_hex_src:"5a6d3976596d462079":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode "Zm9vYmF \ny" (SP+LF inside)
|
||||
base64_decode_hex_src:"5a6d3976596d46200a79":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmF \ry" (SP+CRLF inside)
|
||||
base64_decode_hex_src:"5a6d3976596d46200d0a79":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmF \ry" (SP+CR inside)
|
||||
base64_decode_hex_src:"5a6d3976596d46200d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode "Zm9vYmF y" (2SP inside)
|
||||
base64_decode_hex_src:"5a6d3976596d46202079":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 decode "Zm9vYmF \ny" (2SP+LF inside)
|
||||
base64_decode_hex_src:"5a6d3976596d4620200a79":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmF \ry" (2SP+CRLF inside)
|
||||
base64_decode_hex_src:"5a6d3976596d4620200d0a79":"foobar":0
|
||||
|
||||
Base64 decode "Zm9vYmF \ry" (2SP+CR inside)
|
||||
base64_decode_hex_src:"5a6d3976596d4620200d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
|
||||
|
||||
Base64 encode hex #1
|
||||
base64_encode_hex:"010203040506070809":"AQIDBAUGBwgJ":13:0
|
||||
|
||||
Base64 encode hex #2 (buffer too small)
|
||||
base64_encode_hex:"010203040506070809":"AQIDBAUGBwgJ":12:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Base64 encode hex #3
|
||||
base64_encode_hex:"0102030405060708":"AQIDBAUGBwg=":13:0
|
||||
|
||||
Base64 encode hex #4
|
||||
base64_encode_hex:"01020304050607":"AQIDBAUGBw==":13:0
|
||||
|
||||
# Rotate the bytes around so that they end up at each offset modulo 3 in
|
||||
# successive test cases.
|
||||
Base64 encode hex all valid input bytes #0
|
||||
base64_encode_hex:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==":345:0
|
||||
|
||||
Base64 encode hex all valid input bytes #1
|
||||
base64_encode_hex:"0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff00":"AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+f4CBgoOEhYaHiImKi4yNjo+QkZKTlJWWl5iZmpucnZ6foKGio6SlpqeoqaqrrK2ur7CxsrO0tba3uLm6u7y9vr/AwcLDxMXGx8jJysvMzc7P0NHS09TV1tfY2drb3N3e3+Dh4uPk5ebn6Onq6+zt7u/w8fLz9PX29/j5+vv8/f7/AA==":345:0
|
||||
|
||||
Base64 encode hex all valid input bytes #2
|
||||
base64_encode_hex:"02030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff0001":"AgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX2BhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ent8fX5/gIGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp+goaKjpKWmp6ipqqusra6vsLGys7S1tre4ubq7vL2+v8DBwsPExcbHyMnKy8zNzs/Q0dLT1NXW19jZ2tvc3d7f4OHi4+Tl5ufo6err7O3u7/Dx8vP09fb3+Pn6+/z9/v8AAQ==":345:0
|
||||
|
||||
Base64 encode all valid output characters at all offsets
|
||||
base64_encode_hex:"00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbff800420c41461c824a2cc34e3d04524d45565d865a6dc75e7e08628e49669e8a6aaecb6ebf0c72cf4d76df8e7aefcf7effe00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbff800420c41461c824a2cc34e3d04524d45565d865a6dc75e7e08628e49669e8a6aaecb6ebf0c72cf4d76df8e7aefcf7efd0":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/Q":261:0
|
||||
|
||||
Base64 decode hex #1
|
||||
base64_decode_hex:"AQIDBAUGBwgJ":"010203040506070809":9:0
|
||||
|
||||
Base64 decode hex #2 (buffer too small)
|
||||
base64_decode_hex:"AQIDBAUGBwgJ":"010203040506070809":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Base64 decode hex #3
|
||||
base64_decode_hex:"AQIDBAUGBwg=":"0102030405060708":8:0
|
||||
|
||||
Base64 decode hex #4
|
||||
base64_decode_hex:"AQIDBAUGBw==":"01020304050607":7:0
|
||||
|
||||
Base64 decode hex #5 (buffer too small)
|
||||
base64_decode_hex:"AQIDBAUGBw==":"01020304050607":6:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
|
||||
|
||||
Base64 decode all valid input characters at all offsets
|
||||
base64_decode_hex:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/Q":"00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbff800420c41461c824a2cc34e3d04524d45565d865a6dc75e7e08628e49669e8a6aaecb6ebf0c72cf4d76df8e7aefcf7effe00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbff800420c41461c824a2cc34e3d04524d45565d865a6dc75e7e08628e49669e8a6aaecb6ebf0c72cf4d76df8e7aefcf7efd0":195:0
|
||||
|
||||
Base64 Selftest
|
||||
depends_on:MBEDTLS_SELF_TEST
|
||||
base64_selftest:
|
||||
|
||||
222
vendor/mbedtls/tests/suites/test_suite_base64.function
vendored
Normal file
222
vendor/mbedtls/tests/suites/test_suite_base64.function
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
/* BEGIN_HEADER */
|
||||
#include "mbedtls/base64.h"
|
||||
#include "base64_internal.h"
|
||||
#include "constant_time_internal.h"
|
||||
#include <test/constant_flow.h>
|
||||
|
||||
#if defined(MBEDTLS_TEST_HOOKS)
|
||||
static const char base64_digits[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
#endif /* MBEDTLS_TEST_HOOKS */
|
||||
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
* depends_on:MBEDTLS_BASE64_C
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS */
|
||||
void enc_chars()
|
||||
{
|
||||
for (unsigned value = 0; value < 64; value++) {
|
||||
mbedtls_test_set_step(value);
|
||||
TEST_CF_SECRET(&value, sizeof(value));
|
||||
unsigned char digit = mbedtls_ct_base64_enc_char(value);
|
||||
TEST_CF_PUBLIC(&value, sizeof(value));
|
||||
TEST_CF_PUBLIC(&digit, sizeof(digit));
|
||||
TEST_EQUAL(digit, base64_digits[value]);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS */
|
||||
void dec_chars()
|
||||
{
|
||||
char *p;
|
||||
signed char expected;
|
||||
|
||||
for (unsigned c = 0; c <= 0xff; c++) {
|
||||
mbedtls_test_set_step(c);
|
||||
/* base64_digits is 0-terminated. sizeof()-1 excludes the trailing 0. */
|
||||
p = memchr(base64_digits, c, sizeof(base64_digits) - 1);
|
||||
if (p == NULL) {
|
||||
expected = -1;
|
||||
} else {
|
||||
expected = p - base64_digits;
|
||||
}
|
||||
TEST_CF_SECRET(&c, sizeof(c));
|
||||
signed char actual = mbedtls_ct_base64_dec_value(c);
|
||||
TEST_CF_PUBLIC(&c, sizeof(c));
|
||||
TEST_CF_PUBLIC(&actual, sizeof(actual));
|
||||
TEST_EQUAL(actual, expected);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_base64_encode(char *src_string, char *dst_string,
|
||||
int dst_buf_size, int result)
|
||||
{
|
||||
unsigned char src_str[1000];
|
||||
unsigned char dst_str[1000];
|
||||
size_t len, src_len;
|
||||
|
||||
memset(src_str, 0x00, 1000);
|
||||
memset(dst_str, 0x00, 1000);
|
||||
|
||||
strncpy((char *) src_str, src_string, sizeof(src_str) - 1);
|
||||
src_len = strlen((char *) src_str);
|
||||
|
||||
TEST_CF_SECRET(src_str, sizeof(src_str));
|
||||
TEST_ASSERT(mbedtls_base64_encode(dst_str, dst_buf_size, &len, src_str, src_len) == result);
|
||||
TEST_CF_PUBLIC(src_str, sizeof(src_str));
|
||||
|
||||
/* dest_str will have had tainted data copied to it, prevent the TEST_ASSERT below from triggering
|
||||
CF failures by unmarking it. */
|
||||
TEST_CF_PUBLIC(dst_str, len);
|
||||
|
||||
if (result == 0) {
|
||||
TEST_ASSERT(strcmp((char *) dst_str, dst_string) == 0);
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mbedtls_base64_decode(char *src_string, char *dst_string, int result)
|
||||
{
|
||||
unsigned char *src = NULL;
|
||||
size_t src_len = strlen(src_string);
|
||||
unsigned char *dst = NULL;
|
||||
size_t correct_dst_len = strlen(dst_string);
|
||||
size_t dst_size = correct_dst_len;
|
||||
size_t len;
|
||||
|
||||
/* Allocate exactly the size of the input, to ensure there's no buffer
|
||||
* overread in builds with ASan. (src_string has at least one extra null
|
||||
* character at the end.) */
|
||||
TEST_CALLOC(src, src_len);
|
||||
if (src_len != 0) {
|
||||
memcpy(src, src_string, src_len);
|
||||
}
|
||||
|
||||
/* Allocate exactly the size of the input, to ensure there's no buffer
|
||||
* overflow in builds with ASan. */
|
||||
TEST_CALLOC(dst, dst_size);
|
||||
|
||||
/* Test normal operation */
|
||||
TEST_EQUAL(mbedtls_base64_decode(dst, dst_size, &len,
|
||||
src, src_len),
|
||||
result);
|
||||
if (result == 0) {
|
||||
TEST_MEMORY_COMPARE(dst_string, correct_dst_len, dst, len);
|
||||
}
|
||||
|
||||
/* Test an output buffer that's one byte too small */
|
||||
if (result == 0 && dst_size != 0) {
|
||||
mbedtls_free(dst);
|
||||
dst = NULL;
|
||||
TEST_CALLOC(dst, dst_size - 1);
|
||||
TEST_EQUAL(mbedtls_base64_decode(dst, dst_size - 1, &len,
|
||||
src, src_len),
|
||||
MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
|
||||
TEST_EQUAL(correct_dst_len, len);
|
||||
}
|
||||
|
||||
/* Test an empty output buffer. `mbedtls_base64_decode()` must return
|
||||
* `BUFFER_TOO_SMALL` but report the correct output length.
|
||||
* Skip this when dst_size==0 since that would be a valid call to
|
||||
* `mbedtls_base64_decode()` which should return 0.
|
||||
*/
|
||||
if (result == 0 && dst_size != 0) {
|
||||
TEST_EQUAL(mbedtls_base64_decode(NULL, 0, &len,
|
||||
src, src_len),
|
||||
MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
|
||||
TEST_EQUAL(correct_dst_len, len);
|
||||
}
|
||||
|
||||
/* Test dst=NULL with dlen!=0 (explicitly documented as supported) */
|
||||
if (result == 0 && dst_size != 0) {
|
||||
TEST_EQUAL(mbedtls_base64_decode(NULL, 42, &len,
|
||||
src, src_len),
|
||||
MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
|
||||
TEST_EQUAL(correct_dst_len, len);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(src);
|
||||
mbedtls_free(dst);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void base64_encode_hex(data_t *src, char *dst, int dst_buf_size,
|
||||
int result)
|
||||
{
|
||||
unsigned char *res = NULL;
|
||||
size_t len;
|
||||
|
||||
res = mbedtls_test_zero_alloc(dst_buf_size);
|
||||
|
||||
TEST_CF_SECRET(src->x, src->len);
|
||||
TEST_ASSERT(mbedtls_base64_encode(res, dst_buf_size, &len, src->x, src->len) == result);
|
||||
TEST_CF_PUBLIC(src->x, src->len);
|
||||
|
||||
/* res will have had tainted data copied to it, prevent the TEST_ASSERT below from triggering
|
||||
CF failures by unmarking it. */
|
||||
TEST_CF_PUBLIC(res, len);
|
||||
|
||||
if (result == 0) {
|
||||
TEST_ASSERT(len == strlen(dst));
|
||||
TEST_ASSERT(memcmp(dst, res, len) == 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(res);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void base64_decode_hex(char *src, data_t *dst, int dst_buf_size,
|
||||
int result)
|
||||
{
|
||||
unsigned char *res = NULL;
|
||||
size_t len;
|
||||
|
||||
res = mbedtls_test_zero_alloc(dst_buf_size);
|
||||
|
||||
TEST_ASSERT(mbedtls_base64_decode(res, dst_buf_size, &len, (unsigned char *) src,
|
||||
strlen(src)) == result);
|
||||
if (result == 0) {
|
||||
TEST_ASSERT(len == dst->len);
|
||||
TEST_ASSERT(memcmp(dst->x, res, len) == 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
mbedtls_free(res);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void base64_decode_hex_src(data_t *src, char *dst_ref, int result)
|
||||
{
|
||||
unsigned char dst[1000] = { 0 };
|
||||
size_t len;
|
||||
|
||||
TEST_ASSERT(mbedtls_base64_decode(dst, sizeof(dst), &len, src->x, src->len) == result);
|
||||
if (result == 0) {
|
||||
TEST_ASSERT(len == strlen(dst_ref));
|
||||
TEST_ASSERT(memcmp(dst, dst_ref, len) == 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
;;
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
|
||||
void base64_selftest()
|
||||
{
|
||||
TEST_ASSERT(mbedtls_base64_self_test(1) == 0);
|
||||
}
|
||||
/* END_CASE */
|
||||
1706
vendor/mbedtls/tests/suites/test_suite_bignum.function
vendored
Normal file
1706
vendor/mbedtls/tests/suites/test_suite_bignum.function
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5361
vendor/mbedtls/tests/suites/test_suite_bignum.generated.data
vendored
Normal file
5361
vendor/mbedtls/tests/suites/test_suite_bignum.generated.data
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2014
vendor/mbedtls/tests/suites/test_suite_bignum.misc.data
vendored
Normal file
2014
vendor/mbedtls/tests/suites/test_suite_bignum.misc.data
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user