Skip to content

Commit

Permalink
Multiple code cleanup changes to TransferState -- Enc of transfers is…
Browse files Browse the repository at this point in the history
… handled by the APDU pre/post process functions -- Restore point for previous functionality
  • Loading branch information
maxieds committed Jul 20, 2022
1 parent 871451a commit a050d04
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 944 deletions.
35 changes: 18 additions & 17 deletions Firmware/Chameleon-Mini/Application/CryptoTDEA-HWAccelerated.S
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ _CommonEpilogue:
;
; Returns:
; Nothing.
.global CryptoEncryptDEA
CryptoEncryptDEA:
.global CryptoEncryptDES
CryptoEncryptDES:
; Preserve the clobbered regs
push r2
push r3
Expand Down Expand Up @@ -246,10 +246,10 @@ CryptoEncryptDEA:
ld r1, Z+
ld r0, Z+
; Encrypt
movw r16, r20
movw r16, r20
rcall _EncryptDEA
; Store the ciphertext
movw r30, r22
movw r30, r22
st Z+, r7
st Z+, r6
st Z+, r5
Expand All @@ -260,20 +260,21 @@ CryptoEncryptDEA:
st Z+, r0

; Restore clobbered regs
pop r17
pop r16
pop r17
pop r16
; Reuse epilogue code
rjmp _CommonEpilogue


; Input:
; R25:R24 - Pointer to plaintext input buffer
; R23:R22 - Pointer to ciphertext output buffer
; R21:R20 - Key block pointer.
;
; Returns:
; Nothing.
.global CryptoDecryptDEA
CryptoDecryptDEA:
.global CryptoDecryptDES
CryptoDecryptDES:
; Preserve the clobbered regs
push r2
push r3
Expand All @@ -292,8 +293,8 @@ CryptoDecryptDEA:
push r16
push r17

; Load the plaintext pointer to Z and fetch data
movw r30, r24
; Load the ciphertext pointer to Z and fetch data
movw r30, r22
ld r7, Z+
ld r6, Z+
ld r5, Z+
Expand All @@ -302,11 +303,11 @@ CryptoDecryptDEA:
ld r2, Z+
ld r1, Z+
ld r0, Z+
; Encrypt
; Decrypt
movw r16, r20
rcall _DecryptDEA
; Store the ciphertext
movw r30, r22
; Store the plaintext
movw r30, r24
st Z+, r7
st Z+, r6
st Z+, r5
Expand Down Expand Up @@ -401,7 +402,7 @@ CryptoDecrypt3KTDEA:
push r16
push r17

; Load the plaintext pointer to Z and fetch data
; Load the ciphertext pointer to Z and fetch data
movw r30, r22
ld r7, Z+
ld r6, Z+
Expand All @@ -411,10 +412,10 @@ CryptoDecrypt3KTDEA:
ld r2, Z+
ld r1, Z+
ld r0, Z+
; Encrypt
; Decrypt
movw r16, r20
rcall _Decrypt3KTDEA
; Store the ciphertext
; Store the plaintext
movw r30, r24
st Z+, r7
st Z+, r6
Expand Down Expand Up @@ -460,7 +461,7 @@ CryptoEncrypt2KTDEA:
push r16
push r17

; Load the plaintext pointer to Z and fetch data
; Load the ciphertext pointer to Z and fetch data
movw r30, r24
ld r7, Z+
ld r6, Z+
Expand Down
Loading

0 comments on commit a050d04

Please sign in to comment.