1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/shell_lock: fix compilation with llvm

Make writes to `the_same` "observable behavior" by declaring it
`volatile` to prevent compiler optimization rather than GCC specific
attributes.

Likely, either doesn't a super good job at resulting in constant
time code. But with the plain text password stored in flash, this
likely also isn't what should keep one up at night when actually using
this module.
This commit is contained in:
Marian Buschsieweke 2023-05-20 22:11:20 +02:00 committed by Marian Buschsieweke
parent 4709bbb952
commit 72184a3afd
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -77,9 +77,9 @@ static inline void _print_password_prompt(void)
* which could give away information about the first n correct characters of
* the password. The length of the loop is only dependent on the input string.
* Don't optimize this function by a compiler. */
static bool __attribute__((optimize("O0"))) _safe_strcmp(const char* input, const char* pwd)
static bool _safe_strcmp(const char* input, const char* pwd)
{
bool the_same = true;
volatile bool the_same = true;
int input_index = 0;
int pwd_index = 0;