]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - sha256-asm.S
new MD5 ins ASM with C (working on pure ASM implementation) plus enhancments in asm...
[avr-crypto-lib.git] / sha256-asm.S
index 403506ef5f4ab29150315c7837a7ee469ae88873..67956045fa00c96c97b5a82a959da5f38a7c2a2e 100644 (file)
@@ -919,24 +919,18 @@ sha256_kv: ; round-key-vector stored in ProgMem
 ;      state->length=0;
 ;      memcpy(state->h, sha256_init_vector, 8*4);
 ;}
-; param1: (Func3,r24) 16-bit pointer to sha256_ctx_t struct in ram
+; param1: (r23,r24) 16-bit pointer to sha256_ctx_t struct in ram
 ; modifys: Z(r30,r31), Func1, r22
 sha256_init:
        movw r26, r24 ; (24,25) --> (26,27) load X with param1
        ldi r30, lo8((sha256_init_vector))
        ldi r31, hi8((sha256_init_vector))
-       ldi r22, 32
+       ldi r22, 32+8
 sha256_init_vloop:     
        lpm r23, Z+ 
        st X+, r23
        dec r22
        brne sha256_init_vloop
-       ldi r22, 8
-       clr r1 ;this should not be needed
-sha256_init_lloop:
-       st X+, r1
-       dec r22
-       brne sha256_init_lloop
        ret
        
 sha256_init_vector:
@@ -948,6 +942,8 @@ sha256_init_vector:
 .word 0x688C, 0x9B05 
 .word 0xD9AB, 0x1F83 
 .word 0xCD19, 0x5BE0
+.word 0x0000, 0x0000
+.word 0x0000, 0x0000
 
 ;###########################################################   
 
@@ -968,7 +964,7 @@ rotl32:
        mov r23, r22
        mov r22, r21
        subi r20, 8
-       rjmp rotr32
+       rjmp rotl32
 bitrotl:
        clr r21
        clc