Rm ecp_keypair.alg
Avoid duplicating information already present in pk_context.
diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h
index e6f28e6..7bd9bd5 100644
--- a/include/polarssl/ecp.h
+++ b/include/polarssl/ecp.h
@@ -95,18 +95,12 @@
* \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 @@
*/
#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
diff --git a/library/ecp.c b/library/ecp.c
index 9e7a967..1468312 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -101,7 +101,6 @@
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 @@
ecp_group_free( &key->grp );
mpi_free( &key->d );
ecp_point_free( &key->Q );
- key->alg = POLARSSL_ECP_KEY_ALG_UNRESTRICTED;
}
/*
diff --git a/library/x509parse.c b/library/x509parse.c
index 1dca19d..4fba038 100644
--- a/library/x509parse.c
+++ b/library/x509parse.c
@@ -590,9 +590,6 @@
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 @@
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 )
{