mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 00:15:37 +01:00
Add guards around code that is specific to dynamically-loaded groups
For some curves (semi-coincidentally, short Weierstrass curves), the ECP module calculates some group parameters dynamically. Build the code to calculate the parameters only if a relevant curve is enabled. This fixes an unused function warning when building with only Montgomery curves. Signed-off-by: Gilles Peskine <gilles.peskine@arm.com>
This commit is contained in:
parent
e8c04fed51
commit
aa9493a411
@ -553,6 +553,22 @@ static const mbedtls_mpi_uint brainpoolP512r1_n[] = {
|
||||
};
|
||||
#endif /* MBEDTLS_ECP_DP_BP512R1_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_BP256R1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_BP384R1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) || \
|
||||
defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
|
||||
/* For these curves, we build the group parameters dynamically. */
|
||||
#define ECP_LOAD_GROUP
|
||||
#endif
|
||||
|
||||
#if defined(ECP_LOAD_GROUP)
|
||||
/*
|
||||
* Create an MPI from embedded constants
|
||||
* (assumes len is an exact multiple of sizeof mbedtls_mpi_uint)
|
||||
@ -603,6 +619,7 @@ static int ecp_group_load( mbedtls_ecp_group *grp,
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* ECP_LOAD_GROUP */
|
||||
|
||||
#if defined(MBEDTLS_ECP_NIST_OPTIM)
|
||||
/* Forward declarations */
|
||||
@ -644,6 +661,7 @@ static int ecp_mod_p224k1( mbedtls_mpi * );
|
||||
static int ecp_mod_p256k1( mbedtls_mpi * );
|
||||
#endif
|
||||
|
||||
#if defined(ECP_LOAD_GROUP)
|
||||
#define LOAD_GROUP_A( G ) ecp_group_load( grp, \
|
||||
G ## _p, sizeof( G ## _p ), \
|
||||
G ## _a, sizeof( G ## _a ), \
|
||||
@ -659,6 +677,7 @@ static int ecp_mod_p256k1( mbedtls_mpi * );
|
||||
G ## _gx, sizeof( G ## _gx ), \
|
||||
G ## _gy, sizeof( G ## _gy ), \
|
||||
G ## _n, sizeof( G ## _n ) )
|
||||
#endif /* ECP_LOAD_GROUP */
|
||||
|
||||
#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user