Skip to content

Commit

Permalink
ECDH: Prevent direct access in non-legacy mode
Browse files Browse the repository at this point in the history
Some sample programs access structure fields directly. Making these work is
desirable in the long term, but these are not essential for the core
functionality in non-legacy mode.
  • Loading branch information
yanesca committed Nov 30, 2018
1 parent c9c32f3 commit 52735ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions programs/pkey/ecdh_curve25519.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
#endif /* MBEDTLS_PLATFORM_C */

#if !defined(MBEDTLS_ECDH_C) || \
#if !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDH_LEGACY_CONTEXT) || \
!defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) || \
!defined(MBEDTLS_ENTROPY_C) || !defined(MBEDTLS_CTR_DRBG_C)
int main( void )
{
mbedtls_printf( "MBEDTLS_ECDH_C and/or "
mbedtls_printf( "MBEDTLS_ECDH_C and/or MBEDTLS_ECDH_LEGACY_CONTEXT and/or "
"MBEDTLS_ECP_DP_CURVE25519_ENABLED and/or "
"MBEDTLS_ENTROPY_C and/or MBEDTLS_CTR_DRBG_C "
"not defined\n" );
Expand Down
2 changes: 1 addition & 1 deletion programs/test/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ int main( int argc, char *argv[] )
}
#endif

#if defined(MBEDTLS_ECDH_C)
#if defined(MBEDTLS_ECDH_C) && defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
if( todo.ecdh )
{
mbedtls_ecdh_context ecdh;
Expand Down

0 comments on commit 52735ef

Please sign in to comment.