mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-24 10:20:59 +00:00
Fix ret code in rsa_verify_pss.c
This commit is contained in:
parent
0a860f6301
commit
a8332637d7
|
@ -29,9 +29,12 @@
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define mbedtls_snprintf snprintf
|
#include <stdlib.h>
|
||||||
#define mbedtls_printf printf
|
#define mbedtls_snprintf snprintf
|
||||||
#endif
|
#define mbedtls_printf printf
|
||||||
|
#define MBEDTLS_EXTI_SUCCESS EXIT_SUCCESS
|
||||||
|
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
|
||||||
|
#endif /* MBEDTLS_PLATFORM_C */
|
||||||
|
|
||||||
#if !defined(MBEDTLS_MD_C) || !defined(MBEDTLS_ENTROPY_C) || \
|
#if !defined(MBEDTLS_MD_C) || !defined(MBEDTLS_ENTROPY_C) || \
|
||||||
!defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_SHA256_C) || \
|
!defined(MBEDTLS_RSA_C) || !defined(MBEDTLS_SHA256_C) || \
|
||||||
|
@ -60,6 +63,7 @@ int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
int exit_code = MBEDTLS_EXIT_FAILURE;
|
||||||
size_t i;
|
size_t i;
|
||||||
mbedtls_pk_context pk;
|
mbedtls_pk_context pk;
|
||||||
unsigned char hash[32];
|
unsigned char hash[32];
|
||||||
|
@ -91,7 +95,6 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
if( !mbedtls_pk_can_do( &pk, MBEDTLS_PK_RSA ) )
|
if( !mbedtls_pk_can_do( &pk, MBEDTLS_PK_RSA ) )
|
||||||
{
|
{
|
||||||
ret = 1;
|
|
||||||
mbedtls_printf( " failed\n ! Key is not an RSA key\n" );
|
mbedtls_printf( " failed\n ! Key is not an RSA key\n" );
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +104,6 @@ int main( int argc, char *argv[] )
|
||||||
/*
|
/*
|
||||||
* Extract the RSA signature from the file
|
* Extract the RSA signature from the file
|
||||||
*/
|
*/
|
||||||
ret = 1;
|
|
||||||
mbedtls_snprintf( filename, 512, "%s.sig", argv[2] );
|
mbedtls_snprintf( filename, 512, "%s.sig", argv[2] );
|
||||||
|
|
||||||
if( ( f = fopen( filename, "rb" ) ) == NULL )
|
if( ( f = fopen( filename, "rb" ) ) == NULL )
|
||||||
|
@ -139,7 +141,7 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
mbedtls_printf( "\n . OK (the signature is valid)\n\n" );
|
mbedtls_printf( "\n . OK (the signature is valid)\n\n" );
|
||||||
|
|
||||||
ret = 0;
|
exit_code = MBEDTLS_EXIT_SUCCESS;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_pk_free( &pk );
|
mbedtls_pk_free( &pk );
|
||||||
|
@ -149,7 +151,7 @@ exit:
|
||||||
fflush( stdout ); getchar();
|
fflush( stdout ); getchar();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return( ret );
|
return( exit_code );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_SHA256_C &&
|
#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_RSA_C && MBEDTLS_SHA256_C &&
|
||||||
MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO */
|
MBEDTLS_PK_PARSE_C && MBEDTLS_FS_IO */
|
||||||
|
|
Loading…
Reference in a new issue