Skip to content

Initialize some Kyber client variables#7374

Merged
douzzer merged 1 commit intowolfSSL:masterfrom
gojimmypi:PR-Kyber-Init
Mar 29, 2024
Merged

Initialize some Kyber client variables#7374
douzzer merged 1 commit intowolfSSL:masterfrom
gojimmypi:PR-Kyber-Init

Conversation

@gojimmypi
Copy link
Copy Markdown
Contributor

Description

Similar to #7364 this PR initializes some Kyber variables, this time encountered as TLS client.

These warnings surfaced when implementing a Kyber client test on the ESP8266:

C:/workspace/wolfssl-gojimmypi-pr/wolfcrypt/src/wc_kyber.c: In function 'wc_KyberKey_MakeKeyWithRandom':
C:/workspace/wolfssl-gojimmypi-pr/wolfcrypt/src/wc_kyber.c:273:15: error: 'e' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         ret = kyber_get_noise(&key->prf, kp, key->priv, e, NULL, noiseSeed);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/workspace/wolfssl-gojimmypi-pr/wolfcrypt/src/wc_kyber.c: In function 'wc_KyberKey_Decapsulate':
C:/workspace/wolfssl-gojimmypi-pr/wolfcrypt/src/wc_kyber.c:822:42: error: 'fail' may be used uninitialized in this function [-Werror=maybe-uninitialized]
             kr[i] ^= (kr[i] ^ key->z[i]) & fail;
                      ~~~~~~~~~~~~~~~~~~~~^~~~~~
C:/workspace/wolfssl-gojimmypi-pr/wolfcrypt/src/wc_kyber.c: In function 'wc_KyberKey_EncapsulateWithRandom':
C:/workspace/wolfssl-gojimmypi-pr/wolfcrypt/src/wc_kyber.c:50:33: error: 'ctSz' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define KYBER_HASH_H            wc_Sha3_256Hash
                                 ^~~~~~~~~~~~~~~
C:/workspace/wolfssl-gojimmypi-pr/wolfcrypt/src/wc_kyber.c:531:18: note: 'ctSz' was declared here
     unsigned int ctSz;
                  ^~~~
cc1.exe: some warnings being treated as errors

Fixes zd# n/a

Testing

How did you test?

Tested with command-line Linux apps talking to ESP32 Server. ESP8266 client appears to be working, but I have not yet been able to inspect with WireShark.

Enable Kyber in user_settings.h:

#define WOLFSSL_EXPERIMENTAL_SETTINGS
#define WOLFSSL_HAVE_KYBER
#define WOLFSSL_WC_KYBER
#define WOLFSSL_SHA3

or from command-line:

./configure --enable-kyber=all --enable-experimental

Talk to ESP32 Server from Linux client:

./examples/client/client -h 192.168.1.38 -v 4 \
                         -l TLS_AES_128_GCM_SHA256 \
                         --pqc KYBER_LEVEL5

Listen from Linux Server:

./examples/server/server -v 4 \
                         -l TLS_AES_128_GCM_SHA256 
                         --pqc KYBER_LEVEL5

Blog coming soon.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@gojimmypi
Copy link
Copy Markdown
Contributor Author

Jenkins retest this please

@douzzer douzzer merged commit 1caed21 into wolfSSL:master Mar 29, 2024
@gojimmypi gojimmypi mentioned this pull request Mar 29, 2024
4 tasks
@gojimmypi gojimmypi deleted the PR-Kyber-Init branch October 9, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants