<div dir="ltr">Thanks a lot <span style="font-size:12.800000190734863px">Matthias for the suggestion.</span><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">I have few follow-up questions below:</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 5, 2018 at 2:57 AM, Dr. Matthias St. Pierre <span dir="ltr"><<a href="mailto:Matthias.St.Pierre@ncp-e.com" target="_blank">Matthias.St.Pierre@ncp-e.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF"><span class="gmail-">
<p><br>
</p>
<br>
<div class="gmail-m_-953499180612114366moz-cite-prefix">On 05.03.2018 10:46, Alan Dean wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Question 1: Is it even feasible to make the FIPS
mode always enabled for the whole OpenSSL library (i.e. for both
libcrypto and libssl), so that most the applications which
dynamically linked to libcrypto and libssl will be automatically
use OpenSSL FIPS mode without the need of changes to add the
FIPS_mode_set invocation (with some exception such as OpenSSH
which may still need some fixes). (Assuming from certification's
perspective we are ok if we may these changes)
<div><br>
</div>
<div><br>
</div>
<div>Question 2: If the above idea is feasible, where in the
OpenSSL library will be the best entry to invoke FIPS_mode_set
API, so that we can make the whole OpenSSL library always in
FIPS mode? Any potebtial issues for this solution?</div>
<div><br>
</div>
<div><br>
</div>
<div>Any suggestions will be greatly appreciated.</div>
<div><br>
</div>
</div>
<fieldset class="gmail-m_-953499180612114366mimeAttachmentHeader"></fieldset>
</blockquote>
<br>
<br></span>
The optimal location for inserting the FIPS_mode_set(1) call is
probably OPENSSL_init() (openssl-1.0.2/crypto/o_fips.<wbr>c), see code
snippet below.<br>
<br>
void OPENSSL_init(void)<br>
{<br>
static int done = 0;<br>
if (done)<br>
return;<br>
done = 1;<br>
#ifdef OPENSSL_FIPS<br>
FIPS_set_locking_callbacks(<wbr>CRYPTO_lock, CRYPTO_add_lock);<br>
# ifndef OPENSSL_NO_DEPRECATED<br>
FIPS_crypto_set_id_callback(<wbr>CRYPTO_thread_id);<br>
# endif<br>
FIPS_set_error_callbacks(ERR_<wbr>put_error, ERR_add_error_vdata);<br>
FIPS_set_malloc_callbacks(<wbr>CRYPTO_malloc, CRYPTO_free);<br>
RAND_init_fips();<br>
FIPS_mode_set(1); <<< ENABLE FIPS MODE HERE
<<<<br>
#endif<br>
#if 0<br>
fprintf(stderr, "Called OPENSSL_init\n");<br>
#endif<br></div></blockquote><div><br></div><div>Currently OPENSSL_init() is actually invoked from within FIPS_mode_set(). If we put FIPS_mode_set() inside OPENSSL_init, then it makes OPENSSL_init to call itself recursively. In that case would it be ok to just remove OPENSSL_init from within FIPS_mode_set?</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF">
<br>
<br>
However, I am sceptical whether this approach will be accepted,
because there are (at least) two potential problems:<br>
<br>
* Normally, it is mandatory to check the result of FIPS_mode_set()
or FIPS_mode() to ensure that the FIPS initialization succeeded.
However, an application which is not FIPS-aware won't check the
result.<br></div></blockquote><div>Did you mean if FIPS_mode_set is invoked in the library level, then applications won't be checking the return results of FIPS_mode_set and could cause problem if FIPS_mode_set didn't finish successfully?</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF">
* It can happen that applications which have their own configuration
and enable/disable FIPS mode explicitely, call FIPS_mode_set(0)
afterwards.<br>
<br>
<br>
HTH,<br>
Matthias<br>
<br>
<br>
</div>
<br>--<br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/<wbr>mailman/listinfo/openssl-users</a><br>
<br></blockquote></div><br></div></div>