From 512adcc0dbbebdfe3d8e17dae09fd88a0d1812a6 Mon Sep 17 00:00:00 2001 From: "John M. Schanck" Date: Tue, 15 Sep 2020 12:42:47 -0400 Subject: [PATCH] frodo: satisfy test_boolean --- crypto_kem/frodokem1344aes/clean/util.c | 5 ++++- crypto_kem/frodokem1344aes/opt/util.c | 5 ++++- crypto_kem/frodokem1344shake/clean/util.c | 5 ++++- crypto_kem/frodokem1344shake/opt/util.c | 5 ++++- crypto_kem/frodokem640aes/clean/util.c | 5 ++++- crypto_kem/frodokem640aes/opt/util.c | 5 ++++- crypto_kem/frodokem640shake/clean/util.c | 5 ++++- crypto_kem/frodokem640shake/opt/util.c | 5 ++++- crypto_kem/frodokem976aes/clean/util.c | 5 ++++- crypto_kem/frodokem976aes/opt/util.c | 5 ++++- crypto_kem/frodokem976shake/clean/util.c | 5 ++++- crypto_kem/frodokem976shake/opt/util.c | 5 ++++- 12 files changed, 48 insertions(+), 12 deletions(-) diff --git a/crypto_kem/frodokem1344aes/clean/util.c b/crypto_kem/frodokem1344aes/clean/util.c index be4e2d3e..a64b32d6 100644 --- a/crypto_kem/frodokem1344aes/clean/util.c +++ b/crypto_kem/frodokem1344aes/clean/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM1344AES_CLEAN_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem1344aes/opt/util.c b/crypto_kem/frodokem1344aes/opt/util.c index d2dbb565..7a0bb5fe 100644 --- a/crypto_kem/frodokem1344aes/opt/util.c +++ b/crypto_kem/frodokem1344aes/opt/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM1344AES_OPT_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem1344shake/clean/util.c b/crypto_kem/frodokem1344shake/clean/util.c index 189ea752..e0d9a24a 100644 --- a/crypto_kem/frodokem1344shake/clean/util.c +++ b/crypto_kem/frodokem1344shake/clean/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM1344SHAKE_CLEAN_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem1344shake/opt/util.c b/crypto_kem/frodokem1344shake/opt/util.c index 220bfae5..021f76a0 100644 --- a/crypto_kem/frodokem1344shake/opt/util.c +++ b/crypto_kem/frodokem1344shake/opt/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM1344SHAKE_OPT_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem640aes/clean/util.c b/crypto_kem/frodokem640aes/clean/util.c index d0218113..a31a9cf8 100644 --- a/crypto_kem/frodokem640aes/clean/util.c +++ b/crypto_kem/frodokem640aes/clean/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM640AES_CLEAN_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem640aes/opt/util.c b/crypto_kem/frodokem640aes/opt/util.c index b43d9f84..79b98c5e 100644 --- a/crypto_kem/frodokem640aes/opt/util.c +++ b/crypto_kem/frodokem640aes/opt/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM640AES_OPT_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem640shake/clean/util.c b/crypto_kem/frodokem640shake/clean/util.c index 31e1b155..23e10e90 100644 --- a/crypto_kem/frodokem640shake/clean/util.c +++ b/crypto_kem/frodokem640shake/clean/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM640SHAKE_CLEAN_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem640shake/opt/util.c b/crypto_kem/frodokem640shake/opt/util.c index 6cbe46b0..328af730 100644 --- a/crypto_kem/frodokem640shake/opt/util.c +++ b/crypto_kem/frodokem640shake/opt/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM640SHAKE_OPT_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem976aes/clean/util.c b/crypto_kem/frodokem976aes/clean/util.c index dda97621..388aac89 100644 --- a/crypto_kem/frodokem976aes/clean/util.c +++ b/crypto_kem/frodokem976aes/clean/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM976AES_CLEAN_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem976aes/opt/util.c b/crypto_kem/frodokem976aes/opt/util.c index 67019878..cad5636c 100644 --- a/crypto_kem/frodokem976aes/opt/util.c +++ b/crypto_kem/frodokem976aes/opt/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM976AES_OPT_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem976shake/clean/util.c b/crypto_kem/frodokem976shake/clean/util.c index b8246b87..4f2b0bf2 100644 --- a/crypto_kem/frodokem976shake/clean/util.c +++ b/crypto_kem/frodokem976shake/clean/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM976SHAKE_CLEAN_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8)); diff --git a/crypto_kem/frodokem976shake/opt/util.c b/crypto_kem/frodokem976shake/opt/util.c index 0ae983c1..4bd77615 100644 --- a/crypto_kem/frodokem976shake/opt/util.c +++ b/crypto_kem/frodokem976shake/opt/util.c @@ -11,7 +11,10 @@ #include "common.h" #include "params.h" -#define min(x, y) (((x) < (y)) ? (x) : (y)) +static inline uint8_t min(uint8_t x, uint8_t y) { + if (x < y) return x; + return y; +} uint16_t PQCLEAN_FRODOKEM976SHAKE_OPT_LE_TO_UINT16(uint16_t n) { return (((uint8_t *) &n)[0] | (((uint8_t *) &n)[1] << 8));