Skip to content

Commit

Permalink
Cortex-M/Thumb2 ASM: fix label
Browse files Browse the repository at this point in the history
IAR doesn't like %=.
Fix code to be consistent in use of labels and branch instructions.
  • Loading branch information
SparkiDev committed Jul 22, 2024
1 parent e002b6e commit a3a0247
Show file tree
Hide file tree
Showing 11 changed files with 3,329 additions and 1,377 deletions.
90 changes: 45 additions & 45 deletions wolfcrypt/src/port/arm/thumb2-aes-asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ L_AES_invert_key_mix_loop:
EOR r8, r8, r9, ROR #24
STR r8, [r0], #4
SUBS r11, r11, #0x1
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_invert_key_mix_loop
#else
BNE.W L_AES_invert_key_mix_loop
Expand Down Expand Up @@ -703,13 +703,13 @@ AES_set_encrypt_key:
LDR r10, L_AES_Thumb2_te
ADR lr, L_AES_Thumb2_rcon
CMP r1, #0x80
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_set_encrypt_key_start_128
#else
BEQ.W L_AES_set_encrypt_key_start_128
#endif
CMP r1, #0xc0
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_set_encrypt_key_start_192
#else
BEQ.W L_AES_set_encrypt_key_start_192
Expand Down Expand Up @@ -1026,7 +1026,7 @@ L_AES_encrypt_block_nr:
EOR r6, r6, r10
EOR r7, r7, r11
SUBS r1, r1, #0x1
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_encrypt_block_nr
#else
BNE.W L_AES_encrypt_block_nr
Expand Down Expand Up @@ -1154,13 +1154,13 @@ AES_ECB_encrypt:
LDR r12, [sp, #36]
PUSH {r3}
CMP r12, #0xa
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_ECB_encrypt_start_block_128
#else
BEQ.W L_AES_ECB_encrypt_start_block_128
#endif
CMP r12, #0xc
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_ECB_encrypt_start_block_192
#else
BEQ.W L_AES_ECB_encrypt_start_block_192
Expand Down Expand Up @@ -1196,7 +1196,7 @@ L_AES_ECB_encrypt_loop_block_256:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_ECB_encrypt_loop_block_256
#else
BNE.W L_AES_ECB_encrypt_loop_block_256
Expand Down Expand Up @@ -1238,7 +1238,7 @@ L_AES_ECB_encrypt_loop_block_192:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_ECB_encrypt_loop_block_192
#else
BNE.W L_AES_ECB_encrypt_loop_block_192
Expand Down Expand Up @@ -1280,7 +1280,7 @@ L_AES_ECB_encrypt_loop_block_128:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_ECB_encrypt_loop_block_128
#else
BNE.W L_AES_ECB_encrypt_loop_block_128
Expand All @@ -1305,13 +1305,13 @@ AES_CBC_encrypt:
LDM r9, {r4, r5, r6, r7}
PUSH {r3, r9}
CMP r8, #0xa
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CBC_encrypt_start_block_128
#else
BEQ.W L_AES_CBC_encrypt_start_block_128
#endif
CMP r8, #0xc
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CBC_encrypt_start_block_192
#else
BEQ.W L_AES_CBC_encrypt_start_block_192
Expand Down Expand Up @@ -1351,7 +1351,7 @@ L_AES_CBC_encrypt_loop_block_256:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CBC_encrypt_loop_block_256
#else
BNE.W L_AES_CBC_encrypt_loop_block_256
Expand Down Expand Up @@ -1397,7 +1397,7 @@ L_AES_CBC_encrypt_loop_block_192:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CBC_encrypt_loop_block_192
#else
BNE.W L_AES_CBC_encrypt_loop_block_192
Expand Down Expand Up @@ -1443,7 +1443,7 @@ L_AES_CBC_encrypt_loop_block_128:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CBC_encrypt_loop_block_128
#else
BNE.W L_AES_CBC_encrypt_loop_block_128
Expand Down Expand Up @@ -1474,13 +1474,13 @@ AES_CTR_encrypt:
STM r8, {r4, r5, r6, r7}
PUSH {r3, r8}
CMP r12, #0xa
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CTR_encrypt_start_block_128
#else
BEQ.W L_AES_CTR_encrypt_start_block_128
#endif
CMP r12, #0xc
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CTR_encrypt_start_block_192
#else
BEQ.W L_AES_CTR_encrypt_start_block_192
Expand Down Expand Up @@ -1524,12 +1524,12 @@ L_AES_CTR_encrypt_loop_block_256:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CTR_encrypt_loop_block_256
#else
BNE.W L_AES_CTR_encrypt_loop_block_256
#endif
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
B L_AES_CTR_encrypt_end
#else
B.W L_AES_CTR_encrypt_end
Expand Down Expand Up @@ -1574,12 +1574,12 @@ L_AES_CTR_encrypt_loop_block_192:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CTR_encrypt_loop_block_192
#else
BNE.W L_AES_CTR_encrypt_loop_block_192
#endif
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
B L_AES_CTR_encrypt_end
#else
B.W L_AES_CTR_encrypt_end
Expand Down Expand Up @@ -1624,7 +1624,7 @@ L_AES_CTR_encrypt_loop_block_128:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CTR_encrypt_loop_block_128
#else
BNE.W L_AES_CTR_encrypt_loop_block_128
Expand Down Expand Up @@ -1750,7 +1750,7 @@ L_AES_decrypt_block_nr:
EOR r6, r6, r10
EOR r7, r7, r11
SUBS r1, r1, #0x1
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_decrypt_block_nr
#else
BNE.W L_AES_decrypt_block_nr
Expand Down Expand Up @@ -2138,13 +2138,13 @@ AES_ECB_decrypt:
MOV r12, r2
ADR r2, L_AES_Thumb2_td4
CMP r8, #0xa
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_ECB_decrypt_start_block_128
#else
BEQ.W L_AES_ECB_decrypt_start_block_128
#endif
CMP r8, #0xc
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_ECB_decrypt_start_block_192
#else
BEQ.W L_AES_ECB_decrypt_start_block_192
Expand Down Expand Up @@ -2179,7 +2179,7 @@ L_AES_ECB_decrypt_loop_block_256:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_ECB_decrypt_loop_block_256
#else
BNE.W L_AES_ECB_decrypt_loop_block_256
Expand Down Expand Up @@ -2220,7 +2220,7 @@ L_AES_ECB_decrypt_loop_block_192:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_ECB_decrypt_loop_block_192
#else
BNE.W L_AES_ECB_decrypt_loop_block_192
Expand Down Expand Up @@ -2261,7 +2261,7 @@ L_AES_ECB_decrypt_loop_block_128:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_ECB_decrypt_loop_block_128
#else
BNE.W L_AES_ECB_decrypt_loop_block_128
Expand All @@ -2286,13 +2286,13 @@ AES_CBC_decrypt:
ADR r2, L_AES_Thumb2_td4
PUSH {r3, r4}
CMP r8, #0xa
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CBC_decrypt_loop_block_128
#else
BEQ.W L_AES_CBC_decrypt_loop_block_128
#endif
CMP r8, #0xc
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CBC_decrypt_loop_block_192
#else
BEQ.W L_AES_CBC_decrypt_loop_block_192
Expand Down Expand Up @@ -2337,7 +2337,7 @@ L_AES_CBC_decrypt_loop_block_256:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CBC_decrypt_end_odd
#else
BEQ.W L_AES_CBC_decrypt_end_odd
Expand Down Expand Up @@ -2382,12 +2382,12 @@ L_AES_CBC_decrypt_loop_block_256:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CBC_decrypt_loop_block_256
#else
BNE.W L_AES_CBC_decrypt_loop_block_256
#endif
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
B L_AES_CBC_decrypt_end
#else
B.W L_AES_CBC_decrypt_end
Expand Down Expand Up @@ -2432,7 +2432,7 @@ L_AES_CBC_decrypt_loop_block_192:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CBC_decrypt_end_odd
#else
BEQ.W L_AES_CBC_decrypt_end_odd
Expand Down Expand Up @@ -2477,12 +2477,12 @@ L_AES_CBC_decrypt_loop_block_192:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CBC_decrypt_loop_block_192
#else
BNE.W L_AES_CBC_decrypt_loop_block_192
#endif
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
B L_AES_CBC_decrypt_end
#else
B.W L_AES_CBC_decrypt_end
Expand Down Expand Up @@ -2527,7 +2527,7 @@ L_AES_CBC_decrypt_loop_block_128:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_CBC_decrypt_end_odd
#else
BEQ.W L_AES_CBC_decrypt_end_odd
Expand Down Expand Up @@ -2572,7 +2572,7 @@ L_AES_CBC_decrypt_loop_block_128:
SUBS r12, r12, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_CBC_decrypt_loop_block_128
#else
BNE.W L_AES_CBC_decrypt_loop_block_128
Expand Down Expand Up @@ -3170,7 +3170,7 @@ L_GCM_gmult_len_start_block:
POP {r3}
SUBS r3, r3, #0x10
ADD r2, r2, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_GCM_gmult_len_start_block
#else
BNE.W L_GCM_gmult_len_start_block
Expand Down Expand Up @@ -3202,13 +3202,13 @@ AES_GCM_encrypt:
STM r8, {r4, r5, r6, r7}
PUSH {r3, r8}
CMP r12, #0xa
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_GCM_encrypt_start_block_128
#else
BEQ.W L_AES_GCM_encrypt_start_block_128
#endif
CMP r12, #0xc
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BEQ L_AES_GCM_encrypt_start_block_192
#else
BEQ.W L_AES_GCM_encrypt_start_block_192
Expand Down Expand Up @@ -3249,12 +3249,12 @@ L_AES_GCM_encrypt_loop_block_256:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_GCM_encrypt_loop_block_256
#else
BNE.W L_AES_GCM_encrypt_loop_block_256
#endif
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
B L_AES_GCM_encrypt_end
#else
B.W L_AES_GCM_encrypt_end
Expand Down Expand Up @@ -3296,12 +3296,12 @@ L_AES_GCM_encrypt_loop_block_192:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_GCM_encrypt_loop_block_192
#else
BNE.W L_AES_GCM_encrypt_loop_block_192
#endif
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
B L_AES_GCM_encrypt_end
#else
B.W L_AES_GCM_encrypt_end
Expand Down Expand Up @@ -3343,7 +3343,7 @@ L_AES_GCM_encrypt_loop_block_128:
SUBS r2, r2, #0x10
ADD lr, lr, #0x10
ADD r1, r1, #0x10
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__ICCARM__) || defined(__IAR_SYSTEMS_ICC__)
BNE L_AES_GCM_encrypt_loop_block_128
#else
BNE.W L_AES_GCM_encrypt_loop_block_128
Expand Down
Loading

0 comments on commit a3a0247

Please sign in to comment.