summaryrefslogtreecommitdiff
path: root/validat1.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-04-10 10:52:40 -0400
committerJeffrey Walton <noloader@gmail.com>2017-04-10 10:52:40 -0400
commit8ca0f479391c54ee454e9cddfcbe1657da240f85 (patch)
tree68b52541de179f62f3cd7e83c09f09bada8d4649 /validat1.cpp
parent8c7408bcd56ab3177ee61fe68ff07cc16d13cdd4 (diff)
downloadcryptopp-git-8ca0f479391c54ee454e9cddfcbe1657da240f85.tar.gz
Add ARIA block cipher
This is the reference implementation, test data and test vectors from the ARIA.zip package on the KISA website. The website is located at http://seed.kisa.or.kr/iwt/ko/bbs/EgovReferenceList.do?bbsId=BBSMSTR_000000000002. We have optimized routines that improve Key Setup and Bulk Encryption performance, but they are not being checked-in at the moment. The ARIA team is updating its implementation for contemporary hardware and we would like to use it as a starting point before we wander too far away from the KISA implementation.
Diffstat (limited to 'validat1.cpp')
-rw-r--r--validat1.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/validat1.cpp b/validat1.cpp
index 9844776e..5b6c5bc0 100644
--- a/validat1.cpp
+++ b/validat1.cpp
@@ -41,6 +41,7 @@
#include "skipjack.h"
#include "shacal2.h"
#include "camellia.h"
+#include "aria.h"
#include "osrng.h"
#include "drbg.h"
#include "rdrand.h"
@@ -144,6 +145,7 @@ bool ValidateAll(bool thorough)
pass=ValidateTwofish() && pass;
pass=ValidateSerpent() && pass;
pass=ValidateSHACAL2() && pass;
+ pass=ValidateARIA() && pass;
pass=ValidateCamellia() && pass;
pass=ValidateSalsa() && pass;
pass=ValidateSosemanuk() && pass;
@@ -2545,6 +2547,39 @@ bool ValidateSHACAL2()
return pass1 && pass2 && pass3;
}
+bool ValidateARIA()
+{
+ std::cout << "\nARIA validation suite running...\n\n";
+ bool pass1 = true, pass2 = true, pass3 = true;
+
+ ARIAEncryption enc;
+ pass1 = enc.StaticGetValidKeyLength(8) == 16 && pass1;
+ pass1 = enc.StaticGetValidKeyLength(16) == 16 && pass1;
+ pass1 = enc.StaticGetValidKeyLength(24) == 24 && pass1;
+ pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1;
+ pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1;
+ pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1;
+ pass1 = enc.StaticGetValidKeyLength(0) == enc.MinKeyLength() && pass1;
+ pass1 = enc.StaticGetValidKeyLength(SIZE_MAX) == enc.MaxKeyLength() && pass1;
+
+ ARIADecryption dec;
+ pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2;
+ pass2 = dec.StaticGetValidKeyLength(16) == 16 && pass2;
+ pass2 = dec.StaticGetValidKeyLength(24) == 24 && pass2;
+ pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2;
+ pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2;
+ pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2;
+ pass2 = dec.StaticGetValidKeyLength(0) == dec.MinKeyLength() && pass2;
+ pass2 = dec.StaticGetValidKeyLength(SIZE_MAX) == dec.MaxKeyLength() && pass2;
+ std::cout << (pass1 && pass2 ? "passed:" : "FAILED:") << " Algorithm key lengths\n";
+
+ FileSource valdata(CRYPTOPP_DATA_DIR "TestData/aria.dat", true, new HexDecoder);
+ pass3 = BlockTransformationTest(FixedRoundsCipherFactory<ARIAEncryption, ARIADecryption>(16), valdata, 15) && pass3;
+ pass3 = BlockTransformationTest(FixedRoundsCipherFactory<ARIAEncryption, ARIADecryption>(24), valdata, 15) && pass3;
+ pass3 = BlockTransformationTest(FixedRoundsCipherFactory<ARIAEncryption, ARIADecryption>(32), valdata, 15) && pass3;
+ return pass1 && pass2 && pass3;
+}
+
bool ValidateCamellia()
{
std::cout << "\nCamellia validation suite running...\n\n";