1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-22 15:39:07 +00:00

remove ternary operator in rainbow to compute max

clang-tidy9.0.0 added a new check: bugprone-branch-clone
(https://releases.llvm.org/9.0.0/tools/clang/tools/extra/docs/ReleaseNotes.html)
This doesn't like both branches of an if are the same.
This lead to a warning in rainbow, as where the maximum of two values (which
are always the same) is computed in a macro.
I don't always agree with this warning, but here I think it's worth to
remove the macro.
This commit is contained in:
Matthias J. Kannwischer 2019-10-15 14:54:17 +02:00 committed by Kris Kwiatkowski
parent 6c98832774
commit d1f2d16f46
18 changed files with 18 additions and 18 deletions

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWIIICCLASSIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWIIICCLASSIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -9,6 +9,7 @@
#define _V1 68 #define _V1 68
#define _O1 36 #define _O1 36
#define _O2 36 #define _O2 36
#define _MAX_O 36
#define _HASH_LEN 48 #define _HASH_LEN 48
@ -27,6 +28,7 @@
#define _V2_BYTE (_V2) #define _V2_BYTE (_V2)
#define _O1_BYTE (_O1) #define _O1_BYTE (_O1)
#define _O2_BYTE (_O2) #define _O2_BYTE (_O2)
#define _MAX_O_BYTE (_MAX_O)
#define _PUB_N_BYTE (_PUB_N) #define _PUB_N_BYTE (_PUB_N)
#define _PUB_M_BYTE (_PUB_M) #define _PUB_M_BYTE (_PUB_M)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWIIICCYCLICCOMPRESSED_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWIIICCYCLICCOMPRESSED_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -9,6 +9,7 @@
#define _V1 68 #define _V1 68
#define _O1 36 #define _O1 36
#define _O2 36 #define _O2 36
#define _MAX_O 36
#define _HASH_LEN 48 #define _HASH_LEN 48
@ -27,6 +28,7 @@
#define _V2_BYTE (_V2) #define _V2_BYTE (_V2)
#define _O1_BYTE (_O1) #define _O1_BYTE (_O1)
#define _O2_BYTE (_O2) #define _O2_BYTE (_O2)
#define _MAX_O_BYTE (_MAX_O)
#define _PUB_N_BYTE (_PUB_N) #define _PUB_N_BYTE (_PUB_N)
#define _PUB_M_BYTE (_PUB_M) #define _PUB_M_BYTE (_PUB_M)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWIIICCYCLIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWIIICCYCLIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -9,6 +9,7 @@
#define _V1 68 #define _V1 68
#define _O1 36 #define _O1 36
#define _O2 36 #define _O2 36
#define _MAX_O 36
#define _HASH_LEN 48 #define _HASH_LEN 48
@ -27,6 +28,7 @@
#define _V2_BYTE (_V2) #define _V2_BYTE (_V2)
#define _O1_BYTE (_O1) #define _O1_BYTE (_O1)
#define _O2_BYTE (_O2) #define _O2_BYTE (_O2)
#define _MAX_O_BYTE (_MAX_O)
#define _PUB_N_BYTE (_PUB_N) #define _PUB_N_BYTE (_PUB_N)
#define _PUB_M_BYTE (_PUB_M) #define _PUB_M_BYTE (_PUB_M)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -10,6 +10,7 @@
#define _V1 32 #define _V1 32
#define _O1 32 #define _O1 32
#define _O2 32 #define _O2 32
#define _MAX_O 32
#define _HASH_LEN 32 #define _HASH_LEN 32
@ -28,6 +29,7 @@
#define _V2_BYTE (_V2 / 2) #define _V2_BYTE (_V2 / 2)
#define _O1_BYTE (_O1 / 2) #define _O1_BYTE (_O1 / 2)
#define _O2_BYTE (_O2 / 2) #define _O2_BYTE (_O2 / 2)
#define _MAX_O_BYTE (_MAX_O / 2)
#define _PUB_N_BYTE (_PUB_N / 2) #define _PUB_N_BYTE (_PUB_N / 2)
#define _PUB_M_BYTE (_PUB_M / 2) #define _PUB_M_BYTE (_PUB_M / 2)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWIACYCLICCOMPRESSED_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWIACYCLICCOMPRESSED_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -10,6 +10,7 @@
#define _V1 32 #define _V1 32
#define _O1 32 #define _O1 32
#define _O2 32 #define _O2 32
#define _MAX_O 32
#define _HASH_LEN 32 #define _HASH_LEN 32
@ -28,6 +29,7 @@
#define _V2_BYTE (_V2 / 2) #define _V2_BYTE (_V2 / 2)
#define _O1_BYTE (_O1 / 2) #define _O1_BYTE (_O1 / 2)
#define _O2_BYTE (_O2 / 2) #define _O2_BYTE (_O2 / 2)
#define _MAX_O_BYTE (_MAX_O / 2)
#define _PUB_N_BYTE (_PUB_N / 2) #define _PUB_N_BYTE (_PUB_N / 2)
#define _PUB_M_BYTE (_PUB_M / 2) #define _PUB_M_BYTE (_PUB_M / 2)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWIACYCLIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWIACYCLIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -10,6 +10,7 @@
#define _V1 32 #define _V1 32
#define _O1 32 #define _O1 32
#define _O2 32 #define _O2 32
#define _MAX_O 32
#define _HASH_LEN 32 #define _HASH_LEN 32
@ -28,6 +29,7 @@
#define _V2_BYTE (_V2 / 2) #define _V2_BYTE (_V2 / 2)
#define _O1_BYTE (_O1 / 2) #define _O1_BYTE (_O1 / 2)
#define _O2_BYTE (_O2 / 2) #define _O2_BYTE (_O2 / 2)
#define _MAX_O_BYTE (_MAX_O / 2)
#define _PUB_N_BYTE (_PUB_N / 2) #define _PUB_N_BYTE (_PUB_N / 2)
#define _PUB_M_BYTE (_PUB_M / 2) #define _PUB_M_BYTE (_PUB_M / 2)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWVCCLASSIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWVCCLASSIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -9,6 +9,7 @@
#define _V1 92 #define _V1 92
#define _O1 48 #define _O1 48
#define _O2 48 #define _O2 48
#define _MAX_O 48
#define _HASH_LEN 64 #define _HASH_LEN 64
@ -27,6 +28,7 @@
#define _V2_BYTE (_V2) #define _V2_BYTE (_V2)
#define _O1_BYTE (_O1) #define _O1_BYTE (_O1)
#define _O2_BYTE (_O2) #define _O2_BYTE (_O2)
#define _MAX_O_BYTE (_MAX_O)
#define _PUB_N_BYTE (_PUB_N) #define _PUB_N_BYTE (_PUB_N)
#define _PUB_M_BYTE (_PUB_M) #define _PUB_M_BYTE (_PUB_M)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWVCCYCLICCOMPRESSED_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWVCCYCLICCOMPRESSED_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -9,6 +9,7 @@
#define _V1 92 #define _V1 92
#define _O1 48 #define _O1 48
#define _O2 48 #define _O2 48
#define _MAX_O 48
#define _HASH_LEN 64 #define _HASH_LEN 64
@ -27,6 +28,7 @@
#define _V2_BYTE (_V2) #define _V2_BYTE (_V2)
#define _O1_BYTE (_O1) #define _O1_BYTE (_O1)
#define _O2_BYTE (_O2) #define _O2_BYTE (_O2)
#define _MAX_O_BYTE (_MAX_O)
#define _PUB_N_BYTE (_PUB_N) #define _PUB_N_BYTE (_PUB_N)
#define _PUB_M_BYTE (_PUB_M) #define _PUB_M_BYTE (_PUB_M)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#define MAX_ATTEMPT_FRMAT 128 #define MAX_ATTEMPT_FRMAT 128
#define _MAX_O ((_O1 > _O2) ? _O1 : _O2)
#define _MAX_O_BYTE ((_O1_BYTE > _O2_BYTE) ? _O1_BYTE : _O2_BYTE)
int PQCLEAN_RAINBOWVCCYCLIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) { int PQCLEAN_RAINBOWVCCYCLIC_CLEAN_rainbow_sign(uint8_t *signature, const sk_t *sk, const uint8_t *_digest) {
uint8_t mat_l1[_O1 * _O1_BYTE]; uint8_t mat_l1[_O1 * _O1_BYTE];

View File

@ -9,6 +9,7 @@
#define _V1 92 #define _V1 92
#define _O1 48 #define _O1 48
#define _O2 48 #define _O2 48
#define _MAX_O 48
#define _HASH_LEN 64 #define _HASH_LEN 64
@ -27,6 +28,7 @@
#define _V2_BYTE (_V2) #define _V2_BYTE (_V2)
#define _O1_BYTE (_O1) #define _O1_BYTE (_O1)
#define _O2_BYTE (_O2) #define _O2_BYTE (_O2)
#define _MAX_O_BYTE (_MAX_O)
#define _PUB_N_BYTE (_PUB_N) #define _PUB_N_BYTE (_PUB_N)
#define _PUB_M_BYTE (_PUB_M) #define _PUB_M_BYTE (_PUB_M)