<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Courier;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo;
        panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hello OpenSSL Users,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m trying to use SHA1 message digest hashing in combination with the FIPS provider, but seem to be running into issues. My code looks like the following:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">EVP_PKEY* privateKey = getPrivateKey();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">EVP_MD_CTX* mdContex = EVP_MD_CTX_new();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">if (mdContex != NULL) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">      const EVP_MD* messageDigest = EVP_MD_fetch(NULL, "SHA-1", "provider=fips");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">      if (EVP_DigestSignInit(mdContex, NULL, messageDigest, NULL, privateKey) == 1) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">            std::cout << "Success";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">      } else {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">            std::cout << "EVP_DigestSignInit failed";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">      }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:10.0pt;font-family:Courier">EVP_MD_CTX_free(mdContex);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier">}<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The call to EVP_DigestSignInit() always fails. If I switch to SHA-256 then it works fine. I thought SHA-1 wasn’t allowed for raw sign operations, but was still okay for message digests calculated via the EVP_MD related methods, is that
 thinking incorrect? And in fact, all use of SHA-1 with FIPS is disallowed?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Kevin Millson.<o:p></o:p></p>
</div>
</body>
</html>