Fix ret code in ecdh_curve25519.c
This commit is contained in:
parent
d905db65b7
commit
f47c9c11d1
1 changed files with 9 additions and 4 deletions
|
@ -29,8 +29,11 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define mbedtls_printf printf
|
#include <stdlib.h>
|
||||||
#endif
|
#define mbedtls_printf printf
|
||||||
|
#define MBEDTLS_EXTI_SUCCESS EXIT_SUCCESS
|
||||||
|
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
|
||||||
|
#endif /* MBEDTLS_PLATFORM_C */
|
||||||
|
|
||||||
#if !defined(MBEDTLS_ECDH_C) || \
|
#if !defined(MBEDTLS_ECDH_C) || \
|
||||||
!defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) || \
|
!defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) || \
|
||||||
|
@ -51,7 +54,8 @@ int main( void )
|
||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 1;
|
||||||
|
int exit_code = MBEDTLS_EXIT_FAILURE;
|
||||||
mbedtls_ecdh_context ctx_cli, ctx_srv;
|
mbedtls_ecdh_context ctx_cli, ctx_srv;
|
||||||
mbedtls_entropy_context entropy;
|
mbedtls_entropy_context entropy;
|
||||||
mbedtls_ctr_drbg_context ctr_drbg;
|
mbedtls_ctr_drbg_context ctr_drbg;
|
||||||
|
@ -218,6 +222,7 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
mbedtls_printf( " ok\n" );
|
mbedtls_printf( " ok\n" );
|
||||||
|
|
||||||
|
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
|
@ -231,7 +236,7 @@ exit:
|
||||||
mbedtls_ctr_drbg_free( &ctr_drbg );
|
mbedtls_ctr_drbg_free( &ctr_drbg );
|
||||||
mbedtls_entropy_free( &entropy );
|
mbedtls_entropy_free( &entropy );
|
||||||
|
|
||||||
return( ret != 0 );
|
return( exit_code );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_ECDH_C && MBEDTLS_ECP_DP_CURVE25519_ENABLED &&
|
#endif /* MBEDTLS_ECDH_C && MBEDTLS_ECP_DP_CURVE25519_ENABLED &&
|
||||||
MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */
|
MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */
|
||||||
|
|
Loading…
Reference in a new issue