From f1f47fea7fa88a6b802c598f5db22a221169e216 Mon Sep 17 00:00:00 2001 From: bg Date: Mon, 14 Jan 2013 01:34:06 +0100 Subject: [PATCH] [keccak-asm] applying quick-fix --- keccak/keccak-asm.S | 12 ++++++------ keccak/keccak.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/keccak/keccak-asm.S b/keccak/keccak-asm.S index db8548c..f82063b 100644 --- a/keccak/keccak-asm.S +++ b/keccak/keccak-asm.S @@ -842,14 +842,14 @@ keccak_lastBlock: movw r24, ctx_l movw r22, r4 rcall keccak_nextBlock - sub r4, pbs - sbc r5, __zero_reg__ + add r4, pbs + adc r5, __zero_reg__ sub length_b_l, pr_l - sbc length_b_l, pr_h + sbc length_b_h, pr_h rjmp 10b 20: - movw XL, r4 movw ZL, ctx_l + movw XL, r4 movw r22, length_b_l lsr r23 ror r22 @@ -867,12 +867,12 @@ keccak_lastBlock: dec r23 brne 10b 20: + ldi r25, 1 mov r18, length_b_l andi r18, 7 - mov r19, r18 - ldi r25, 1 breq 30f /* we have trailing bits */ + mov r19, r18 ld r24, X+ subi r18, 8 neg r18 diff --git a/keccak/keccak.c b/keccak/keccak.c index 506c77c..501ca77 100644 --- a/keccak/keccak.c +++ b/keccak/keccak.c @@ -195,7 +195,7 @@ void keccak_lastBlock(keccak_ctx_t* ctx, const void* block, uint16_t length_b){ }else{ t = 0x01; } - ctx->a[length_B] ^= t + ctx->a[length_B] ^= t; if(length_b == ctx->r - 1){ keccak_f1600(ctx->a); } -- 2.39.2