<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks for all of the help so far. Unfortunately, I'm still struggling with this. There could be a number of issues, starting with the installation of OpenSSL. I basically followed the documentation and did the following:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<p style="margin:0in;font-family:"Courier New";font-size:11.0pt">./Configure <span style="background:yellow;mso-highlight:yellow">
enable-fips</span></p>
<p style="margin:0in;font-family:"Courier New";font-size:11.0pt">make</p>
<p style="margin:0in;font-family:"Courier New";font-size:11.0pt">make test</p>
<p style="margin:0in;font-family:"Courier New";font-size:11.0pt">make install</p>
<br>
</div>
<div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>The "make test" actually fails, but I did not troubleshoot as it seems like a lot of systems have issues here. But I know the .so produced when I build my application is linking to the correct OpenSSL libraries (libssl.so.3 and libcrypto.so.3). Checking
 the OpenSSL version shows 3.0.</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>I've tried a number of combinations trying to make this work, starting with the code from Dr. Paul Dale in a previous message:</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>    fips_libctx = OSSL_LIB_CTX_new();
<div>    if (!fips_libctx)</div>
<div>        // error handling</div>
<div><br>
</div>
<div>    non_fips_libctx = OSSL_LIB_CTX_new();</div>
<div>    if (!non_fips_libctx)</div>
<span>        // error handling</span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>    fipsp = OSSL_PROVIDER_load(fips_libctx, "fips");
<div>    if (fipsp == NULL)</div>
<div>      {</div>
<div>        /* error handling */</div>
<div>      }</div>
<div><br>
</div>
<div>    </div>
<div>    basep = OSSL_PROVIDER_load(fips_libctx, "base"); </div>
<div>    if (basep == NULL)</div>
<div>      {</div>
<div>        /* error handling */</div>
<div>      }</div>
<div><br>
</div>
<div>    defp = OSSL_PROVIDER_load(non_fips_libctx, "default");</div>
<div>    if (defp == NULL)</div>
<div>      {</div>
<div>        /* error handling */</div>
<div>      }</div>
<div><br>
</div>
<div>    /* Disallow falling back to the default library context */</div>
<div>    </div>
<div>    nullp = OSSL_PROVIDER_load(NULL, "null");</div>
<div>    if (nullp == NULL)</div>
<div>      {</div>
<div>        /*error handling */<br>
</div>
      }<br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>With the code like the above, the OSSL_PROVIDER_load() calls fails for fips. If I try to use the fips_libctx in SSL_CTX_new_ex(), it fails and returns NULL, which is probably expected given the fips provider didn't load.</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>At that point, I wasn't sure if my application was using the (correct) config file in /usr/local/ssl/. I don't have any environment variables set up, and would prefer not to have to set any to get this to work. So I changed the provider load for FIPS
 to use OSSL_LIB_CTX_load_config():</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>    if (!OSSL_LIB_CTX_load_config(fips_libctx, "/usr/local/ssl/openssl-fips.cnf"))
