<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Crypto++: fips140.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Crypto++  <span id="projectnumber">7.0</span> </div> <div id="projectbrief">Free C++ class library of cryptographic schemes</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',false,false,'search.php','Search'); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> | <a href="#define-members">Macros</a> | <a href="#enum-members">Enumerations</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">fips140.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>Classes and functions for the FIPS 140-2 validated library. <a href="#details">More...</a></p> <p><a href="fips140_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Classes</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_self_test_failure.html">SelfTestFailure</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="class_exception.html" title="Base class for all exceptions thrown by the library.">Exception</a> thrown when a crypto algorithm is used after a self test fails. <a href="class_self_test_failure.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:afa5d25ce1be2e8d1beda9340260a4d77"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#afa5d25ce1be2e8d1beda9340260a4d77">CRYPTOPP_DUMMY_DLL_MAC</a>   "MAC_51f34b8db820ae8"</td></tr> <tr class="memdesc:afa5d25ce1be2e8d1beda9340260a4d77"><td class="mdescLeft"> </td><td class="mdescRight">The placeholder used prior to embedding the actual MAC in the module. <a href="#afa5d25ce1be2e8d1beda9340260a4d77">More...</a><br /></td></tr> <tr class="separator:afa5d25ce1be2e8d1beda9340260a4d77"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a> Enumerations</h2></td></tr> <tr class="memitem:a8ccac50ac3bfc5abaa6cb457f0ded35d"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#a8ccac50ac3bfc5abaa6cb457f0ded35d">PowerUpSelfTestStatus</a> { <a class="el" href="fips140_8h.html#a8ccac50ac3bfc5abaa6cb457f0ded35da50805cb51444d59eb747962fa279ad27">POWER_UP_SELF_TEST_NOT_DONE</a>, <a class="el" href="fips140_8h.html#a8ccac50ac3bfc5abaa6cb457f0ded35da7fdf030b911a428fda600038ef914c95">POWER_UP_SELF_TEST_FAILED</a>, <a class="el" href="fips140_8h.html#a8ccac50ac3bfc5abaa6cb457f0ded35da6c4f7efa0a4251f4c3a2836abba17877">POWER_UP_SELF_TEST_PASSED</a> }</td></tr> <tr class="memdesc:a8ccac50ac3bfc5abaa6cb457f0ded35d"><td class="mdescLeft"> </td><td class="mdescRight">Status of the power-up self test. <a href="fips140_8h.html#a8ccac50ac3bfc5abaa6cb457f0ded35d">More...</a><br /></td></tr> <tr class="separator:a8ccac50ac3bfc5abaa6cb457f0ded35d"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:afcc971af5af431d1528a09f52c195d64"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#afcc971af5af431d1528a09f52c195d64">FIPS_140_2_ComplianceEnabled</a> ()</td></tr> <tr class="memdesc:afcc971af5af431d1528a09f52c195d64"><td class="mdescLeft"> </td><td class="mdescRight">Determines whether the library provides FIPS validated cryptography. <a href="#afcc971af5af431d1528a09f52c195d64">More...</a><br /></td></tr> <tr class="separator:afcc971af5af431d1528a09f52c195d64"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ac4890bf392b8a421fb9288327a885a47"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#ac4890bf392b8a421fb9288327a885a47">DoPowerUpSelfTest</a> (const char *moduleFilename, const byte *expectedModuleMac)</td></tr> <tr class="memdesc:ac4890bf392b8a421fb9288327a885a47"><td class="mdescLeft"> </td><td class="mdescRight">Performs the power-up self test. <a href="#ac4890bf392b8a421fb9288327a885a47">More...</a><br /></td></tr> <tr class="separator:ac4890bf392b8a421fb9288327a885a47"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8daad2060ff39aa61384c1d81af8a3c2"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#a8daad2060ff39aa61384c1d81af8a3c2">DoDllPowerUpSelfTest</a> ()</td></tr> <tr class="memdesc:a8daad2060ff39aa61384c1d81af8a3c2"><td class="mdescLeft"> </td><td class="mdescRight">Performs the power-up self test on the DLL. <a href="#a8daad2060ff39aa61384c1d81af8a3c2">More...</a><br /></td></tr> <tr class="separator:a8daad2060ff39aa61384c1d81af8a3c2"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8899256483ab45e1fc1ac856a04495fa"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#a8899256483ab45e1fc1ac856a04495fa">SimulatePowerUpSelfTestFailure</a> ()</td></tr> <tr class="memdesc:a8899256483ab45e1fc1ac856a04495fa"><td class="mdescLeft"> </td><td class="mdescRight">Sets the power-up self test status to POWER_UP_SELF_TEST_FAILED. <a href="#a8899256483ab45e1fc1ac856a04495fa">More...</a><br /></td></tr> <tr class="separator:a8899256483ab45e1fc1ac856a04495fa"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a4c02704f811a57301d998fabd8bcf5ae"><td class="memItemLeft" align="right" valign="top"><a class="el" href="fips140_8h.html#a8ccac50ac3bfc5abaa6cb457f0ded35d">PowerUpSelfTestStatus</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#a4c02704f811a57301d998fabd8bcf5ae">GetPowerUpSelfTestStatus</a> ()</td></tr> <tr class="memdesc:a4c02704f811a57301d998fabd8bcf5ae"><td class="mdescLeft"> </td><td class="mdescRight">Provides the current power-up self test status. <a href="#a4c02704f811a57301d998fabd8bcf5ae">More...</a><br /></td></tr> <tr class="separator:a4c02704f811a57301d998fabd8bcf5ae"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a516ac52317797e392c0daaaf8cd136fc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_message_authentication_code.html">MessageAuthenticationCode</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#a516ac52317797e392c0daaaf8cd136fc">NewIntegrityCheckingMAC</a> ()</td></tr> <tr class="memdesc:a516ac52317797e392c0daaaf8cd136fc"><td class="mdescLeft"> </td><td class="mdescRight">Class object that calculates the MAC on the module. <a href="#a516ac52317797e392c0daaaf8cd136fc">More...</a><br /></td></tr> <tr class="separator:a516ac52317797e392c0daaaf8cd136fc"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ad93887bc085f01ddffbba846e74c5239"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="fips140_8h.html#ad93887bc085f01ddffbba846e74c5239">IntegrityCheckModule</a> (const char *moduleFilename, const byte *expectedModuleMac, <a class="el" href="class_sec_byte_block.html">SecByteBlock</a> *pActualMac=NULL, unsigned long *pMacFileLocation=NULL)</td></tr> <tr class="memdesc:ad93887bc085f01ddffbba846e74c5239"><td class="mdescLeft"> </td><td class="mdescRight">Verifies the MAC on the module. <a href="#ad93887bc085f01ddffbba846e74c5239">More...</a><br /></td></tr> <tr class="separator:ad93887bc085f01ddffbba846e74c5239"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Classes and functions for the FIPS 140-2 validated library. </p> <p>The FIPS validated library is only available on Windows as a DLL. Once compiled, the library is always in FIPS mode contingent upon successful execution of <a class="el" href="fips140_8h.html#ac4890bf392b8a421fb9288327a885a47" title="Performs the power-up self test.">DoPowerUpSelfTest()</a> or <a class="el" href="fips140_8h.html#a8daad2060ff39aa61384c1d81af8a3c2" title="Performs the power-up self test on the DLL.">DoDllPowerUpSelfTest()</a>. </p><dl class="section see"><dt>See also</dt><dd><a href="http://cryptopp.com/wiki/Visual_Studio">Visual Studio</a> and <a href="http://cryptopp.com/wiki/config.h">config.h</a> on the Crypto++ wiki. </dd></dl> <p class="definition">Definition in file <a class="el" href="fips140_8h_source.html">fips140.h</a>.</p> </div><h2 class="groupheader">Macro Definition Documentation</h2> <a id="afa5d25ce1be2e8d1beda9340260a4d77"></a> <h2 class="memtitle"><span class="permalink"><a href="#afa5d25ce1be2e8d1beda9340260a4d77">◆ </a></span>CRYPTOPP_DUMMY_DLL_MAC</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define CRYPTOPP_DUMMY_DLL_MAC   "MAC_51f34b8db820ae8"</td> </tr> </table> </div><div class="memdoc"> <p>The placeholder used prior to embedding the actual MAC in the module. </p> <p>After the DLL is built but before it is MAC'd, the string CRYPTOPP_DUMMY_DLL_MAC is used as a placeholder for the actual MAC. A post-build step is performed which calculates the MAC of the DLL and embeds it in the module. The actual MAC is written by the <code>cryptest.exe</code> program using the <code>mac_dll</code> subcommand. </p> <p class="definition">Definition at line <a class="el" href="fips140_8h_source.html#l00108">108</a> of file <a class="el" href="fips140_8h_source.html">fips140.h</a>.</p> </div> </div> <h2 class="groupheader">Enumeration Type Documentation</h2> <a id="a8ccac50ac3bfc5abaa6cb457f0ded35d"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8ccac50ac3bfc5abaa6cb457f0ded35d">◆ </a></span>PowerUpSelfTestStatus</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">enum <a class="el" href="fips140_8h.html#a8ccac50ac3bfc5abaa6cb457f0ded35d">PowerUpSelfTestStatus</a></td> </tr> </table> </div><div class="memdoc"> <p>Status of the power-up self test. </p> <table class="fieldtable"> <tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="a8ccac50ac3bfc5abaa6cb457f0ded35da50805cb51444d59eb747962fa279ad27"></a>POWER_UP_SELF_TEST_NOT_DONE </td><td class="fielddoc"><p>The self tests have not been performed. </p> </td></tr> <tr><td class="fieldname"><a id="a8ccac50ac3bfc5abaa6cb457f0ded35da7fdf030b911a428fda600038ef914c95"></a>POWER_UP_SELF_TEST_FAILED </td><td class="fielddoc"><p>The self tests were executed via <a class="el" href="fips140_8h.html#ac4890bf392b8a421fb9288327a885a47" title="Performs the power-up self test.">DoPowerUpSelfTest()</a> or <a class="el" href="fips140_8h.html#a8daad2060ff39aa61384c1d81af8a3c2" title="Performs the power-up self test on the DLL.">DoDllPowerUpSelfTest()</a>, but the result was failure. </p> </td></tr> <tr><td class="fieldname"><a id="a8ccac50ac3bfc5abaa6cb457f0ded35da6c4f7efa0a4251f4c3a2836abba17877"></a>POWER_UP_SELF_TEST_PASSED </td><td class="fielddoc"><p>The self tests were executed via <a class="el" href="fips140_8h.html#ac4890bf392b8a421fb9288327a885a47" title="Performs the power-up self test.">DoPowerUpSelfTest()</a> or <a class="el" href="fips140_8h.html#a8daad2060ff39aa61384c1d81af8a3c2" title="Performs the power-up self test on the DLL.">DoDllPowerUpSelfTest()</a>, and the result was success. </p> </td></tr> </table> <p class="definition">Definition at line <a class="el" href="fips140_8h_source.html#l00037">37</a> of file <a class="el" href="fips140_8h_source.html">fips140.h</a>.</p> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a id="afcc971af5af431d1528a09f52c195d64"></a> <h2 class="memtitle"><span class="permalink"><a href="#afcc971af5af431d1528a09f52c195d64">◆ </a></span>FIPS_140_2_ComplianceEnabled()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool FIPS_140_2_ComplianceEnabled </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Determines whether the library provides FIPS validated cryptography. </p> <dl class="section return"><dt>Returns</dt><dd>true if FIPS 140-2 validated features were enabled at compile time.</dd></dl> <p>true if FIPS 140-2 validated features were enabled at compile time, false otherwise. </p><dl class="section note"><dt>Note</dt><dd>FIPS mode is enabled at compile time. A program or other module cannot arbitrarily enter or exit the mode. </dd></dl> <p class="definition">Definition at line <a class="el" href="fips140_8cpp_source.html#l00029">29</a> of file <a class="el" href="fips140_8cpp_source.html">fips140.cpp</a>.</p> </div> </div> <a id="ac4890bf392b8a421fb9288327a885a47"></a> <h2 class="memtitle"><span class="permalink"><a href="#ac4890bf392b8a421fb9288327a885a47">◆ </a></span>DoPowerUpSelfTest()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void DoPowerUpSelfTest </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"><em>moduleFilename</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const byte * </td> <td class="paramname"><em>expectedModuleMac</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Performs the power-up self test. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">moduleFilename</td><td>the fully qualified name of the module </td></tr> <tr><td class="paramname">expectedModuleMac</td><td>the expected MAC of the components protected by the integrity check</td></tr> </table> </dd> </dl> <p>Performs the power-up self test, and sets the self test status to POWER_UP_SELF_TEST_PASSED or POWER_UP_SELF_TEST_FAILED.</p> <p>The self tests for an algorithm are performed by the Algortihm class when CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 is defined. </p> </div> </div> <a id="a8daad2060ff39aa61384c1d81af8a3c2"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8daad2060ff39aa61384c1d81af8a3c2">◆ </a></span>DoDllPowerUpSelfTest()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void DoDllPowerUpSelfTest </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Performs the power-up self test on the DLL. </p> <p>Performs the power-up self test using the filename of this DLL and the embedded module MAC, and sets the self test status to POWER_UP_SELF_TEST_PASSED or POWER_UP_SELF_TEST_FAILED.</p> <p>The self tests for an algorithm are performed by the Algortihm class when CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2 is defined. </p> </div> </div> <a id="a8899256483ab45e1fc1ac856a04495fa"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8899256483ab45e1fc1ac856a04495fa">◆ </a></span>SimulatePowerUpSelfTestFailure()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void SimulatePowerUpSelfTestFailure </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Sets the power-up self test status to POWER_UP_SELF_TEST_FAILED. </p> <p>Sets the power-up self test status to POWER_UP_SELF_TEST_FAILED to simulate failure. </p> <p class="definition">Definition at line <a class="el" href="fips140_8cpp_source.html#l00034">34</a> of file <a class="el" href="fips140_8cpp_source.html">fips140.cpp</a>.</p> </div> </div> <a id="a4c02704f811a57301d998fabd8bcf5ae"></a> <h2 class="memtitle"><span class="permalink"><a href="#a4c02704f811a57301d998fabd8bcf5ae">◆ </a></span>GetPowerUpSelfTestStatus()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="fips140_8h.html#a8ccac50ac3bfc5abaa6cb457f0ded35d">PowerUpSelfTestStatus</a> GetPowerUpSelfTestStatus </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Provides the current power-up self test status. </p> <dl class="section return"><dt>Returns</dt><dd>the current power-up self test status </dd></dl> <p class="definition">Definition at line <a class="el" href="fips140_8cpp_source.html#l00039">39</a> of file <a class="el" href="fips140_8cpp_source.html">fips140.cpp</a>.</p> </div> </div> <a id="a516ac52317797e392c0daaaf8cd136fc"></a> <h2 class="memtitle"><span class="permalink"><a href="#a516ac52317797e392c0daaaf8cd136fc">◆ </a></span>NewIntegrityCheckingMAC()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="class_message_authentication_code.html">MessageAuthenticationCode</a>* NewIntegrityCheckingMAC </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Class object that calculates the MAC on the module. </p> <dl class="section return"><dt>Returns</dt><dd>the MAC for the module </dd></dl> </div> </div> <a id="ad93887bc085f01ddffbba846e74c5239"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad93887bc085f01ddffbba846e74c5239">◆ </a></span>IntegrityCheckModule()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool IntegrityCheckModule </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"><em>moduleFilename</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const byte * </td> <td class="paramname"><em>expectedModuleMac</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="class_sec_byte_block.html">SecByteBlock</a> * </td> <td class="paramname"><em>pActualMac</em> = <code>NULL</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned long * </td> <td class="paramname"><em>pMacFileLocation</em> = <code>NULL</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Verifies the MAC on the module. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">moduleFilename</td><td>the fully qualified name of the module </td></tr> <tr><td class="paramname">expectedModuleMac</td><td>the expected MAC of the components protected by the integrity check </td></tr> <tr><td class="paramname">pActualMac</td><td>the actual MAC of the components calculated by the integrity check </td></tr> <tr><td class="paramname">pMacFileLocation</td><td>the offest of the MAC in the PE/PE+ module </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>true if the MAC is valid, false otherwise </dd></dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Wed Nov 27 2019 15:03:50 for Crypto++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.15 </small></address> </body> </html>