Declare dependency on bignum in sample programs

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2023-12-23 18:44:20 +01:00
parent 52cc2a6368
commit 9552a52f5f
2 changed files with 30 additions and 38 deletions

View file

@ -9,8 +9,19 @@
#include "mbedtls/platform.h" #include "mbedtls/platform.h"
#if defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_FS_IO) && \ #if !defined(MBEDTLS_PK_WRITE_C) || !defined(MBEDTLS_PEM_WRITE_C) || \
defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C) !defined(MBEDTLS_FS_IO) || !defined(MBEDTLS_ENTROPY_C) || \
!defined(MBEDTLS_CTR_DRBG_C) || !defined(MBEDTLS_BIGNUM_C)
int main(void)
{
mbedtls_printf("MBEDTLS_PK_WRITE_C and/or MBEDTLS_FS_IO and/or "
"MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or "
"MBEDTLS_PEM_WRITE_C and/or MBEDTLS_BIGNUM_C "
"not defined.\n");
mbedtls_exit(0);
}
#else
#include "mbedtls/error.h" #include "mbedtls/error.h"
#include "mbedtls/pk.h" #include "mbedtls/pk.h"
#include "mbedtls/ecdsa.h" #include "mbedtls/ecdsa.h"
@ -61,7 +72,6 @@ int dev_random_entropy_poll(void *data, unsigned char *output,
return 0; return 0;
} }
#endif /* !_WIN32 */ #endif /* !_WIN32 */
#endif
#if defined(MBEDTLS_ECP_C) #if defined(MBEDTLS_ECP_C)
#define DFL_EC_CURVE mbedtls_ecp_curve_list()->grp_id #define DFL_EC_CURVE mbedtls_ecp_curve_list()->grp_id
@ -96,19 +106,6 @@ int dev_random_entropy_poll(void *data, unsigned char *output,
USAGE_DEV_RANDOM \ USAGE_DEV_RANDOM \
"\n" "\n"
#if !defined(MBEDTLS_PK_WRITE_C) || !defined(MBEDTLS_PEM_WRITE_C) || \
!defined(MBEDTLS_FS_IO) || !defined(MBEDTLS_ENTROPY_C) || \
!defined(MBEDTLS_CTR_DRBG_C)
int main(void)
{
mbedtls_printf("MBEDTLS_PK_WRITE_C and/or MBEDTLS_FS_IO and/or "
"MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or "
"MBEDTLS_PEM_WRITE_C"
"not defined.\n");
mbedtls_exit(0);
}
#else
/* /*
* global options * global options
@ -478,5 +475,4 @@ exit:
mbedtls_exit(exit_code); mbedtls_exit(exit_code);
} }
#endif /* MBEDTLS_PK_WRITE_C && MBEDTLS_PEM_WRITE_C && MBEDTLS_FS_IO && #endif /* program viability conditions */
* MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */

View file

@ -9,9 +9,21 @@
#include "mbedtls/platform.h" #include "mbedtls/platform.h"
#if defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_PK_WRITE_C) && \ #if !defined(MBEDTLS_PK_PARSE_C) || \
defined(MBEDTLS_FS_IO) && \ !defined(MBEDTLS_PK_WRITE_C) || \
defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C) !defined(MBEDTLS_FS_IO) || \
!defined(MBEDTLS_ENTROPY_C) || \
!defined(MBEDTLS_CTR_DRBG_C) || \
!defined(MBEDTLS_BIGNUM_C)
int main(void)
{
mbedtls_printf("MBEDTLS_PK_PARSE_C and/or MBEDTLS_PK_WRITE_C and/or "
"MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or "
"MBEDTLS_FS_IO and/or MBEDTLS_BIGNUM_C not defined.\n");
mbedtls_exit(0);
}
#else
#include "mbedtls/error.h" #include "mbedtls/error.h"
#include "mbedtls/pk.h" #include "mbedtls/pk.h"
#include "mbedtls/error.h" #include "mbedtls/error.h"
@ -21,7 +33,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#endif
#if defined(MBEDTLS_PEM_WRITE_C) #if defined(MBEDTLS_PEM_WRITE_C)
#define USAGE_OUT \ #define USAGE_OUT \
@ -66,20 +77,6 @@
USAGE_OUT \ USAGE_OUT \
"\n" "\n"
#if !defined(MBEDTLS_PK_PARSE_C) || \
!defined(MBEDTLS_PK_WRITE_C) || \
!defined(MBEDTLS_FS_IO) || \
!defined(MBEDTLS_ENTROPY_C) || \
!defined(MBEDTLS_CTR_DRBG_C)
int main(void)
{
mbedtls_printf("MBEDTLS_PK_PARSE_C and/or MBEDTLS_PK_WRITE_C and/or "
"MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C and/or "
"MBEDTLS_FS_IO not defined.\n");
mbedtls_exit(0);
}
#else
/* /*
* global options * global options
@ -495,5 +492,4 @@ exit:
mbedtls_exit(exit_code); mbedtls_exit(exit_code);
} }
#endif /* MBEDTLS_PK_PARSE_C && MBEDTLS_PK_WRITE_C && MBEDTLS_FS_IO && #endif /* program viability conditions */
MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */