Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

# fips140.h

Go to the documentation of this file.

    00001 #ifndef CRYPTOPP_FIPS140_H
    00002 #define CRYPTOPP_FIPS140_H
    00003
    00004 /*! \file
    00005         FIPS 140 related functions and classes.
    00006 */
    00007
    00008 #include "cryptlib.h"
    00009 #include "secblock.h"
    00010
    00011 NAMESPACE_BEGIN(CryptoPP)
    00012
    00013 //! exception thrown when a crypto algorithm is used after a self test fails
    00014 class CRYPTOPP_DLL SelfTestFailure : public Exception
    00015 {
    00016 public:
    00017         explicit SelfTestFailure(const std::string &s) : Exception(OTHER_ERROR, s) {}
    00018 };
    00019
    00020 //! returns whether FIPS 140-2 compliance features were enabled at compile time
    00021 CRYPTOPP_DLL bool FIPS_140_2_ComplianceEnabled();
    00022
    00023 //! enum values representing status of the power-up self test
    00024 enum PowerUpSelfTestStatus {POWER_UP_SELF_TEST_NOT_DONE, POWER_UP_SELF_TEST_FAILED, POWER_UP_SELF_TEST_PASSED};
    00025
    00026 //! perform the power-up self test, and set the self test status
    00027 CRYPTOPP_DLL void DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac);
    00028
    00029 //! perform the power-up self test using the filename of this DLL and the embedded module MAC
    00030 CRYPTOPP_DLL void DoDllPowerUpSelfTest();
    00031
    00032 //! set the power-up self test status to POWER_UP_SELF_TEST_FAILED
    00033 CRYPTOPP_DLL void SimulatePowerUpSelfTestFailure();
    00034
    00035 //! return the current power-up self test status
    00036 CRYPTOPP_DLL PowerUpSelfTestStatus CRYPTOPP_API GetPowerUpSelfTestStatus();
    00037
    00038 typedef PowerUpSelfTestStatus (CRYPTOPP_API * PGetPowerUpSelfTestStatus)();
    00039
    00040 CRYPTOPP_DLL const byte * CRYPTOPP_API GetActualMacAndLocation(unsigned int &macSize, unsigned int &fileLocation);
    00041
    00042 typedef const byte * (CRYPTOPP_API * PGetActualMacAndLocation)(unsigned int &macSize, unsigned int &fileLocation);
    00043
    00044 CRYPTOPP_DLL MessageAuthenticationCode * NewIntegrityCheckingMAC();
    00045
    00046 CRYPTOPP_DLL bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac = NULL, unsigned long *pMacFileLocation = NULL);
    00047
    00048 // this is used by Algorithm constructor to allow Algorithm objects to be constructed for the self test
    00049 bool PowerUpSelfTestInProgressOnThisThread();
    00050
    00051 void SetPowerUpSelfTestInProgressOnThisThread(bool inProgress);
    00052
    00053 void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier &verifier);
    00054 void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor);
    00055
    00056 void SignaturePairwiseConsistencyTest_FIPS_140_Only(const PK_Signer &signer, const PK_Verifier &verifier);
    00057 void EncryptionPairwiseConsistencyTest_FIPS_140_Only(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor);
    00058
    00059 NAMESPACE_END
    00060
    00061 #endif