Fix ret code in aescrypt2.c

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

View File

@ -29,9 +29,12 @@
#include "mbedtls/platform.h" #include "mbedtls/platform.h"
#else #else
#include <stdio.h> #include <stdio.h>
#define mbedtls_fprintf fprintf #include <stdlib.h>
#define mbedtls_printf printf #define mbedtls_fprintf fprintf
#endif #define mbedtls_printf printf
#define MBEDTLS_EXTI_SUCCESS EXIT_SUCCESS
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
#endif /* MBEDTLS_PLATFORM_C */
#include "mbedtls/aes.h" #include "mbedtls/aes.h"
#include "mbedtls/md.h" #include "mbedtls/md.h"
@ -71,7 +74,8 @@ int main( void )
#else #else
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int ret = 1; int ret = 0;
int exit_code = MBEDTLS_EXIT_FAILURE;
unsigned int i, n; unsigned int i, n;
int mode, lastn; int mode, lastn;
@ -429,7 +433,7 @@ int main( int argc, char *argv[] )
} }
} }
ret = 0; exit_code = MBEDTLS_EXIT_SUCCESS;
exit: exit:
if( fin ) if( fin )
@ -452,6 +456,6 @@ exit:
mbedtls_aes_free( &aes_ctx ); mbedtls_aes_free( &aes_ctx );
mbedtls_md_free( &sha_ctx ); mbedtls_md_free( &sha_ctx );
return( ret ); return( exit_code );
} }
#endif /* MBEDTLS_AES_C && MBEDTLS_SHA256_C && MBEDTLS_FS_IO */ #endif /* MBEDTLS_AES_C && MBEDTLS_SHA256_C && MBEDTLS_FS_IO */