mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 01:24:16 +01:00
Fix ret code in key_app_writer.c
This commit is contained in:
parent
f57bccf839
commit
aa3291e1fb
@ -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_PK_WRITE_C) && defined(MBEDTLS_FS_IO)
|
#if defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_FS_IO)
|
||||||
#include "mbedtls/error.h"
|
#include "mbedtls/error.h"
|
||||||
@ -189,7 +192,8 @@ static int write_private_key( mbedtls_pk_context *key, const char *output_file )
|
|||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 1;
|
||||||
|
int exit_code = MBEDTLS_EXIT_FAILURE;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int i;
|
int i;
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
@ -210,7 +214,6 @@ int main( int argc, char *argv[] )
|
|||||||
if( argc == 0 )
|
if( argc == 0 )
|
||||||
{
|
{
|
||||||
usage:
|
usage:
|
||||||
ret = 1;
|
|
||||||
mbedtls_printf( USAGE );
|
mbedtls_printf( USAGE );
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@ -403,9 +406,11 @@ int main( int argc, char *argv[] )
|
|||||||
write_private_key( &key, opt.output_file );
|
write_private_key( &key, opt.output_file );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
if( ret != 0 && ret != 1)
|
if( exit_code != MBEDTLS_EXIT_SUCCESS )
|
||||||
{
|
{
|
||||||
#ifdef MBEDTLS_ERROR_C
|
#ifdef MBEDTLS_ERROR_C
|
||||||
mbedtls_strerror( ret, buf, sizeof( buf ) );
|
mbedtls_strerror( ret, buf, sizeof( buf ) );
|
||||||
@ -426,6 +431,6 @@ exit:
|
|||||||
fflush( stdout ); getchar();
|
fflush( stdout ); getchar();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return( ret );
|
return( exit_code );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_PK_WRITE_C && MBEDTLS_FS_IO */
|
#endif /* MBEDTLS_PK_WRITE_C && MBEDTLS_FS_IO */
|
||||||
|
Loading…
Reference in New Issue
Block a user