mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-23 05:35:14 +00:00
Rm ecp_keypair.alg
Avoid duplicating information already present in pk_context.
This commit is contained in:
parent
8b863cd641
commit
96f3a4e1b3
|
@ -95,18 +95,12 @@ ecp_group;
|
|||
* \brief ECP key pair structure
|
||||
*
|
||||
* A generic key pair that could be used for ECDSA, fixed ECDH, etc.
|
||||
* Usage can be restricted to a particular algorithm by the 'alg' field,
|
||||
* see POLARSSL_ECP_KEY_ALG_* constants (default: unrestricted).
|
||||
*
|
||||
* \sa ecdh_context
|
||||
* \sa ecdsa_context
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ecp_group grp; /*!< Elliptic curve and base point */
|
||||
mpi d; /*!< our secret value */
|
||||
ecp_point Q; /*!< our public value */
|
||||
int alg; /*!< algorithm to use this key with */
|
||||
}
|
||||
ecp_keypair;
|
||||
|
||||
|
@ -160,12 +154,6 @@ ecp_keypair;
|
|||
*/
|
||||
#define POLARSSL_ECP_TLS_NAMED_CURVE 3 /**< ECCurveType's named_curve */
|
||||
|
||||
/*
|
||||
* Algorithm identifiers from RFC 5480 for use with EC keys
|
||||
*/
|
||||
#define POLARSSL_ECP_KEY_ALG_UNRESTRICTED 0 /**< RFC 5480 2.1.1 */
|
||||
#define POLARSSL_ECP_KEY_ALG_ECDH 1 /**< RFC 5480 2.1.2 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -101,7 +101,6 @@ void ecp_keypair_init( ecp_keypair *key )
|
|||
ecp_group_init( &key->grp );
|
||||
mpi_init( &key->d );
|
||||
ecp_point_init( &key->Q );
|
||||
key->alg = POLARSSL_ECP_KEY_ALG_UNRESTRICTED;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -142,7 +141,6 @@ void ecp_keypair_free( ecp_keypair *key )
|
|||
ecp_group_free( &key->grp );
|
||||
mpi_free( &key->d );
|
||||
ecp_point_free( &key->Q );
|
||||
key->alg = POLARSSL_ECP_KEY_ALG_UNRESTRICTED;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -590,9 +590,6 @@ static int x509_get_pubkey( unsigned char **p,
|
|||
break;
|
||||
|
||||
case POLARSSL_PK_ECKEY_DH:
|
||||
((ecp_keypair *) pk->data)->alg = POLARSSL_ECP_KEY_ALG_ECDH;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case POLARSSL_PK_ECKEY:
|
||||
ret = x509_use_ecparams( &alg_params, &pk_ec( *pk )->grp ) ||
|
||||
x509_get_ecpubkey( p, end, pk->data );
|
||||
|
@ -2385,9 +2382,6 @@ static int x509parse_key_pkcs8_unencrypted_der(
|
|||
|
||||
if( pk_alg == POLARSSL_PK_ECKEY || pk_alg == POLARSSL_PK_ECKEY_DH )
|
||||
{
|
||||
if( pk_alg == POLARSSL_PK_ECKEY_DH )
|
||||
pk_ec( *pk )->alg = POLARSSL_ECP_KEY_ALG_ECDH;
|
||||
|
||||
if( ( ret = x509_use_ecparams( ¶ms, &pk_ec( *pk )->grp ) ) != 0 ||
|
||||
( ret = x509parse_key_sec1_der( pk_ec( *pk ), p, len ) ) != 0 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue