#include <openssl/err.h>
#include <openssl/objects.h>
#include <openssl/proverr.h>
+#include <openssl/self_test.h>
#include "crypto/bn.h"
#include "crypto/ec.h"
#include "prov/implementations.h"
#include "prov/providercommon.h"
#include "prov/provider_ctx.h"
#include "prov/securitycheck.h"
+#include "internal/fips.h"
#include "internal/param_build_set.h"
#ifndef FIPS_MODULE
if ((selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS) != 0)
ok = ok && ossl_ec_key_otherparams_fromdata(ec, params);
+#ifdef FIPS_MODULE
+ if (ok > 0
+ && !ossl_fips_self_testing()
+ && EC_KEY_get0_public_key(ec) != NULL
+ && EC_KEY_get0_private_key(ec) != NULL
+ && EC_KEY_get0_group(ec) != NULL) {
+ BN_CTX *bnctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(ec));
+
+ ok = bnctx != NULL && ossl_ec_key_pairwise_check(ec, bnctx);
+ BN_CTX_free(bnctx);
+ if (ok <= 0)
+ ossl_set_error_state(OSSL_SELF_TEST_TYPE_PCT);
+ }
+#endif /* FIPS_MODULE */
+
return ok;
}