Skip to content

Commit 5cf6b6d

Browse files
committed
Merge branch 'contrib/github_pr_17582' into 'master'
fix(mbedtls): prevent vectorization fault in clang O2 optimization (GitHub PR) Closes IDFGH-16450 See merge request espressif/esp-idf!41973
2 parents b8a0d88 + 4358d21 commit 5cf6b6d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

components/mbedtls/port/esp_ds/esp_rsa_dec_alt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ static int esp_ds_rsaes_pkcs1_v15_unpadding(unsigned char *input,
6262
}
6363

6464
/* Verify padding bytes are non-zero in constant time */
65+
#if defined(__clang__) && defined(__xtensa__)
66+
#pragma clang loop vectorize(disable)
67+
#endif
6568
for (size_t i = 2; i < ilen; i++) {
6669
unsigned char in_padding = (i < pad_count + 2);
6770
unsigned char is_zero = (input[i] == 0x00);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_COMPILER_RT_LIB_CLANGRT=y
2+
CONFIG_COMPILER_OPTIMIZATION_PERF=y

0 commit comments

Comments
 (0)