From 8e50f73f7d597d5de84db82d82c829223d59ae1f Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Wed, 21 Nov 2018 14:58:36 +0100 Subject: Extraction du code de debug de tweakey.c dans un entête MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pour que cipher.c puisse s'en servir. --- crypto_aead/lilliputaei128v1/ref/tweakey.c | 43 +++++++----------------------- 1 file changed, 10 insertions(+), 33 deletions(-) (limited to 'crypto_aead/lilliputaei128v1/ref/tweakey.c') diff --git a/crypto_aead/lilliputaei128v1/ref/tweakey.c b/crypto_aead/lilliputaei128v1/ref/tweakey.c index dc8064a..4310dc5 100644 --- a/crypto_aead/lilliputaei128v1/ref/tweakey.c +++ b/crypto_aead/lilliputaei128v1/ref/tweakey.c @@ -6,37 +6,14 @@ #include "parameters.h" #include "tweakey.h" +#include "debug.h" + #define LANE_BITS 64 #define LANE_BYTES (LANE_BITS/8) #define LANES_NB (TWEAKEY_BYTES/LANE_BYTES) -static void _dump_buffer(FILE *output, const char *header, size_t len, const uint8_t buf[len], int indent) -{ - if (!output) - { - return; - } - - fprintf(output, "%s\n", header); - - for (size_t line=0; lineTK+TWEAK_BYTES, key, KEY_BYTES); TK->debug = debug; - _dump_buffer(debug, " Tweak is :", TWEAK_BYTES, tweak, 5); - _dump_buffer(debug, " Key is :", KEY_BYTES, key, 5); - _dump_buffer(debug, " Tweakey is :", sizeof(TK->TK), TK->TK, 5); + debug_dump_buffer(debug, " Tweak is :", TWEAK_BYTES, tweak, 5); + debug_dump_buffer(debug, " Key is :", KEY_BYTES, key, 5); + debug_dump_buffer(debug, " Tweakey is :", sizeof(TK->TK), TK->TK, 5); } @@ -74,8 +51,8 @@ void tweakey_state_extract( char debug[512]; snprintf(debug, sizeof(debug), " Extracting Subtweakey round %"PRIu8, i); - _dump_buffer(TK->debug, debug, sizeof(TK->TK), TK->TK, 5); - _dump_buffer(TK->debug, " Subtweakey :", ROUND_TWEAKEY_BYTES, round_tweakey, 5); + debug_dump_buffer(TK->debug, debug, sizeof(TK->TK), TK->TK, 5); + debug_dump_buffer(TK->debug, " Subtweakey :", ROUND_TWEAKEY_BYTES, round_tweakey, 5); } @@ -115,13 +92,13 @@ static void _multiply_state(tweakey_state *TK) void tweakey_state_update(tweakey_state *TK) { - _dump_buffer(TK->debug, " Input Tweakey :", sizeof(TK->TK), TK->TK, 10); + debug_dump_buffer(TK->debug, " Input Tweakey :", sizeof(TK->TK), TK->TK, 10); _permute_state(TK); - _dump_buffer(TK->debug, " Post permutation Tweakey :", sizeof(TK->TK), TK->TK, 10); + debug_dump_buffer(TK->debug, " Post permutation Tweakey :", sizeof(TK->TK), TK->TK, 10); _multiply_state(TK); - _dump_buffer(TK->debug, " Post multiplication Tweakey :", sizeof(TK->TK), TK->TK, 10); + debug_dump_buffer(TK->debug, " Post multiplication Tweakey :", sizeof(TK->TK), TK->TK, 10); } -- cgit v1.2.3