summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assembly/passworddoor/passworddoor.S6
-rw-r--r--assembly/passworddoor/sha256sum.S47
2 files changed, 30 insertions, 23 deletions
diff --git a/assembly/passworddoor/passworddoor.S b/assembly/passworddoor/passworddoor.S
index a808609..a854bb4 100644
--- a/assembly/passworddoor/passworddoor.S
+++ b/assembly/passworddoor/passworddoor.S
@@ -279,14 +279,14 @@ sw t0,0(a0) # Append the salt to the message
j sha256sum # Tail call optimization :D
msgpwprompt: .asciz "\nPanel Locked\n\n\n\n\nEnter password:"
-msgwait: .asciz "\nChecking Password\n\n\nPlease wait...\n\n"
+msgwait: .asciz "\nChecking Password\n\n\n\nPlease wait...\n"
msgnewpassword: .asciz "\nChanging Password\nPassword may be\nup to 16 characters\n\nEnter new\npassword:"
msgnewpassword2: .asciz "\nChanging Password\nPassword may be\nup to 16 characters\n\nConfirm new\npassword:"
msgmismatch: .asciz "\nPasswords\ndo not match!\n\n\n\nPress any key"
msgwrongpassword: .asciz "\nIncorrect Password!\n\n\nPress any key\n\n"
msgcorrectpassword: .asciz "\nAccess Granted\n\n\nPress any key\n\n"
-msgchanging1: .asciz "\nChanging Password\n\n\n\nSalting\nPlease wait..."
-msgchanging2: .asciz "\nChanging Password\n\n\n\nHashing\nPlease wait..."
+msgchanging1: .asciz "\nChanging Password\n\n\nSalting\nPlease wait...\n"
+msgchanging2: .asciz "\nChanging Password\n\n\nHashing\nPlease wait...\n"
msgrngfail: .asciz "\nHardware RNG\nreported\nfatal error\n\nSystem halted\n"
msgmainmenu: .asciz "\nMENU\n1: Toggle Door\n2: Change Password\n\n\n0: Logout"
msgtoggledone: .asciz "\nDoor Toggled\nSuccessfully\n\n\n\nPress any key"
diff --git a/assembly/passworddoor/sha256sum.S b/assembly/passworddoor/sha256sum.S
index 2f60b69..ecfd36f 100644
--- a/assembly/passworddoor/sha256sum.S
+++ b/assembly/passworddoor/sha256sum.S
@@ -49,35 +49,32 @@ addi t1,t1,8
addi s0,s0,2
blt s0,t2,1b
+li a0,'#'
+li a7,11
+ecall
+
# Wikipedia calls this "Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array"
-1: la t0,w
-sh2add t0,s0,t0
-addi t0,t0,-60 # i-15
-la t1,w
-sh2add t1,s0,t1
-addi t1,t1,-8 # i-2
-la t2,w
-sh2add t2,s0,t2
-addi t2,t2,-64 # i-16
-la t3,w
-sh2add t3,s0,t3
-addi t3,t3,-28 # i-7
-lw t0,0(t0)
-lw t1,0(t1)
-lw t2,0(t2)
-lw t3,0(t3)
+1: la t4,w
+sh2add t4,s0,t4
+lw t0,-60(t4) # i-15
+lw t1,-8(t4) # i-2
+lw t2,-64(t4) # i-16
+lw t3,-28(t4) # i-7
sha256sig0 t0,t0
sha256sig1 t1,t1
add t0,t0,t1
add t0,t0,t2
add t0,t0,t3
-la t1,w
-sh2add t1,s0,t1
-sw t0,0(t1)
+sw t0,0(t4)
addi s0,s0,1
li t0,64
blt s0,t0,1b
+li a0,'#'
+li a7,11
+ecall
+ecall
+
# Load initial working values
la t0,h
lw a0,0(t0)
@@ -133,7 +130,17 @@ mv a2,a1 # c = b
mv a1,a0 # b = a
add a0,t0,t1 # a = temp1 + temp2
-addi s0,s0,1
+andi t0,s0,3
+bnez t0,2f
+mv t0,a0
+mv t1,a7
+li a0,'#'
+li a7,11
+ecall
+mv a0,t0
+mv a7,t1
+
+2: addi s0,s0,1
li t0,64
blt s0,t0,1b