X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=twister%2Ftwister.c;h=19c95d26d219af90e455768ac0aad885ee48fcd0;hp=40f38363f9cd177cd2d654ad2ebab7bdc9d4c6d8;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=7b5401ab9ce23a5da1de8b6c7de3a1aa20ac4cf8 diff --git a/twister/twister.c b/twister/twister.c index 40f3836..19c95d2 100644 --- a/twister/twister.c +++ b/twister/twister.c @@ -1,7 +1,7 @@ /* twister.c */ /* This file is part of the AVR-Crypto-Lib. - Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) + Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ #include #include "twister.h" #include "twister_tables.h" -#include "memxor/memxor.h" +#include "memxor.h" //#ifndef TWISTER_MUL_TABLE # include "gf256mul/gf256mul.h" @@ -37,7 +37,7 @@ # define MULT(a,b) gf256mul((a),(b), 0x4D) //#endif -void twister_blank_round(twister_state_t* ctx){ +void twister_blank_round(twister_state_t *ctx){ uint8_t i,j,k; uint8_t tmp[8][8]; /* add twist counter */ @@ -76,7 +76,7 @@ void twister_blank_round(twister_state_t* ctx){ } } } -void twister_mini_round(twister_state_t* ctx, const void* msg){ +void twister_mini_round(twister_state_t *ctx, const void *msg){ /* inject message */ uint8_t i; for(i=0; i<8; ++i){ @@ -86,7 +86,7 @@ void twister_mini_round(twister_state_t* ctx, const void* msg){ twister_blank_round(ctx); } -void twister_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_b){ +void twister_ctx2hash(void *dest, twister_state_t *ctx, uint16_t hashsize_b){ uint8_t tmp[8][8]; uint8_t j; uint16_t i=hashsize_b; @@ -107,7 +107,7 @@ void twister_ctx2hash(void* dest, twister_state_t* ctx, uint16_t hashsize_b){ memxor(ctx->s, tmp, 64); twister_blank_round(ctx); for(j=0; j<4; ++j){ - *((uint8_t*)dest) = ctx->s[3-j][0] ^ tmp[3-j][0]; + *((uint8_t*)dest) = ctx->s[7-j][0] ^ tmp[7-j][0]; dest = (uint8_t*)dest + 1; } }