<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi</div><div><br></div><div>I am new to python and I am trying to run <a href="https://mitmproxy.org/">mitmproxy </a>in fips mode. It uses <a href="https://github.com/mitmproxy/mitmproxy/issues/1808">cryptography</a>.  Since its built on top of python i thought we need to make my python use fips openssl and enable fips mode in it. <br></div><div><br></div><div>I compiled python 3.6 against fips openssl and along with exposing functions to enabled fips mode in it as explained <a href="https://stackoverflow.com/questions/49493537/how-to-implement-fips-mode-and-fips-mode-set-in-python-3-6s-ssl-module">here</a>.<br></div><div><br></div><div>Python shows that it uses fips openssl <br></div><div><br></div><div>nsroot@Egress-1:~/openssl$ python3<br>Python 3.6.4 (default, Jan 10 2019, 21:10:38) <br>[GCC 5.4.0 20160609] on linux<br>Type "help", "copyright", "credits" or "license" for more information.<br>>>> import ssl<br>>>> ssl.OPENSSL_VERSION<br><b>'OpenSSL 1.0.2q-fips  20 Nov 2018'</b></div><div><br></div><div>But when i do following i see different version</div><div><br></div><div>nsroot@Egress-1:~/python$ python3<br>Python 3.6.4 (default, Jan 10 2019, 21:10:38) <br>[GCC 5.4.0 20160609] on linux<br>Type "help", "copyright", "credits" or "license" for more information.<br>>>> from OpenSSL import SSL<br>>>> print("OpenSSL:   {}".format(SSL.SSLeay_version(SSL.SSLEAY_VERSION).decode()),)<br><b>OpenSSL:   OpenSSL 1.1.0j  20 Nov 2018</b></div><div><br></div><div>So i guess i am getting different version because cryptography comes with its own version of openssl as mentioned here <a href="https://cryptography.io/en/latest/installation/#using-your-own-openssl-on-linux">https://cryptography.io/en/latest/installation/#using-your-own-openssl-on-linux</a> <br></div><div><br></div><div>Looking at the documentation it looks like its tested with fips openssl <a href="https://cryptography.io/en/latest/installation/#supported-platforms">https://cryptography.io/en/latest/installation/#supported-platforms</a>. <br></div><div><br></div><div>The <a href="https://cryptography.io/en/latest/installation/#using-your-own-openssl-on-linux ">link</a> doesn't explain in detail how we can compile cryptography step by step with any custom openssl here in my case with fips openssl. Is there any other link or documentation which i can follow to compile cryptography against fips openssl? Any help is appreciated.</div><div><br></div><div>Also once its compiled against fips openssl how do we enable fips mode in it. Openssl documentation says the application should call <span class="gmail-highlight gmail-selected">FIPS_mode</span>_set() to be really in FIPS mode. How do we do it for the openssl used by cryptography so that the application mitmproxy uses FIPS crypto.<br></div><div><br></div><div>Thanks <br></div><div><div dir="ltr" class="gmail_signature">Krishna kumar<br><br></div></div></div></div></div></div></div></div></div>