~ubuntu-branches/debian/squeeze/pycryptopp/squeeze

« back to all changes in this revision

Viewing changes to cryptopp/fips140.h

  • Committer: Bazaar Package Importer
  • Author(s): Zooko O'Whielacronx
  • Date: 2009-06-22 22:20:50 UTC
  • Revision ID: james.westby@ubuntu.com-20090622222050-hbqmn50dt2kvoz5o
Tags: upstream-0.5.14
ImportĀ upstreamĀ versionĀ 0.5.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef CRYPTOPP_FIPS140_H
 
2
#define CRYPTOPP_FIPS140_H
 
3
 
 
4
/*! \file
 
5
        FIPS 140 related functions and classes.
 
6
*/
 
7
 
 
8
#include "cryptlib.h"
 
9
#include "secblock.h"
 
10
 
 
11
NAMESPACE_BEGIN(CryptoPP)
 
12
 
 
13
//! exception thrown when a crypto algorithm is used after a self test fails
 
14
class CRYPTOPP_DLL SelfTestFailure : public Exception
 
15
{
 
16
public:
 
17
        explicit SelfTestFailure(const std::string &s) : Exception(OTHER_ERROR, s) {}
 
18
};
 
19
 
 
20
//! returns whether FIPS 140-2 compliance features were enabled at compile time
 
21
CRYPTOPP_DLL bool CRYPTOPP_API FIPS_140_2_ComplianceEnabled();
 
22
 
 
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};
 
25
 
 
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);
 
28
 
 
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();
 
31
 
 
32
//! set the power-up self test status to POWER_UP_SELF_TEST_FAILED
 
33
CRYPTOPP_DLL void CRYPTOPP_API SimulatePowerUpSelfTestFailure();
 
34
 
 
35
//! return the current power-up self test status
 
36
CRYPTOPP_DLL PowerUpSelfTestStatus CRYPTOPP_API GetPowerUpSelfTestStatus();
 
37
 
 
38
typedef PowerUpSelfTestStatus (CRYPTOPP_API * PGetPowerUpSelfTestStatus)();
 
39
 
 
40
CRYPTOPP_DLL MessageAuthenticationCode * CRYPTOPP_API NewIntegrityCheckingMAC();
 
41
 
 
42
CRYPTOPP_DLL bool CRYPTOPP_API IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac = NULL, unsigned long *pMacFileLocation = NULL);
 
43
 
 
44
// this is used by Algorithm constructor to allow Algorithm objects to be constructed for the self test
 
45
bool PowerUpSelfTestInProgressOnThisThread();
 
46
 
 
47
void SetPowerUpSelfTestInProgressOnThisThread(bool inProgress);
 
48
 
 
49
void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier &verifier);
 
50
void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_Decryptor &decryptor);
 
51
 
 
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);
 
54
 
 
55
#define CRYPTOPP_DUMMY_DLL_MAC "MAC_51f34b8db820ae8"
 
56
 
 
57
NAMESPACE_END
 
58
 
 
59
#endif