Merge branch 'mbedtls-1.3'

This commit is contained in:
Simon Butcher 2016-05-18 20:11:17 +01:00
commit 65e79fae53
3 changed files with 2 additions and 56 deletions

View file

@ -30,6 +30,7 @@
#include "polarssl/platform.h"
#else
#include <stdio.h>
#include <stdlib.h>
#define polarssl_printf printf
#define polarssl_exit exit
#endif

View file

@ -30,6 +30,7 @@
#include "polarssl/platform.h"
#else
#include <stdio.h>
#include <stdlib.h>
#define polarssl_fprintf fprintf
#define polarssl_printf printf
#define polarssl_exit exit

View file

@ -209,59 +209,3 @@ exit:
}
/* END_CASE */
/* BEGIN_CASE */
void pkcs1_rsassa_v15_verify_ext( int mod,
int radix_N, char *input_N,
int radix_E, char *input_E,
int msg_digest_id, int ctx_hash,
int mgf_hash, int salt_len,
char *message_hex_string,
char *result_hex_str,
int result_simple,
int result_full )
{
unsigned char message_str[1000];
unsigned char hash_result[1000];
unsigned char result_str[1000];
rsa_context ctx;
size_t msg_len, hash_len;
rsa_init( &ctx, RSA_PKCS_V15, ctx_hash );
memset( message_str, 0x00, 1000 );
memset( hash_result, 0x00, 1000 );
memset( result_str, 0x00, 1000 );
ctx.len = mod / 8 + ( ( mod % 8 ) ? 1 : 0 );
TEST_ASSERT( mpi_read_string( &ctx.N, radix_N, input_N ) == 0 );
TEST_ASSERT( mpi_read_string( &ctx.E, radix_E, input_E ) == 0 );
TEST_ASSERT( rsa_check_pubkey( &ctx ) == 0 );
msg_len = unhexify( message_str, message_hex_string );
unhexify( result_str, result_hex_str );
if( msg_digest_id != POLARSSL_MD_NONE )
{
TEST_ASSERT( md( md_info_from_type( msg_digest_id ),
message_str, msg_len, hash_result ) == 0 );
hash_len = 0;
}
else
{
memcpy( hash_result, message_str, msg_len );
hash_len = msg_len;
}
TEST_ASSERT( rsa_pkcs1_verify( &ctx, NULL, NULL, RSA_PUBLIC,
msg_digest_id, hash_len, hash_result,
result_str ) == result_simple );
TEST_ASSERT( rsa_rsassa_pss_verify_ext( &ctx, NULL, NULL, RSA_PUBLIC,
msg_digest_id, hash_len, hash_result,
mgf_hash, salt_len,
result_str ) == result_full );
exit:
rsa_free( &ctx );
}
/* END_CASE */