--- a/deps/picotls/include/picotls/openssl.h
+++ b/deps/picotls/include/picotls/openssl.h
@@ -26,11 +26,14 @@
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
 #include <openssl/x509.h>
+#include <openssl/opensslconf.h>
 #include "../picotls.h"
 
 #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
 #define PTLS_OPENSSL_HAVE_CHACHA20_POLY1305
 #endif
+#endif
 
 extern ptls_key_exchange_algorithm_t ptls_openssl_secp256r1;
 extern ptls_key_exchange_algorithm_t *ptls_openssl_key_exchanges[];
