From 5cddb24de41c991178565b5f64d47087da76c02d Mon Sep 17 00:00:00 2001 From: "John M. Schanck" Date: Mon, 14 Sep 2020 17:11:08 -0400 Subject: [PATCH] typo and unary negation --- crypto_kem/hqc-128/avx2/vector.c | 2 +- crypto_kem/hqc-128/clean/vector.c | 2 +- crypto_kem/hqc-192/avx2/vector.c | 2 +- crypto_kem/hqc-192/clean/vector.c | 2 +- crypto_kem/hqc-256/avx2/vector.c | 2 +- crypto_kem/hqc-256/clean/vector.c | 2 +- crypto_kem/hqc-rmrs-128/avx2/reed_solomon.c | 2 +- crypto_kem/hqc-rmrs-128/avx2/vector.c | 2 +- crypto_kem/hqc-rmrs-128/clean/reed_solomon.c | 2 +- crypto_kem/hqc-rmrs-128/clean/vector.c | 2 +- crypto_kem/hqc-rmrs-192/avx2/reed_solomon.c | 2 +- crypto_kem/hqc-rmrs-192/avx2/vector.c | 2 +- crypto_kem/hqc-rmrs-192/clean/reed_solomon.c | 2 +- crypto_kem/hqc-rmrs-192/clean/vector.c | 2 +- crypto_kem/hqc-rmrs-256/avx2/reed_solomon.c | 2 +- crypto_kem/hqc-rmrs-256/avx2/vector.c | 2 +- crypto_kem/hqc-rmrs-256/clean/reed_solomon.c | 2 +- crypto_kem/hqc-rmrs-256/clean/vector.c | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crypto_kem/hqc-128/avx2/vector.c b/crypto_kem/hqc-128/avx2/vector.c index 79f70361..0a3fb074 100644 --- a/crypto_kem/hqc-128/avx2/vector.c +++ b/crypto_kem/hqc-128/avx2/vector.c @@ -167,7 +167,7 @@ uint8_t PQCLEAN_HQC128_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v2, u for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-128/clean/vector.c b/crypto_kem/hqc-128/clean/vector.c index a5ddc317..198ace94 100644 --- a/crypto_kem/hqc-128/clean/vector.c +++ b/crypto_kem/hqc-128/clean/vector.c @@ -183,7 +183,7 @@ uint8_t PQCLEAN_HQC128_CLEAN_vect_compare(const uint8_t *v1, const uint8_t *v2, for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-192/avx2/vector.c b/crypto_kem/hqc-192/avx2/vector.c index cceaaf38..1eaf9571 100644 --- a/crypto_kem/hqc-192/avx2/vector.c +++ b/crypto_kem/hqc-192/avx2/vector.c @@ -167,7 +167,7 @@ uint8_t PQCLEAN_HQC192_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v2, u for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-192/clean/vector.c b/crypto_kem/hqc-192/clean/vector.c index 242d9284..33a95650 100644 --- a/crypto_kem/hqc-192/clean/vector.c +++ b/crypto_kem/hqc-192/clean/vector.c @@ -183,7 +183,7 @@ uint8_t PQCLEAN_HQC192_CLEAN_vect_compare(const uint8_t *v1, const uint8_t *v2, for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-256/avx2/vector.c b/crypto_kem/hqc-256/avx2/vector.c index 56f60bfe..24c264d8 100644 --- a/crypto_kem/hqc-256/avx2/vector.c +++ b/crypto_kem/hqc-256/avx2/vector.c @@ -167,7 +167,7 @@ uint8_t PQCLEAN_HQC256_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v2, u for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-256/clean/vector.c b/crypto_kem/hqc-256/clean/vector.c index 2c08f50d..2eb148a3 100644 --- a/crypto_kem/hqc-256/clean/vector.c +++ b/crypto_kem/hqc-256/clean/vector.c @@ -183,7 +183,7 @@ uint8_t PQCLEAN_HQC256_CLEAN_vect_compare(const uint8_t *v1, const uint8_t *v2, for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-rmrs-128/avx2/reed_solomon.c b/crypto_kem/hqc-rmrs-128/avx2/reed_solomon.c index a45b40c6..b80b36dc 100644 --- a/crypto_kem/hqc-rmrs-128/avx2/reed_solomon.c +++ b/crypto_kem/hqc-rmrs-128/avx2/reed_solomon.c @@ -53,7 +53,7 @@ void PQCLEAN_HQCRMRS128_AVX2_reed_solomon_encode(uint8_t *cdw, const uint8_t *ms prev = 0; for (k = 0; k < PARAM_N1 - PARAM_K; k++) { x = cdw[k]; - cdw[k] = (uint8_t) prev ^ tmp[k]; + cdw[k] = (uint8_t) (prev ^ tmp[k]); prev = x; } } diff --git a/crypto_kem/hqc-rmrs-128/avx2/vector.c b/crypto_kem/hqc-rmrs-128/avx2/vector.c index 66f239d4..d60431b4 100644 --- a/crypto_kem/hqc-rmrs-128/avx2/vector.c +++ b/crypto_kem/hqc-rmrs-128/avx2/vector.c @@ -151,7 +151,7 @@ uint8_t PQCLEAN_HQCRMRS128_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-rmrs-128/clean/reed_solomon.c b/crypto_kem/hqc-rmrs-128/clean/reed_solomon.c index 0640fbf1..e0212bdc 100644 --- a/crypto_kem/hqc-rmrs-128/clean/reed_solomon.c +++ b/crypto_kem/hqc-rmrs-128/clean/reed_solomon.c @@ -53,7 +53,7 @@ void PQCLEAN_HQCRMRS128_CLEAN_reed_solomon_encode(uint8_t *cdw, const uint8_t *m prev = 0; for (k = 0; k < PARAM_N1 - PARAM_K; k++) { x = cdw[k]; - cdw[k] = (uint8_t) prev ^ tmp[k]; + cdw[k] = (uint8_t) (prev ^ tmp[k]); prev = x; } } diff --git a/crypto_kem/hqc-rmrs-128/clean/vector.c b/crypto_kem/hqc-rmrs-128/clean/vector.c index bbe402c9..35a19120 100644 --- a/crypto_kem/hqc-rmrs-128/clean/vector.c +++ b/crypto_kem/hqc-rmrs-128/clean/vector.c @@ -183,7 +183,7 @@ uint8_t PQCLEAN_HQCRMRS128_CLEAN_vect_compare(const uint8_t *v1, const uint8_t * for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-rmrs-192/avx2/reed_solomon.c b/crypto_kem/hqc-rmrs-192/avx2/reed_solomon.c index b50e91d1..f455f447 100644 --- a/crypto_kem/hqc-rmrs-192/avx2/reed_solomon.c +++ b/crypto_kem/hqc-rmrs-192/avx2/reed_solomon.c @@ -53,7 +53,7 @@ void PQCLEAN_HQCRMRS192_AVX2_reed_solomon_encode(uint8_t *cdw, const uint8_t *ms prev = 0; for (k = 0; k < PARAM_N1 - PARAM_K; k++) { x = cdw[k]; - cdw[k] = (uint8_t) prev ^ tmp[k]; + cdw[k] = (uint8_t) (prev ^ tmp[k]); prev = x; } } diff --git a/crypto_kem/hqc-rmrs-192/avx2/vector.c b/crypto_kem/hqc-rmrs-192/avx2/vector.c index d43b4f7b..69671d47 100644 --- a/crypto_kem/hqc-rmrs-192/avx2/vector.c +++ b/crypto_kem/hqc-rmrs-192/avx2/vector.c @@ -151,7 +151,7 @@ uint8_t PQCLEAN_HQCRMRS192_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-rmrs-192/clean/reed_solomon.c b/crypto_kem/hqc-rmrs-192/clean/reed_solomon.c index 1ee9ec2e..c8365024 100644 --- a/crypto_kem/hqc-rmrs-192/clean/reed_solomon.c +++ b/crypto_kem/hqc-rmrs-192/clean/reed_solomon.c @@ -53,7 +53,7 @@ void PQCLEAN_HQCRMRS192_CLEAN_reed_solomon_encode(uint8_t *cdw, const uint8_t *m prev = 0; for (k = 0; k < PARAM_N1 - PARAM_K; k++) { x = cdw[k]; - cdw[k] = (uint8_t) prev ^ tmp[k]; + cdw[k] = (uint8_t) (prev ^ tmp[k]); prev = x; } } diff --git a/crypto_kem/hqc-rmrs-192/clean/vector.c b/crypto_kem/hqc-rmrs-192/clean/vector.c index 364dfa49..a9888879 100644 --- a/crypto_kem/hqc-rmrs-192/clean/vector.c +++ b/crypto_kem/hqc-rmrs-192/clean/vector.c @@ -183,7 +183,7 @@ uint8_t PQCLEAN_HQCRMRS192_CLEAN_vect_compare(const uint8_t *v1, const uint8_t * for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-rmrs-256/avx2/reed_solomon.c b/crypto_kem/hqc-rmrs-256/avx2/reed_solomon.c index 99ee5a41..11b52c2b 100644 --- a/crypto_kem/hqc-rmrs-256/avx2/reed_solomon.c +++ b/crypto_kem/hqc-rmrs-256/avx2/reed_solomon.c @@ -53,7 +53,7 @@ void PQCLEAN_HQCRMRS256_AVX2_reed_solomon_encode(uint8_t *cdw, const uint8_t *ms prev = 0; for (k = 0; k < PARAM_N1 - PARAM_K; k++) { x = cdw[k]; - cdw[k] = (uint8_t) prev ^ tmp[k]; + cdw[k] = (uint8_t) (prev ^ tmp[k]); prev = x; } } diff --git a/crypto_kem/hqc-rmrs-256/avx2/vector.c b/crypto_kem/hqc-rmrs-256/avx2/vector.c index 543d3060..f6aa1d5e 100644 --- a/crypto_kem/hqc-rmrs-256/avx2/vector.c +++ b/crypto_kem/hqc-rmrs-256/avx2/vector.c @@ -151,7 +151,7 @@ uint8_t PQCLEAN_HQCRMRS256_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; } diff --git a/crypto_kem/hqc-rmrs-256/clean/reed_solomon.c b/crypto_kem/hqc-rmrs-256/clean/reed_solomon.c index d6a1f62c..df6b3997 100644 --- a/crypto_kem/hqc-rmrs-256/clean/reed_solomon.c +++ b/crypto_kem/hqc-rmrs-256/clean/reed_solomon.c @@ -53,7 +53,7 @@ void PQCLEAN_HQCRMRS256_CLEAN_reed_solomon_encode(uint8_t *cdw, const uint8_t *m prev = 0; for (k = 0; k < PARAM_N1 - PARAM_K; k++) { x = cdw[k]; - cdw[k] = (uint8_t) prev ^ tmp[k]; + cdw[k] = (uint8_t) (prev ^ tmp[k]); prev = x; } } diff --git a/crypto_kem/hqc-rmrs-256/clean/vector.c b/crypto_kem/hqc-rmrs-256/clean/vector.c index 3eacead2..58486178 100644 --- a/crypto_kem/hqc-rmrs-256/clean/vector.c +++ b/crypto_kem/hqc-rmrs-256/clean/vector.c @@ -183,7 +183,7 @@ uint8_t PQCLEAN_HQCRMRS256_CLEAN_vect_compare(const uint8_t *v1, const uint8_t * for (size_t i = 0; i < size; i++) { r |= v1[i] ^ v2[i]; } - r = (-r) >> 63; + r = (~r + 1) >> 63; return (uint8_t) r; }