summaryrefslogtreecommitdiff
path: root/crypto_aead/lilliputaei128v1/ref/test/test-cipher.c
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2018-11-21 16:34:25 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2018-11-21 16:34:49 +0100
commit8d46de55be9fce55b297915e7086f77ceaab6f19 (patch)
tree6847da64c3e46f455fdd626f8d9d2a0dcdc37cad /crypto_aead/lilliputaei128v1/ref/test/test-cipher.c
parent42b8c9908b04635cabc775c4f86f66cb91497c9f (diff)
downloadlilliput-ae-implem-8d46de55be9fce55b297915e7086f77ceaab6f19.tar.xz
Ajout de traces pour cipher.c (début)
Implémentation de test-cipher.c en passant.
Diffstat (limited to 'crypto_aead/lilliputaei128v1/ref/test/test-cipher.c')
-rw-r--r--crypto_aead/lilliputaei128v1/ref/test/test-cipher.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-cipher.c b/crypto_aead/lilliputaei128v1/ref/test/test-cipher.c
index 6bc807f..c56e5fb 100644
--- a/crypto_aead/lilliputaei128v1/ref/test/test-cipher.c
+++ b/crypto_aead/lilliputaei128v1/ref/test/test-cipher.c
@@ -6,9 +6,18 @@
#include "helpers.h"
-/* [0]: LSB */
+struct vector_input
+{
+ char * name;
+ uint8_t key[KEY_BYTES];
+ uint8_t tweak[TWEAK_BYTES];
+ uint8_t message[BLOCK_BYTES];
+};
+
+typedef struct vector_input vector_input;
+/* [0]: LSB */
vector_input VECTORS[] = {
{
.name = "order",
@@ -20,6 +29,10 @@ vector_input VECTORS[] = {
.key = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
+ },
+ .message = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
}
},
{
@@ -32,11 +45,31 @@ vector_input VECTORS[] = {
.key = {
0xc1, 0x96, 0xc6, 0x0a, 0x02, 0x73, 0x91, 0x68,
0x7f, 0xf4, 0x23, 0x4d, 0x3d, 0xd5, 0xf9, 0x9b
+ },
+ .message = {
+ 0xbc, 0xd7, 0xf0, 0x29, 0x84, 0xb6, 0xc8, 0xf9,
+ 0x9c, 0x9d, 0x1d, 0xbd, 0x0d, 0x30, 0x94, 0x0b
}
}
};
-int main()
+int main(int argc, char const * const *argv)
{
+ if (argc < 2)
+ {
+ fprintf(stderr, "usage: %s OUTPUT-FOLDER\n", argv[0]);
+ return 1;
+ }
+
+ for (vector_input* input=VECTORS; input<ARRAY_END(VECTORS); input++)
+ {
+ printf("%s\n", input->name);
+ FILE* dump = open_dump_file(argv[1], "cipher", input->name);
+
+ uint8_t ciphertext[BLOCK_BYTES];
+ lilliput_tbc_encrypt(input->key, input->tweak, input->message, ciphertext, dump);
+
+ fclose(dump);
+ }
}