Advertisement
AnthonyCagliano

Untitled

Apr 23rd, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. sha_hw_lock: db 0
  2. _hw_sha256_init := 000035Ch
  3. hash_hwsha256_init:
  4. ld a, (sha_hw_lock)
  5. cp 0
  6. .smc_sha_hw_lock := $-1
  7. jr nz, .exit0
  8. call port_unlock
  9. call _hw_sha256_init
  10. call port_lock
  11. ld a, 1
  12. ld (.smc_sha_hw_lock), a
  13. jr .exit
  14. .exit0:
  15. ld a, 0
  16. .exit:
  17. ret
  18.  
  19. _hw_sha256_update := 0000360h
  20. hash_hwsha256_update:
  21.  
  22. call ti._frameset0
  23. ; (ix + 0) RV
  24. ; (ix + 3) old IX
  25. ; (ix + 6) arg1: ctx
  26. ; (ix + 9) arg2: data
  27. ; (ix + 12) arg3: len
  28. ; get data, len in proper imm24s
  29. call port_unlock
  30. ld hl, (ix + 9)
  31. ld bc, (ix + 12)
  32. call _hw_sha256_update
  33. call port_lock
  34.  
  35. pop ix
  36. ret
  37.  
  38.  
  39. _hw_sha256_final := 0000364h
  40. hash_hwsha256_final:
  41.  
  42. call ti._frameset0
  43. ; (ix + 6) arg1: digest
  44. ; get digest in proper imm24s
  45. call port_unlock
  46.  
  47. ld hl, (ix + 6)
  48. call _hw_sha256_final
  49. call port_lock
  50. ld a, 0
  51. ld (sha_hw_lock), a
  52.  
  53. pop ix
  54. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement