Security Scol plugin
fips140.h
Go to the documentation of this file.
1// fips140.h - originally written and placed in the public domain by Wei Dai
2
10
11#ifndef CRYPTOPP_FIPS140_H
12#define CRYPTOPP_FIPS140_H
13
14#include "cryptlib.h"
15#include "secblock.h"
16
17NAMESPACE_BEGIN(CryptoPP)
18
19
22class CRYPTOPP_DLL SelfTestFailure : public Exception
23{
24public:
25 explicit SelfTestFailure(const std::string &s) : Exception(OTHER_ERROR, s) {}
26};
27
34CRYPTOPP_DLL bool CRYPTOPP_API FIPS_140_2_ComplianceEnabled();
35
48
56CRYPTOPP_DLL void CRYPTOPP_API DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac);
57
64CRYPTOPP_DLL void CRYPTOPP_API DoDllPowerUpSelfTest();
65
68CRYPTOPP_DLL void CRYPTOPP_API SimulatePowerUpSelfTestFailure();
69
72CRYPTOPP_DLL PowerUpSelfTestStatus CRYPTOPP_API GetPowerUpSelfTestStatus();
73
74#ifndef CRYPTOPP_DOXYGEN_PROCESSING
75typedef PowerUpSelfTestStatus (CRYPTOPP_API * PGetPowerUpSelfTestStatus)();
76#endif
77
80CRYPTOPP_DLL MessageAuthenticationCode * CRYPTOPP_API NewIntegrityCheckingMAC();
81
88CRYPTOPP_DLL bool CRYPTOPP_API IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac = NULLPTR, unsigned long *pMacFileLocation = NULLPTR);
89
90#ifndef CRYPTOPP_DOXYGEN_PROCESSING
91// this is used by Algorithm constructor to allow Algorithm objects to be constructed for the self test
92bool PowerUpSelfTestInProgressOnThisThread();
93
94void SetPowerUpSelfTestInProgressOnThisThread(bool inProgress);
95
96void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier &verifier);
97void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor);
98
99void SignaturePairwiseConsistencyTest_FIPS_140_Only(const PK_Signer &signer, const PK_Verifier &verifier);
100void EncryptionPairwiseConsistencyTest_FIPS_140_Only(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor);
101#endif
102
108#define CRYPTOPP_DUMMY_DLL_MAC "MAC_51f34b8db820ae8"
109
110NAMESPACE_END
111
112#endif
Base class for all exceptions thrown by the library.
Definition cryptlib.h:159
Interface for message authentication codes.
Definition cryptlib.h:1299
Interface for public-key decryptors.
Definition cryptlib.h:2733
Interface for public-key encryptors.
Definition cryptlib.h:2698
Interface for public-key signers.
Definition cryptlib.h:2877
Interface for public-key signature verifiers.
Definition cryptlib.h:2941
Abstract base classes that provide a uniform interface to this library.
CRYPTOPP_DLL MessageAuthenticationCode *CRYPTOPP_API NewIntegrityCheckingMAC()
Class object that calculates the MAC on the module.
Definition fipstest.cpp:272
CRYPTOPP_DLL void CRYPTOPP_API DoDllPowerUpSelfTest()
Performs the power-up self test on the DLL.
Definition fipstest.cpp:626
CRYPTOPP_DLL bool CRYPTOPP_API FIPS_140_2_ComplianceEnabled()
Determines whether the library provides FIPS validated cryptography.
Definition fips140.cpp:24
PowerUpSelfTestStatus
Status of the power-up self test.
Definition fips140.h:37
@ POWER_UP_SELF_TEST_NOT_DONE
The self tests have not been performed.
Definition fips140.h:40
@ POWER_UP_SELF_TEST_PASSED
The self tests were executed via DoPowerUpSelfTest() or DoDllPowerUpSelfTest(), and the result was su...
Definition fips140.h:46
@ POWER_UP_SELF_TEST_FAILED
The self tests were executed via DoPowerUpSelfTest() or DoDllPowerUpSelfTest(), but the result was fa...
Definition fips140.h:43
CRYPTOPP_DLL void CRYPTOPP_API SimulatePowerUpSelfTestFailure()
Sets the power-up self test status to POWER_UP_SELF_TEST_FAILED.
Definition fips140.cpp:29
CRYPTOPP_DLL PowerUpSelfTestStatus CRYPTOPP_API GetPowerUpSelfTestStatus()
Provides the current power-up self test status.
Definition fips140.cpp:34
CRYPTOPP_DLL bool CRYPTOPP_API IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac=NULLPTR, unsigned long *pMacFileLocation=NULLPTR)
Verifies the MAC on the module.
Definition fipstest.cpp:278
CRYPTOPP_DLL void CRYPTOPP_API DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac)
Performs the power-up self test.
Definition fipstest.cpp:466
Classes and functions for secure memory allocations.