Skip to content

Commit c83676f

Browse files
committed
Assignment
1 parent 7306ccb commit c83676f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

simple_crypto_functions.s

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
///
1313
.align 4
1414
encrypt:
15-
push {r4, r5, r6, r7, LP} // step #1_en - Save R4,R5,R6,R7, and LR
15+
push {r4, r5, r6, r7, LR} // step #1_en - Save R4,R5,R6,R7, and LR
1616
mov r4, #0 // step #2_en - Set register R4 to 0
1717
mov r5, #0 // step #3_en - Set register R5 to 0
1818

@@ -21,11 +21,11 @@ EN_WHL_R5_LT_R1:
2121
blGE r5, EN_END_WHL_R5_LT_R1 // step #5_en - if R5 greater than or equal to R1, branch to EN_END_WHL_R5_LT_R1
2222
ldrb r6, r0[r5] // step #6_en - load byte into register R6, the contents of R0[R5]
2323
ldrb r7, r2[r4] // step #7_en - load byte into register R7, the contents of R2[R4]
24-
OR r6, r6, r7 // step #8_en - exclusive or R6 and R7, storing result in R6
24+
XOR r6, r7 // step #8_en - exclusive or R6 and R7, storing result in R6
2525
AND r7, r5, #255 // step #9_en - use bitwise AND with R5 and #255 to cast R5's value as char instead of int, store in R7
2626
add r6, r6, r7 // step #10_en - add R6 and R7, storing result in R6
2727
strb r6, r0[r5] // step #11_en - store byte in R6 to R0[R5]
28-
inc r4 // step #12_en - increment R4 by one
28+
inc r4, #1 // step #12_en - increment R4 by one
2929
EN_IF_R4_GE_R3:
3030
cmp r4, r3 // step #13_en - compare R4 and R3 in this order of the registers
3131
movGE r4, #0// step #14_en - do conditional execution, move if greater than or equal, into R4 the value #0
@@ -56,8 +56,8 @@ DE_WHL_R5_LT_R1:
5656
ldrb r6, r0[r5]// step #6_de - load byte into register R6, the contents of R0[R5]
5757
AND r7, r5, #255 // step #7_de - use bitwise AND with R5 and #255 to cast R5's value as char instead of int, store in R7
5858
sub r6, r6, r7 // step #8_de - subtract R6 and R7, storing result in R6
59-
ldbr r7, r2[r4] // step #9_de - load byte into register R7, the contents of R2[R4]
60-
OR r6, r6, r7// step #10_de - exclusive or R6 and R7, storing result in R6
59+
ldrb r7, r2[r4] // step #9_de - load byte into register R7, the contents of R2[R4]
60+
XOR r6, r7 // step #10_de - exclusive or R6 and R7, storing result in R6
6161
strb r6, r0[r5] // step #11_de - store byte in R6 to R0[R5]
6262
inc r4 // step #12_de - increment R4 by one
6363
DE_IF_R4_GE_R3:

0 commit comments

Comments
 (0)