ms);
EVP_PKEY_generate(pctx, &amp;pkey);
...
EVP_PKEY_free(pkey);
EVP_PKEY_CTX_free(pctx);</code></pre>

<p><b>DHX</b> domain parameters can be generated according to <b>FIPS186-4</b> by calling:</p>

<pre><code>int gindex = 2;
unsigned int pbits = 2048;
unsigned int qbits = 256;
OSSL_PARAM params[6];
EVP_PKEY *param_key = NULL;
EVP_PKEY_CTX *pctx = NULL;

pctx = EVP_PKEY_CTX_new_from_name(NULL, &quot;DHX&quot;, NULL);
EVP_PKEY_paramgen_init(pctx);

params[0] = OSSL_PARAM_construct_uint(&quot;pbits&quot;, &