Merge pull request #9693 from Harry-Ramsey/split-revert-error-development

Split error.h and move back error.c to mbedtls
This commit is contained in:
Ronald Cron 2024-10-25 13:12:58 +00:00 committed by GitHub
commit 5f6e69dae5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
90 changed files with 205 additions and 174 deletions

67
include/mbedtls/error.h Normal file
View File

@ -0,0 +1,67 @@
/**
* \file error.h
*
* \brief Error to string translation
*/
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ERROR_H
#define MBEDTLS_ERROR_H
#include "mbedtls/build_info.h"
#include "mbedtls/error_common.h"
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Translate an Mbed TLS error code into a string representation.
* The result is truncated if necessary and always includes a
* terminating null byte.
*
* \param errnum error code
* \param buffer buffer to place representation in
* \param buflen length of the buffer
*/
void mbedtls_strerror(int errnum, char *buffer, size_t buflen);
/**
* \brief Translate the high-level part of an Mbed TLS error code into a string
* representation.
*
* This function returns a const pointer to an un-modifiable string. The caller
* must not try to modify the string. It is intended to be used mostly for
* logging purposes.
*
* \param error_code error code
*
* \return The string representation of the error code, or \c NULL if the error
* code is unknown.
*/
const char *mbedtls_high_level_strerr(int error_code);
/**
* \brief Translate the low-level part of an Mbed TLS error code into a string
* representation.
*
* This function returns a const pointer to an un-modifiable string. The caller
* must not try to modify the string. It is intended to be used mostly for
* logging purposes.
*
* \param error_code error code
*
* \return The string representation of the error code, or \c NULL if the error
* code is unknown.
*/
const char *mbedtls_low_level_strerr(int error_code);
#ifdef __cplusplus
}
#endif
#endif /* error.h */

View File

@ -1,4 +1,5 @@
set(src_x509
error.c
pkcs7.c
x509.c
x509_create.c
@ -34,6 +35,26 @@ set(src_tls
)
if(GEN_FILES)
find_package(Perl REQUIRED)
file(GLOB crypto_error_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/mbedtls/*.h)
file(GLOB tls_error_headers ${MBEDTLS_DIR}/include/mbedtls/*.h)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/error.c
COMMAND
${PERL_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_errors.pl
${CMAKE_CURRENT_SOURCE_DIR}/../tf-psa-crypto/drivers/builtin/include/mbedtls
${CMAKE_CURRENT_SOURCE_DIR}/../include/mbedtls
${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files
${CMAKE_CURRENT_BINARY_DIR}/${TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_DIR}/error.c
DEPENDS
${MBEDTLS_DIR}/scripts/generate_errors.pl
${crypto_error_headers}
${tls_error_headers}
${MBEDTLS_DIR}/scripts/data_files/error.fmt
)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/version_features.c
@ -62,6 +83,7 @@ if(GEN_FILES)
${tls_error_headers}
)
else()
link_to_source(error.c)
link_to_source(version_features.c)
link_to_source(ssl_debug_helpers_generated.c)
endif()

View File

@ -6,7 +6,7 @@ TF_PSA_CRYPTO_CORE_PATH = $(MBEDTLS_PATH)/tf-psa-crypto/core
TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH = $(MBEDTLS_PATH)/tf-psa-crypto/drivers/builtin/src
GENERATED_FILES := \
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/error.c \
error.c \
version_features.c \
ssl_debug_helpers_generated.c \
$(TF_PSA_CRYPTO_CORE_PATH)/psa_crypto_driver_wrappers.h \
@ -148,7 +148,6 @@ OBJS_CRYPTO= \
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/ecp_curves_new.o \
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/entropy.o \
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/entropy_poll.o \
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/error.o \
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/gcm.o \
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/hkdf.o \
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/hmac_drbg.o \
@ -206,6 +205,7 @@ OBJS_X509= \
x509write_crt.o \
x509write_csr.o \
pkcs7.o \
error.o \
# This line is intentionally left blank
OBJS_TLS= \
@ -357,10 +357,10 @@ else
gen_file_dep = |
endif
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/error.c: $(gen_file_dep) ../scripts/generate_errors.pl
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/error.c: $(gen_file_dep) ../scripts/data_files/error.fmt
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/error.c: $(gen_file_dep) $(filter-out %config%,$(wildcard ../include/mbedtls/*.h))
$(TF_PSA_CRYPTO_DRIVERS_BUILTIN_SRC_PATH)/error.c:
error.c: $(gen_file_dep) ../scripts/generate_errors.pl
error.c: $(gen_file_dep) ../scripts/data_files/error.fmt
error.c: $(gen_file_dep) $(filter-out %config%,$(wildcard ../include/mbedtls/*.h))
error.c:
echo " Gen $@"
$(PERL) ../scripts/generate_errors.pl

View File

@ -453,8 +453,9 @@ exit:
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
#ifdef MBEDTLS_ERROR_C
mbedtls_strerror(ret, buf, sizeof(buf));
mbedtls_printf(" - %s\n", buf);
mbedtls_printf("Error code: %d", ret);
/* mbedtls_strerror(ret, buf, sizeof(buf));
mbedtls_printf(" - %s\n", buf); */
#else
mbedtls_printf("\n");
#endif

View File

@ -347,8 +347,9 @@ cleanup:
#if defined(MBEDTLS_ERROR_C)
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
mbedtls_strerror(ret, buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf);
mbedtls_printf("Error code: %d", ret);
/* mbedtls_strerror(ret, buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf); */
}
#endif

View File

@ -469,8 +469,9 @@ exit:
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
#ifdef MBEDTLS_ERROR_C
mbedtls_strerror(ret, buf, sizeof(buf));
mbedtls_printf(" - %s\n", buf);
mbedtls_printf("Error code: %d", ret);
/* mbedtls_strerror(ret, buf, sizeof(buf));
mbedtls_printf(" - %s\n", buf); */
#else
mbedtls_printf("\n");
#endif

View File

@ -142,8 +142,9 @@ exit:
#if defined(MBEDTLS_ERROR_C)
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
mbedtls_strerror(ret, (char *) buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf);
mbedtls_printf("Error code: %d", ret);
/* mbedtls_strerror(ret, (char *) buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf); */
}
#endif

