diff options
| author | Jeffrey Walton <noloader@gmail.com> | 2018-07-29 20:30:19 -0400 |
|---|---|---|
| committer | Jeffrey Walton <noloader@gmail.com> | 2018-07-29 20:30:19 -0400 |
| commit | d51f701e063828f391cd44a0ba75a194f2d9b77e (patch) | |
| tree | 6bf745d73b6253d625e675af9a1def2d47e8ad06 /validate.h | |
| parent | 98e35d29250dce3c560af1021f416ea1aefe8b2f (diff) | |
| download | cryptopp-git-d51f701e063828f391cd44a0ba75a194f2d9b77e.tar.gz | |
Refactor validat5.cpp and validat6.cpp
Also see https://groups.google.com/forum/#\!topic/cryptopp-users/j_aQj6r-PoI
Diffstat (limited to 'validate.h')
| -rw-r--r-- | validate.h | 78 |
1 files changed, 54 insertions, 24 deletions
@@ -156,6 +156,20 @@ bool TestMersenne(); bool TestSharing();
#endif
+class FixedRNG : public RandomNumberGenerator
+{
+public:
+ FixedRNG(BufferedTransformation &source) : m_source(source) {}
+
+ void GenerateBlock(byte *output, size_t size)
+ {
+ m_source.Get(output, size);
+ }
+
+private:
+ BufferedTransformation &m_source;
+};
+
#if 1
// Coverity findings in benchmark and validation routines
class StreamState
@@ -183,27 +197,6 @@ private: };
#endif
-#if 0
-class StreamState
-{
-public:
- StreamState(std::ostream& out)
- : m_out(out), m_state(NULLPTR)
- {
- m_state.copyfmt(m_out);
- }
-
- ~StreamState()
- {
- m_out.copyfmt(m_state);
- }
-
-private:
- std::ostream& m_out;
- std::ios m_state;
-};
-#endif
-
// Safer functions on Windows for C&A, http://github.com/weidai11/cryptopp/issues/55
inline std::string TimeToString(const time_t& t)
{
@@ -269,10 +262,47 @@ inline int StringToValue<int, true>(const std::string& str) return r;
}
-// Functions that need a RNG; uses AES inf CFB mode with Seed.
-CryptoPP::RandomNumberGenerator & GlobalRNG();
+// Definition in test.cpp
+RandomNumberGenerator & GlobalRNG();
+
+// Definition in datatest.cpp
+bool RunTestDataFile(const char *filename, const NameValuePairs &overrideParameters=g_nullNameValuePairs, bool thorough=true);
+
+// Definitions in validat6.cpp
+bool CryptoSystemValidate(PK_Decryptor &priv, PK_Encryptor &pub, bool thorough = false);
+bool SimpleKeyAgreementValidate(SimpleKeyAgreementDomain &d);
+bool AuthenticatedKeyAgreementValidate(AuthenticatedKeyAgreementDomain &d);
+bool SignatureValidate(PK_Signer &priv, PK_Verifier &pub, bool thorough = false);
-bool RunTestDataFile(const char *filename, const CryptoPP::NameValuePairs &overrideParameters=CryptoPP::g_nullNameValuePairs, bool thorough=true);
+// Miscellaneous PK definitions in validat6.cpp
+// Key Agreement definitions in validat7.cpp
+// Encryption and Decryption definitions in validat8.cpp
+// Sign and Verify definitions in validat9.cpp
+
+bool ValidateECP();
+bool ValidateEC2N();
+
+bool ValidateRSA_Encrypt();
+bool ValidateRSA_Sign();
+
+bool ValidateLUC_Encrypt();
+bool ValidateLUC_Sign();
+
+bool ValidateLUC_DL_Encrypt();
+bool ValidateLUC_DL_Sign();
+
+bool ValidateRabin_Encrypt();
+bool ValidateRabin_Sign();
+
+bool ValidateECP();
+bool ValidateECP_Agreement();
+bool ValidateECP_Encrypt();
+bool ValidateECP_Sign();
+
+bool ValidateEC2N();
+bool ValidateEC2N_Agreement();
+bool ValidateEC2N_Encrypt();
+bool ValidateEC2N_Sign();
NAMESPACE_END // Test
NAMESPACE_END // CryptoPP
|
