Remove Deprecated Items From Sample Programs

Remove the drbg module and entropy functions from the sample programs as these are
now handled by their PSA equivalents

Signed-off-by: Ben Taylor <[email protected]>
This commit is contained in:
Ben Taylor
2026-01-14 13:01:22 +00:00
parent 69e117fee0
commit fe978ac1f3
35 changed files with 37 additions and 579 deletions
@@ -5,8 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
#include "mbedtls/build_info.h"
#include "mbedtls/platform.h"
@@ -6,8 +6,6 @@
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
#include "mbedtls/build_info.h"
#include "mbedtls/platform.h"
@@ -6,8 +6,6 @@
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
#include "mbedtls/build_info.h"
#include "mbedtls/platform.h"
-2
View File
@@ -5,8 +5,6 @@
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
#include "mbedtls/build_info.h"
#include "mbedtls/platform.h"
-54
View File
@@ -9,9 +9,6 @@
#include "mbedtls/build_info.h"
#include "mbedtls/private/entropy.h"
#include "mbedtls/private/hmac_drbg.h"
#include "mbedtls/private/ctr_drbg.h"
#include "mbedtls/private/gcm.h"
#include "mbedtls/private/ccm.h"
#include "mbedtls/private/cmac.h"
@@ -204,48 +201,6 @@ static int run_test_snprintf(void)
test_snprintf(5, "123", 3) != 0;
}
/*
* Check if a seed file is present, and if not create one for the entropy
* self-test. If this fails, we attempt the test anyway, so no error is passed
* back.
*/
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_ENTROPY_C)
#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
static void dummy_entropy(unsigned char *output, size_t output_size)
{
srand(1);
for (size_t i = 0; i < output_size; i++) {
output[i] = rand();
}
}
static void create_entropy_seed_file(void)
{
int result;
unsigned char seed_value[MBEDTLS_ENTROPY_BLOCK_SIZE];
/* Attempt to read the entropy seed file. If this fails - attempt to write
* to the file to ensure one is present. */
result = mbedtls_platform_std_nv_seed_read(seed_value,
MBEDTLS_ENTROPY_BLOCK_SIZE);
if (0 == result) {
return;
}
dummy_entropy(seed_value, MBEDTLS_ENTROPY_BLOCK_SIZE);
mbedtls_platform_std_nv_seed_write(seed_value, MBEDTLS_ENTROPY_BLOCK_SIZE);
}
#endif
static int mbedtls_entropy_self_test_wrapper(int verbose)
{
#if defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_PSA_DRIVER_GET_ENTROPY)
create_entropy_seed_file();
#endif
return mbedtls_entropy_self_test(verbose);
}
#endif
#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
static int mbedtls_memory_buffer_alloc_free_and_self_test(int verbose)
@@ -328,21 +283,12 @@ const selftest_t selftests[] =
#if defined(MBEDTLS_ARIA_C)
{ "aria", mbedtls_aria_self_test },
#endif
#if defined(MBEDTLS_CTR_DRBG_C)
{ "ctr_drbg", mbedtls_ctr_drbg_self_test },
#endif
#if defined(MBEDTLS_HMAC_DRBG_C)
{ "hmac_drbg", mbedtls_hmac_drbg_self_test },
#endif
#if defined(MBEDTLS_ECP_C)
{ "ecp", mbedtls_ecp_self_test },
#endif
#if defined(MBEDTLS_ECJPAKE_C)
{ "ecjpake", mbedtls_ecjpake_self_test },
#endif
#if defined(MBEDTLS_ENTROPY_C)
{ "entropy", mbedtls_entropy_self_test_wrapper },
#endif
#if defined(MBEDTLS_PKCS5_C)
{ "pkcs5", mbedtls_pkcs5_self_test },
#endif
-3
View File
@@ -11,9 +11,6 @@
* example of good general usage.
*/
#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
#include "mbedtls/build_info.h"
#include <limits.h>