1
#ifndef CRYPTOPP_FIPS140_H
2
#define CRYPTOPP_FIPS140_H
5
FIPS 140 related functions and classes.
11
NAMESPACE_BEGIN(CryptoPP)
13
//! exception thrown when a crypto algorithm is used after a self test fails
14
class CRYPTOPP_DLL SelfTestFailure : public Exception
17
explicit SelfTestFailure(const std::string &s) : Exception(OTHER_ERROR, s) {}
20
//! returns whether FIPS 140-2 compliance features were enabled at compile time
21
CRYPTOPP_DLL bool CRYPTOPP_API FIPS_140_2_ComplianceEnabled();
23
//! enum values representing status of the power-up self test
24
enum PowerUpSelfTestStatus {POWER_UP_SELF_TEST_NOT_DONE, POWER_UP_SELF_TEST_FAILED, POWER_UP_SELF_TEST_PASSED};
26
//! perform the power-up self test, and set the self test status
27
CRYPTOPP_DLL void CRYPTOPP_API DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac);
29
//! perform the power-up self test using the filename of this DLL and the embedded module MAC
30
CRYPTOPP_DLL void CRYPTOPP_API DoDllPowerUpSelfTest();
32
//! set the power-up self test status to POWER_UP_SELF_TEST_FAILED
33
CRYPTOPP_DLL void CRYPTOPP_API SimulatePowerUpSelfTestFailure();
35
//! return the current power-up self test status
36
CRYPTOPP_DLL PowerUpSelfTestStatus CRYPTOPP_API GetPowerUpSelfTestStatus();
38
typedef PowerUpSelfTestStatus (CRYPTOPP_API * PGetPowerUpSelfTestStatus)();
40
CRYPTOPP_DLL MessageAuthenticationCode * CRYPTOPP_API NewIntegrityCheckingMAC();
42
CRYPTOPP_DLL bool CRYPTOPP_API IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac = NULL, unsigned long *pMacFileLocation = NULL);
44
// this is used by Algorithm constructor to allow Algorithm objects to be constructed for the self test
45
bool PowerUpSelfTestInProgressOnThisThread();
47
void SetPowerUpSelfTestInProgressOnThisThread(bool inProgress);
49
void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier &verifier);
50
void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor);
52
void SignaturePairwiseConsistencyTest_FIPS_140_Only(const PK_Signer &signer, const PK_Verifier &verifier);
53
void EncryptionPairwiseConsistencyTest_FIPS_140_Only(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor);
55
#define CRYPTOPP_DUMMY_DLL_MAC "MAC_51f34b8db820ae8"