Don't output bogus errors in PKCS12_parse
[openssl.git] / crypto / ecdh / ech_lib.c
index b910b503fbbe9f19408bb8a07c1be8668500b798..62734bc96f7c40b67ae64a037a896933afa5b66f 100644 (file)
@@ -103,11 +103,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 +110,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 +117,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 +143,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 +172,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)