lilliput-ae-reference-implementation

Implementations of Lilliput-AE submitted to the NIST LWC standardization process
git clone https://git.kevinlegouguec.net/lilliput-ae-reference-implementation
Log | Files | Refs | README

commit 50dfa88971425c701a9f55f6ced2528088348483
parent c30548a179dcd0999bd342b10eeaad2a1a304e90
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date:   Thu, 22 Nov 2018 10:00:42 +0100

Renommage du test "cipher" en "tbc-encrypt"

tbc-decrypt inbound.

Diffstat:
Mcrypto_aead/lilliputaei128v1/ref/Makefile | 6+++---
Dcrypto_aead/lilliputaei128v1/ref/test/test-cipher.c | 75---------------------------------------------------------------------------
Rcrypto_aead/lilliputaei128v1/ref/test/test-cipher-ref/cipher_order.txt -> crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt-ref/tbc-encrypt_order.txt | 0
Rcrypto_aead/lilliputaei128v1/ref/test/test-cipher-ref/cipher_random.txt -> crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt-ref/tbc-encrypt_random.txt | 0
Acrypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/crypto_aead/lilliputaei128v1/ref/Makefile b/crypto_aead/lilliputaei128v1/ref/Makefile @@ -1,4 +1,4 @@ -tests = test-tweakey test-cipher +tests = test-tweakey test-tbc-encrypt .PHONY: clean test $(tests) @@ -27,11 +27,11 @@ $(tests): %: results/% diff -ru test/$*-ref results/$@-output -results/test-cipher: results/cipher.o results/tweakey.o results/constants.o | results +results/test-tbc-encrypt: results/cipher.o results/tweakey.o results/constants.o | results results/test-tweakey: results/tweakey.o results/constants.o | results results/test-*.o: test/helpers.h parameters.h -results/test-cipher.o: cipher.h +results/test-tbc-encrypt.o: cipher.h results/test-tweakey.o: tweakey.h results/cipher.o: cipher.h tweakey.h constants.h parameters.h debug.h diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-cipher.c b/crypto_aead/lilliputaei128v1/ref/test/test-cipher.c @@ -1,75 +0,0 @@ -#include <inttypes.h> -#include <stdio.h> - -#include "cipher.h" - -#include "helpers.h" - - -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", - .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 - }, - .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, - } - }, - { - .name = "random", - .tweak = { - 0xa8, 0x43, 0xf3, 0x10, 0x81, 0x11, 0x1c, 0x84, - 0xdf, 0xf8, 0x2e, 0xfa, 0x90, 0x90, 0x26, 0x21, - 0x7d, 0x8d, 0x43, 0x12, 0x2a, 0xb3, 0xd2, 0x4d - }, - .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 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); - } -} diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-cipher-ref/cipher_order.txt b/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt-ref/tbc-encrypt_order.txt diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-cipher-ref/cipher_random.txt b/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt-ref/tbc-encrypt_random.txt diff --git a/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c b/crypto_aead/lilliputaei128v1/ref/test/test-tbc-encrypt.c @@ -0,0 +1,75 @@ +#include <inttypes.h> +#include <stdio.h> + +#include "cipher.h" + +#include "helpers.h" + + +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", + .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 + }, + .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, + } + }, + { + .name = "random", + .tweak = { + 0xa8, 0x43, 0xf3, 0x10, 0x81, 0x11, 0x1c, 0x84, + 0xdf, 0xf8, 0x2e, 0xfa, 0x90, 0x90, 0x26, 0x21, + 0x7d, 0x8d, 0x43, 0x12, 0x2a, 0xb3, 0xd2, 0x4d + }, + .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 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], "tbc-encrypt", input->name); + + uint8_t ciphertext[BLOCK_BYTES]; + lilliput_tbc_encrypt(input->key, input->tweak, input->message, ciphertext, dump); + + fclose(dump); + } +}