From f772093fd46e0123b34ed8ab562d4136ac53e442 Mon Sep 17 00:00:00 2001 From: "John M. Schanck" Date: Mon, 24 Aug 2020 10:43:44 -0400 Subject: [PATCH] NTRU: add explicit cast for MS compiler --- crypto_kem/ntruhps2048509/META.yml | 4 ++-- crypto_kem/ntruhps2048509/clean/poly_s3_inv.c | 2 +- crypto_kem/ntruhps2048677/META.yml | 4 ++-- crypto_kem/ntruhps2048677/clean/poly_s3_inv.c | 2 +- crypto_kem/ntruhps4096821/META.yml | 4 ++-- crypto_kem/ntruhps4096821/clean/poly_s3_inv.c | 2 +- crypto_kem/ntruhrss701/META.yml | 4 ++-- crypto_kem/ntruhrss701/clean/poly_s3_inv.c | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crypto_kem/ntruhps2048509/META.yml b/crypto_kem/ntruhps2048509/META.yml index 2da9d2d5..043d9686 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/4699d70a reference implementation + version: https://github.com/jschanck/ntru/tree/00f73a7f reference implementation - name: avx2 - version: https://github.com/jschanck/ntru/tree/4699d70a avx2 implementation + version: https://github.com/jschanck/ntru/tree/00f73a7f avx2 implementation supported_platforms: - architecture: x86_64 operating_systems: diff --git a/crypto_kem/ntruhps2048509/clean/poly_s3_inv.c b/crypto_kem/ntruhps2048509/clean/poly_s3_inv.c index e6b85690..92b08480 100644 --- a/crypto_kem/ntruhps2048509/clean/poly_s3_inv.c +++ b/crypto_kem/ntruhps2048509/clean/poly_s3_inv.c @@ -7,7 +7,7 @@ static inline uint8_t mod3(uint8_t a) { /* a between 0 and 9 */ a = (a >> 2) + (a & 3); /* between 0 and 4 */ t = a - 3; c = t >> 5; - return t ^ (c & (a ^ t)); + return (uint8_t) (t ^ (c & (a ^ t))); } /* return -1 if x<0 and y<0; otherwise return 0 */ diff --git a/crypto_kem/ntruhps2048677/META.yml b/crypto_kem/ntruhps2048677/META.yml index 8f3c9c9c..8fbbd05f 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/4699d70a reference implementation + version: https://github.com/jschanck/ntru/tree/00f73a7f reference implementation - name: avx2 - version: https://github.com/jschanck/ntru/tree/4699d70a avx2 implementation + version: https://github.com/jschanck/ntru/tree/00f73a7f avx2 implementation supported_platforms: - architecture: x86_64 operating_systems: diff --git a/crypto_kem/ntruhps2048677/clean/poly_s3_inv.c b/crypto_kem/ntruhps2048677/clean/poly_s3_inv.c index 099a80d4..3412f136 100644 --- a/crypto_kem/ntruhps2048677/clean/poly_s3_inv.c +++ b/crypto_kem/ntruhps2048677/clean/poly_s3_inv.c @@ -7,7 +7,7 @@ static inline uint8_t mod3(uint8_t a) { /* a between 0 and 9 */ a = (a >> 2) + (a & 3); /* between 0 and 4 */ t = a - 3; c = t >> 5; - return t ^ (c & (a ^ t)); + return (uint8_t) (t ^ (c & (a ^ t))); } /* return -1 if x<0 and y<0; otherwise return 0 */ diff --git a/crypto_kem/ntruhps4096821/META.yml b/crypto_kem/ntruhps4096821/META.yml index 96c97793..9da1e89b 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/4699d70a reference implementation + version: https://github.com/jschanck/ntru/tree/00f73a7f reference implementation - name: avx2 - version: https://github.com/jschanck/ntru/tree/4699d70a avx2 implementation + version: https://github.com/jschanck/ntru/tree/00f73a7f avx2 implementation supported_platforms: - architecture: x86_64 operating_systems: diff --git a/crypto_kem/ntruhps4096821/clean/poly_s3_inv.c b/crypto_kem/ntruhps4096821/clean/poly_s3_inv.c index 3369cf1c..0f6ec95c 100644 --- a/crypto_kem/ntruhps4096821/clean/poly_s3_inv.c +++ b/crypto_kem/ntruhps4096821/clean/poly_s3_inv.c @@ -7,7 +7,7 @@ static inline uint8_t mod3(uint8_t a) { /* a between 0 and 9 */ a = (a >> 2) + (a & 3); /* between 0 and 4 */ t = a - 3; c = t >> 5; - return t ^ (c & (a ^ t)); + return (uint8_t) (t ^ (c & (a ^ t))); } /* return -1 if x<0 and y<0; otherwise return 0 */ diff --git a/crypto_kem/ntruhrss701/META.yml b/crypto_kem/ntruhrss701/META.yml index a9a1ba77..36617929 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/4699d70a reference implementation + version: https://github.com/jschanck/ntru/tree/00f73a7f reference implementation - name: avx2 - version: https://github.com/jschanck/ntru/tree/4699d70a avx2 implementation + version: https://github.com/jschanck/ntru/tree/00f73a7f avx2 implementation supported_platforms: - architecture: x86_64 operating_systems: diff --git a/crypto_kem/ntruhrss701/clean/poly_s3_inv.c b/crypto_kem/ntruhrss701/clean/poly_s3_inv.c index d4039d23..6100a08f 100644 --- a/crypto_kem/ntruhrss701/clean/poly_s3_inv.c +++ b/crypto_kem/ntruhrss701/clean/poly_s3_inv.c @@ -7,7 +7,7 @@ static inline uint8_t mod3(uint8_t a) { /* a between 0 and 9 */ a = (a >> 2) + (a & 3); /* between 0 and 4 */ t = a - 3; c = t >> 5; - return t ^ (c & (a ^ t)); + return (uint8_t) (t ^ (c & (a ^ t))); } /* return -1 if x<0 and y<0; otherwise return 0 */