mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-10-30 12:33:33 +00:00
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:
@@ -15,14 +15,12 @@
|
||||
|
||||
#if !defined(MBEDTLS_X509_CRT_WRITE_C) || \
|
||||
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_FS_IO) || \
|
||||
!defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CTR_DRBG_C) || \
|
||||
!defined(MBEDTLS_ERROR_C) || !defined(PSA_WANT_ALG_SHA_256) || \
|
||||
!defined(MBEDTLS_PEM_WRITE_C) || !defined(MBEDTLS_MD_C)
|
||||
int main(void)
|
||||
{
|
||||
mbedtls_printf("MBEDTLS_X509_CRT_WRITE_C and/or MBEDTLS_X509_CRT_PARSE_C and/or "
|
||||
"MBEDTLS_FS_IO and/or PSA_WANT_ALG_SHA_256 and/or "
|
||||
"MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or "
|
||||
"MBEDTLS_ERROR_C not defined.\n");
|
||||
mbedtls_exit(0);
|
||||
}
|
||||
@@ -31,8 +29,6 @@ int main(void)
|
||||
#include "mbedtls/x509_crt.h"
|
||||
#include "mbedtls/x509_csr.h"
|
||||
#include "mbedtls/oid.h"
|
||||
#include "mbedtls/private/entropy.h"
|
||||
#include "mbedtls/private/ctr_drbg.h"
|
||||
#include "mbedtls/error.h"
|
||||
#include "test/helpers.h"
|
||||
|
||||
@@ -306,9 +302,6 @@ int main(int argc, char *argv[])
|
||||
unsigned char serial[MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN];
|
||||
size_t serial_len;
|
||||
mbedtls_asn1_sequence *ext_key_usage;
|
||||
mbedtls_entropy_context entropy;
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
const char *pers = "crt example app";
|
||||
mbedtls_x509_san_list *cur, *prev;
|
||||
uint8_t ip[4] = { 0 };
|
||||
/*
|
||||
@@ -317,8 +310,6 @@ int main(int argc, char *argv[])
|
||||
mbedtls_x509write_crt_init(&crt);
|
||||
mbedtls_pk_init(&loaded_issuer_key);
|
||||
mbedtls_pk_init(&loaded_subject_key);
|
||||
mbedtls_ctr_drbg_init(&ctr_drbg);
|
||||
mbedtls_entropy_init(&entropy);
|
||||
#if defined(MBEDTLS_X509_CSR_PARSE_C)
|
||||
mbedtls_x509_csr_init(&csr);
|
||||
#endif
|
||||
@@ -681,15 +672,6 @@ usage:
|
||||
mbedtls_printf(" . Seeding the random number generator...");
|
||||
fflush(stdout);
|
||||
|
||||
if ((ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
|
||||
(const unsigned char *) pers,
|
||||
strlen(pers))) != 0) {
|
||||
mbedtls_strerror(ret, buf, sizeof(buf));
|
||||
mbedtls_printf(" failed\n ! mbedtls_ctr_drbg_seed returned %d - %s\n",
|
||||
ret, buf);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mbedtls_printf(" ok\n");
|
||||
|
||||
// Parse serial to MPI
|
||||
@@ -1022,12 +1004,10 @@ exit:
|
||||
mbedtls_x509write_crt_free(&crt);
|
||||
mbedtls_pk_free(&loaded_subject_key);
|
||||
mbedtls_pk_free(&loaded_issuer_key);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
#endif /* MBEDTLS_X509_CRT_WRITE_C && MBEDTLS_X509_CRT_PARSE_C &&
|
||||
MBEDTLS_FS_IO && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C &&
|
||||
MBEDTLS_FS_IO
|
||||
MBEDTLS_ERROR_C && MBEDTLS_PEM_WRITE_C */
|
||||
|
||||
Reference in New Issue
Block a user