* cipher/const-time.c (ct_not_memequal, ct_memequal) (ct_memmov_cond): Rename these to ... (_gcry_ct_not_memequal, _gcry_ct_memequal) (_gcry_ct_memmov_cond): ... these. * cipher/const-time.h (ct_not_memequal, ct_memequal) (ct_memmov_cond): Rename these to ... (_gcry_ct_not_memequal, _gcry_ct_memequal) (_gcry_ct_memmov_cond): ... these. (ct_not_memequal, ct_memequal, ct_memmov_cond): New macros. --
Signed-off-by: Jussi Kivilinna <jussi.kivili...@iki.fi> --- src/const-time.c | 10 +++++----- src/const-time.h | 13 +++++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/const-time.c b/src/const-time.c index 908c0ee9..2066d48d 100644 --- a/src/const-time.c +++ b/src/const-time.c @@ -36,7 +36,7 @@ volatile unsigned int _gcry_ct_vone = 1; * 0, otherwise. */ unsigned int -ct_not_memequal (const void *b1, const void *b2, size_t len) +_gcry_ct_not_memequal (const void *b1, const void *b2, size_t len) { const byte *a = b1; const byte *b = b2; @@ -60,9 +60,9 @@ ct_not_memequal (const void *b1, const void *b2, size_t len) * 1, otherwise. */ unsigned int -ct_memequal (const void *b1, const void *b2, size_t len) +_gcry_ct_memequal (const void *b1, const void *b2, size_t len) { - return ct_not_memequal (b1, b2, len) ^ 1; + return _gcry_ct_not_memequal (b1, b2, len) ^ 1; } /* @@ -71,8 +71,8 @@ ct_memequal (const void *b1, const void *b2, size_t len) * DST > SRC, the memory areas must not overlap. */ void -ct_memmov_cond (void *dst, const void *src, size_t len, - unsigned long op_enable) +_gcry_ct_memmov_cond (void *dst, const void *src, size_t len, + unsigned long op_enable) { size_t i; unsigned char mask; diff --git a/src/const-time.h b/src/const-time.h index 3a229ddb..e324dcb7 100644 --- a/src/const-time.h +++ b/src/const-time.h @@ -23,6 +23,11 @@ #include "types.h" +#define ct_not_memequal _gcry_ct_not_memequal +#define ct_memequal _gcry_ct_memequal +#define ct_memmov_cond _gcry_ct_memmov_cond + + extern volatile unsigned int _gcry_ct_vzero; extern volatile unsigned int _gcry_ct_vone; @@ -68,12 +73,12 @@ ct_not_equal_byte (unsigned char b0, unsigned char b1) /* Compare byte-arrays of length LEN, return 1 if it's not same, 0 otherwise. We use pointer of void *, so that it can be used with any structure. */ -unsigned int ct_not_memequal (const void *b1, const void *b2, size_t len); +unsigned int _gcry_ct_not_memequal (const void *b1, const void *b2, size_t len); /* Compare byte-arrays of length LEN, return 0 if it's not same, 1 otherwise. We use pointer of void *, so that it can be used with any structure. */ -unsigned int ct_memequal (const void *b1, const void *b2, size_t len); +unsigned int _gcry_ct_memequal (const void *b1, const void *b2, size_t len); /* * Return A when OP_ENABLED=1 @@ -106,7 +111,7 @@ sexp_null_cond (gcry_sexp_t w, unsigned long op_enable) * OP_ENABLED=1. When DST <= SRC, the memory areas may overlap. When * DST > SRC, the memory areas must not overlap. */ -void ct_memmov_cond (void *dst, const void *src, size_t len, - unsigned long op_enable); +void _gcry_ct_memmov_cond (void *dst, const void *src, size_t len, + unsigned long op_enable); #endif /*GCRY_CONST_TIME_H*/ -- 2.40.1 _______________________________________________ Gcrypt-devel mailing list Gcrypt-devel@gnupg.org https://lists.gnupg.org/mailman/listinfo/gcrypt-devel