if (a->type != b->type)
return -1;
- if (EVP_PKEY_cmp_parameters(a, b) == 0)
- return 0;
-
- if (a->ameth && a->ameth->pub_cmp)
- return a->ameth->pub_cmp(a, b);
+ if (a->ameth)
+ {
+ int ret;
+ /* Compare parameters if the algorithm has them */
+ if (a->ameth->param_cmp)
+ {
+ ret = a->ameth->param_cmp(a, b);
+ if (ret <= 0)
+ return ret;
+ }
+
+ if (a->ameth->pub_cmp)
+ return a->ameth->pub_cmp(a, b);
+ }
return -2;
}
#ifndef OPENSSL_NO_ENGINE
/* If we have an ENGINE release it */
if (pkey->engine)
+ {
ENGINE_finish(pkey->engine);
+ pkey->engine = NULL;
+ }
#endif
}
if (str)
static void EVP_PKEY_free_it(EVP_PKEY *x)
{
if (x->ameth && x->ameth->pkey_free)
+ {
x->ameth->pkey_free(x);
+ x->pkey.ptr = NULL;
+ }
#ifndef OPENSSL_NO_ENGINE
if (x->engine)
{