mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 02:15:37 +01:00
Fix ret code in cert_write.c
This commit is contained in:
parent
aacd928f97
commit
f9a54d339f
@ -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_X509_CRT_WRITE_C) || \
|
#if !defined(MBEDTLS_X509_CRT_WRITE_C) || \
|
||||||
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_FS_IO) || \
|
!defined(MBEDTLS_X509_CRT_PARSE_C) || !defined(MBEDTLS_FS_IO) || \
|
||||||
@ -211,7 +214,8 @@ int write_certificate( mbedtls_x509write_cert *crt, 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;
|
||||||
mbedtls_x509_crt issuer_crt;
|
mbedtls_x509_crt issuer_crt;
|
||||||
mbedtls_pk_context loaded_issuer_key, loaded_subject_key;
|
mbedtls_pk_context loaded_issuer_key, loaded_subject_key;
|
||||||
mbedtls_pk_context *issuer_key = &loaded_issuer_key,
|
mbedtls_pk_context *issuer_key = &loaded_issuer_key,
|
||||||
@ -248,7 +252,6 @@ int main( int argc, char *argv[] )
|
|||||||
{
|
{
|
||||||
usage:
|
usage:
|
||||||
mbedtls_printf( USAGE );
|
mbedtls_printf( USAGE );
|
||||||
ret = 1;
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +614,6 @@ int main( int argc, char *argv[] )
|
|||||||
{
|
{
|
||||||
mbedtls_printf( " failed\n ! issuer_key does not match "
|
mbedtls_printf( " failed\n ! issuer_key does not match "
|
||||||
"issuer certificate\n\n" );
|
"issuer certificate\n\n" );
|
||||||
ret = -1;
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -784,6 +786,8 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
mbedtls_printf( " ok\n" );
|
mbedtls_printf( " ok\n" );
|
||||||
|
|
||||||
|
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_x509write_crt_free( &crt );
|
mbedtls_x509write_crt_free( &crt );
|
||||||
mbedtls_pk_free( &loaded_subject_key );
|
mbedtls_pk_free( &loaded_subject_key );
|
||||||
@ -797,7 +801,7 @@ exit:
|
|||||||
fflush( stdout ); getchar();
|
fflush( stdout ); getchar();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return( ret );
|
return( exit_code );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_X509_CRT_WRITE_C && MBEDTLS_X509_CRT_PARSE_C &&
|
#endif /* MBEDTLS_X509_CRT_WRITE_C && MBEDTLS_X509_CRT_PARSE_C &&
|
||||||
MBEDTLS_FS_IO && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C &&
|
MBEDTLS_FS_IO && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C &&
|
||||||
|
Loading…
Reference in New Issue
Block a user