From 4e1314d33891480abd836f7594d4f683b18f8677 Mon Sep 17 00:00:00 2001 From: "John M. Schanck" Date: Mon, 5 Oct 2020 14:21:52 -0400 Subject: [PATCH] ntru: fix narrowing warning --- crypto_kem/ntruhps2048509/META.yml | 4 ++-- crypto_kem/ntruhps2048509/clean/poly.h | 1 + crypto_kem/ntruhps2048509/clean/poly_r2_inv.c | 4 ++-- crypto_kem/ntruhps2048509/clean/poly_s3_inv.c | 4 ++-- crypto_kem/ntruhps2048677/META.yml | 4 ++-- crypto_kem/ntruhps2048677/clean/poly.h | 1 + crypto_kem/ntruhps2048677/clean/poly_r2_inv.c | 4 ++-- crypto_kem/ntruhps2048677/clean/poly_s3_inv.c | 4 ++-- crypto_kem/ntruhps4096821/META.yml | 4 ++-- crypto_kem/ntruhps4096821/clean/poly.h | 1 + crypto_kem/ntruhps4096821/clean/poly_r2_inv.c | 4 ++-- crypto_kem/ntruhps4096821/clean/poly_s3_inv.c | 4 ++-- crypto_kem/ntruhrss701/META.yml | 4 ++-- crypto_kem/ntruhrss701/clean/poly.h | 1 + crypto_kem/ntruhrss701/clean/poly_r2_inv.c | 4 ++-- crypto_kem/ntruhrss701/clean/poly_s3_inv.c | 4 ++-- 16 files changed, 28 insertions(+), 24 deletions(-) diff --git a/crypto_kem/ntruhps2048509/META.yml b/crypto_kem/ntruhps2048509/META.yml index e04dcd86..b261c05f 100644 --- a/crypto_kem/ntruhps2048509/META.yml +++ b/crypto_kem/ntruhps2048509/META.yml @@ -23,9 +23,9 @@ auxiliary-submitters: - Zhenfei Zhang implementations: - name: clean - version: https://github.com/jschanck/ntru/tree/b4b08d67 reference implementation + version: https://github.com/jschanck/ntru/tree/a6b42aac reference implementation - name: avx2 - version: https://github.com/jschanck/ntru/tree/b4b08d67 avx2 implementation + version: https://github.com/jschanck/ntru/tree/a6b42aac avx2 implementation supported_platforms: - architecture: x86_64 operating_systems: diff --git a/crypto_kem/ntruhps2048509/clean/poly.h b/crypto_kem/ntruhps2048509/clean/poly.h index 66830976..30816b96 100644 --- a/crypto_kem/ntruhps2048509/clean/poly.h +++ b/crypto_kem/ntruhps2048509/clean/poly.h @@ -4,6 +4,7 @@ #include "params.h" #include +#include #define MODQ(X) ((X) & (NTRU_Q-1)) diff --git a/crypto_kem/ntruhps2048509/clean/poly_r2_inv.c b/crypto_kem/ntruhps2048509/clean/poly_r2_inv.c index bfcb974c..82e3164d 100644 --- a/crypto_kem/ntruhps2048509/clean/poly_r2_inv.c +++ b/crypto_kem/ntruhps2048509/clean/poly_r2_inv.c @@ -9,8 +9,8 @@ static inline int16_t both_negative_mask(int16_t x, int16_t y) { void PQCLEAN_NTRUHPS2048509_CLEAN_poly_R2_inv(poly *r, const poly *a) { poly f, g, v, w; - int16_t i, loop, delta; - int16_t sign, swap, t; + size_t i, loop; + int16_t delta, sign, swap, t; for (i = 0; i < NTRU_N; ++i) { v.coeffs[i] = 0; diff --git a/crypto_kem/ntruhps2048509/clean/poly_s3_inv.c b/crypto_kem/ntruhps2048509/clean/poly_s3_inv.c index 32cd39ca..6887e7f6 100644 --- a/crypto_kem/ntruhps2048509/clean/poly_s3_inv.c +++ b/crypto_kem/ntruhps2048509/clean/poly_s3_inv.c @@ -17,8 +17,8 @@ static inline int16_t both_negative_mask(int16_t x, int16_t y) { void PQCLEAN_NTRUHPS2048509_CLEAN_poly_S3_inv(poly *r, const poly *a) { poly f, g, v, w; - int16_t i, loop, delta; - int16_t sign, swap, t; + size_t i, loop; + int16_t delta, sign, swap, t; for (i = 0; i < NTRU_N; ++i) { v.coeffs[i] = 0; diff --git a/crypto_kem/ntruhps2048677/META.yml b/crypto_kem/ntruhps2048677/META.yml index 90e464c5..5281fe72 100644 --- a/crypto_kem/ntruhps2048677/META.yml +++ b/crypto_kem/ntruhps2048677/META.yml @@ -23,9 +23,9 @@ auxiliary-submitters: - Zhenfei Zhang implementations: - name: clean - version: https://github.com/jschanck/ntru/tree/b4b08d67 reference implementation + version: https://github.com/jschanck/ntru/tree/a6b42aac reference implementation - name: avx2 - version: https://github.com/jschanck/ntru/tree/b4b08d67 avx2 implementation + version: https://github.com/jschanck/ntru/tree/a6b42aac avx2 implementation supported_platforms: - architecture: x86_64 operating_systems: diff --git a/crypto_kem/ntruhps2048677/clean/poly.h b/crypto_kem/ntruhps2048677/clean/poly.h index 97e2f6e1..6b6d381f 100644 --- a/crypto_kem/ntruhps2048677/clean/poly.h +++ b/crypto_kem/ntruhps2048677/clean/poly.h @@ -4,6 +4,7 @@ #include "params.h" #include +#include #define MODQ(X) ((X) & (NTRU_Q-1)) diff --git a/crypto_kem/ntruhps2048677/clean/poly_r2_inv.c b/crypto_kem/ntruhps2048677/clean/poly_r2_inv.c index 2bc45e07..3e1e1c76 100644 --- a/crypto_kem/ntruhps2048677/clean/poly_r2_inv.c +++ b/crypto_kem/ntruhps2048677/clean/poly_r2_inv.c @@ -9,8 +9,8 @@ static inline int16_t both_negative_mask(int16_t x, int16_t y) { void PQCLEAN_NTRUHPS2048677_CLEAN_poly_R2_inv(poly *r, const poly *a) { poly f, g, v, w; - int16_t i, loop, delta; - int16_t sign, swap, t; + size_t i, loop; + int16_t delta, sign, swap, t; for (i = 0; i < NTRU_N; ++i) { v.coeffs[i] = 0; diff --git a/crypto_kem/ntruhps2048677/clean/poly_s3_inv.c b/crypto_kem/ntruhps2048677/clean/poly_s3_inv.c index 00c0ad8f..46f6ece1 100644 --- a/crypto_kem/ntruhps2048677/clean/poly_s3_inv.c +++ b/crypto_kem/ntruhps2048677/clean/poly_s3_inv.c @@ -17,8 +17,8 @@ static inline int16_t both_negative_mask(int16_t x, int16_t y) { void PQCLEAN_NTRUHPS2048677_CLEAN_poly_S3_inv(poly *r, const poly *a) { poly f, g, v, w; - int16_t i, loop, delta; - int16_t sign, swap, t; + size_t i, loop; + int16_t delta, sign, swap, t; for (i = 0; i < NTRU_N; ++i) { v.coeffs[i] = 0; diff --git a/crypto_kem/ntruhps4096821/META.yml b/crypto_kem/ntruhps4096821/META.yml index 2621f03f..651f063d 100644 --- a/crypto_kem/ntruhps4096821/META.yml +++ b/crypto_kem/ntruhps4096821/META.yml @@ -23,9 +23,9 @@ auxiliary-submitters: - Zhenfei Zhang implementations: - name: clean - version: https://github.com/jschanck/ntru/tree/b4b08d67 reference implementation + version: https://github.com/jschanck/ntru/tree/a6b42aac reference implementation - name: avx2 - version: https://github.com/jschanck/ntru/tree/b4b08d67 avx2 implementation + version: https://github.com/jschanck/ntru/tree/a6b42aac avx2 implementation supported_platforms: - architecture: x86_64 operating_systems: diff --git a/crypto_kem/ntruhps4096821/clean/poly.h b/crypto_kem/ntruhps4096821/clean/poly.h index 851222ae..0d684313 100644 --- a/crypto_kem/ntruhps4096821/clean/poly.h +++ b/crypto_kem/ntruhps4096821/clean/poly.h @@ -4,6 +4,7 @@ #include "params.h" #include +#include #define MODQ(X) ((X) & (NTRU_Q-1)) diff --git a/crypto_kem/ntruhps4096821/clean/poly_r2_inv.c b/crypto_kem/ntruhps4096821/clean/poly_r2_inv.c index 8d110d28..9da75ae0 100644 --- a/crypto_kem/ntruhps4096821/clean/poly_r2_inv.c +++ b/crypto_kem/ntruhps4096821/clean/poly_r2_inv.c @@ -9,8 +9,8 @@ static inline int16_t both_negative_mask(int16_t x, int16_t y) { void PQCLEAN_NTRUHPS4096821_CLEAN_poly_R2_inv(poly *r, const poly *a) { poly f, g, v, w; - int16_t i, loop, delta; - int16_t sign, swap, t; + size_t i, loop; + int16_t delta, sign, swap, t; for (i = 0; i < NTRU_N; ++i) { v.coeffs[i] = 0; diff --git a/crypto_kem/ntruhps4096821/clean/poly_s3_inv.c b/crypto_kem/ntruhps4096821/clean/poly_s3_inv.c index 35b38d8e..ac54d4f8 100644 --- a/crypto_kem/ntruhps4096821/clean/poly_s3_inv.c +++ b/crypto_kem/ntruhps4096821/clean/poly_s3_inv.c @@ -17,8 +17,8 @@ static inline int16_t both_negative_mask(int16_t x, int16_t y) { void PQCLEAN_NTRUHPS4096821_CLEAN_poly_S3_inv(poly *r, const poly *a) { poly f, g, v, w; - int16_t i, loop, delta; - int16_t sign, swap, t; + size_t i, loop; + int16_t delta, sign, swap, t; for (i = 0; i < NTRU_N; ++i) { v.coeffs[i] = 0; diff --git a/crypto_kem/ntruhrss701/META.yml b/crypto_kem/ntruhrss701/META.yml index 5df494e0..95866b90 100644 --- a/crypto_kem/ntruhrss701/META.yml +++ b/crypto_kem/ntruhrss701/META.yml @@ -23,9 +23,9 @@ auxiliary-submitters: - Zhenfei Zhang implementations: - name: clean - version: https://github.com/jschanck/ntru/tree/b4b08d67 reference implementation + version: https://github.com/jschanck/ntru/tree/a6b42aac reference implementation - name: avx2 - version: https://github.com/jschanck/ntru/tree/b4b08d67 avx2 implementation + version: https://github.com/jschanck/ntru/tree/a6b42aac avx2 implementation supported_platforms: - architecture: x86_64 operating_systems: diff --git a/crypto_kem/ntruhrss701/clean/poly.h b/crypto_kem/ntruhrss701/clean/poly.h index f41fb78e..40391362 100644 --- a/crypto_kem/ntruhrss701/clean/poly.h +++ b/crypto_kem/ntruhrss701/clean/poly.h @@ -4,6 +4,7 @@ #include "params.h" #include +#include #define MODQ(X) ((X) & (NTRU_Q-1)) diff --git a/crypto_kem/ntruhrss701/clean/poly_r2_inv.c b/crypto_kem/ntruhrss701/clean/poly_r2_inv.c index 7d5ff25a..422deae6 100644 --- a/crypto_kem/ntruhrss701/clean/poly_r2_inv.c +++ b/crypto_kem/ntruhrss701/clean/poly_r2_inv.c @@ -9,8 +9,8 @@ static inline int16_t both_negative_mask(int16_t x, int16_t y) { void PQCLEAN_NTRUHRSS701_CLEAN_poly_R2_inv(poly *r, const poly *a) { poly f, g, v, w; - int16_t i, loop, delta; - int16_t sign, swap, t; + size_t i, loop; + int16_t delta, sign, swap, t; for (i = 0; i < NTRU_N; ++i) { v.coeffs[i] = 0; diff --git a/crypto_kem/ntruhrss701/clean/poly_s3_inv.c b/crypto_kem/ntruhrss701/clean/poly_s3_inv.c index 41bf0a77..d6ca4ee6 100644 --- a/crypto_kem/ntruhrss701/clean/poly_s3_inv.c +++ b/crypto_kem/ntruhrss701/clean/poly_s3_inv.c @@ -17,8 +17,8 @@ static inline int16_t both_negative_mask(int16_t x, int16_t y) { void PQCLEAN_NTRUHRSS701_CLEAN_poly_S3_inv(poly *r, const poly *a) { poly f, g, v, w; - int16_t i, loop, delta; - int16_t sign, swap, t; + size_t i, loop; + int16_t delta, sign, swap, t; for (i = 0; i < NTRU_N; ++i) { v.coeffs[i] = 0;