h2o / picotls

TLS 1.3 implementation in C (master supports RFC8446 as well as draft-26, -27, -28)
527 stars 140 forks source link

Fix build error due to undefined variables #532

Open nak3 opened 1 month ago

nak3 commented 1 month ago

When buidling LibreSSL + picotls with -Wundef option, the build fails due to the following error.

2024-06-16T05:50:37.9131759Z In file included from /home/runner/work/ngtcp2/ngtcp2/ngtcp2-1.6.0-DEV/crypto/picotls/picotls.c:36:
2024-06-16T05:50:37.9134332Z /home/runner/work/ngtcp2/ngtcp2/picotls-libressl/include/picotls/openssl.h:91:5: error: 'PTLS_OPENSSL_HAVE_CHACHA20_POLY1305' is not defined, evaluates to 0 [-Werror,-Wundef]
2024-06-16T05:50:37.9136125Z #if PTLS_OPENSSL_HAVE_CHACHA20_POLY1305
2024-06-16T05:50:37.9136719Z     ^
2024-06-16T05:50:37.9138515Z /home/runner/work/ngtcp2/ngtcp2/picotls-libressl/include/picotls/openssl.h:108:5: error: 'PTLS_OPENSSL_HAVE_CHACHA20_POLY1305' is not defined, evaluates to 0 [-Werror,-Wundef]
2024-06-16T05:50:37.9140294Z #if PTLS_OPENSSL_HAVE_CHACHA20_POLY1305
2024-06-16T05:50:37.9141272Z     ^
2024-06-16T05:50:37.9143043Z /home/runner/work/ngtcp2/ngtcp2/picotls-libressl/include/picotls/openssl.h:119:5: error: 'PTLS_OPENSSL_HAVE_X25519' is not defined, evaluates to 0 [-Werror,-Wundef]
2024-06-16T05:50:37.9144740Z #if PTLS_OPENSSL_HAVE_X25519
2024-06-16T05:50:37.9145253Z     ^
2024-06-16T05:50:37.9147028Z /home/runner/work/ngtcp2/ngtcp2/picotls-libressl/include/picotls/openssl.h:127:5: error: 'PTLS_OPENSSL_HAVE_CHACHA20_POLY1305' is not defined, evaluates to 0 [-Werror,-Wundef]
2024-06-16T05:50:37.9148787Z #if PTLS_OPENSSL_HAVE_CHACHA20_POLY1305
2024-06-16T05:50:37.9149365Z     ^
2024-06-16T05:50:37.9221836Z 4 errors generated.
2024-06-16T05:50:37.9278275Z make[2]: *** [crypto/picotls/CMakeFiles/ngtcp2_crypto_picotls_static.dir/build.make:76: crypto/picotls/CMakeFiles/ngtcp2_crypto_picotls_static.dir/picotls.c.o] Error 1
2024-06-16T05:50:37.9280880Z make[1]: *** [CMakeFiles/Makefile2:553: crypto/picotls/CMakeFiles/ngtcp2_crypto_picotls_static.dir/all] Error 2

This patch fixes them.