Remove OPENSSL_FIPSCANISTER code.
[openssl.git] / crypto / ecdh / ech_ossl.c
index 94a8f4b696a5fcb97c3cd08ab4c471d8dc696210..e25fd4f1d35c9076a328c3cca59bfc18c8382ad5 100644 (file)
@@ -146,6 +146,18 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
                }
 
        group = EC_KEY_get0_group(ecdh);
+
+       if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH)
+               {
+               if (!EC_GROUP_get_cofactor(group, x, ctx) ||
+                       !BN_mul(x, x, priv_key, ctx))
+                       {
+                       ECDHerr(ECDH_F_ECDH_COMPUTE_KEY, ERR_R_MALLOC_FAILURE);
+                       goto err;
+                       }
+               priv_key = x;
+               }
+
        if ((tmp=EC_POINT_new(group)) == NULL)
                {
                ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);
@@ -222,15 +234,3 @@ err:
        if (buf) OPENSSL_free(buf);
        return(ret);
        }
-
-#ifdef OPENSSL_FIPSCANISTER
-/* FIPS stanadlone version of ecdh_check: just return FIPS method */
-ECDH_DATA *fips_ecdh_check(EC_KEY *key)
-       {
-       static ECDH_DATA rv = {
-               0,0,0,
-               &openssl_ecdh_meth
-               };
-       return &rv;
-       }
-#endif