Skip to content

pq-crypto/kyber_90s_r2/ntt.c fails to build with gcc 11 with -Werror #2989

@madebr

Description

@madebr

Security issue notifications

minimal

Problem:

pq-crypto/kyber_90s_r2/ntt.h declares the number-theoretic transform clean functions as:

void PQCLEAN_KYBER51290S_CLEAN_ntt(int16_t *poly);
void PQCLEAN_KYBER51290S_CLEAN_invntt(int16_t *poly);

pq-crypto/kyber_90s_r2/ntt.c implements them as:
void PQCLEAN_KYBER51290S_CLEAN_ntt(int16_t poly[256]) {

void PQCLEAN_KYBER51290S_CLEAN_invntt(int16_t poly[256]) {

This causes the following build error (with -Werror enabled)

/home/maarten/.conan/data/s2n/1.0.11/_/_/build/ea52c257f3ec393174a518e0be296686d3870cfe/source_subfolder/pq-crypto/kyber_90s_r2/ntt.c:92:44: error: argument 1 of type ‘int16_t[256]’ {aka ‘short int[256]’} with mismatched bound [-Werror=array-parameter=]
   92 | void PQCLEAN_KYBER51290S_CLEAN_ntt(int16_t poly[256]) {
      |                                    ~~~~~~~~^~~~~~~~~
In file included from /home/maarten/.conan/data/s2n/1.0.11/_/_/build/ea52c257f3ec393174a518e0be296686d3870cfe/source_subfolder/pq-crypto/kyber_90s_r2/ntt.c:1:
/home/maarten/.conan/data/s2n/1.0.11/_/_/build/ea52c257f3ec393174a518e0be296686d3870cfe/source_subfolder/pq-crypto/kyber_90s_r2/ntt.h:9:45: note: previously declared as ‘int16_t *’ {aka ‘short int *’}
    9 | void PQCLEAN_KYBER51290S_CLEAN_ntt(int16_t *poly);
      |                                    ~~~~~~~~~^~~~
/home/maarten/.conan/data/s2n/1.0.11/_/_/build/ea52c257f3ec393174a518e0be296686d3870cfe/source_subfolder/pq-crypto/kyber_90s_r2/ntt.c:116:47: error: argument 1 of type ‘int16_t[256]’ {aka ‘short int[256]’} with mismatched bound [-Werror=array-parameter=]
  116 | void PQCLEAN_KYBER51290S_CLEAN_invntt(int16_t poly[256]) {
      |                                       ~~~~~~~~^~~~~~~~~
In file included from /home/maarten/.conan/data/s2n/1.0.11/_/_/build/ea52c257f3ec393174a518e0be296686d3870cfe/source_subfolder/pq-crypto/kyber_90s_r2/ntt.c:1:
/home/maarten/.conan/data/s2n/1.0.11/_/_/build/ea52c257f3ec393174a518e0be296686d3870cfe/source_subfolder/pq-crypto/kyber_90s_r2/ntt.h:10:48: note: previously declared as ‘int16_t *’ {aka ‘short int *’}
   10 | void PQCLEAN_KYBER51290S_CLEAN_invntt(int16_t *poly);
      |       

Solution:

Modify the declarations in pq-crypto/kyber_90s_r2/ntt.h to include the size of the polynomal.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions