Add ECDH to validated module.
[openssl.git] / crypto / ecdh / ech_ossl.c
index 2a40ff12dfa8c29c4624e49bb668f2c5d0eebbbf..ceaa2f06b6389cd81dd4d09404d852407242b4ba 100644 (file)
@@ -67,6 +67,7 @@
  *
  */
 
+#define OPENSSL_FIPSAPI
 
 #include <string.h>
 #include <limits.h>
@@ -157,6 +158,7 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
                        goto err;
                        }
                }
+#ifndef OPENSSL_NO_EC2M
        else
                {
                if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp, x, y, ctx)) 
@@ -165,6 +167,7 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
                        goto err;
                        }
                }
+#endif
 
        buflen = (EC_GROUP_get_degree(group) + 7)/8;
        len = BN_num_bytes(x);
@@ -211,3 +214,15 @@ 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