diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-17 16:48:23 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-17 16:48:23 +0100 |
commit | 77511c68e4f8dad16bd215b541c53cd730d0df51 (patch) | |
tree | 0d1595551ec08d86b9cf592fa47fda1740ee087d | |
parent | test: improve portability (diff) | |
download | libar2-77511c68e4f8dad16bd215b541c53cd730d0df51.tar.gz libar2-77511c68e4f8dad16bd215b541c53cd730d0df51.tar.bz2 libar2-77511c68e4f8dad16bd215b541c53cd730d0df51.tar.xz |
Fix typo: libar2_earse -> libar2_erase
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | common.h | 2 | ||||
-rw-r--r-- | libar2.h | 8 | ||||
-rw-r--r-- | libar2_erase.c (renamed from libar2_earse.c) | 14 |
4 files changed, 19 insertions, 7 deletions
@@ -21,7 +21,7 @@ OBJ =\ libar2_decode_params.o\ libar2_encode_base64.o\ libar2_encode_params.o\ - libar2_earse.o\ + libar2_erase.o\ libar2_hash.o\ libar2_latest_argon2_version.o\ libar2_string_to_type.o\ @@ -54,7 +54,7 @@ #define MIN(A, B) ((A) < (B) ? (A) : (B)) -#define ERASE(PTR, N) libar2_earse(PTR, N) +#define ERASE(PTR, N) libar2_erase(PTR, N) #define ERASE_ARRAY(ARR) ERASE(ARR, sizeof(ARR)) #define ERASE_STRUCT(S) ERASE(&(S), sizeof(S)) @@ -316,9 +316,9 @@ struct libar2_context { /** * Memory deallocation function * - * The application may which to earse the memory before + * The application may which to erase the memory before * deallocating it; this is not done by the library. - * This can be done using `libar2_earse`; + * This can be done using `libar2_erase`; * * Example implementation: * @@ -572,12 +572,12 @@ size_t libar2_decode_base64(const char *str, void *data, size_t *lenp); enum libar2_parameter_error libar2_validate_params(const struct libar2_argon2_parameters *params, const char **errmsgp); /** - * Securily earse memory + * Securily erase memory * * @param mem The memory to erase * @param size The number of bytes to erase */ -void libar2_earse(volatile void *mem, size_t size); +void libar2_erase(volatile void *mem, size_t size); /** * Hash a message diff --git a/libar2_earse.c b/libar2_erase.c index 905695a..490cc4a 100644 --- a/libar2_earse.c +++ b/libar2_erase.c @@ -23,7 +23,7 @@ __attribute__((optimize("O0"))) # endif #endif void -libar2_earse(volatile void *mem_, size_t size) +libar2_erase(volatile void *mem_, size_t size) { void *mem = *(void **)(void *)&mem_; #if defined(memset_s) @@ -36,3 +36,15 @@ libar2_earse(volatile void *mem_, size_t size) libar2_internal_explicit_memset__(mem, 0, size); #endif } + +/* Typo in version 1.0 */ +#if defined(__GNUC__) +extern __typeof(libar2_erase) libar2_earse __attribute__((__weak__, __alias__("libar2_erase"))); +#else +void libar2_earse(volatile void *mem, size_t size); +void +libar2_earse(volatile void *mem, size_t size) +{ + libar2_erase(mem, size); +} +#endif |