mirror of
https://github.com/yuzu-mirror/mbedtls.git
synced 2026-04-04 14:08:39 +00:00
Merge remote-tracking branch 'origin/development' into development_new
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
Conflicts:
include/mbedtls/check_config.h: nearby edits
library/entropy.c: nearby edits
programs/random/gen_random_havege.c: modification vs. removal
programs/ssl/ssl_test_lib.h: nearby edits
programs/test/cpp_dummy_build.cpp: nearby edits
visualc/VS2010/mbedTLS.vcxproj: automatically generated file,
regenerated with scripts/generate_visualc_files.pl
This commit is contained in:
commit
73e3e2cb1a
217 changed files with 23474 additions and 8202 deletions
|
|
@ -265,6 +265,21 @@ void ecp_clear_precomputed( mbedtls_ecp_group *grp )
|
|||
#define ecp_clear_precomputed( g )
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
static int set_ecp_curve( const char *string, mbedtls_ecp_curve_info *curve )
|
||||
{
|
||||
const mbedtls_ecp_curve_info *found =
|
||||
mbedtls_ecp_curve_info_from_name( string );
|
||||
if( found != NULL )
|
||||
{
|
||||
*curve = *found;
|
||||
return( 1 );
|
||||
}
|
||||
else
|
||||
return( 0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned char buf[BUFSIZE];
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -288,6 +303,17 @@ int main( int argc, char *argv[] )
|
|||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
unsigned char alloc_buf[HEAP_SIZE] = { 0 };
|
||||
#endif
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
mbedtls_ecp_curve_info single_curve[2] = {
|
||||
{ MBEDTLS_ECP_DP_NONE, 0, 0, NULL },
|
||||
{ MBEDTLS_ECP_DP_NONE, 0, 0, NULL },
|
||||
};
|
||||
const mbedtls_ecp_curve_info *curve_list = mbedtls_ecp_curve_list( );
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
(void) curve_list; /* Unused in some configurations where no benchmark uses ECC */
|
||||
#endif
|
||||
|
||||
if( argc <= 1 )
|
||||
{
|
||||
|
|
@ -353,6 +379,10 @@ int main( int argc, char *argv[] )
|
|||
todo.ecdsa = 1;
|
||||
else if( strcmp( argv[i], "ecdh" ) == 0 )
|
||||
todo.ecdh = 1;
|
||||
#if defined(MBEDTLS_ECP_C)
|
||||
else if( set_ecp_curve( argv[i], single_curve ) )
|
||||
curve_list = single_curve;
|
||||
#endif
|
||||
else
|
||||
{
|
||||
mbedtls_printf( "Unrecognized option: %s\n", argv[i] );
|
||||
|
|
@ -832,7 +862,7 @@ int main( int argc, char *argv[] )
|
|||
|
||||
memset( buf, 0x2A, sizeof( buf ) );
|
||||
|
||||
for( curve_info = mbedtls_ecp_curve_list();
|
||||
for( curve_info = curve_list;
|
||||
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
|
@ -854,7 +884,7 @@ int main( int argc, char *argv[] )
|
|||
mbedtls_ecdsa_free( &ecdsa );
|
||||
}
|
||||
|
||||
for( curve_info = mbedtls_ecp_curve_list();
|
||||
for( curve_info = curve_list;
|
||||
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
|
@ -898,8 +928,23 @@ int main( int argc, char *argv[] )
|
|||
};
|
||||
const mbedtls_ecp_curve_info *curve_info;
|
||||
size_t olen;
|
||||
const mbedtls_ecp_curve_info *selected_montgomery_curve_list =
|
||||
montgomery_curve_list;
|
||||
|
||||
for( curve_info = mbedtls_ecp_curve_list();
|
||||
if( curve_list == (const mbedtls_ecp_curve_info*) &single_curve )
|
||||
{
|
||||
mbedtls_ecp_group grp;
|
||||
mbedtls_ecp_group_init( &grp );
|
||||
if( mbedtls_ecp_group_load( &grp, curve_list->grp_id ) != 0 )
|
||||
mbedtls_exit( 1 );
|
||||
if( mbedtls_ecp_get_type( &grp ) == MBEDTLS_ECP_TYPE_MONTGOMERY )
|
||||
selected_montgomery_curve_list = single_curve;
|
||||
else /* empty list */
|
||||
selected_montgomery_curve_list = single_curve + 1;
|
||||
mbedtls_ecp_group_free( &grp );
|
||||
}
|
||||
|
||||
for( curve_info = curve_list;
|
||||
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
|
@ -925,7 +970,7 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
|
||||
/* Montgomery curves need to be handled separately */
|
||||
for ( curve_info = montgomery_curve_list;
|
||||
for ( curve_info = selected_montgomery_curve_list;
|
||||
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
|
@ -947,7 +992,7 @@ int main( int argc, char *argv[] )
|
|||
mbedtls_mpi_free( &z );
|
||||
}
|
||||
|
||||
for( curve_info = mbedtls_ecp_curve_list();
|
||||
for( curve_info = curve_list;
|
||||
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
|
@ -973,7 +1018,7 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
|
||||
/* Montgomery curves need to be handled separately */
|
||||
for ( curve_info = montgomery_curve_list;
|
||||
for ( curve_info = selected_montgomery_curve_list;
|
||||
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||
curve_info++)
|
||||
{
|
||||
|
|
@ -1002,7 +1047,6 @@ int main( int argc, char *argv[] )
|
|||
{
|
||||
mbedtls_ecdh_context ecdh_srv, ecdh_cli;
|
||||
unsigned char buf_srv[BUFSIZE], buf_cli[BUFSIZE];
|
||||
const mbedtls_ecp_curve_info * curve_list = mbedtls_ecp_curve_list();
|
||||
const mbedtls_ecp_curve_info *curve_info;
|
||||
size_t olen;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "mbedtls/check_config.h"
|
||||
#include "mbedtls/cipher.h"
|
||||
#include "mbedtls/cmac.h"
|
||||
#include "mbedtls/config_psa.h"
|
||||
#include "mbedtls/ctr_drbg.h"
|
||||
#include "mbedtls/debug.h"
|
||||
#include "mbedtls/des.h"
|
||||
|
|
|
|||
|
|
@ -652,6 +652,14 @@ int query_config( const char *config )
|
|||
}
|
||||
#endif /* MBEDTLS_ECP_INTERNAL_ALT */
|
||||
|
||||
#if defined(MBEDTLS_ECP_NO_FALLBACK)
|
||||
if( strcmp( "MBEDTLS_ECP_NO_FALLBACK", config ) == 0 )
|
||||
{
|
||||
MACRO_EXPANSION_TO_STR( MBEDTLS_ECP_NO_FALLBACK );
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_ECP_NO_FALLBACK */
|
||||
|
||||
#if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT)
|
||||
if( strcmp( "MBEDTLS_ECP_RANDOMIZE_JAC_ALT", config ) == 0 )
|
||||
{
|
||||
|
|
@ -1212,6 +1220,14 @@ int query_config( const char *config )
|
|||
}
|
||||
#endif /* MBEDTLS_PKCS1_V21 */
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT)
|
||||
if( strcmp( "MBEDTLS_PSA_CRYPTO_CLIENT", config ) == 0 )
|
||||
{
|
||||
MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_CRYPTO_CLIENT );
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_CLIENT */
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_DRIVERS)
|
||||
if( strcmp( "MBEDTLS_PSA_CRYPTO_DRIVERS", config ) == 0 )
|
||||
{
|
||||
|
|
@ -2604,6 +2620,14 @@ int query_config( const char *config )
|
|||
}
|
||||
#endif /* MBEDTLS_PSA_HMAC_DRBG_MD_TYPE */
|
||||
|
||||
#if defined(MBEDTLS_PSA_KEY_SLOT_COUNT)
|
||||
if( strcmp( "MBEDTLS_PSA_KEY_SLOT_COUNT", config ) == 0 )
|
||||
{
|
||||
MACRO_EXPANSION_TO_STR( MBEDTLS_PSA_KEY_SLOT_COUNT );
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_PSA_KEY_SLOT_COUNT */
|
||||
|
||||
#if defined(MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT)
|
||||
if( strcmp( "MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT", config ) == 0 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue