From 859522e1c4559fce38fc1eedf7fd79a7615ecb92 Mon Sep 17 00:00:00 2001 From: "John M. Schanck" Date: Wed, 9 Sep 2020 17:20:11 -0400 Subject: [PATCH] Fix left shift overflow for MASK_N2 --- crypto_kem/hqc-128/avx2/repetition.c | 2 +- crypto_kem/hqc-128/clean/repetition.c | 2 +- crypto_kem/hqc-192/avx2/repetition.c | 2 +- crypto_kem/hqc-192/clean/repetition.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto_kem/hqc-128/avx2/repetition.c b/crypto_kem/hqc-128/avx2/repetition.c index e9540c81..1187ec70 100644 --- a/crypto_kem/hqc-128/avx2/repetition.c +++ b/crypto_kem/hqc-128/avx2/repetition.c @@ -10,7 +10,7 @@ */ -#define MASK_N2 ((1UL << PARAM_N2) - 1) +#define MASK_N2 ((((uint64_t) 1) << PARAM_N2) - 1) /** * @brief Decoding the code words to a message using the repetition code diff --git a/crypto_kem/hqc-128/clean/repetition.c b/crypto_kem/hqc-128/clean/repetition.c index 654e34a1..ade90caf 100644 --- a/crypto_kem/hqc-128/clean/repetition.c +++ b/crypto_kem/hqc-128/clean/repetition.c @@ -8,7 +8,7 @@ * @brief Implementation of repetition codes */ -#define MASK_N2 ((1UL << PARAM_N2) - 1) +#define MASK_N2 ((((uint64_t) 1) << PARAM_N2) - 1) static inline int32_t popcount(uint64_t n); diff --git a/crypto_kem/hqc-192/avx2/repetition.c b/crypto_kem/hqc-192/avx2/repetition.c index 8c873b6f..a4851e59 100644 --- a/crypto_kem/hqc-192/avx2/repetition.c +++ b/crypto_kem/hqc-192/avx2/repetition.c @@ -10,7 +10,7 @@ */ -#define MASK_N2 ((1UL << PARAM_N2) - 1) +#define MASK_N2 ((((uint64_t) 1) << PARAM_N2) - 1) /** * @brief Decoding the code words to a message using the repetition code diff --git a/crypto_kem/hqc-192/clean/repetition.c b/crypto_kem/hqc-192/clean/repetition.c index c11de2aa..09f647ff 100644 --- a/crypto_kem/hqc-192/clean/repetition.c +++ b/crypto_kem/hqc-192/clean/repetition.c @@ -8,7 +8,7 @@ * @brief Implementation of repetition codes */ -#define MASK_N2 ((1UL << PARAM_N2) - 1) +#define MASK_N2 ((((uint64_t) 1) << PARAM_N2) - 1) static inline int32_t popcount(uint64_t n);