Fix ret code in crypt_and_hash.c

This commit is contained in:
Andres Amaya Garcia 2018-04-29 19:11:26 +01:00
parent 388c1b124e
commit 4c47df6f3f

View file

@ -30,9 +30,12 @@
#include "mbedtls/platform.h" #include "mbedtls/platform.h"
#else #else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#define mbedtls_fprintf fprintf #define mbedtls_fprintf fprintf
#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_CIPHER_C) && defined(MBEDTLS_MD_C) && \ #if defined(MBEDTLS_CIPHER_C) && defined(MBEDTLS_MD_C) && \
defined(MBEDTLS_FS_IO) defined(MBEDTLS_FS_IO)
@ -74,6 +77,7 @@ int main( void )
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int ret = 1, i, n; int ret = 1, i, n;
int exit_code = MBEDTLS_EXIT_FAILURE;
int mode; int mode;
size_t keylen, ilen, olen; size_t keylen, ilen, olen;
FILE *fkey, *fin = NULL, *fout = NULL; FILE *fkey, *fin = NULL, *fout = NULL;
@ -526,7 +530,7 @@ int main( int argc, char *argv[] )
} }
} }
ret = 0; exit_code = MBEDTLS_EXIT_SUCCESS;
exit: exit:
if( fin ) if( fin )
@ -549,6 +553,6 @@ exit:
mbedtls_cipher_free( &cipher_ctx ); mbedtls_cipher_free( &cipher_ctx );
mbedtls_md_free( &md_ctx ); mbedtls_md_free( &md_ctx );
return( ret ); return( exit_code );
} }
#endif /* MBEDTLS_CIPHER_C && MBEDTLS_MD_C && MBEDTLS_FS_IO */ #endif /* MBEDTLS_CIPHER_C && MBEDTLS_MD_C && MBEDTLS_FS_IO */