View File

@ -143,8 +143,9 @@ exit:
#if defined(MBEDTLS_ERROR_C)
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
mbedtls_strerror(ret, (char *) buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf);
mbedtls_printf("Error code: %d", ret);
/* mbedtls_strerror(ret, (char *) buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf); */
}
#endif

View File

@ -143,8 +143,9 @@ exit:
#if defined(MBEDTLS_ERROR_C)
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
mbedtls_strerror(ret, (char *) buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf);
mbedtls_printf("Error code: %d", ret);
/* mbedtls_strerror(ret, (char *) buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf); */
}
#endif

View File

@ -117,8 +117,9 @@ exit:
#if defined(MBEDTLS_ERROR_C)
if (exit_code != MBEDTLS_EXIT_SUCCESS) {
mbedtls_strerror(ret, (char *) buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf);
mbedtls_printf("Error code: %d", ret);
/* mbedtls_strerror(ret, (char *) buf, sizeof(buf));
mbedtls_printf(" ! Last error was: %s\n", buf); */
}
#endif

View File

@ -117,8 +117,9 @@ static unsigned long mbedtls_timing_hardclock(void);
#if defined(MBEDTLS_ERROR_C)
#define PRINT_ERROR \
mbedtls_strerror(ret, (char *) tmp, sizeof(tmp)); \
mbedtls_printf("FAILED: %s\n", tmp);
mbedtls_printf("Error code: %d", ret);
/* mbedtls_strerror(ret, (char *) tmp, sizeof(tmp)); \
mbedtls_printf("FAILED: %s\n", tmp); */
#else
#define PRINT_ERROR \
mbedtls_printf("FAILED: -0x%04x\n", (unsigned int) -ret);

View File

@ -1,5 +1,6 @@
set(libs
${mbedcrypto_target}
${mbedx509_target}
)
set(executables

View File

@ -220,6 +220,8 @@ def include_in_crypto(name):
'MBEDTLS_DEBUG_C', # part of libmbedtls
'MBEDTLS_NET_C', # part of libmbedtls
'MBEDTLS_PKCS7_C', # part of libmbedx509
'MBEDTLS_ERROR_C', # part of libmbedx509
'MBEDTLS_ERROR_STRERROR_DUMMY', # part of libmbedx509
]:
return False
if name in EXCLUDE_FROM_CRYPTO:

