Fix ret code in pem2der.c
This commit is contained in:
parent
357b0b283a
commit
78dabe07bf
1 changed files with 12 additions and 6 deletions
|
@ -29,10 +29,13 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#define mbedtls_free free
|
#define mbedtls_free free
|
||||||
#define mbedtls_calloc calloc
|
#define mbedtls_calloc calloc
|
||||||
#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_BASE64_C) && defined(MBEDTLS_FS_IO)
|
#if defined(MBEDTLS_BASE64_C) && defined(MBEDTLS_FS_IO)
|
||||||
#include "mbedtls/error.h"
|
#include "mbedtls/error.h"
|
||||||
|
@ -178,7 +181,8 @@ static int write_file( const char *path, unsigned char *buf, size_t n )
|
||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 1;
|
||||||
|
int exit_code = MBEDTLS_EXIT_FAILURE;
|
||||||
unsigned char *pem_buffer = NULL;
|
unsigned char *pem_buffer = NULL;
|
||||||
unsigned char der_buffer[4096];
|
unsigned char der_buffer[4096];
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
@ -273,6 +277,8 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
mbedtls_printf( " ok\n" );
|
mbedtls_printf( " ok\n" );
|
||||||
|
|
||||||
|
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
free( pem_buffer );
|
free( pem_buffer );
|
||||||
|
|
||||||
|
@ -281,6 +287,6 @@ exit:
|
||||||
fflush( stdout ); getchar();
|
fflush( stdout ); getchar();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return( ret );
|
return( exit_code );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_BASE64_C && MBEDTLS_FS_IO */
|
#endif /* MBEDTLS_BASE64_C && MBEDTLS_FS_IO */
|
||||||
|
|
Loading…
Reference in a new issue