Fix ret code in ecdsa.c
This commit is contained in:
parent
03a992c817
commit
2602a1fbc5
1 changed files with 10 additions and 7 deletions
|
@ -29,8 +29,11 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#define mbedtls_printf printf
|
#define mbedtls_printf printf
|
||||||
#endif
|
#define MBEDTLS_EXTI_SUCCESS EXIT_SUCCESS
|
||||||
|
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
|
||||||
|
#endif /* MBEDTLS_PLATFORM_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDSA_C) && \
|
#if defined(MBEDTLS_ECDSA_C) && \
|
||||||
defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C)
|
defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_CTR_DRBG_C)
|
||||||
|
@ -98,7 +101,8 @@ static void dump_pubkey( const char *title, mbedtls_ecdsa_context *key )
|
||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = 1;
|
||||||
|
int exit_code = MBEDTLS_EXIT_FAILURE;
|
||||||
mbedtls_ecdsa_context ctx_sign, ctx_verify;
|
mbedtls_ecdsa_context ctx_sign, ctx_verify;
|
||||||
mbedtls_entropy_context entropy;
|
mbedtls_entropy_context entropy;
|
||||||
mbedtls_ctr_drbg_context ctr_drbg;
|
mbedtls_ctr_drbg_context ctr_drbg;
|
||||||
|
@ -115,7 +119,6 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
memset( sig, 0, sizeof( sig ) );
|
memset( sig, 0, sizeof( sig ) );
|
||||||
memset( message, 0x25, sizeof( message ) );
|
memset( message, 0x25, sizeof( message ) );
|
||||||
ret = 1;
|
|
||||||
|
|
||||||
if( argc != 1 )
|
if( argc != 1 )
|
||||||
{
|
{
|
||||||
|
@ -213,8 +216,6 @@ int main( int argc, char *argv[] )
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify signature
|
* Verify signature
|
||||||
*/
|
*/
|
||||||
|
@ -231,6 +232,8 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
mbedtls_printf( " ok\n" );
|
mbedtls_printf( " ok\n" );
|
||||||
|
|
||||||
|
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -243,7 +246,7 @@ exit:
|
||||||
mbedtls_ctr_drbg_free( &ctr_drbg );
|
mbedtls_ctr_drbg_free( &ctr_drbg );
|
||||||
mbedtls_entropy_free( &entropy );
|
mbedtls_entropy_free( &entropy );
|
||||||
|
|
||||||
return( ret );
|
return( exit_code );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C &&
|
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C &&
|
||||||
ECPARAMS */
|
ECPARAMS */
|
||||||
|
|
Loading…
Reference in a new issue