Rename ENGINE _EC_KEY functions to _EC.
Add support for EC_KEY_METHOD in ENGINE_set_default et al. Copy
ec_meth.
Reviewed-by: Richard Levitte <levitte@openssl.org>
}
ret->engine = engine;
} else
- ret->engine = ENGINE_get_default_EC_KEY();
+ ret->engine = ENGINE_get_default_EC();
if (ret->engine) {
- ret->meth = ENGINE_get_EC_KEY(ret->engine);
+ ret->meth = ENGINE_get_EC(ret->engine);
if (!ret->meth) {
ECerr(EC_F_EC_KEY_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
return 0;
#endif
#ifndef OPENSSL_NO_EC
+ if ((flags & ENGINE_METHOD_EC) && !ENGINE_set_default_EC(e))
+ return 0;
#endif
if ((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e))
return 0;
*pflags |= ENGINE_METHOD_DSA;
else if (strncmp(alg, "DH", len) == 0)
*pflags |= ENGINE_METHOD_DH;
+ else if (strncmp(alg, "EC", len) == 0)
+ *pflags |= ENGINE_METHOD_EC;
else if (strncmp(alg, "RAND", len) == 0)
*pflags |= ENGINE_METHOD_RAND;
else if (strncmp(alg, "CIPHERS", len) == 0)
ENGINE_register_DH(e);
#endif
#ifndef OPENSSL_NO_EC
+ ENGINE_register_EC(e);
#endif
ENGINE_register_RAND(e);
ENGINE_register_pkey_meths(e);
const RSA_METHOD *rsa_meth;
const DSA_METHOD *dsa_meth;
const DH_METHOD *dh_meth;
- const EC_KEY_METHOD *ec_key_meth;
+ const EC_KEY_METHOD *ec_meth;
const RAND_METHOD *rand_meth;
const STORE_METHOD *store_meth;
/* Cipher handling is via this callback */
dest->dh_meth = src->dh_meth;
#endif
#ifndef OPENSSL_NO_EC
-
+ dest->ec_meth = src->ec_meth;
#endif
dest->rand_meth = src->rand_meth;
dest->store_meth = src->store_meth;
static ENGINE_TABLE *dh_table = NULL;
static const int dummy_nid = 1;
-void ENGINE_unregister_EC_KEY(ENGINE *e)
+void ENGINE_unregister_EC(ENGINE *e)
{
engine_table_unregister(&dh_table, e);
}
-static void engine_unregister_all_EC_KEY(void)
+static void engine_unregister_all_EC(void)
{
engine_table_cleanup(&dh_table);
}
-int ENGINE_register_EC_KEY(ENGINE *e)
+int ENGINE_register_EC(ENGINE *e)
{
- if (e->ec_key_meth)
+ if (e->ec_meth)
return engine_table_register(&dh_table,
- engine_unregister_all_EC_KEY, e, &dummy_nid,
+ engine_unregister_all_EC, e, &dummy_nid,
1, 0);
return 1;
}
-void ENGINE_register_all_EC_KEY()
+void ENGINE_register_all_EC()
{
ENGINE *e;
for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
- ENGINE_register_EC_KEY(e);
+ ENGINE_register_EC(e);
}
-int ENGINE_set_default_EC_KEY(ENGINE *e)
+int ENGINE_set_default_EC(ENGINE *e)
{
- if (e->ec_key_meth)
+ if (e->ec_meth)
return engine_table_register(&dh_table,
- engine_unregister_all_EC_KEY, e, &dummy_nid,
+ engine_unregister_all_EC, e, &dummy_nid,
1, 1);
return 1;
}
* table (ie. try to get a functional reference from the tabled structural
* references).
*/
-ENGINE *ENGINE_get_default_EC_KEY(void)
+ENGINE *ENGINE_get_default_EC(void)
{
return engine_table_select(&dh_table, dummy_nid);
}
/* Obtains an EC_KEY implementation from an ENGINE functional reference */
-const EC_KEY_METHOD *ENGINE_get_EC_KEY(const ENGINE *e)
+const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e)
{
- return e->ec_key_meth;
+ return e->ec_meth;
}
/* Sets an EC_KEY implementation in an ENGINE structure */
-int ENGINE_set_EC_KEY(ENGINE *e, const EC_KEY_METHOD *ec_key_meth)
+int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ec_meth)
{
- e->ec_key_meth = ec_key_meth;
+ e->ec_meth = ec_meth;
return 1;
}
# include <openssl/dh.h>
# endif
# ifndef OPENSSL_NO_EC
-# include <openssl/ecdh.h>
-# include <openssl/ecdsa.h>
+# include <openssl/ec.h>
# endif
# include <openssl/rand.h>
# include <openssl/ui.h>
# define ENGINE_METHOD_STORE (unsigned int)0x0100
# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200
# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400
-# define ENGINE_METHOD_EC_KEY (unsigned int)0x0800
+# define ENGINE_METHOD_EC (unsigned int)0x0800
/* Obvious all-or-nothing cases. */
# define ENGINE_METHOD_ALL (unsigned int)0xFFFF
# define ENGINE_METHOD_NONE (unsigned int)0x0000
void ENGINE_unregister_DSA(ENGINE *e);
void ENGINE_register_all_DSA(void);
-int ENGINE_register_EC_KEY(ENGINE *e);
-void ENGINE_unregister_EC_KEY(ENGINE *e);
-void ENGINE_register_all_EC_KEY(void);
+int ENGINE_register_EC(ENGINE *e);
+void ENGINE_unregister_EC(ENGINE *e);
+void ENGINE_register_all_EC(void);
int ENGINE_register_DH(ENGINE *e);
void ENGINE_unregister_DH(ENGINE *e);
int ENGINE_set_name(ENGINE *e, const char *name);
int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
-int ENGINE_set_EC_KEY(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth);
+int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth);
int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth);
const char *ENGINE_get_name(const ENGINE *e);
const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
-const EC_KEY_METHOD *ENGINE_get_EC_KEY(const ENGINE *e);
+const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e);
const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e);
ENGINE *ENGINE_get_default_RSA(void);
/* Same for the other "methods" */
ENGINE *ENGINE_get_default_DSA(void);
-ENGINE *ENGINE_get_default_EC_KEY(void);
+ENGINE *ENGINE_get_default_EC(void);
ENGINE *ENGINE_get_default_DH(void);
ENGINE *ENGINE_get_default_RAND(void);
/*
int ENGINE_set_default_string(ENGINE *e, const char *def_list);
/* Same for the other "methods" */
int ENGINE_set_default_DSA(ENGINE *e);
-int ENGINE_set_default_EC_KEY(ENGINE *e);
+int ENGINE_set_default_EC(ENGINE *e);
int ENGINE_set_default_DH(ENGINE *e);
int ENGINE_set_default_RAND(ENGINE *e);
int ENGINE_set_default_ciphers(ENGINE *e);