<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">Hi,<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">I generated OpenSSL libcrypto (1.0.1l) with the OpenSSL FIPS crypto module (2.0.8) on FreeBSD 8.4 amd64.<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">It seems to build fine, and with OPENSSL_FIPS, it seems to behave correctly (e.g., MD5 is refused, DH with 512-bit key is refused, etc.).<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">However, genrsa(1) is failing with the following message.<br><br>------<br># /usr/bin/openssl genrsa -out rsa1 2048<br>Generating RSA private key, 2048 bit long modulus<br>34374116264:error:0409B09D:rsa routines:RSA_generate_key_ex:non fips rsa method:[...]/openssl/crypto/rsa/rsa_gen.c:88:<br>------<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">So, I put some debugging printf's, and this is what I found.<br><br>------<br># /usr/bin/openssl genrsa -out rsa1 2048<br>XXX MAIN: engine = 0x0<br>Generating RSA private key, 2048 bit long modulus<br>XXX MAIN: e = 0x0<br>XXX RSA_get_default_method: returning FIPS_rsa_pkcs1_ssleay()<br>XXX RSA_new_method: ret->meth = <span style="background-color:rgb(255,255,0)">0x800b4a7e0</span><br>XXX RSA_new_method: engine = 0x0<br>XXX RSA_new_method: ret->engine = 0x800e28100<br>XXX RSA_new_method: ret->meth = <span style="background-color:rgb(0,255,0)">0x800b2ee40</span><br>XXX MAIN: rsa->meth = <span style="background-color:rgb(0,255,0)">0x800b2ee40</span><br>XXX RSA_generate_key_ex: rsa->meth = <span style="background-color:rgb(0,255,0)">0x800b2ee40</span><br>34374116264:error:0409B09D:rsa routines:RSA_generate_key_ex:non fips rsa method:/usr/home/hongch/ns_depot/TOT/usr.src/crypto/openssl/crypto/rsa/rsa_gen.c:88:<br>------<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">​So, it seems like the FIPS RSA_METHOD gets overridden by the default ENGINE (the machine does not have any hardware crypto module), which does not have​ the RSA_FLAG_FIPS_METHOD flag set.<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">I understand that I can rebuild the library with "./config no-engine", but I haven't seen this mentioned in the FIPS guide.<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">Is this the right way to do it? Or can the interaction between FIPS and (the default) ENGINE be better?<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">Thanks.<br><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">Hong.<br></div><br></div>