Skip to content

Commit

Permalink
Void all unused parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Eddy Kim <[email protected]>
  • Loading branch information
Eddy-M-K committed Jul 31, 2024
1 parent 2406568 commit 68435ad
Show file tree
Hide file tree
Showing 20 changed files with 151 additions and 29 deletions.
7 changes: 7 additions & 0 deletions scripts/copy_from_upstream/src/kem/family/kem_scheme.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ OQS_API OQS_STATUS OQS_KEM_{{ family }}_{{ scheme['scheme'] }}_keypair_derand(ui
#endif
{%- endif %}
{%- else %}
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
{%- endif %}
}
Expand Down Expand Up @@ -246,6 +249,10 @@ OQS_API OQS_STATUS OQS_KEM_{{ family }}_{{ scheme['scheme'] }}_encaps_derand(uin
#endif
{%- endif %}
{%- else %}
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
{%- endif %}
}
Expand Down
27 changes: 14 additions & 13 deletions src/kem/bike/additional_r4/kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
#include "sampling.h"
#include "sha.h"

#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#else
#define UNUSED
#endif

// m_t and seed_t have the same size and thus can be considered
// to be of the same type. However, for security reasons we distinguish
// these types, even on the costs of small extra complexity.
Expand Down Expand Up @@ -277,17 +271,24 @@ OQS_API int decaps(OUT unsigned char * ss,
return SUCCESS;
}

OQS_API int keypair_derand(UNUSED OUT unsigned char * pk,
UNUSED OUT unsigned char * sk,
UNUSED IN const unsigned char *coins)
OQS_API int keypair_derand(OUT unsigned char * pk,
OUT unsigned char * sk,
IN const unsigned char *coins)
{
(void)pk;
(void)sk;
(void)coins;
return OQS_ERROR;
}

OQS_API int encaps_derand(UNUSED OUT unsigned char * ct,
UNUSED OUT unsigned char * ss,
UNUSED IN const unsigned char *pk,
UNUSED IN const unsigned char *coins)
OQS_API int encaps_derand(OUT unsigned char * ct,
OUT unsigned char * ss,
IN const unsigned char *pk,
IN const unsigned char *coins)
{
(void)ct;
(void)ss;
(void)pk;
(void)coins;
return OQS_ERROR;
}
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_348864.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE348864_AVX2_crypto_kem_dec(uint8_t *ss, const uint8_t
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_348864_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_348864_keypair(uint8_t *public_key,
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_348864_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_348864f.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_dec(uint8_t *ss, const uint8_
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_348864f_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_348864f_keypair(uint8_t *public_key,
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_348864f_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_460896.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE460896_AVX2_crypto_kem_dec(uint8_t *ss, const uint8_t
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_460896_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_460896_keypair(uint8_t *public_key,
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_460896_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_460896f.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_dec(uint8_t *ss, const uint8_
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_460896f_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_460896f_keypair(uint8_t *public_key,
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_460896f_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_6688128.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_dec(uint8_t *ss, const uint8_
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6688128_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6688128_keypair(uint8_t *public_key,
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6688128_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_6688128f.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_dec(uint8_t *ss, const uint8
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6688128f_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6688128f_keypair(uint8_t *public_key
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6688128f_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_6960119.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_dec(uint8_t *ss, const uint8_
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6960119_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6960119_keypair(uint8_t *public_key,
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6960119_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_6960119f.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_dec(uint8_t *ss, const uint8
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6960119f_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6960119f_keypair(uint8_t *public_key
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_6960119f_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_8192128.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_dec(uint8_t *ss, const uint8_
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_8192128_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_8192128_keypair(uint8_t *public_key,
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_8192128_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/classic_mceliece/kem_classic_mceliece_8192128f.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern int PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_dec(uint8_t *ss, const uint8
#endif

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_8192128f_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -64,6 +67,10 @@ OQS_API OQS_STATUS OQS_KEM_classic_mceliece_8192128f_keypair(uint8_t *public_key
}

OQS_API OQS_STATUS OQS_KEM_classic_mceliece_8192128f_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
17 changes: 9 additions & 8 deletions src/kem/frodokem/external/kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@

#include <string.h>

#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#else
#define UNUSED
#endif

OQS_STATUS crypto_kem_keypair_derand(UNUSED unsigned char *pk, UNUSED unsigned char *sk, UNUSED const unsigned char *coins)
OQS_STATUS crypto_kem_keypair_derand(unsigned char *pk, unsigned char *sk, const unsigned char *coins)
{
(void)pk;
(void)sk;
(void)coins;
return OQS_ERROR;
}

Expand Down Expand Up @@ -75,8 +72,12 @@ OQS_STATUS crypto_kem_keypair(unsigned char* pk, unsigned char* sk)
}


OQS_STATUS crypto_kem_enc_derand(UNUSED unsigned char *ct, UNUSED unsigned char *ss, UNUSED const unsigned char *pk, UNUSED const unsigned char *coins)
OQS_STATUS crypto_kem_enc_derand(unsigned char *ct, unsigned char *ss, const unsigned char *pk, const unsigned char *coins)
{
(void)ct;
(void)ss;
(void)pk;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/hqc/kem_hqc_128.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ extern int PQCLEAN_HQC128_CLEAN_crypto_kem_enc(uint8_t *ct, uint8_t *ss, const u
extern int PQCLEAN_HQC128_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);

OQS_API OQS_STATUS OQS_KEM_hqc_128_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -46,6 +49,10 @@ OQS_API OQS_STATUS OQS_KEM_hqc_128_keypair(uint8_t *public_key, uint8_t *secret_
}

OQS_API OQS_STATUS OQS_KEM_hqc_128_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/hqc/kem_hqc_192.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ extern int PQCLEAN_HQC192_CLEAN_crypto_kem_enc(uint8_t *ct, uint8_t *ss, const u
extern int PQCLEAN_HQC192_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);

OQS_API OQS_STATUS OQS_KEM_hqc_192_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -46,6 +49,10 @@ OQS_API OQS_STATUS OQS_KEM_hqc_192_keypair(uint8_t *public_key, uint8_t *secret_
}

OQS_API OQS_STATUS OQS_KEM_hqc_192_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/hqc/kem_hqc_256.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ extern int PQCLEAN_HQC256_CLEAN_crypto_kem_enc(uint8_t *ct, uint8_t *ss, const u
extern int PQCLEAN_HQC256_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);

OQS_API OQS_STATUS OQS_KEM_hqc_256_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand All @@ -46,6 +49,10 @@ OQS_API OQS_STATUS OQS_KEM_hqc_256_keypair(uint8_t *public_key, uint8_t *secret_
}

OQS_API OQS_STATUS OQS_KEM_hqc_256_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
7 changes: 7 additions & 0 deletions src/kem/kyber/kem_kyber_1024.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ extern int PQCLEAN_KYBER1024_AARCH64_crypto_kem_dec(uint8_t *ss, const uint8_t *
#endif

OQS_API OQS_STATUS OQS_KEM_kyber_1024_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *coins) {
(void)public_key;
(void)secret_key;
(void)coins;
return OQS_ERROR;
}

Expand Down Expand Up @@ -80,6 +83,10 @@ OQS_API OQS_STATUS OQS_KEM_kyber_1024_keypair(uint8_t *public_key, uint8_t *secr
}

OQS_API OQS_STATUS OQS_KEM_kyber_1024_encaps_derand(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key, const uint8_t *coins) {
(void)ciphertext;
(void)shared_secret;
(void)public_key;
(void)coins;
return OQS_ERROR;
}

Expand Down
Loading

0 comments on commit 68435ad

Please sign in to comment.