View File

@ -152,8 +152,4 @@ void mbedtls_strerror(int ret, char *buf, size_t buflen)
#endif /* MBEDTLS_ERROR_C */
#if defined(MBEDTLS_TEST_HOOKS)
void (*mbedtls_test_hook_error_add)(int, int, const char *, int);
#endif
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */

View File

@ -24,7 +24,7 @@ if( @ARGV ) {
$crypto_include_dir = 'tf-psa-crypto/drivers/builtin/include/mbedtls';
$tls_include_dir = 'include/mbedtls';
$data_dir = 'scripts/data_files';
$error_file = 'tf-psa-crypto/drivers/builtin/src/error.c';
$error_file = 'library/error.c';
unless( -d $crypto_include_dir && -d $tls_include_dir && -d $data_dir ) {
chdir '..' or die;
@ -91,6 +91,7 @@ foreach my $file (@files) {
if ($found) {
my $include_name = $file;
$include_name =~ s!.*/!!;
$include_name = "error.h" if ($include_name eq "error_common.h");
push @necessary_include_files, $include_name;
}
}

View File

@ -21,6 +21,10 @@
#error "Error: MBEDTLS_PSA_CRYPTO_C must be enabled on server build"
#endif
#if defined(MBEDTLS_TEST_HOOKS)
void (*mbedtls_test_hook_error_add)(int, int, const char *, int);
#endif
// Returns 1 for success, 0 for failure
int psa_crypto_init_wrapper(
uint8_t *in_params, size_t in_params_len,

View File

@ -170,7 +170,7 @@ check scripts/generate_driver_wrappers.py ${crypto_core_dir}/psa_crypto_driver_w
# Additional checks for Mbed TLS only
if in_mbedtls_repo; then
check scripts/generate_errors.pl ${builtin_drivers_dir}/error.c
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

View File

@ -717,4 +717,7 @@ void mbedtls_test_err_add_check(int high, int low,
line, file);
}
}
void (*mbedtls_test_hook_error_add)(int, int, const char *, int);
#endif /* MBEDTLS_TEST_HOOKS */

View File

@ -58,13 +58,13 @@
#include "mbedtls/ecdh.h"
#include "mbedtls/ecp.h"
#include "mbedtls/entropy.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/gcm.h"
#include "mbedtls/md5.h"
#include "mbedtls/pk.h"
#include "pk_wrap.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/ripemd160.h"
#include "mbedtls/rsa.h"
#include "mbedtls/sha1.h"

View File

@ -1,34 +1,6 @@
add_subdirectory(src)
file(GLOB src_builtin RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.c)
if(NOT "src/error.c" IN_LIST "${src_builtin}")
list(APPEND src_builtin src/error.c)
endif()
if(GEN_FILES)
find_package(Perl REQUIRED)
file(GLOB crypto_error_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/mbedtls/*.h)
file(GLOB tls_error_headers ${MBEDTLS_DIR}/include/mbedtls/*.h)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/src/error.c
COMMAND
${PERL_EXECUTABLE}
${MBEDTLS_DIR}/scripts/generate_errors.pl
${CMAKE_CURRENT_SOURCE_DIR}/include/mbedtls
${MBEDTLS_DIR}/include/mbedtls
${MBEDTLS_DIR}/scripts/data_files
${CMAKE_CURRENT_BINARY_DIR}/src/error.c
DEPENDS
${MBEDTLS_DIR}/scripts/generate_errors.pl
${crypto_error_headers}
${tls_error_headers}
${MBEDTLS_DIR}/scripts/data_files/error.fmt
)
else()
link_to_source(src/error.c)
endif()
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-declarations -Wmissing-prototypes")

View File

@ -1,14 +1,14 @@
/**
* \file error.h
* \file error_common.h
*
* \brief Error to string translation
* \brief Error codes
*/
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ERROR_H
#define MBEDTLS_ERROR_H
#ifndef MBEDTLS_ERROR_COMMON_H
#define MBEDTLS_ERROR_COMMON_H
#include "mbedtls/build_info.h"
@ -152,49 +152,8 @@ static inline int mbedtls_error_add(int high, int low,
return high + low;
}
/**
* \brief Translate an Mbed TLS error code into a string representation.
* The result is truncated if necessary and always includes a
* terminating null byte.
*
* \param errnum error code
* \param buffer buffer to place representation in
* \param buflen length of the buffer
*/
void mbedtls_strerror(int errnum, char *buffer, size_t buflen);
/**
* \brief Translate the high-level part of an Mbed TLS error code into a string
* representation.
*
* This function returns a const pointer to an un-modifiable string. The caller
* must not try to modify the string. It is intended to be used mostly for
* logging purposes.
*
* \param error_code error code
*
* \return The string representation of the error code, or \c NULL if the error
* code is unknown.
*/
const char *mbedtls_high_level_strerr(int error_code);
/**
* \brief Translate the low-level part of an Mbed TLS error code into a string
* representation.
*
* This function returns a const pointer to an un-modifiable string. The caller
* must not try to modify the string. It is intended to be used mostly for
* logging purposes.
*
* \param error_code error code
*
* \return The string representation of the error code, or \c NULL if the error
* code is unknown.
*/
const char *mbedtls_low_level_strerr(int error_code);
#ifdef __cplusplus
}
#endif
#endif /* error.h */
#endif /* error_common.h */

View File

@ -20,7 +20,7 @@
#include "mbedtls/aes.h"
#include "mbedtls/platform.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#if defined(MBEDTLS_AES_USE_HARDWARE_ONLY)
#if !((defined(MBEDTLS_ARCH_IS_ARMV8_A) && defined(MBEDTLS_AESCE_C)) || \

View File

@ -12,7 +12,7 @@
#include "mbedtls/asn1.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -11,7 +11,7 @@
defined(PSA_HAVE_ALG_SOME_ECDSA)
#include "mbedtls/asn1write.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -30,7 +30,7 @@
#include "bignum_internal.h"
#include "bn_mul.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "constant_time_internal.h"
#include <limits.h>

View File

@ -11,7 +11,7 @@
#include <string.h>
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/platform_util.h"
#include "constant_time_internal.h"

View File

@ -12,7 +12,7 @@
#include <string.h>
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/bignum.h"
#include "mbedtls/platform.h"

View File

@ -11,7 +11,7 @@
#include <string.h>
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/platform.h"

View File

@ -20,7 +20,7 @@
#include "mbedtls/ccm.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/constant_time.h"
#if defined(MBEDTLS_BLOCK_CIPHER_C)

View File

@ -15,7 +15,7 @@
#include "mbedtls/chacha20.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <stddef.h>
#include <string.h>

View File

@ -12,7 +12,7 @@
#include "mbedtls/chachapoly.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/constant_time.h"
#include <string.h>

View File

@ -16,7 +16,7 @@
#include "mbedtls/cipher.h"
#include "cipher_wrap.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/constant_time.h"
#include "constant_time_internal.h"

View File

@ -14,7 +14,7 @@
#if defined(MBEDTLS_CIPHER_C)
#include "cipher_wrap.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#if defined(MBEDTLS_CHACHAPOLY_C)
#include "mbedtls/chachapoly.h"

View File

@ -32,7 +32,7 @@
#include "mbedtls/cmac.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/platform.h"
#include "constant_time_internal.h"

View File

@ -16,7 +16,7 @@
#include "common.h"
#include "constant_time_internal.h"
#include "mbedtls/constant_time.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/platform_util.h"
#include <string.h>

View File

@ -17,7 +17,7 @@
#include "ctr.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -16,7 +16,7 @@
#if defined(MBEDTLS_DES_C)
#include "mbedtls/des.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/platform_util.h"
#include <string.h>

View File

@ -19,7 +19,7 @@
#include "mbedtls/dhm.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -18,7 +18,7 @@
#include "mbedtls/ecdh.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -27,7 +27,7 @@
#include "mbedtls/platform.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#if defined(MBEDTLS_ECP_RESTARTABLE)

View File

@ -16,7 +16,7 @@
#include "mbedtls/ecjpake.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -36,7 +36,7 @@
#include "mbedtls/ecp.h"
#include "mbedtls/threading.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "bn_mul.h"
#include "ecp_invasive.h"

View File

@ -13,7 +13,7 @@
#include "mbedtls/ecp.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "bn_mul.h"
#include "bignum_core.h"

View File

@ -14,7 +14,7 @@
#include "mbedtls/ecp.h"
#include "mbedtls/platform.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/platform.h"

View File

@ -12,7 +12,7 @@
#include "mbedtls/entropy.h"
#include "entropy_poll.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -20,7 +20,7 @@
#include "mbedtls/entropy.h"
#include "entropy_poll.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#if defined(MBEDTLS_TIMING_C)
#include "mbedtls/timing.h"

View File

@ -22,7 +22,7 @@
#include "mbedtls/gcm.h"
#include "mbedtls/platform.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/constant_time.h"
#if defined(MBEDTLS_BLOCK_CIPHER_C)

View File

@ -11,7 +11,7 @@
#include <string.h>
#include "mbedtls/hkdf.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
int mbedtls_hkdf(const mbedtls_md_info_t *md, const unsigned char *salt,
size_t salt_len, const unsigned char *ikm, size_t ikm_len,

View File

@ -17,7 +17,7 @@
#include "mbedtls/hmac_drbg.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -28,7 +28,7 @@
#include "mbedtls/lms.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "psa_util_internal.h"
#include "psa/crypto.h"

View File

@ -29,7 +29,7 @@
#include "psa/crypto.h"
#include "psa_util_internal.h"
#include "mbedtls/lms.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/platform.h"

View File

@ -32,7 +32,7 @@
#include "mbedtls/md.h"
#include "md_wrap.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/md5.h"
#include "mbedtls/ripemd160.h"

View File

@ -16,7 +16,7 @@
#include "mbedtls/md5.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -21,7 +21,7 @@
#include "mbedtls/nist_kw.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/constant_time.h"
#include "constant_time_internal.h"

View File

@ -13,7 +13,7 @@
#include "mbedtls/oid.h"
#include "mbedtls/rsa.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/pk.h"
#include <stdio.h>

View File

@ -16,7 +16,7 @@
#include "mbedtls/md.h"
#include "mbedtls/cipher.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -14,7 +14,7 @@
#include "pk_internal.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#if defined(MBEDTLS_RSA_C)
#include "mbedtls/rsa.h"

View File

@ -8,7 +8,7 @@
#include "common.h"
#include "mbedtls/pk.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/ecp.h"
#include "pk_internal.h"

View File

@ -12,7 +12,7 @@
#if defined(MBEDTLS_PK_C)
#include "pk_wrap.h"
#include "pk_internal.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/psa_util.h"
/* Even if RSA not activated, for the sake of RSA-alt */

View File

@ -21,7 +21,7 @@
#include "mbedtls/cipher.h"
#endif /* MBEDTLS_CIPHER_C */
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -20,7 +20,7 @@
#if defined(MBEDTLS_PKCS5_C)
#include "mbedtls/pkcs5.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#if defined(MBEDTLS_ASN1_PARSE_C)
#include "mbedtls/asn1.h"

View File

@ -14,7 +14,7 @@
#include "mbedtls/oid.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/platform.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/ecp.h"
#include "pk_internal.h"

View File

@ -13,7 +13,7 @@
#include "mbedtls/asn1write.h"
#include "mbedtls/oid.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "pk_internal.h"
#include <string.h>

View File

@ -11,7 +11,7 @@
#include "mbedtls/platform.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
/* The compile time configuration of memory allocation via the macros
* MBEDTLS_PLATFORM_{FREE/CALLOC}_MACRO takes precedence over the runtime

View File

@ -12,7 +12,7 @@
#include "mbedtls/poly1305.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -21,7 +21,7 @@
#include "mbedtls/chachapoly.h"
#include "mbedtls/cipher.h"
#include "mbedtls/gcm.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
static psa_status_t psa_aead_setup(
mbedtls_psa_aead_operation_t *operation,

View File

@ -15,7 +15,7 @@
#include "psa_crypto_random_impl.h"
#include "mbedtls/cipher.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -23,7 +23,7 @@
#include <mbedtls/ecdsa.h>
#include <mbedtls/ecdh.h>
#include <mbedtls/ecp.h>
#include <mbedtls/error.h>
#include <mbedtls/error_common.h>
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_BASIC) || \
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR_IMPORT) || \

View File

@ -21,7 +21,7 @@
#include "psa_crypto_ffdh.h"
#include "psa_crypto_random_impl.h"
#include "mbedtls/platform.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_EXPORT) || \
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DH_KEY_PAIR_GENERATE) || \

View File

@ -14,7 +14,7 @@
#include "psa_crypto_core.h"
#include "psa_crypto_hash.h"
#include <mbedtls/error.h>
#include <mbedtls/error_common.h>
#include <string.h>
#if defined(MBEDTLS_PSA_BUILTIN_HASH)

View File

@ -16,7 +16,7 @@
#include "psa_crypto_mac.h"
#include <mbedtls/md.h>
#include <mbedtls/error.h>
#include <mbedtls/error_common.h>
#include "mbedtls/constant_time.h"
#include <string.h>

View File

@ -19,7 +19,7 @@
#include "psa_util_internal.h"
#include <mbedtls/platform.h>
#include <mbedtls/error.h>
#include <mbedtls/error_common.h>
#include <string.h>
/*

View File

@ -23,7 +23,7 @@
#include "mbedtls/platform.h"
#include <mbedtls/rsa.h>
#include <mbedtls/error.h>
#include <mbedtls/error_common.h>
#include "rsa_internal.h"
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) || \

View File

@ -9,7 +9,7 @@
#include "common.h"
/* This is needed for MBEDTLS_ERR_XXX macros */
#include <mbedtls/error.h>
#include <mbedtls/error_common.h>
#if defined(MBEDTLS_ASN1_WRITE_C)
#include <mbedtls/asn1write.h>

View File

@ -17,7 +17,7 @@
#include "mbedtls/ripemd160.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -35,7 +35,7 @@
#include "mbedtls/oid.h"
#include "mbedtls/asn1write.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "constant_time_internal.h"
#include "mbedtls/constant_time.h"
#include "md_psa.h"

View File

@ -16,7 +16,7 @@
#include "mbedtls/sha1.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -54,7 +54,7 @@
#include "mbedtls/sha256.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -43,7 +43,7 @@
#include "mbedtls/sha3.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include <string.h>

View File

@ -32,7 +32,7 @@
#include "mbedtls/sha512.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#if defined(_MSC_VER) || defined(__WATCOMC__)
#define UL64(x) x##ui64

View File

@ -16,9 +16,7 @@
#include <stdlib.h>
#include <string.h>
#if defined(MBEDTLS_ERROR_C)
#include "mbedtls/error.h"
#endif
#include "mbedtls/error_common.h"
#include "mbedtls/platform.h"
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)

View File

@ -232,9 +232,7 @@ 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

View File

@ -1,6 +1,6 @@
/* BEGIN_HEADER */
#include "mbedtls/dhm.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
static int check_get_value(const mbedtls_dhm_context *ctx,
mbedtls_dhm_parameter param,

View File

@ -7,7 +7,7 @@
#include "mbedtls/asn1.h"
#include "mbedtls/base64.h"
#include "mbedtls/ecp.h"
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/rsa.h"
#include "rsa_internal.h"
#include "pk_internal.h"

View File

@ -1,5 +1,5 @@
/* BEGIN_HEADER */
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/pkcs5.h"
#include "mbedtls/cipher.h"
/* END_HEADER */

View File

@ -1,5 +1,5 @@
/* BEGIN_HEADER */
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/pk.h"
#include "mbedtls/pem.h"
#include "mbedtls/oid.h"

View File

@ -9,7 +9,7 @@
#if defined(MBEDTLS_PSA_ITS_FILE_C)
#include "psa_crypto_its.h"
#else /* Native ITS implementation */
#include "psa/error.h"
#include "psa/error_common.h"
#include "psa/internal_trusted_storage.h"
#endif

View File

@ -1,5 +1,5 @@
/* BEGIN_HEADER */
#include "mbedtls/error.h"
#include "mbedtls/error_common.h"
#include "mbedtls/rsa.h"
#include "bignum_core.h"
#include "rsa_alt_helpers.h"