summaryrefslogtreecommitdiff
path: root/fipsalgt.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-07-26 07:58:40 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-07-26 07:58:40 +0000
commit244bc80865242575f546a8dd0f50138226015751 (patch)
tree756f142677f3e4f744fe740d7ef6699a3ba61dd9 /fipsalgt.cpp
parentc26f501f496ef64f16a9b4e4b08b32b1e29cf60e (diff)
downloadcryptopp-244bc80865242575f546a8dd0f50138226015751.tar.gz
new AES test format
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@114 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'fipsalgt.cpp')
-rw-r--r--fipsalgt.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/fipsalgt.cpp b/fipsalgt.cpp
index 4537ee4..6a62d1b 100644
--- a/fipsalgt.cpp
+++ b/fipsalgt.cpp
@@ -3,7 +3,12 @@
// This file implements the various algorithm tests needed to pass FIPS 140 validation.
// They're preserved here (commented out) in case Crypto++ needs to be revalidated.
-/*
+#if 0
+#include "dll.h"
+
+USING_NAMESPACE(CryptoPP)
+USING_NAMESPACE(std)
+
class LineBreakParser : public AutoSignaling<Bufferless<Filter> >
{
public:
@@ -97,6 +102,21 @@ public:
m_nameToType["PT"] = OUTPUT;
m_nameToType["CT"] = INPUT;
}
+
+ if (m_algorithm == "AES")
+ {
+ if (encrypt)
+ {
+ m_trigger = "PLAINTEXT";
+ m_typeToName[OUTPUT] = "CIPHERTEXT";
+ }
+ else
+ {
+ m_trigger = "CIPHERTEXT";
+ m_typeToName[OUTPUT] = "PLAINTEXT";
+ }
+ m_count = 0;
+ }
}
protected:
@@ -175,7 +195,7 @@ protected:
void OutputData(std::string &output, DataType t, const SecByteBlock &data)
{
std::string hexData;
- StringSource(data, true, new HexEncoder(new StringSink(hexData), false));
+ StringSource(data.begin(), data.size(), true, new HexEncoder(new StringSink(hexData), false));
OutputData(output, t, hexData);
}
@@ -644,6 +664,8 @@ protected:
inputs[j+1] = outputs[j-1];
}
+ if (m_algorithm == "AES")
+ OutputData(output, COUNT, m_count++);
OutputData(output, KEY_T, KEY[i]);
if (m_mode != "ECB")
OutputData(output, IV, ivs[i]);
@@ -827,18 +849,17 @@ protected:
Map m_data; // raw data
typedef std::map<DataType, SecByteBlock> Map2;
Map2 m_data2;
+ int m_count;
AutoSeededX917RNG<DES_EDE3> m_rng;
std::vector<unsigned int> m_compactString;
};
-*/
-/*
int main (int argc, char **argv)
{
std::string algorithm = argv[1];
std::string pathname = argv[2];
- i = pathname.find_last_of("\\/");
+ int i = pathname.find_last_of("\\/");
std::string filename = pathname.substr(i == std::string::npos ? 0 : i+1);
std::string mode;
if (filename[0] == 'S' || filename[0] == 'T')
@@ -873,5 +894,6 @@ int main (int argc, char **argv)
pSink = new FileSink(cout);
FileSource(pathname.c_str(), true, new LineBreakParser(new TestDataParser(algorithm, test, mode, feedbackSize, encrypt, pSink)), false);
+ return 0;
}
-*/
+#endif