Fix method by which the EC curve type is determined
The way the curve type was determined was fragile when moving between
processor types. Change it to a more explicit curve type check.
Change-Id: I3fe1d6c38bd0e360ba3ec4f688b44485b5a1c7ab
diff --git a/src/main/native/org_conscrypt_NativeCrypto.cpp b/src/main/native/org_conscrypt_NativeCrypto.cpp
index 788503f..6680a99 100644
--- a/src/main/native/org_conscrypt_NativeCrypto.cpp
+++ b/src/main/native/org_conscrypt_NativeCrypto.cpp
@@ -3395,12 +3395,10 @@
#if !defined(OPENSSL_IS_BORINGSSL)
static int get_EC_GROUP_type(const EC_GROUP* group)
{
- const EC_METHOD* method = EC_GROUP_method_of(group);
- if (method == EC_GFp_nist_method()
- || method == EC_GFp_mont_method()
- || method == EC_GFp_simple_method()) {
+ const int curve_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));
+ if (curve_nid == NID_X9_62_prime_field) {
return EC_CURVE_GFP;
- } else if (method == EC_GF2m_simple_method()) {
+ } else if (curve_nid == NID_X9_62_characteristic_two_field) {
return EC_CURVE_GF2M;
}