]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
[keccak-asm] applying quick-fix
authorbg <daniel.otte@rub.de>
Mon, 14 Jan 2013 00:34:06 +0000 (01:34 +0100)
committerbg <daniel.otte@rub.de>
Mon, 14 Jan 2013 00:34:06 +0000 (01:34 +0100)
keccak/keccak-asm.S
keccak/keccak.c

index db8548cb4f44383a9caced05b95c32198d43860f..f82063b077e1cb54c904d43201bb646671822f24 100644 (file)
@@ -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
index 506c77c2b6da5dd377de432e5f1a3412f554881e..501ca77ba5ae3374e375ff527d77c0357667f95e 100644 (file)
@@ -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);
     }