aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-12-11 11:11:31 +0000
committerlloyd <[email protected]>2013-12-11 11:11:31 +0000
commit403f6fedd5d8360b33368193ef13da9c1bf7e61f (patch)
tree718311e89d6bca4c540e57f3a3673dd42ea7ed9d
parent6aafaa3a6ab63a97e56715a8c8471977d383bdef (diff)
Move OCB test to AEAD test framework. Disable Threefish benchmark.
-rw-r--r--checks/aead.vec8
-rw-r--r--checks/ocb.cpp27
-rw-r--r--checks/tests.cpp12
-rw-r--r--checks/transform.cpp6
4 files changed, 20 insertions, 33 deletions
diff --git a/checks/aead.vec b/checks/aead.vec
index 4d9f39556..bc75ca489 100644
--- a/checks/aead.vec
+++ b/checks/aead.vec
@@ -1,3 +1,4 @@
+
AEAD = AES-128/SIV
Plaintext = 112233445566778899AABBCCDDEE
Key = FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF
@@ -10,3 +11,10 @@ Key = 7F7E7D7C7B7A79787776757473727170404142434445464748494A4B4C4D4E4F
AD = 00112233445566778899AABBCCDDEEFFDEADDADADEADDADAFFEEDDCCBBAA99887766554433221100
Nonce = 09F911029D74E35BD84156C5635688C1
Ciphertext = E21A9D0FE3BD3ED189C71F29B24C39E1E40B9BAB82D428D0A9B392F13EA14C9B4433F393595A8E031F032350F50D2B21825B3EE64958103BD8445C3F48E5CF
+
+AEAD = AES-128/OCB
+Plaintext = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627
+AD = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627
+Nonce = 000102030405060708090A0B
+Key = 000102030405060708090A0B0C0D0E0F
+Ciphertext = BEA5E8798DBE7110031C144DA0B26122CEAAB9B05DF771A657149D53773463CB68C65778B058A635659C623211DEEA0DE30D2C381879F4C8
diff --git a/checks/ocb.cpp b/checks/ocb.cpp
index d2fbbeeb3..3cb9c4c09 100644
--- a/checks/ocb.cpp
+++ b/checks/ocb.cpp
@@ -126,33 +126,6 @@ void test_ocb_long(size_t taglen, const std::string &expected)
void test_ocb()
{
- SymmetricKey key("000102030405060708090A0B0C0D0E0F");
-
- std::vector<byte> nonce = hex_decode("000102030405060708090A0B");
-
- std::vector<byte> pt = hex_decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627");
- std::vector<byte> ad = hex_decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324252627");
-
- const std::string expected = "BEA5E8798DBE7110031C144DA0B26122CEAAB9B05DF771A657149D53773463CB68C65778B058A635659C623211DEEA0DE30D2C381879F4C8";
-
- std::vector<byte> ctext = ocb_encrypt(key, nonce, pt, ad);
-
- const std::string ctext_hex = hex_encode(ctext);
-
- if(ctext_hex != expected)
- std::cout << "OCB/AES-128 encrypt test failure\n" << ctext_hex << " !=\n" << expected << "\n";
-
- try
- {
- std::vector<byte> dec = ocb_decrypt(key, nonce, ctext, ad);
-
- if(dec != pt) std::cout << "OCB fails to decrypt\n";
- }
- catch(std::exception& e)
- {
- std::cout << "Correct OCB message rejected - " << e.what() << "\n";
- }
-
test_ocb_long(128, "B2B41CBF9B05037DA7F16C24A35C1C94");
test_ocb_long(96, "1A4F0654277709A5BDA0D380");
test_ocb_long(64, "B7ECE9D381FE437F");
diff --git a/checks/tests.cpp b/checks/tests.cpp
index fdaccd805..db934735e 100644
--- a/checks/tests.cpp
+++ b/checks/tests.cpp
@@ -31,10 +31,16 @@ void run_tests_bb(std::istream& src,
if(key == output_key)
{
++test_cnt;
- bool passed = cb(vars);
-
- if(!passed)
+ try
+ {
+ if(!cb(vars))
+ ++test_fail;
+ }
+ catch(std::exception& e)
+ {
+ std::cout << e.what() << "\n";
++test_fail;
+ }
if(clear_between_cb)
vars.clear();
diff --git a/checks/transform.cpp b/checks/transform.cpp
index 70d86541e..71ecc35e7 100644
--- a/checks/transform.cpp
+++ b/checks/transform.cpp
@@ -52,7 +52,7 @@ void test_transform()
hex_decode_locked(m["Input"])));
});
- time_transform("Threefish-512");
+ //time_transform("Threefish-512");
}
void time_transform(const std::string& algo)
@@ -64,7 +64,7 @@ void time_transform(const std::string& algo)
tf->set_key(rng.random_vec(tf->maximum_keylength()));
tf->start_vec(rng.random_vec(tf->default_nonce_length()));
- for(size_t mult : { 1, 2, 4, 8, 16, 128, 1024 })
+ for(size_t mult : { 1, 2, 4, 8, 16, 128 })
{
const size_t buf_size = mult*tf->update_granularity();
@@ -78,6 +78,6 @@ void time_transform(const std::string& algo)
const u64bit Mbytes = (res * buf_size) / 1024 / 1024;
- std::cout << Mbytes << " MiB / second in " << buf_size << " blocks\n";
+ std::cout << Mbytes << " MiB / second in " << buf_size << " byte blocks\n";
}
}