; 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:
.word 0x688C, 0x9B05
.word 0xD9AB, 0x1F83
.word 0xCD19, 0x5BE0
+.word 0x0000, 0x0000
+.word 0x0000, 0x0000
;###########################################################
mov r23, r22
mov r22, r21
subi r20, 8
- rjmp rotr32
+ rjmp rotl32
bitrotl:
clr r21
clc