diff options
author | Emilia Kasper <emilia@openssl.org> | 2014-09-04 13:04:42 +0200 |
---|---|---|
committer | Emilia Kasper <emilia@openssl.org> | 2014-09-24 15:52:41 +0200 |
commit | 8d507aee7c2d91aaa9b9142530d46d82f1a0139b (patch) | |
tree | 882e8e3e3c3f966ad8fa4f30448f781dbc754a54 /crypto/constant_time_locl.h | |
parent | 133145686e054a28f78b94e8a996ef7ae13d30b7 (diff) |
RT3067: simplify patch
(Original commit adb46dbc6dd7347750df2468c93e8c34bcb93a4b)
Use the new constant-time methods consistently in s3_srvr.c
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
(cherry picked from commit 455b65dfab0de51c9f67b3c909311770f2b3f801)
Diffstat (limited to 'crypto/constant_time_locl.h')
-rw-r--r-- | crypto/constant_time_locl.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/constant_time_locl.h b/crypto/constant_time_locl.h index ccf7b62f5f..c0483939fe 100644 --- a/crypto/constant_time_locl.h +++ b/crypto/constant_time_locl.h @@ -106,6 +106,11 @@ static inline unsigned char constant_time_is_zero_8(unsigned int a); static inline unsigned int constant_time_eq(unsigned int a, unsigned int b); /* Convenience method for getting an 8-bit mask. */ static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b); +/* Signed integers. */ +static inline unsigned int constant_time_eq_int(int a, int b); +/* Convenience method for getting an 8-bit mask. */ +static inline unsigned char constant_time_eq_int_8(int a, int b); + /* * Returns (mask & a) | (~mask & b). @@ -177,6 +182,16 @@ static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b) return (unsigned char)(constant_time_eq(a, b)); } +static inline unsigned int constant_time_eq_int(int a, int b) + { + return constant_time_eq((unsigned)(a), (unsigned)(b)); + } + +static inline unsigned char constant_time_eq_int_8(int a, int b) + { + return constant_time_eq_8((unsigned)(a), (unsigned)(b)); + } + static inline unsigned int constant_time_select(unsigned int mask, unsigned int a, unsigned int b) { |