<div>          // error handling</div>
<div><br>
</div>
<div>This seems to work load the provider; however, there are two separate problems at this point. If FIPS is enabled by my application creating the SSL_CTX with  the FIPS library context fails, returning NULL. </div>
<div><br>
</div>
<div>If FIPS is turned OFF by my application, creating an SSL_CTX with the non_fips_libctx
<span style="background-color:rgb(255, 255, 255);display:inline !important"><span> </span>is successful</span>, but later calling X509_get_pubkey() returns NULL, implying maybe something is wrong with the non_fips_libctx as well. </div>
<div><br>
</div>
<div>I've tried other combinations, but at this point I'm just guessing. Is there anything obvious I could be missing and I should be checking?</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Jason</div>
<div><br>
</div>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dr Paul Dale <pauli@openssl.org><br>
<b>Sent:</b> Monday, October 25, 2021 9:37 PM<br>
<b>To:</b> Jason Schultz <jetson23@hotmail.com>; openssl-users@openssl.org <openssl-users@openssl.org><br>
<b>Subject:</b> Re: OpenSSL 3.0 FIPS questions</font>
<div> </div>
</div>
<div>It was meant for the second method only.  The first method is using different library contexts to distinguish FIPS algorithms.  Using the properties in addition is harmless and might prevent a future mistake that breaks compliance.<br>
<br>
Pauli<br>
<br>
<div class="x_moz-cite-prefix">On 26/10/21 4:46 am, Jason Schultz wrote:<br>
</div>
<blockquote type="cite">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks again. I think most of that makes sense. Going back to your initial response, there is something I'm not clear on. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
The second method you explained (which I don't plan to use) starting with "Alternatively,..." included the calls to OSSL_PRIVIDER_load(), and then discussed calling the following API for FIPS:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<pre style="font-family:courier,"courier new",monospace; font-size:14px; margin:0em; background-color:rgb(255,255,255)">   EVP_set_default_properties(NULL, “fips=yes”);</pre>
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span></span></div>
<div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Was the EVP_set_default_properties() call specifically and only for the 2nd method, or did that API call apply to both the first and second methods you explained? From reading the doc for that call, it seems like I should be doing it if I use the first method
 as well.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Jason</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> openssl-users
<a class="x_moz-txt-link-rfc2396E" href="mailto:openssl-users-bounces@openssl.org">
<openssl-users-bounces@openssl.org></a> on behalf of Dr Paul Dale <a class="x_moz-txt-link-rfc2396E" href="mailto:pauli@openssl.org">
<pauli@openssl.org></a><br>
<b>Sent:</b> Sunday, October 24, 2021 11:12 PM<br>
<b>To:</b> <a class="x_moz-txt-link-abbreviated" href="mailto:openssl-users@openssl.org">
openssl-users@openssl.org</a> <a class="x_moz-txt-link-rfc2396E" href="mailto:openssl-users@openssl.org">
<openssl-users@openssl.org></a><br>
<b>Subject:</b> Re: OpenSSL 3.0 FIPS questions</font>
<div> </div>
</div>
<div>The configuration shouldn't have much impact.  You will need a fips section specifying where the integrity check data are.  You shouldn't need base or default sections.<br>
<br>
<br>
Pauli<br>
<br>
<div class="x_x_moz-cite-prefix">On 25/10/21 5:23 am, Jason Schultz wrote:<br>
</div>
<blockquote type="cite">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span id="" title="" class="">Thank you </span>for your response. I think all of that makes sense, and seems to accomplish what I want programmatically, limiting it to my application. I guess the only question I have is what about the config files? Should they
 remain as they were installed, or do I need to provide sections for fips, base, default, etc?</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Jason</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> openssl-users
<a class="x_x_moz-txt-link-rfc2396E" href="mailto:openssl-users-bounces@openssl.org">
<openssl-users-bounces@openssl.org></a> on behalf of Dr Paul Dale <a class="x_x_moz-txt-link-rfc2396E" href="mailto:pauli@openssl.org">
<pauli@openssl.org></a><br>
<b>Sent:</b> Sunday, October 24, 2021 12:28 AM<br>
<b>To:</b> <a class="x_x_moz-txt-link-abbreviated" href="mailto:openssl-users@openssl.org">
openssl-users@openssl.org</a> <a class="x_x_moz-txt-link-rfc2396E" href="mailto:openssl-users@openssl.org">
<openssl-users@openssl.org></a><br>
<b>Subject:</b> Re: OpenSSL 3.0 FIPS questions</font>
<div> </div>
</div>
<div>Oops, the second time this occurs "<font face="monospace">defp = OSSL_PROVIDER_load(<span style=""></span>non_fips_libctx, "default");" it should be "</font><font face="monospace">defp = OSSL_PROVIDER_load(NULL, "default");"</font><br>
<br>
<br>
Pauli<br>
<br>
<div class="x_x_x_moz-cite-prefix">On 24/10/21 10:06 am, Dr Paul Dale wrote:<br>
</div>
<blockquote type="cite"><font face="monospace">defp = OSSL_PROVIDER_load(<span style=""></span>non_fips_libctx, "default");</font></blockquote>
<br>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</body>
</html>