remove ECDH_METHOD from ENGINE
[openssl.git] / crypto / ecdh / ech_lib.c
index b910b503fbbe9f19408bb8a07c1be8668500b798..f402caf73cb99d033bb2eacebd88a95532c46de8 100644 (file)
@@ -74,8 +74,6 @@
 #endif
 #include <openssl/err.h>
 
-const char ECDH_version[] = "ECDH" OPENSSL_VERSION_PTEXT;
-
 static const ECDH_METHOD *default_ECDH_method = NULL;
 
 static void *ecdh_data_new(void);
@@ -103,11 +101,6 @@ int ECDH_set_method(EC_KEY *eckey, const ECDH_METHOD *meth)
     if (ecdh == NULL)
         return 0;
 
-#if 0
-    mtmp = ecdh->meth;
-    if (mtmp->finish)
-        mtmp->finish(eckey);
-#endif
 #ifndef OPENSSL_NO_ENGINE
     if (ecdh->engine) {
         ENGINE_finish(ecdh->engine);
@@ -115,10 +108,6 @@ int ECDH_set_method(EC_KEY *eckey, const ECDH_METHOD *meth)
     }
 #endif
     ecdh->meth = meth;
-#if 0
-    if (meth->init)
-        meth->init(eckey);
-#endif
     return 1;
 }
 
@@ -126,7 +115,7 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine)
 {
     ECDH_DATA *ret;
 
-    ret = (ECDH_DATA *)OPENSSL_malloc(sizeof(ECDH_DATA));
+    ret = OPENSSL_malloc(sizeof(*ret));
     if (ret == NULL) {
         ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
         return (NULL);
@@ -152,13 +141,6 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine)
 
     ret->flags = ret->meth->flags;
     CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data);
-#if 0
-    if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
-        CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data);
-        OPENSSL_free(ret);
-        ret = NULL;
-    }
-#endif
     return (ret);
 }
 
@@ -188,10 +170,7 @@ void ecdh_data_free(void *data)
 #endif
 
     CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, r, &r->ex_data);
-
-    OPENSSL_cleanse((void *)r, sizeof(ECDH_DATA));
-
-    OPENSSL_free(r);
+    OPENSSL_clear_free((void *)r, sizeof(ECDH_DATA));
 }
 
 ECDH_DATA *ecdh_check(EC_KEY *key)
@@ -221,13 +200,6 @@ ECDH_DATA *ecdh_check(EC_KEY *key)
     return ecdh_data;
 }
 
-int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
-                          CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
-{
-    return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ECDH, argl, argp,
-                                   new_func, dup_func, free_func);
-}
-
 int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg)
 {
     ECDH_DATA *ecdh;