Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.3 KiB

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