Browse Source

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.
kyber
Matthias J. Kannwischer 5 years ago
committed by Kris Kwiatkowski
parent
commit
d1f2d16f46
18 changed files with 18 additions and 18 deletions
  1. +0
    -2
      crypto_sign/rainbowIIIc-classic/clean/rainbow.c
  2. +2
    -0
      crypto_sign/rainbowIIIc-classic/clean/rainbow_config.h
  3. +0
    -2
      crypto_sign/rainbowIIIc-cyclic-compressed/clean/rainbow.c
  4. +2
    -0
      crypto_sign/rainbowIIIc-cyclic-compressed/clean/rainbow_config.h
  5. +0
    -2
      crypto_sign/rainbowIIIc-cyclic/clean/rainbow.c
  6. +2
    -0
      crypto_sign/rainbowIIIc-cyclic/clean/rainbow_config.h
  7. +0
    -2
      crypto_sign/rainbowIa-classic/clean/rainbow.c
  8. +2
    -0
      crypto_sign/rainbowIa-classic/clean/rainbow_config.h
  9. +0
    -2
      crypto_sign/rainbowIa-cyclic-compressed/clean/rainbow.c
  10. +2
    -0
      crypto_sign/rainbowIa-cyclic-compressed/clean/rainbow_config.h
  11. +0
    -2
      crypto_sign/rainbowIa-cyclic/clean/rainbow.c
  12. +2
    -0
      crypto_sign/rainbowIa-cyclic/clean/rainbow_config.h
  13. +0
    -2
      crypto_sign/rainbowVc-classic/clean/rainbow.c
  14. +2
    -0
      crypto_sign/rainbowVc-classic/clean/rainbow_config.h
  15. +0
    -2
      crypto_sign/rainbowVc-cyclic-compressed/clean/rainbow.c
  16. +2
    -0
      crypto_sign/rainbowVc-cyclic-compressed/clean/rainbow_config.h
  17. +0
    -2
      crypto_sign/rainbowVc-cyclic/clean/rainbow.c
  18. +2
    -0
      crypto_sign/rainbowVc-cyclic/clean/rainbow_config.h

+ 0
- 2
crypto_sign/rainbowIIIc-classic/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowIIIc-classic/clean/rainbow_config.h View File

@@ -9,6 +9,7 @@
#define _V1 68
#define _O1 36
#define _O2 36
#define _MAX_O 36
#define _HASH_LEN 48


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



+ 0
- 2
crypto_sign/rainbowIIIc-cyclic-compressed/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowIIIc-cyclic-compressed/clean/rainbow_config.h View File

@@ -9,6 +9,7 @@
#define _V1 68
#define _O1 36
#define _O2 36
#define _MAX_O 36
#define _HASH_LEN 48


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



+ 0
- 2
crypto_sign/rainbowIIIc-cyclic/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowIIIc-cyclic/clean/rainbow_config.h View File

@@ -9,6 +9,7 @@
#define _V1 68
#define _O1 36
#define _O2 36
#define _MAX_O 36
#define _HASH_LEN 48


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



+ 0
- 2
crypto_sign/rainbowIa-classic/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowIa-classic/clean/rainbow_config.h View File

@@ -10,6 +10,7 @@
#define _V1 32
#define _O1 32
#define _O2 32
#define _MAX_O 32
#define _HASH_LEN 32


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



+ 0
- 2
crypto_sign/rainbowIa-cyclic-compressed/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowIa-cyclic-compressed/clean/rainbow_config.h View File

@@ -10,6 +10,7 @@
#define _V1 32
#define _O1 32
#define _O2 32
#define _MAX_O 32
#define _HASH_LEN 32


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



+ 0
- 2
crypto_sign/rainbowIa-cyclic/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowIa-cyclic/clean/rainbow_config.h View File

@@ -10,6 +10,7 @@
#define _V1 32
#define _O1 32
#define _O2 32
#define _MAX_O 32
#define _HASH_LEN 32


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



+ 0
- 2
crypto_sign/rainbowVc-classic/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowVc-classic/clean/rainbow_config.h View File

@@ -9,6 +9,7 @@
#define _V1 92
#define _O1 48
#define _O2 48
#define _MAX_O 48
#define _HASH_LEN 64


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



+ 0
- 2
crypto_sign/rainbowVc-cyclic-compressed/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowVc-cyclic-compressed/clean/rainbow_config.h View File

@@ -9,6 +9,7 @@
#define _V1 92
#define _O1 48
#define _O2 48
#define _MAX_O 48
#define _HASH_LEN 64


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



+ 0
- 2
crypto_sign/rainbowVc-cyclic/clean/rainbow.c View File

@@ -15,8 +15,6 @@
#include <string.h>

#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) {
uint8_t mat_l1[_O1 * _O1_BYTE];


+ 2
- 0
crypto_sign/rainbowVc-cyclic/clean/rainbow_config.h View File

@@ -9,6 +9,7 @@
#define _V1 92
#define _O1 48
#define _O2 48
#define _MAX_O 48
#define _HASH_LEN 64


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



Loading…
Cancel
Save