diff options
author | Kenny Root <kroot@google.com> | 2015-02-27 20:53:09 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-02-27 20:53:09 +0000 |
commit | 7a2c703250e0a9a552d0214a34d116ef2f90af82 (patch) | |
tree | 51d47f0a5d7c717ceeb0fb7982c9a8050f8bdb33 /src/crypto | |
parent | 46ba7161f20f8b1e6729384a98e1b9973ed3c908 (diff) | |
parent | ef935713a3ff3d53600ea7e012f892ed4ecf59c6 (diff) | |
download | external_boringssl-7a2c703250e0a9a552d0214a34d116ef2f90af82.zip external_boringssl-7a2c703250e0a9a552d0214a34d116ef2f90af82.tar.gz external_boringssl-7a2c703250e0a9a552d0214a34d116ef2f90af82.tar.bz2 |
Merge "EC_GROUP_cmp should return zero if the groups match."
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/ec/ec.c | 9 | ||||
-rw-r--r-- | src/crypto/evp/p_ec_asn1.c | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/crypto/ec/ec.c b/src/crypto/ec/ec.c index 0d70959..15e5735 100644 --- a/src/crypto/ec/ec.c +++ b/src/crypto/ec/ec.c @@ -491,11 +491,10 @@ err: } } -int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ignored) { - if (a->curve_name == NID_undef || b->curve_name == NID_undef) { - return 0; - } - return a->curve_name == b->curve_name; +int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b) { + return a->curve_name == NID_undef || + b->curve_name == NID_undef || + a->curve_name != b->curve_name; } const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group) { diff --git a/src/crypto/evp/p_ec_asn1.c b/src/crypto/evp/p_ec_asn1.c index 37f5135..914cc2f 100644 --- a/src/crypto/evp/p_ec_asn1.c +++ b/src/crypto/evp/p_ec_asn1.c @@ -379,7 +379,11 @@ static int ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) { static int ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) { const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), *group_b = EC_KEY_get0_group(b->pkey.ec); - return EC_GROUP_cmp(group_a, group_b, NULL); + if (EC_GROUP_cmp(group_a, group_b, NULL) != 0) { + /* mismatch */ + return 0; + } + return 1; } static void int_ec_free(EVP_PKEY *pkey) { EC_KEY_free(pkey->pkey.ec); } |