static int gost_set_priv_key(EVP_PKEY *pkey, BIGNUM *priv)
{
    switch (EVP_PKEY_base_id(pkey)) {
    case NID_id_GostR3410_2001:
        {
            EC_KEY *ec = EVP_PKEY_get0(pkey);
            if (!ec) {
                ec = EC_KEY_new();
                EVP_PKEY_assign(pkey, EVP_PKEY_base_id(pkey), ec);
            }
            if (!EC_KEY_set_private_key(ec, priv))
                return 0;
            if (!EVP_PKEY_missing_parameters(pkey))
                gost2001_compute_public(ec);
            break;
        }
    }
    return 1;
}