From: bg Date: Thu, 14 May 2009 14:28:59 +0000 (+0000) Subject: moved twister naming from big to large X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=commitdiff_plain;h=bce0505abf49276430f7439960829683b4daf53b moved twister naming from big to large --- diff --git a/hfal_twister384.c b/hfal_twister384.c index de97177..888078e 100644 --- a/hfal_twister384.c +++ b/hfal_twister384.c @@ -28,7 +28,7 @@ #include #include #include "hashfunction_descriptor.h" -#include "twister-big.h" +#include "twister-large.h" static const char twister384_str[] PROGMEM = "Twister-384"; diff --git a/hfal_twister512.c b/hfal_twister512.c index f672344..4f6e7b0 100644 --- a/hfal_twister512.c +++ b/hfal_twister512.c @@ -28,7 +28,7 @@ #include #include #include "hashfunction_descriptor.h" -#include "twister-big.h" +#include "twister-large.h" static const char twister512_str[] PROGMEM = "Twister-512"; diff --git a/mkfiles/twister.mk b/mkfiles/twister.mk index 24fc9bc..f6196ef 100644 --- a/mkfiles/twister.mk +++ b/mkfiles/twister.mk @@ -4,7 +4,7 @@ ALGO_NAME := TWISTER # comment out the following line for removement of TWISTER from the build process HASHES += $(ALGO_NAME) -$(ALGO_NAME)_OBJ := twister-small-asm.o twister-big-asm.o twister-asm.o \ +$(ALGO_NAME)_OBJ := twister-small-asm.o twister-large-asm.o twister-asm.o \ twister224.o twister256.o twister384.o twister512.o $(ALGO_NAME)_TEST_BIN := main-twister-test.o hfal_twister224.o hfal_twister256.o \ hfal_twister384.o hfal_twister512.o $(CLI_STD) $(HFAL_STD) diff --git a/mkfiles/twister_c.mk b/mkfiles/twister_c.mk index 11eeca1..7d6ec36 100644 --- a/mkfiles/twister_c.mk +++ b/mkfiles/twister_c.mk @@ -4,7 +4,7 @@ ALGO_NAME := TWISTER_C # comment out the following line for removement of TWISTER from the build process HASHES += $(ALGO_NAME) -$(ALGO_NAME)_OBJ := twister.o twister-small.o twister-big.o memxor.o gf256mul.o +$(ALGO_NAME)_OBJ := twister.o twister-small.o twister-large.o memxor.o gf256mul.o $(ALGO_NAME)_TEST_BIN := main-twister-test.o hfal_twister224.o hfal_twister256.o \ hfal_twister384.o hfal_twister512.o $(CLI_STD) $(HFAL_STD) $(ALGO_NAME)_NESSIE_TEST := "nessie" diff --git a/test_src/main-twister-test.c b/test_src/main-twister-test.c index 794c054..505bbaf 100644 --- a/test_src/main-twister-test.c +++ b/test_src/main-twister-test.c @@ -27,6 +27,7 @@ #include "debug.h" #include "twister-small.h" +#include "twister-large.h" #include "nessie_hash_test.h" #include "performance_test.h" #include "hfal_twister224.h" diff --git a/twister-asm.S b/twister-asm.S index 7ae3842..746ea09 100644 --- a/twister-asm.S +++ b/twister-asm.S @@ -301,7 +301,7 @@ TMP_SAVE1 = 17 .global twister_ctx2hash .global twister_small_ctx2hash -.global twister_big_ctx2hash +.global twister_large_ctx2hash .global twister224_ctx2hash .global twister256_ctx2hash .global twister384_ctx2hash @@ -327,7 +327,7 @@ twister512_ctx2hash: ldi r21, hi8(512) ; rjmp twister_ctx2hash -twister_big_ctx2hash: +twister_large_ctx2hash: twister_small_ctx2hash: twister_ctx2hash: push_range 10, 17 diff --git a/twister-big-asm.S b/twister-big-asm.S deleted file mode 100644 index a274cf4..0000000 --- a/twister-big-asm.S +++ /dev/null @@ -1,516 +0,0 @@ -/* twister-big-asm.S */ -/* - This file is part of the AVR-Crypto-Lib. - Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) - - 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -/** - * \file twister-big-asm.S - * \email daniel.otte@rub.de - * \author Daniel Otte - * \date 2008-12-27 - * \license GPLv3 or later - * - */ - - #include "avr-asm-macros.S" - -/* void checksum_update(twister_big_ctx_t* ctx, uint8_t col) */ -/* - * param ctx: r24:r25 - * param col: r22 - */ -checksum_update: - push r16 - push r28 - push r29 - lsl r22 - lsl r22 - lsl r22 - mov r16, r22 - movw r30, r24 /* X points to ctx->state.s */ - - ldd r18, Z+7*8 - ldd r19, Z+6*8 - ldd r20, Z+5*8 - ldd r21, Z+4*8 - ldd r22, Z+3*8 - ldd r23, Z+2*8 - ldd r24, Z+1*8 - ldd r25, Z+0*8 - - adiw r30, 63 - adiw r30, 1+3*8 /* Z points at ctx->checksum[0][8] */ - movw r28, r30 /* Y points at ctx->checksum[0][8] */ - andi r16, 63 - add r30, r16 /* Z points at ctx->checksum[col][8]*/ - adc r31, r1 - ldi r26, 8 - add r16, r26 - andi r16, 63 - add r28, r16 - adc r29, r1 /* Y points at ctx->checksum[(col+1)%8][8]*/ - - ld r0, -Y - add r18, r0 - ld r0, -Z - eor r0, r18 - st Z, r0 - - ld r0, -Y - adc r19, r0 - ld r0, -Z - eor r0, r19 - st Z, r0 - - ld r0, -Y - adc r20, r0 - ld r0, -Z - eor r0, r20 - st Z, r0 - - ld r0, -Y - adc r21, r0 - ld r0, -Z - eor r0, r21 - st Z, r0 - - ld r0, -Y - adc r22, r0 - ld r0, -Z - eor r0, r22 - st Z, r0 - - ld r0, -Y - adc r23, r0 - ld r0, -Z - eor r0, r23 - st Z, r0 - - ld r0, -Y - adc r24, r0 - ld r0, -Z - eor r0, r24 - st Z, r0 - - ld r0, -Y - adc r25, r0 - ld r0, -Z - eor r0, r25 - st Z, r0 - - pop r29 - pop r28 - pop r16 - ret - -/*********************************************************************/ -/* void twister_big_init(twister_big_ctx_t* ctx, uint16_t hashsize_b)*/ -/* - * param ctx: r24:r25 - * param hashsize_b: r22:r23 - */ -.global twister384_init -twister384_init: - ldi r22, lo8(384) - ldi r23, hi8(384) - rjmp twister_big_init - -.global twister512_init -twister512_init: - ldi r22, lo8(512) - ldi r23, hi8(512) - -.global twister_big_init -twister_big_init: - movw r30, r24 - ldi r24, 64 -1: - st Z+, r1 - dec r24 - brne 1b - - dec r1 - ldi r24, 8 -1: - st Z+, r1 - dec r24 - brne 1b - - inc r1 - ldi r24, 8+64 -1: - st Z+, r1 - dec r24 - brne 1b - - subi r30, lo8(1+8+8+8*7+64) - sbci r31, hi8(1+8+8+8*7+64) - st Z, r23 - std Z+8, r22 - ret - -/*********************************************************************/ -/* void twister_big_nextBlock(twister_state_t* ctx, void* msg) */ -/* - * param ctx: r24:r25 - * param msg: r22:r23 - */ -CTX_SAVE0 = 14 -CTX_SAVE1 = 15 -TMP_SAVE0 = 12 -TMP_SAVE1 = 13 -MSG_SAVE0 = 28 -MSG_SAVE1 = 29 -.global twister_big_nextBlock -.global twister384_nextBlock -.global twister512_nextBlock - -twister384_nextBlock: -twister512_nextBlock: -twister_big_nextBlock: - push_range 12, 15 - push r28 - push r29 - stack_alloc_large 64 - adiw r30, 1 - movw TMP_SAVE0, r30 - movw CTX_SAVE0, r24 - movw MSG_SAVE0, r22 - movw r26, CTX_SAVE0 - ldi r18, 64/8 -1: - ld r0, X+ - st Z+, r0 - ld r0, X+ - st Z+, r0 - ld r0, X+ - st Z+, r0 - ld r0, X+ - st Z+, r0 - ld r0, X+ - st Z+, r0 - ld r0, X+ - st Z+, r0 - ld r0, X+ - st Z+, r0 - ld r0, X+ - st Z+, r0 - dec r18 - brne 1b - /* maxi round 1 */ - movw r24, CTX_SAVE0 - ldi r22, 0 - rcall checksum_update - movw r22, MSG_SAVE0 - movw r24, CTX_SAVE0 - rcall twister_mini_round - - movw r24, CTX_SAVE0 - ldi r22, 1 - rcall checksum_update - adiw MSG_SAVE0, 8 - movw r22, MSG_SAVE0 - movw r24, CTX_SAVE0 - rcall twister_mini_round - - movw r24, CTX_SAVE0 - ldi r22, 2 - rcall checksum_update - adiw MSG_SAVE0, 8 - movw r22, MSG_SAVE0 - movw r24, CTX_SAVE0 - rcall twister_mini_round - - movw r30, TMP_SAVE0 - movw r26, CTX_SAVE0 - ldi r18, 64 -1: - ld r0, X - ld r23, Z - eor r0, r23 - st X+, r0 - st Z+, r0 - dec r18 - brne 1b - /* maxi round 2 */ - movw r24, CTX_SAVE0 - ldi r22, 3 - rcall checksum_update - adiw MSG_SAVE0, 8 - movw r22, MSG_SAVE0 - movw r24, CTX_SAVE0 - rcall twister_mini_round - - movw r24, CTX_SAVE0 - rcall twister_blank_round - - movw r24, CTX_SAVE0 - ldi r22, 4 - rcall checksum_update - adiw MSG_SAVE0, 8 - movw r22, MSG_SAVE0 - movw r24, CTX_SAVE0 - rcall twister_mini_round - - movw r30, TMP_SAVE0 - movw r26, CTX_SAVE0 - ldi r18, 64 -1: - ld r0, X - ld r23, Z - eor r0, r23 - st X+, r0 - st Z+, r0 - dec r18 - brne 1b - /* maxi round 3 */ - movw r24, CTX_SAVE0 - ldi r22, 5 - rcall checksum_update - adiw MSG_SAVE0, 8 - movw r22, MSG_SAVE0 - movw r24, CTX_SAVE0 - rcall twister_mini_round - - movw r24, CTX_SAVE0 - ldi r22, 6 - rcall checksum_update - adiw MSG_SAVE0, 8 - movw r22, MSG_SAVE0 - movw r24, CTX_SAVE0 - rcall twister_mini_round - - movw r24, CTX_SAVE0 - ldi r22, 7 - rcall checksum_update - adiw MSG_SAVE0, 8 - movw r22, MSG_SAVE0 - movw r24, CTX_SAVE0 - rcall twister_mini_round - - movw r24, CTX_SAVE0 - rcall twister_blank_round - - movw r30, TMP_SAVE0 - movw r26, CTX_SAVE0 - ldi r18, 64 -1: - ld r0, X - ld r23, Z+ - eor r0, r23 - st X+, r0 - dec r18 - brne 1b - - adiw r26, 9 - ldi r19, 2 - ld r0, X - add r0, r19 - st X+, r0 - - ld r0, X - adc r0, r1 - st X+, r0 - ld r0, X - adc r0, r1 - st X+, r0 - ld r0, X - adc r0, r1 - st X+, r0 - ld r0, X - adc r0, r1 - st X+, r0 - ld r0, X - adc r0, r1 - st X+, r0 - ld r0, X - adc r0, r1 - st X+, r0 - ld r0, X - adc r0, r1 - st X+, r0 - - stack_free_large 64 - pop r29 - pop r28 - pop_range 12, 15 - ret - -/*********************************************************************/ -/* void twister_big_lastBlock(twister_state_t* ctx, void* msg, uint16_t length_b) */ -/* - * param ctx: r24:r25 - * param msg: r22:r23 - * param length_b: r20:r21 - */ -TMP_SAVE0 = 12 -TMP_SAVE1 = 13 -CTX_SAVE0 = 14 -CTX_SAVE1 = 15 -LEN_SAVE0 = 16 -LEN_SAVE1 = 17 -MSG_SAVE0 = 28 -MSG_SAVE1 = 29 -.global twister_big_lastBlock -.global twister384_lastBlock -.global twister512_lastBlock - -twister384_lastBlock: -twister512_lastBlock: -twister_big_lastBlock: - push_range 12, 17 - push r28 - push r29 - stack_alloc_large 64 - adiw r30, 1 - movw TMP_SAVE0, r30 - movw CTX_SAVE0, r24 - movw MSG_SAVE0, r22 - movw LEN_SAVE0, r20 -1: - cpi LEN_SAVE1, 2 - brmi 2f - movw r24, CTX_SAVE0 - movw r22, MSG_SAVE0 - rcall twister_big_nextBlock - adiw MSG_SAVE0, 8 - subi LEN_SAVE1, 2 - rjmp 1b -2: - movw r18, LEN_SAVE0 - lsr r19 - ror r18 - lsr r18 - lsr r18 - ldi r19, 63 - movw r26, MSG_SAVE0 - movw r30, TMP_SAVE0 - ldi r20, 0x80 - sub r19, r18 /* r18: bytes to copy, r19: bytes to clear */ - - ld r0, X+ -3: - tst r18 - breq 4f -31: - st Z+, r0 - ld r0, X+ - dec r18 - brne 31b -4: - mov r18, LEN_SAVE0 - andi r18, 0x07 - ldi r20, 0x80 - breq 5f -4: - lsr r20 - dec r18 - brne 4b - or r20, r0 - rjmp 5f - -5: - st Z+, r20 - tst r19 - breq 7f -6: - st Z+, r1 - dec r19 - brne 6b -7: - movw r24, CTX_SAVE0 - movw r22, TMP_SAVE0 - rcall twister_big_nextBlock - - ldi r19, 2 - clr r18 - - sub r18, LEN_SAVE0 - sbc r19, LEN_SAVE1 - movw r26, CTX_SAVE0 - adiw r26, 63 - adiw r26, 1+8 - - ld r0, X - sub r0, r18 - st X+, r0 - ld r0, X - sbc r0, r19 - st X+, r0 - ld r0, X - sbc r0, r1 - st X+, r0 - ld r0, X - sbc r0, r1 - st X+, r0 - ld r0, X - sbc r0, r1 - st X+, r0 - ld r0, X - sbc r0, r1 - st X+, r0 - ld r0, X - sbc r0, r1 - st X+, r0 - ld r0, X - sbc r0, r1 - st X+, r0 - - sbiw r26, 8 - movw r24, CTX_SAVE0 - movw r22, r26 - rcall twister_mini_round - - movw r24, CTX_SAVE0 - movw r22, CTX_SAVE0 - ldi r16, 64+8+8 - add r22, r16 - adc r23, r1 - movw r30, r22 - ldi r26, 8 -1: - ld r12, Z+ - ld r13, Z+ - ld r16, Z+ - ld r17, Z+ - ld r18, Z+ - ld r19, Z+ - ld r20, Z+ - ld r21, Z+ - st -Z, r12 - st -Z, r13 - st -Z, r16 - st -Z, r17 - st -Z, r18 - st -Z, r19 - st -Z, r20 - st -Z, r21 - adiw r30, 8 - dec r26 - brne 1b - - movw r24, CTX_SAVE0 - movw r22, CTX_SAVE0 - ldi r26, 64+2*8 - add r22, r26 - adc r23, r1 - rcall twister_small_nextBlock - - stack_free_large 64 - pop r29 - pop r28 - pop_range 12, 17 - ret diff --git a/twister-big.c b/twister-big.c deleted file mode 100644 index 1c0c56f..0000000 --- a/twister-big.c +++ /dev/null @@ -1,238 +0,0 @@ -/* twister-big.c */ -/* - This file is part of the AVR-Crypto-Lib. - Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) - - 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 - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include -#include "memxor.h" -#include "twister.h" -#include "twister-big.h" - -/*********************************************************************/ - -static -void checksum_update(twister_big_ctx_t* ctx, uint8_t col){ - uint8_t i, col2; - uint8_t carry = 0; - int sum = 0; - - col2 = (col+1)%8; - - for( i=0; i<8; i++ ) - { - sum = (int) ctx->checksum[col2][7-i] - + (int) ctx->state.s[7-i][0] /* col or 0 ???*/ - + carry; - ctx->checksum[col][7-i] ^= (uint8_t)sum; - carry = sum>>8; - - } -} - -/*********************************************************************/ - -void twister_big_init(twister_big_ctx_t* ctx, uint16_t hashsize_b){ - memset(ctx->state.s, 0, 64); - memset(ctx->checksum, 0, 64); - ctx->state.counter=0xffffffffffffffffLL; - ctx->state.s[0][7] = hashsize_b>>8; - ctx->state.s[1][7] = hashsize_b&0xff; - ctx->state.length_counter_b = 0; -} - -/*********************************************************************/ - -void twister_big_nextBlock(twister_big_ctx_t* ctx, const void* msg){ - uint8_t tmp[8][8]; - - /* 1st maxi round */ - memcpy(tmp, ctx->state.s, 64); - checksum_update(ctx, 0); - twister_mini_round(&(ctx->state), msg); - msg = (uint8_t*)msg + 8; - - checksum_update(ctx, 1); - twister_mini_round(&(ctx->state), msg); - msg = (uint8_t*)msg + 8; - - checksum_update(ctx, 2); - twister_mini_round(&(ctx->state), msg); - msg = (uint8_t*)msg + 8; - memxor(ctx->state.s, tmp, 64); - - /* 2nd maxi round */ - memcpy(tmp, ctx->state.s, 64); - checksum_update(ctx, 3); - twister_mini_round(&(ctx->state), msg); - msg = (uint8_t*)msg + 8; - - twister_blank_round(&(ctx->state)); - - checksum_update(ctx, 4); - twister_mini_round(&(ctx->state), msg); - msg = (uint8_t*)msg + 8; - memxor(ctx->state.s, tmp, 64); - - /* 3rd maxi round */ - memcpy(tmp, ctx->state.s, 64); - checksum_update(ctx, 5); - twister_mini_round(&(ctx->state), msg); - msg = (uint8_t*)msg + 8; - - checksum_update(ctx, 6); - twister_mini_round(&(ctx->state), msg); - msg = (uint8_t*)msg + 8; - - checksum_update(ctx, 7); - twister_mini_round(&(ctx->state), msg); - - twister_blank_round(&(ctx->state)); - memxor(ctx->state.s, tmp, 64); - ctx->state.length_counter_b += 512; -} - -/*********************************************************************/ - -void twister_inject_chksum(twister_big_ctx_t* ctx, uint8_t col){ - *((uint64_t*)(&ctx->state.s[7][0])) ^= *((uint64_t*)(&ctx->checksum[col][0])); - twister_blank_round(&ctx->state); -} - -/*********************************************************************/ - -void twister_big_lastBlock(twister_big_ctx_t* ctx, const void* msg, uint16_t length_b){ - uint8_t tmp[64]; - while(length_b>=512){ - twister_big_nextBlock(ctx, msg); - msg = ((uint8_t*)msg)+64; - length_b -= 512; - } - memset(tmp, 0, 64); - memcpy(tmp, msg, (length_b+7)/8); - tmp[length_b/8] |= 0x80 >> (length_b&0x07); - twister_big_nextBlock(ctx, tmp); - ctx->state.length_counter_b -= 512 - length_b; - twister_mini_round(&(ctx->state), &(ctx->state.length_counter_b)); - - memcpy(tmp, ctx->state.s, 64); - twister_inject_chksum(ctx, 0); - twister_inject_chksum(ctx, 1); - twister_inject_chksum(ctx, 2); - memxor(ctx->state.s, tmp, 64); - - memcpy(tmp, ctx->state.s, 64); - twister_inject_chksum(ctx, 3); - twister_inject_chksum(ctx, 4); - twister_inject_chksum(ctx, 5); - memxor(ctx->state.s, tmp, 64); - - memcpy(tmp, ctx->state.s, 64); - twister_inject_chksum(ctx, 6); - twister_inject_chksum(ctx, 7); - twister_blank_round(&(ctx->state)); - memxor(ctx->state.s, tmp, 64); - -} - -/*********************************************************************/ - -void twister_big_ctx2hash(void* dest, twister_big_ctx_t* ctx, uint16_t hashsize_b){ - twister_ctx2hash(dest, &(ctx->state), hashsize_b); -} - -/*********************************************************************/ -/*********************************************************************/ - -void twister384_init(twister384_ctx_t* ctx){ - twister_big_init(ctx, 384); -} - -/*********************************************************************/ - -void twister384_nextBlock(twister384_ctx_t* ctx, const void* msg){ - twister_big_nextBlock(ctx, msg); -} - -/*********************************************************************/ - -void twister384_lastBlock(twister384_ctx_t* ctx, const void* msg, uint16_t length_b){ - twister_big_lastBlock(ctx, msg, length_b); -} - -/*********************************************************************/ - -void twister384_ctx2hash(void* dest, twister384_ctx_t* ctx){ - twister_big_ctx2hash(dest, ctx, 384); -} - -/*********************************************************************/ - -void twister384(void* dest, const void* msg, uint32_t msg_length_b){ - twister_big_ctx_t ctx; - twister_big_init(&ctx, 384); - while(msg_length_b >=512){ - twister_big_nextBlock(&ctx, msg); - msg = (uint8_t*)msg + 512/8; - msg_length_b -= 512; - } - twister_big_lastBlock(&ctx, msg, msg_length_b); - twister_big_ctx2hash(dest, &ctx, 384); -} - -/*********************************************************************/ -/*********************************************************************/ - - -void twister512_init(twister512_ctx_t* ctx){ - twister_big_init(ctx, 512); -} - -/*********************************************************************/ - -void twister512_nextBlock(twister512_ctx_t* ctx, const void* msg){ - twister_big_nextBlock(ctx, msg); -} - -/*********************************************************************/ - -void twister512_lastBlock(twister512_ctx_t* ctx, const void* msg, uint16_t length_b){ - twister_big_lastBlock(ctx, msg, length_b); -} - -/*********************************************************************/ - -void twister512_ctx2hash(void* dest, twister512_ctx_t* ctx){ - twister_big_ctx2hash(dest, ctx, 512); -} - -/*********************************************************************/ - -void twister512(void* dest, const void* msg, uint32_t msg_length_b){ - twister_big_ctx_t ctx; - twister_big_init(&ctx, 512); - while(msg_length_b >=512){ - twister_big_nextBlock(&ctx, msg); - msg = (uint8_t*)msg + 512/8; - msg_length_b -= 512; - } - twister_big_lastBlock(&ctx, msg, msg_length_b); - twister_big_ctx2hash(dest, &ctx, 512); -} - - - diff --git a/twister-big.h b/twister-big.h deleted file mode 100644 index b10c0f0..0000000 --- a/twister-big.h +++ /dev/null @@ -1,45 +0,0 @@ -/* twister-big.h */ - -#ifndef TWISTER_BIG_H_ -#define TWISTER_BIG_H_ - -#include -#include "twister.h" - -typedef uint8_t twister384_hash_t[384/8]; -typedef uint8_t twister512_hash_t[512/8]; - -typedef struct { - twister_state_t state; - twister_checksum_t checksum; -} twister_big_ctx_t; - -typedef twister_big_ctx_t twister384_ctx_t; -typedef twister_big_ctx_t twister512_ctx_t; - -/*********************************************************************/ - -void twister_big_nextBlock(twister_big_ctx_t* ctx, const void* msg); -void twister_big_init(twister_big_ctx_t* ctx, uint16_t hashsize_b); -void twister_big_lastBlock(twister_big_ctx_t* ctx, const void* msg, uint16_t length_b); -void twister_big_ctx2hash(void* dest, twister_big_ctx_t* ctx, uint16_t hashsize_b); - -/*********************************************************************/ - -void twister384_init(twister384_ctx_t* ctx); -void twister384_nextBlock(twister384_ctx_t* ctx, const void* msg); -void twister384_lastBlock(twister384_ctx_t* ctx, const void* msg, uint16_t length_b); -void twister384_ctx2hash(void* dest, twister384_ctx_t* ctx); -void twister384(void* dest, const void* msg, uint32_t msg_length_b); - -/*********************************************************************/ - -void twister512_init(twister512_ctx_t* ctx); -void twister512_nextBlock(twister512_ctx_t* ctx, const void* msg); -void twister512_lastBlock(twister512_ctx_t* ctx, const void* msg, uint16_t length_b); -void twister512_ctx2hash(void* dest, twister512_ctx_t* ctx); -void twister512(void* dest, const void* msg, uint32_t msg_length_b); - - -#endif /* TWISTER_BIG_H_ */ - diff --git a/twister-large-asm.S b/twister-large-asm.S new file mode 100644 index 0000000..be10546 --- /dev/null +++ b/twister-large-asm.S @@ -0,0 +1,516 @@ +/* twister-large-asm.S */ +/* + This file is part of the AVR-Crypto-Lib. + Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +/** + * \file twister-large-asm.S + * \email daniel.otte@rub.de + * \author Daniel Otte + * \date 2008-12-27 + * \license GPLv3 or later + * + */ + + #include "avr-asm-macros.S" + +/* void checksum_update(twister_large_ctx_t* ctx, uint8_t col) */ +/* + * param ctx: r24:r25 + * param col: r22 + */ +checksum_update: + push r16 + push r28 + push r29 + lsl r22 + lsl r22 + lsl r22 + mov r16, r22 + movw r30, r24 /* X points to ctx->state.s */ + + ldd r18, Z+7*8 + ldd r19, Z+6*8 + ldd r20, Z+5*8 + ldd r21, Z+4*8 + ldd r22, Z+3*8 + ldd r23, Z+2*8 + ldd r24, Z+1*8 + ldd r25, Z+0*8 + + adiw r30, 63 + adiw r30, 1+3*8 /* Z points at ctx->checksum[0][8] */ + movw r28, r30 /* Y points at ctx->checksum[0][8] */ + andi r16, 63 + add r30, r16 /* Z points at ctx->checksum[col][8]*/ + adc r31, r1 + ldi r26, 8 + add r16, r26 + andi r16, 63 + add r28, r16 + adc r29, r1 /* Y points at ctx->checksum[(col+1)%8][8]*/ + + ld r0, -Y + add r18, r0 + ld r0, -Z + eor r0, r18 + st Z, r0 + + ld r0, -Y + adc r19, r0 + ld r0, -Z + eor r0, r19 + st Z, r0 + + ld r0, -Y + adc r20, r0 + ld r0, -Z + eor r0, r20 + st Z, r0 + + ld r0, -Y + adc r21, r0 + ld r0, -Z + eor r0, r21 + st Z, r0 + + ld r0, -Y + adc r22, r0 + ld r0, -Z + eor r0, r22 + st Z, r0 + + ld r0, -Y + adc r23, r0 + ld r0, -Z + eor r0, r23 + st Z, r0 + + ld r0, -Y + adc r24, r0 + ld r0, -Z + eor r0, r24 + st Z, r0 + + ld r0, -Y + adc r25, r0 + ld r0, -Z + eor r0, r25 + st Z, r0 + + pop r29 + pop r28 + pop r16 + ret + +/*********************************************************************/ +/* void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b)*/ +/* + * param ctx: r24:r25 + * param hashsize_b: r22:r23 + */ +.global twister384_init +twister384_init: + ldi r22, lo8(384) + ldi r23, hi8(384) + rjmp twister_large_init + +.global twister512_init +twister512_init: + ldi r22, lo8(512) + ldi r23, hi8(512) + +.global twister_large_init +twister_large_init: + movw r30, r24 + ldi r24, 64 +1: + st Z+, r1 + dec r24 + brne 1b + + dec r1 + ldi r24, 8 +1: + st Z+, r1 + dec r24 + brne 1b + + inc r1 + ldi r24, 8+64 +1: + st Z+, r1 + dec r24 + brne 1b + + subi r30, lo8(1+8+8+8*7+64) + sbci r31, hi8(1+8+8+8*7+64) + st Z, r23 + std Z+8, r22 + ret + +/*********************************************************************/ +/* void twister_large_nextBlock(twister_state_t* ctx, void* msg) */ +/* + * param ctx: r24:r25 + * param msg: r22:r23 + */ +CTX_SAVE0 = 14 +CTX_SAVE1 = 15 +TMP_SAVE0 = 12 +TMP_SAVE1 = 13 +MSG_SAVE0 = 28 +MSG_SAVE1 = 29 +.global twister_large_nextBlock +.global twister384_nextBlock +.global twister512_nextBlock + +twister384_nextBlock: +twister512_nextBlock: +twister_large_nextBlock: + push_range 12, 15 + push r28 + push r29 + stack_alloc_large 64 + adiw r30, 1 + movw TMP_SAVE0, r30 + movw CTX_SAVE0, r24 + movw MSG_SAVE0, r22 + movw r26, CTX_SAVE0 + ldi r18, 64/8 +1: + ld r0, X+ + st Z+, r0 + ld r0, X+ + st Z+, r0 + ld r0, X+ + st Z+, r0 + ld r0, X+ + st Z+, r0 + ld r0, X+ + st Z+, r0 + ld r0, X+ + st Z+, r0 + ld r0, X+ + st Z+, r0 + ld r0, X+ + st Z+, r0 + dec r18 + brne 1b + /* maxi round 1 */ + movw r24, CTX_SAVE0 + ldi r22, 0 + rcall checksum_update + movw r22, MSG_SAVE0 + movw r24, CTX_SAVE0 + rcall twister_mini_round + + movw r24, CTX_SAVE0 + ldi r22, 1 + rcall checksum_update + adiw MSG_SAVE0, 8 + movw r22, MSG_SAVE0 + movw r24, CTX_SAVE0 + rcall twister_mini_round + + movw r24, CTX_SAVE0 + ldi r22, 2 + rcall checksum_update + adiw MSG_SAVE0, 8 + movw r22, MSG_SAVE0 + movw r24, CTX_SAVE0 + rcall twister_mini_round + + movw r30, TMP_SAVE0 + movw r26, CTX_SAVE0 + ldi r18, 64 +1: + ld r0, X + ld r23, Z + eor r0, r23 + st X+, r0 + st Z+, r0 + dec r18 + brne 1b + /* maxi round 2 */ + movw r24, CTX_SAVE0 + ldi r22, 3 + rcall checksum_update + adiw MSG_SAVE0, 8 + movw r22, MSG_SAVE0 + movw r24, CTX_SAVE0 + rcall twister_mini_round + + movw r24, CTX_SAVE0 + rcall twister_blank_round + + movw r24, CTX_SAVE0 + ldi r22, 4 + rcall checksum_update + adiw MSG_SAVE0, 8 + movw r22, MSG_SAVE0 + movw r24, CTX_SAVE0 + rcall twister_mini_round + + movw r30, TMP_SAVE0 + movw r26, CTX_SAVE0 + ldi r18, 64 +1: + ld r0, X + ld r23, Z + eor r0, r23 + st X+, r0 + st Z+, r0 + dec r18 + brne 1b + /* maxi round 3 */ + movw r24, CTX_SAVE0 + ldi r22, 5 + rcall checksum_update + adiw MSG_SAVE0, 8 + movw r22, MSG_SAVE0 + movw r24, CTX_SAVE0 + rcall twister_mini_round + + movw r24, CTX_SAVE0 + ldi r22, 6 + rcall checksum_update + adiw MSG_SAVE0, 8 + movw r22, MSG_SAVE0 + movw r24, CTX_SAVE0 + rcall twister_mini_round + + movw r24, CTX_SAVE0 + ldi r22, 7 + rcall checksum_update + adiw MSG_SAVE0, 8 + movw r22, MSG_SAVE0 + movw r24, CTX_SAVE0 + rcall twister_mini_round + + movw r24, CTX_SAVE0 + rcall twister_blank_round + + movw r30, TMP_SAVE0 + movw r26, CTX_SAVE0 + ldi r18, 64 +1: + ld r0, X + ld r23, Z+ + eor r0, r23 + st X+, r0 + dec r18 + brne 1b + + adiw r26, 9 + ldi r19, 2 + ld r0, X + add r0, r19 + st X+, r0 + + ld r0, X + adc r0, r1 + st X+, r0 + ld r0, X + adc r0, r1 + st X+, r0 + ld r0, X + adc r0, r1 + st X+, r0 + ld r0, X + adc r0, r1 + st X+, r0 + ld r0, X + adc r0, r1 + st X+, r0 + ld r0, X + adc r0, r1 + st X+, r0 + ld r0, X + adc r0, r1 + st X+, r0 + + stack_free_large 64 + pop r29 + pop r28 + pop_range 12, 15 + ret + +/*********************************************************************/ +/* void twister_large_lastBlock(twister_state_t* ctx, void* msg, uint16_t length_b) */ +/* + * param ctx: r24:r25 + * param msg: r22:r23 + * param length_b: r20:r21 + */ +TMP_SAVE0 = 12 +TMP_SAVE1 = 13 +CTX_SAVE0 = 14 +CTX_SAVE1 = 15 +LEN_SAVE0 = 16 +LEN_SAVE1 = 17 +MSG_SAVE0 = 28 +MSG_SAVE1 = 29 +.global twister_large_lastBlock +.global twister384_lastBlock +.global twister512_lastBlock + +twister384_lastBlock: +twister512_lastBlock: +twister_large_lastBlock: + push_range 12, 17 + push r28 + push r29 + stack_alloc_large 64 + adiw r30, 1 + movw TMP_SAVE0, r30 + movw CTX_SAVE0, r24 + movw MSG_SAVE0, r22 + movw LEN_SAVE0, r20 +1: + cpi LEN_SAVE1, 2 + brmi 2f + movw r24, CTX_SAVE0 + movw r22, MSG_SAVE0 + rcall twister_large_nextBlock + adiw MSG_SAVE0, 8 + subi LEN_SAVE1, 2 + rjmp 1b +2: + movw r18, LEN_SAVE0 + lsr r19 + ror r18 + lsr r18 + lsr r18 + ldi r19, 63 + movw r26, MSG_SAVE0 + movw r30, TMP_SAVE0 + ldi r20, 0x80 + sub r19, r18 /* r18: bytes to copy, r19: bytes to clear */ + + ld r0, X+ +3: + tst r18 + breq 4f +31: + st Z+, r0 + ld r0, X+ + dec r18 + brne 31b +4: + mov r18, LEN_SAVE0 + andi r18, 0x07 + ldi r20, 0x80 + breq 5f +4: + lsr r20 + dec r18 + brne 4b + or r20, r0 + rjmp 5f + +5: + st Z+, r20 + tst r19 + breq 7f +6: + st Z+, r1 + dec r19 + brne 6b +7: + movw r24, CTX_SAVE0 + movw r22, TMP_SAVE0 + rcall twister_large_nextBlock + + ldi r19, 2 + clr r18 + + sub r18, LEN_SAVE0 + sbc r19, LEN_SAVE1 + movw r26, CTX_SAVE0 + adiw r26, 63 + adiw r26, 1+8 + + ld r0, X + sub r0, r18 + st X+, r0 + ld r0, X + sbc r0, r19 + st X+, r0 + ld r0, X + sbc r0, r1 + st X+, r0 + ld r0, X + sbc r0, r1 + st X+, r0 + ld r0, X + sbc r0, r1 + st X+, r0 + ld r0, X + sbc r0, r1 + st X+, r0 + ld r0, X + sbc r0, r1 + st X+, r0 + ld r0, X + sbc r0, r1 + st X+, r0 + + sbiw r26, 8 + movw r24, CTX_SAVE0 + movw r22, r26 + rcall twister_mini_round + + movw r24, CTX_SAVE0 + movw r22, CTX_SAVE0 + ldi r16, 64+8+8 + add r22, r16 + adc r23, r1 + movw r30, r22 + ldi r26, 8 +1: + ld r12, Z+ + ld r13, Z+ + ld r16, Z+ + ld r17, Z+ + ld r18, Z+ + ld r19, Z+ + ld r20, Z+ + ld r21, Z+ + st -Z, r12 + st -Z, r13 + st -Z, r16 + st -Z, r17 + st -Z, r18 + st -Z, r19 + st -Z, r20 + st -Z, r21 + adiw r30, 8 + dec r26 + brne 1b + + movw r24, CTX_SAVE0 + movw r22, CTX_SAVE0 + ldi r26, 64+2*8 + add r22, r26 + adc r23, r1 + rcall twister_small_nextBlock + + stack_free_large 64 + pop r29 + pop r28 + pop_range 12, 17 + ret diff --git a/twister-large.c b/twister-large.c new file mode 100644 index 0000000..1775488 --- /dev/null +++ b/twister-large.c @@ -0,0 +1,238 @@ +/* twister-large.c */ +/* + This file is part of the AVR-Crypto-Lib. + Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include +#include "memxor.h" +#include "twister.h" +#include "twister-large.h" + +/*********************************************************************/ + +static +void checksum_update(twister_large_ctx_t* ctx, uint8_t col){ + uint8_t i, col2; + uint8_t carry = 0; + int sum = 0; + + col2 = (col+1)%8; + + for( i=0; i<8; i++ ) + { + sum = (int) ctx->checksum[col2][7-i] + + (int) ctx->state.s[7-i][0] /* col or 0 ???*/ + + carry; + ctx->checksum[col][7-i] ^= (uint8_t)sum; + carry = sum>>8; + + } +} + +/*********************************************************************/ + +void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b){ + memset(ctx->state.s, 0, 64); + memset(ctx->checksum, 0, 64); + ctx->state.counter=0xffffffffffffffffLL; + ctx->state.s[0][7] = hashsize_b>>8; + ctx->state.s[1][7] = hashsize_b&0xff; + ctx->state.length_counter_b = 0; +} + +/*********************************************************************/ + +void twister_large_nextBlock(twister_large_ctx_t* ctx, const void* msg){ + uint8_t tmp[8][8]; + + /* 1st maxi round */ + memcpy(tmp, ctx->state.s, 64); + checksum_update(ctx, 0); + twister_mini_round(&(ctx->state), msg); + msg = (uint8_t*)msg + 8; + + checksum_update(ctx, 1); + twister_mini_round(&(ctx->state), msg); + msg = (uint8_t*)msg + 8; + + checksum_update(ctx, 2); + twister_mini_round(&(ctx->state), msg); + msg = (uint8_t*)msg + 8; + memxor(ctx->state.s, tmp, 64); + + /* 2nd maxi round */ + memcpy(tmp, ctx->state.s, 64); + checksum_update(ctx, 3); + twister_mini_round(&(ctx->state), msg); + msg = (uint8_t*)msg + 8; + + twister_blank_round(&(ctx->state)); + + checksum_update(ctx, 4); + twister_mini_round(&(ctx->state), msg); + msg = (uint8_t*)msg + 8; + memxor(ctx->state.s, tmp, 64); + + /* 3rd maxi round */ + memcpy(tmp, ctx->state.s, 64); + checksum_update(ctx, 5); + twister_mini_round(&(ctx->state), msg); + msg = (uint8_t*)msg + 8; + + checksum_update(ctx, 6); + twister_mini_round(&(ctx->state), msg); + msg = (uint8_t*)msg + 8; + + checksum_update(ctx, 7); + twister_mini_round(&(ctx->state), msg); + + twister_blank_round(&(ctx->state)); + memxor(ctx->state.s, tmp, 64); + ctx->state.length_counter_b += 512; +} + +/*********************************************************************/ + +void twister_inject_chksum(twister_large_ctx_t* ctx, uint8_t col){ + *((uint64_t*)(&ctx->state.s[7][0])) ^= *((uint64_t*)(&ctx->checksum[col][0])); + twister_blank_round(&ctx->state); +} + +/*********************************************************************/ + +void twister_large_lastBlock(twister_large_ctx_t* ctx, const void* msg, uint16_t length_b){ + uint8_t tmp[64]; + while(length_b>=512){ + twister_large_nextBlock(ctx, msg); + msg = ((uint8_t*)msg)+64; + length_b -= 512; + } + memset(tmp, 0, 64); + memcpy(tmp, msg, (length_b+7)/8); + tmp[length_b/8] |= 0x80 >> (length_b&0x07); + twister_large_nextBlock(ctx, tmp); + ctx->state.length_counter_b -= 512 - length_b; + twister_mini_round(&(ctx->state), &(ctx->state.length_counter_b)); + + memcpy(tmp, ctx->state.s, 64); + twister_inject_chksum(ctx, 0); + twister_inject_chksum(ctx, 1); + twister_inject_chksum(ctx, 2); + memxor(ctx->state.s, tmp, 64); + + memcpy(tmp, ctx->state.s, 64); + twister_inject_chksum(ctx, 3); + twister_inject_chksum(ctx, 4); + twister_inject_chksum(ctx, 5); + memxor(ctx->state.s, tmp, 64); + + memcpy(tmp, ctx->state.s, 64); + twister_inject_chksum(ctx, 6); + twister_inject_chksum(ctx, 7); + twister_blank_round(&(ctx->state)); + memxor(ctx->state.s, tmp, 64); + +} + +/*********************************************************************/ + +void twister_large_ctx2hash(void* dest, twister_large_ctx_t* ctx, uint16_t hashsize_b){ + twister_ctx2hash(dest, &(ctx->state), hashsize_b); +} + +/*********************************************************************/ +/*********************************************************************/ + +void twister384_init(twister384_ctx_t* ctx){ + twister_large_init(ctx, 384); +} + +/*********************************************************************/ + +void twister384_nextBlock(twister384_ctx_t* ctx, const void* msg){ + twister_large_nextBlock(ctx, msg); +} + +/*********************************************************************/ + +void twister384_lastBlock(twister384_ctx_t* ctx, const void* msg, uint16_t length_b){ + twister_large_lastBlock(ctx, msg, length_b); +} + +/*********************************************************************/ + +void twister384_ctx2hash(void* dest, twister384_ctx_t* ctx){ + twister_large_ctx2hash(dest, ctx, 384); +} + +/*********************************************************************/ + +void twister384(void* dest, const void* msg, uint32_t msg_length_b){ + twister_large_ctx_t ctx; + twister_large_init(&ctx, 384); + while(msg_length_b >=512){ + twister_large_nextBlock(&ctx, msg); + msg = (uint8_t*)msg + 512/8; + msg_length_b -= 512; + } + twister_large_lastBlock(&ctx, msg, msg_length_b); + twister_large_ctx2hash(dest, &ctx, 384); +} + +/*********************************************************************/ +/*********************************************************************/ + + +void twister512_init(twister512_ctx_t* ctx){ + twister_large_init(ctx, 512); +} + +/*********************************************************************/ + +void twister512_nextBlock(twister512_ctx_t* ctx, const void* msg){ + twister_large_nextBlock(ctx, msg); +} + +/*********************************************************************/ + +void twister512_lastBlock(twister512_ctx_t* ctx, const void* msg, uint16_t length_b){ + twister_large_lastBlock(ctx, msg, length_b); +} + +/*********************************************************************/ + +void twister512_ctx2hash(void* dest, twister512_ctx_t* ctx){ + twister_large_ctx2hash(dest, ctx, 512); +} + +/*********************************************************************/ + +void twister512(void* dest, const void* msg, uint32_t msg_length_b){ + twister_large_ctx_t ctx; + twister_large_init(&ctx, 512); + while(msg_length_b >=512){ + twister_large_nextBlock(&ctx, msg); + msg = (uint8_t*)msg + 512/8; + msg_length_b -= 512; + } + twister_large_lastBlock(&ctx, msg, msg_length_b); + twister_large_ctx2hash(dest, &ctx, 512); +} + + + diff --git a/twister-large.h b/twister-large.h new file mode 100644 index 0000000..45de18b --- /dev/null +++ b/twister-large.h @@ -0,0 +1,45 @@ +/* twister-large.h */ + +#ifndef TWISTER_large_H_ +#define TWISTER_large_H_ + +#include +#include "twister.h" + +typedef uint8_t twister384_hash_t[384/8]; +typedef uint8_t twister512_hash_t[512/8]; + +typedef struct { + twister_state_t state; + twister_checksum_t checksum; +} twister_large_ctx_t; + +typedef twister_large_ctx_t twister384_ctx_t; +typedef twister_large_ctx_t twister512_ctx_t; + +/*********************************************************************/ + +void twister_large_nextBlock(twister_large_ctx_t* ctx, const void* msg); +void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b); +void twister_large_lastBlock(twister_large_ctx_t* ctx, const void* msg, uint16_t length_b); +void twister_large_ctx2hash(void* dest, twister_large_ctx_t* ctx, uint16_t hashsize_b); + +/*********************************************************************/ + +void twister384_init(twister384_ctx_t* ctx); +void twister384_nextBlock(twister384_ctx_t* ctx, const void* msg); +void twister384_lastBlock(twister384_ctx_t* ctx, const void* msg, uint16_t length_b); +void twister384_ctx2hash(void* dest, twister384_ctx_t* ctx); +void twister384(void* dest, const void* msg, uint32_t msg_length_b); + +/*********************************************************************/ + +void twister512_init(twister512_ctx_t* ctx); +void twister512_nextBlock(twister512_ctx_t* ctx, const void* msg); +void twister512_lastBlock(twister512_ctx_t* ctx, const void* msg, uint16_t length_b); +void twister512_ctx2hash(void* dest, twister512_ctx_t* ctx); +void twister512(void* dest, const void* msg, uint32_t msg_length_b); + + +#endif /* TWISTER_large_H_ */ + diff --git a/twister384.S b/twister384.S index e586243..6a15fc5 100644 --- a/twister384.S +++ b/twister384.S @@ -60,7 +60,7 @@ twister384: movw r24, CTX_SAVE0 ldi r22, lo8(384) ldi r23, hi8(384) - rcall twister_big_init + rcall twister_large_init 1: tst MSG_LEN3 brne 2f @@ -71,7 +71,7 @@ twister384: 2: movw r24, CTX_SAVE0 movw r22, MSG_SAVE0 - rcall twister_big_nextBlock + rcall twister_large_nextBlock adiw MSG_SAVE0, 63 adiw MSG_SAVE0, 1 subi MSG_LEN1, 2 @@ -82,13 +82,13 @@ twister384: movw r24, CTX_SAVE0 movw r22, MSG_SAVE0 movw r20, MSG_LEN0 - rcall twister_big_lastBlock + rcall twister_large_lastBlock movw r24, DST_SAVE0 movw r22, CTX_SAVE0 ldi r20, lo8(384) ldi r21, hi8(384) - rcall twister_big_ctx2hash + rcall twister_large_ctx2hash stack_free_large2 64+2*8+64 pop r29 diff --git a/twister512.S b/twister512.S index f2f701f..0aece4d 100644 --- a/twister512.S +++ b/twister512.S @@ -60,7 +60,7 @@ twister512: movw r24, CTX_SAVE0 ldi r22, lo8(512) ldi r23, hi8(512) - rcall twister_big_init + rcall twister_large_init 1: tst MSG_LEN3 brne 2f @@ -71,7 +71,7 @@ twister512: 2: movw r24, CTX_SAVE0 movw r22, MSG_SAVE0 - rcall twister_big_nextBlock + rcall twister_large_nextBlock adiw MSG_SAVE0, 63 adiw MSG_SAVE0, 1 subi MSG_LEN1, 2 @@ -82,13 +82,13 @@ twister512: movw r24, CTX_SAVE0 movw r22, MSG_SAVE0 movw r20, MSG_LEN0 - rcall twister_big_lastBlock + rcall twister_large_lastBlock movw r24, DST_SAVE0 movw r22, CTX_SAVE0 ldi r20, lo8(512) ldi r21, hi8(512) - rcall twister_big_ctx2hash + rcall twister_large_ctx2hash stack_free_large2 64+2*8+64 pop r29