Merge pull request #4168 from stevew817/fix/unreferenced_function_in_ecp_c

Remove unreferenced static functions when ECP_NO_FALLBACK is used
This commit is contained in:
Janos Follath 2021-03-05 08:51:13 +00:00 committed by GitHub
commit 477a463684
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1243,6 +1243,13 @@ cleanup:
while( (N).s < 0 && mbedtls_mpi_cmp_int( &(N), 0 ) != 0 ) \ while( (N).s < 0 && mbedtls_mpi_cmp_int( &(N), 0 ) != 0 ) \
MBEDTLS_MPI_CHK( mbedtls_mpi_add_mpi( &(N), &(N), &grp->P ) ) MBEDTLS_MPI_CHK( mbedtls_mpi_add_mpi( &(N), &(N), &grp->P ) )
#if ( defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED) && \
!( defined(MBEDTLS_ECP_NO_FALLBACK) && \
defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && \
defined(MBEDTLS_ECP_ADD_MIXED_ALT) ) ) || \
( defined(MBEDTLS_ECP_MONTGOMERY_ENABLED) && \
!( defined(MBEDTLS_ECP_NO_FALLBACK) && \
defined(MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT) ) )
static inline int mbedtls_mpi_sub_mod( const mbedtls_ecp_group *grp, static inline int mbedtls_mpi_sub_mod( const mbedtls_ecp_group *grp,
mbedtls_mpi *X, mbedtls_mpi *X,
const mbedtls_mpi *A, const mbedtls_mpi *A,
@ -1254,6 +1261,7 @@ static inline int mbedtls_mpi_sub_mod( const mbedtls_ecp_group *grp,
cleanup: cleanup:
return( ret ); return( ret );
} }
#endif /* All functions referencing mbedtls_mpi_sub_mod() are alt-implemented without fallback */
/* /*
* Reduce a mbedtls_mpi mod p in-place, to use after mbedtls_mpi_add_mpi and mbedtls_mpi_mul_int. * Reduce a mbedtls_mpi mod p in-place, to use after mbedtls_mpi_add_mpi and mbedtls_mpi_mul_int.
@ -1276,6 +1284,10 @@ cleanup:
return( ret ); return( ret );
} }
#if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED) && \
!( defined(MBEDTLS_ECP_NO_FALLBACK) && \
defined(MBEDTLS_ECP_DOUBLE_JAC_ALT) && \
defined(MBEDTLS_ECP_ADD_MIXED_ALT) )
static inline int mbedtls_mpi_shift_l_mod( const mbedtls_ecp_group *grp, static inline int mbedtls_mpi_shift_l_mod( const mbedtls_ecp_group *grp,
mbedtls_mpi *X, mbedtls_mpi *X,
size_t count ) size_t count )
@ -1286,6 +1298,7 @@ static inline int mbedtls_mpi_shift_l_mod( const mbedtls_ecp_group *grp,
cleanup: cleanup:
return( ret ); return( ret );
} }
#endif /* All functions referencing mbedtls_mpi_shift_l_mod() are alt-implemented without fallback */
#if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED) #if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED)
/* /*