mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-08-30 23:09:56 +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:
@@ -11,7 +11,6 @@
|
||||
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
#define _XOPEN_SOURCE 600
|
||||
#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
|
||||
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
@@ -21,14 +20,14 @@
|
||||
#if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \
|
||||
!defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_CLI_C) || \
|
||||
!defined(MBEDTLS_NET_C) || !defined(MBEDTLS_RSA_C) || \
|
||||
!defined(MBEDTLS_CTR_DRBG_C) || !defined(MBEDTLS_X509_CRT_PARSE_C) || \
|
||||
!defined(MBEDTLS_X509_CRT_PARSE_C) || \
|
||||
!defined(MBEDTLS_FS_IO)
|
||||
int main(void)
|
||||
{
|
||||
mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or "
|
||||
"MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_CLI_C and/or "
|
||||
"MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or "
|
||||
"MBEDTLS_CTR_DRBG_C and/or MBEDTLS_X509_CRT_PARSE_C "
|
||||
"and/or MBEDTLS_X509_CRT_PARSE_C "
|
||||
"not defined.\n");
|
||||
mbedtls_exit(0);
|
||||
}
|
||||
@@ -38,8 +37,6 @@ int main(void)
|
||||
#include "mbedtls/error.h"
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#include "mbedtls/ssl.h"
|
||||
#include "mbedtls/private/entropy.h"
|
||||
#include "mbedtls/private/ctr_drbg.h"
|
||||
#include "test/certs.h"
|
||||
#include "mbedtls/x509.h"
|
||||
|
||||
@@ -334,10 +331,7 @@ int main(int argc, char *argv[])
|
||||
unsigned char buf[1024];
|
||||
#endif
|
||||
char hostname[32];
|
||||
const char *pers = "ssl_mail_client";
|
||||
|
||||
mbedtls_entropy_context entropy;
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
mbedtls_ssl_context ssl;
|
||||
mbedtls_ssl_config conf;
|
||||
mbedtls_x509_crt cacert;
|
||||
@@ -358,8 +352,6 @@ int main(int argc, char *argv[])
|
||||
mbedtls_x509_crt_init(&cacert);
|
||||
mbedtls_x509_crt_init(&clicert);
|
||||
mbedtls_pk_init(&pkey);
|
||||
mbedtls_ctr_drbg_init(&ctr_drbg);
|
||||
mbedtls_entropy_init(&entropy);
|
||||
|
||||
psa_status_t status = psa_crypto_init();
|
||||
if (status != PSA_SUCCESS) {
|
||||
@@ -456,13 +448,6 @@ usage:
|
||||
mbedtls_printf("\n . 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_printf(" failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mbedtls_printf(" ok\n");
|
||||
|
||||
/*
|
||||
@@ -800,12 +785,9 @@ exit:
|
||||
mbedtls_pk_free(&pkey);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
mbedtls_psa_crypto_free();
|
||||
|
||||
mbedtls_exit(exit_code);
|
||||
}
|
||||
#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C &&
|
||||
MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C **
|
||||
MBEDTLS_CTR_DRBG_C */
|
||||
MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C */
|
||||
|
||||
Reference in New Issue
Block a user