<div dir="ltr"><div>Platform: Linux x86_64</div><div><br></div><div>I understand this is still alpha but how complete is the FIPS provider right now? I'm following the documentation at <a href="https://wiki.openssl.org/index.php/OpenSSL_3.0">https://wiki.openssl.org/index.php/OpenSSL_3.0</a> but I'm having a problem where my application hangs during exit() when I use the "fips" provider. I reduced my code down to this minimal snippet that reproduces the problem:</div><div><br></div><div><span style="color:rgb(0,0,255)"><span style="font-family:monospace">#include <stdio.h><br>#include <stdlib.h><br>#include <unistd.h><br>#include <openssl/evp.h><br>#include <openssl/crypto.h><br>#include <openssl/err.h><br>#include <openssl/provider.h><br><br>int<br>main(int argc, char **argv)<br>{<br>        OSSL_PROVIDER *pvdr = NULL;<br>        EVP_MD_CTX *ctx;<br>        const EVP_MD *md;<br>        char *alg = "sha1";<br>        int rc = 0;<br><br>        pvdr = OSSL_PROVIDER_load(NULL, "fips");<br>        if (pvdr == NULL) {<br>                fprintf(stderr, "Error loading FIPS provider\n");<br>                exit(1);<br>        }<br><br>        md = EVP_get_digestbyname(alg);<br>        if (!digest) {<br>                fprintf(stderr, "unknown digest '%s'\n", alg);<br>                exit(1);<br>        }<br><br>        ctx = EVP_MD_CTX_create();<br><br>        if (EVP_DigestInit_ex(ctx, md, NULL) != 1) {<br>                long err = ERR_get_error();<br>                char *msg = ERR_error_string(err, NULL);<br>                fprintf(stderr, "EVP_DigestInit_ex() failed: %s\n", msg);<br>                exit(1);<br>        }<br><br>        EVP_MD_CTX_destroy(ctx);<br><br>        rc = OSSL_PROVIDER_unload(pvdr);<br>        if (rc != 1) {<br>                fprintf(stderr, "Error unloading FIPS provider\n");<br>                exit(1);<br>        }<br><br>        printf("finished!\n");</span></span></div><div><span style="color:rgb(0,0,255)"><span style="font-family:monospace">        exit(0);<br>}<br></span></span></div><div><span style="color:rgb(0,0,255)"><span style="font-family:monospace"><br></span></span></div><div>When I run this it prints "finished!" and then hangs in some kind of spin loop consuming 100% CPU. Skipping the call to EVP_DigestInit_ex() allows it to exit successfully, as does inserting a call to OPENSSL_init_crypto() at the very top with the OPENSSL_INIT_NO_ATEXIT flag. Passing "default" instead of "fips" to OSSL_PROVIDER_load() also seems to work fine. What am I missing?</div><div><br></div><div>Also, per section 7.8 of the wiki referenced above, I'm unable to confirm that the digest algorithm I want to use is being provided by the FIPS module. EVP_MD_provider(md) returns NULL even though the actual digest is computed correctly.<br></div><div><br></div><div><br></div><div>Thanks,</div><div>Tom.III</div><div><br></div><div><br></div></div>