diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2006-07-02 21:12:40 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2006-07-02 21:12:40 +0000 |
commit | 86207c1960f2fd5de93541488713639c3d8577db (patch) | |
tree | c36c1a0dd095173b0e41fe255d0b350089783fb0 /crypto/evp/p_lib.c | |
parent | 9c62bca11a9d71e5e14d98397fe1440b6f2bd197 (diff) | |
download | openssl-86207c1960f2fd5de93541488713639c3d8577db.tar.gz |
Make return value from EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters() consistent.
Diffstat (limited to 'crypto/evp/p_lib.c')
-rw-r--r-- | crypto/evp/p_lib.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 939857fdb0..6715c154b2 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -161,11 +161,20 @@ int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b) 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->meth) + { + int ret; + /* Compare parameters if the algorithm has them */ + if (a->meth->param_cmp) + { + ret = a->meth->param_cmp(a, b); + if (ret <= 0) + return ret; + } + + if (a->ameth->pub_cmp) + return a->ameth->pub_cmp(a, b); + } return -2; } |