diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passphrase.c | 7 | ||||
-rw-r--r-- | src/passphrase.h | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/passphrase.c b/src/passphrase.c index 3c91907..9e5a7e8 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -248,7 +248,7 @@ char* passphrase_read(void) /** * Used to make sure that `passphrase_wipe` is not optimised away even within this library */ -volatile sig_atomic_t passphrase_wipe_volatile = 1; +volatile sig_atomic_t passphrase_wipe_volatile________________ = 1; /** * Forcable write NUL characters to a passphrase @@ -256,10 +256,13 @@ volatile sig_atomic_t passphrase_wipe_volatile = 1; * @param ptr The password to wipe * @param n The number of characters to wipe */ +#ifdef __GNUC__ +__attribute__((optimize("-O0"))) +#endif void passphrase_wipe(volatile char* ptr, size_t n) { size_t i; - for (i = 0; (i < n) && passphrase_wipe_volatile; i++) + for (i = 0; (i < n) && passphrase_wipe_volatile________________; i++) *(ptr + i) = 0; } diff --git a/src/passphrase.h b/src/passphrase.h index e0537e8..85faffd 100644 --- a/src/passphrase.h +++ b/src/passphrase.h @@ -33,7 +33,7 @@ extern char* passphrase_read(void); * @param ptr The password to wipe * @param n The number of characters to wipe */ -extern void passphrase_wipe(volatile char* ptr, size_t n) __attribute__((optimize("-O0"))); +extern void passphrase_wipe(volatile char*, size_t); /** * Disable echoing and do anything else to the terminal settnings `passphrase_read` requires |