Add ecp_curve_list(), hide ecp_supported_curves
This commit is contained in:
parent
dace82f805
commit
da179e4870
5 changed files with 22 additions and 12 deletions
|
@ -64,7 +64,7 @@ typedef enum
|
|||
} ecp_group_id;
|
||||
|
||||
/**
|
||||
* Curve information for use by the SSL module
|
||||
* Curve information for use by other modules
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
|
@ -74,11 +74,6 @@ typedef struct
|
|||
const char *name; /*!< Human-friendly name */
|
||||
} ecp_curve_info;
|
||||
|
||||
/**
|
||||
* List of supported curves
|
||||
*/
|
||||
extern const ecp_curve_info ecp_supported_curves[];
|
||||
|
||||
/**
|
||||
* \brief ECP point structure (jacobian coordinates)
|
||||
*
|
||||
|
@ -180,6 +175,13 @@ ecp_keypair;
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Return the list of supported curves with associated info
|
||||
*
|
||||
* \return A statically allocated array, the last entry is 0.
|
||||
*/
|
||||
const ecp_curve_info *ecp_curve_list( void );
|
||||
|
||||
/**
|
||||
* \brief Initialize a point (as zero)
|
||||
*/
|
||||
|
|
|
@ -94,6 +94,14 @@ const ecp_curve_info ecp_supported_curves[] =
|
|||
{ POLARSSL_ECP_DP_NONE, 0, 0, NULL },
|
||||
};
|
||||
|
||||
/*
|
||||
* List of supported curves and associated info
|
||||
*/
|
||||
const ecp_curve_info *ecp_curve_list( void )
|
||||
{
|
||||
return ecp_supported_curves;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize (the components of) a point
|
||||
*/
|
||||
|
@ -755,7 +763,7 @@ ecp_group_id ecp_grp_id_from_named_curve( uint16_t tls_id )
|
|||
{
|
||||
const ecp_curve_info *curve_info;
|
||||
|
||||
for( curve_info = ecp_supported_curves;
|
||||
for( curve_info = ecp_curve_list();
|
||||
curve_info->grp_id != POLARSSL_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
@ -773,7 +781,7 @@ uint16_t ecp_named_curve_from_grp_id( ecp_group_id grp_id )
|
|||
{
|
||||
const ecp_curve_info *curve_info;
|
||||
|
||||
for( curve_info = ecp_supported_curves;
|
||||
for( curve_info = ecp_curve_list();
|
||||
curve_info->grp_id != POLARSSL_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
|
|
@ -240,7 +240,7 @@ static void ssl_write_supported_elliptic_curves_ext( ssl_context *ssl,
|
|||
|
||||
SSL_DEBUG_MSG( 3, ( "client hello, adding supported_elliptic_curves extension" ) );
|
||||
|
||||
for( curve = ecp_supported_curves;
|
||||
for( curve = ecp_curve_list();
|
||||
curve->grp_id != POLARSSL_ECP_DP_NONE;
|
||||
curve++ )
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#if !defined(ECPARAMS)
|
||||
#define ECPARAMS ecp_supported_curves[0].grp_id
|
||||
#define ECPARAMS ecp_curve_list()->grp_id
|
||||
#endif
|
||||
|
||||
#if !defined(POLARSSL_ECDSA_C) || \
|
||||
|
|
|
@ -447,7 +447,7 @@ int main( int argc, char *argv[] )
|
|||
|
||||
memset( buf, 0x2A, sizeof( buf ) );
|
||||
|
||||
for( curve_info = ecp_supported_curves;
|
||||
for( curve_info = ecp_curve_list();
|
||||
curve_info->grp_id != POLARSSL_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
@ -478,7 +478,7 @@ int main( int argc, char *argv[] )
|
|||
const ecp_curve_info *curve_info;
|
||||
size_t olen;
|
||||
|
||||
for( curve_info = ecp_supported_curves;
|
||||
for( curve_info = ecp_curve_list();
|
||||
curve_info->grp_id != POLARSSL_ECP_DP_NONE;
|
||||
curve_info++ )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue