summaryrefslogtreecommitdiff
path: root/crypto_aead/lilliputaei256v1/ref/test/traces-tbc-256-i.c
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2018-11-28 17:49:12 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2018-11-28 17:49:12 +0100
commit58bd58f23c0a6a36aa40cb07f8a5b2245d6225d4 (patch)
treedb858f3bcbd30fa836681ae99d5b05f72ae0e4ec /crypto_aead/lilliputaei256v1/ref/test/traces-tbc-256-i.c
parent463b5237c5947b551ecb2b0a6d2419c19bf18a97 (diff)
downloadlilliput-ae-implem-58bd58f23c0a6a36aa40cb07f8a5b2245d6225d4.tar.xz
Ajout de Lilliput-Ⅰ-256
Diffstat (limited to 'crypto_aead/lilliputaei256v1/ref/test/traces-tbc-256-i.c')
-rw-r--r--crypto_aead/lilliputaei256v1/ref/test/traces-tbc-256-i.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/crypto_aead/lilliputaei256v1/ref/test/traces-tbc-256-i.c b/crypto_aead/lilliputaei256v1/ref/test/traces-tbc-256-i.c
new file mode 100644
index 0000000..6668c8c
--- /dev/null
+++ b/crypto_aead/lilliputaei256v1/ref/test/traces-tbc-256-i.c
@@ -0,0 +1,63 @@
+#include <stdio.h>
+#include <stdint.h>
+
+#include "cipher.h"
+
+#include "debug.h"
+#include "test-helpers.h"
+
+
+FILE *DUMP;
+
+
+struct vector
+{
+ char *name;
+ uint8_t key[KEY_BYTES];
+ uint8_t tweak[TWEAK_BYTES];
+ uint8_t message[BLOCK_BYTES];
+};
+
+typedef struct vector vector;
+
+
+const vector VECTORS[] = {
+ {
+ .name = "order",
+ .key = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
+ },
+ .tweak = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17
+ },
+ .message = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+ }
+ }
+};
+
+
+int main()
+{
+ for (const vector *v=VECTORS; v<ARRAY_END(VECTORS); v++)
+ {
+ debug_open_dump("tbc-256-i", v->name);
+ debug_dump_buffer("message", BLOCK_BYTES, v->message, 0);
+ debug_dump_buffer("key", KEY_BYTES, v->key, 0);
+ debug_dump_buffer("tweak", TWEAK_BYTES, v->tweak, 0);
+
+ uint8_t ciphertext[BLOCK_BYTES];
+
+ lilliput_tbc_encrypt(v->key, v->tweak, v->message, ciphertext);
+
+ debug_dump_buffer("ciphertext", BLOCK_BYTES, ciphertext, 0);
+
+ fclose(DUMP);
+ }
+}