Merge remote-tracking branch 'origin/pr/654' into baremetal

This commit is contained in:
Simon Butcher 2019-09-10 14:54:28 +01:00
commit 88b535a47e
41 changed files with 1695 additions and 899 deletions

View file

@ -100,7 +100,7 @@ int main( int argc, char *argv[] )
unsigned char diff;
const mbedtls_cipher_info_t *cipher_info;
const mbedtls_md_info_t *md_info;
mbedtls_md_handle_t md_info;
mbedtls_cipher_context_t cipher_ctx;
mbedtls_md_context_t md_ctx;
#if defined(_WIN32_WCE)
@ -192,7 +192,7 @@ int main( int argc, char *argv[] )
}
md_info = mbedtls_md_info_from_string( argv[5] );
if( md_info == NULL )
if( md_info == MBEDTLS_MD_INVALID_HANDLE )
{
mbedtls_fprintf( stderr, "Message Digest '%s' not found\n", argv[5] );
goto exit;

View file

@ -53,7 +53,7 @@ int main( void )
#else
static int generic_wrapper( const mbedtls_md_info_t *md_info, char *filename, unsigned char *sum )
static int generic_wrapper( mbedtls_md_handle_t md_info, char *filename, unsigned char *sum )
{
int ret = mbedtls_md_file( md_info, filename, sum );
@ -66,7 +66,7 @@ static int generic_wrapper( const mbedtls_md_info_t *md_info, char *filename, un
return( ret );
}
static int generic_print( const mbedtls_md_info_t *md_info, char *filename )
static int generic_print( mbedtls_md_handle_t md_info, char *filename )
{
int i;
unsigned char sum[MBEDTLS_MD_MAX_SIZE];
@ -81,7 +81,7 @@ static int generic_print( const mbedtls_md_info_t *md_info, char *filename )
return( 0 );
}
static int generic_check( const mbedtls_md_info_t *md_info, char *filename )
static int generic_check( mbedtls_md_handle_t md_info, char *filename )
{
int i;
size_t n;
@ -177,7 +177,7 @@ int main( int argc, char *argv[] )
{
int ret = 1, i;
int exit_code = MBEDTLS_EXIT_FAILURE;
const mbedtls_md_info_t *md_info;
mbedtls_md_handle_t md_info;
mbedtls_md_context_t md_ctx;
mbedtls_md_init( &md_ctx );
@ -210,7 +210,7 @@ int main( int argc, char *argv[] )
* Read the MD from the command line
*/
md_info = mbedtls_md_info_from_string( argv[1] );
if( md_info == NULL )
if( md_info == MBEDTLS_MD_INVALID_HANDLE )
{
mbedtls_fprintf( stderr, "Message Digest '%s' not found\n", argv[1] );
return( exit_code );

View file

@ -2914,6 +2914,14 @@ int query_config( const char *config )
}
#endif /* MBEDTLS_SSL_CONF_SINGLE_SIG_HASH_TLS_ID */
#if defined(MBEDTLS_MD_SINGLE_HASH)
if( strcmp( "MBEDTLS_MD_SINGLE_HASH", config ) == 0 )
{
MACRO_EXPANSION_TO_STR( MBEDTLS_MD_SINGLE_HASH );
return( 0 );
}
#endif /* MBEDTLS_MD_SINGLE_HASH */
/* If the symbol is not found, return an error */
return( 1 );
}

View file

@ -693,13 +693,16 @@ int main( int argc, char *argv[] )
if( todo.hmac_drbg )
{
mbedtls_hmac_drbg_context hmac_drbg;
const mbedtls_md_info_t *md_info;
mbedtls_md_handle_t md_info;
mbedtls_hmac_drbg_init( &hmac_drbg );
#if defined(MBEDTLS_SHA1_C)
if( ( md_info = mbedtls_md_info_from_type( MBEDTLS_MD_SHA1 ) ) == NULL )
if( ( md_info = mbedtls_md_info_from_type( MBEDTLS_MD_SHA1 ) ) ==
MBEDTLS_MD_INVALID_HANDLE )
{
mbedtls_exit(1);
}
if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
mbedtls_exit(1);
@ -715,8 +718,11 @@ int main( int argc, char *argv[] )
#endif
#if defined(MBEDTLS_SHA256_C)
if( ( md_info = mbedtls_md_info_from_type( MBEDTLS_MD_SHA256 ) ) == NULL )
if( ( md_info = mbedtls_md_info_from_type( MBEDTLS_MD_SHA256 ) ) ==
MBEDTLS_MD_INVALID_HANDLE )
{
mbedtls_exit(1);
}
if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
mbedtls_exit(1);

View file

@ -66,7 +66,6 @@
#include "mbedtls/md2.h"
#include "mbedtls/md4.h"
#include "mbedtls/md5.h"
#include "mbedtls/md_internal.h"
#include "mbedtls/net.h"
#include "mbedtls/net_sockets.h"
#include "mbedtls/nist_kw.h"