OpenSSL backend: use compile-time information about enabled features

This commit is contained in:
Evgeny Grin (Karlson2k)
2024-12-04 11:54:00 +03:00
parent 8f34593b11
commit 0874c39ea3
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -335,6 +335,7 @@ static const unsigned char alpn_codes_list[] = {
8u, 'h', 't', 't', 'p', '/', '1', '.', '0' /* Registered value for HTTP/1.0 */
};
#ifndef OPENSSL_NO_NEXTPROTONEG
/**
* Provide the list of supported protocols for NPN extension
* @param sess the TLS session (ignored)
@@ -356,6 +357,8 @@ get_npn_list (SSL *sess,
}
#endif /* ! OPENSSL_NO_NEXTPROTONEG */
/**
* Select protocol from the provided list for ALPN extension
* @param sess the TLS session (ignored)
@@ -430,10 +433,12 @@ daemon_init_ctx (struct MHD_Daemon *restrict d,
// TODO: add configuration option
// ctx_opts |= SSL_OP_CIPHER_SERVER_PREFERENCE;
#ifndef OPENSSL_NO_KTLS
/* Enable kernel TLS */ // TODO: add configuration option
ctx_opts |= SSL_OP_ENABLE_KTLS;
#ifdef SSL_OP_ENABLE_KTLS_TX_ZEROCOPY_SENDFILE
# ifdef SSL_OP_ENABLE_KTLS_TX_ZEROCOPY_SENDFILE
ctx_opts |= SSL_OP_ENABLE_KTLS_TX_ZEROCOPY_SENDFILE;
# endif
#endif
/* HTTP defines strict framing for the client-side data,
@@ -472,9 +477,11 @@ daemon_init_ctx (struct MHD_Daemon *restrict d,
SSL_CTX_set_alpn_select_cb (d_tls->ctx,
&select_alpn_prot,
NULL);
#ifndef OPENSSL_NO_NEXTPROTONEG
SSL_CTX_set_next_protos_advertised_cb (d_tls->ctx,
&get_npn_list,
NULL);
#endif /* ! OPENSSL_NO_NEXTPROTONEG */
return MHD_SC_OK;
}
+1
View File
@@ -39,6 +39,7 @@
#define OPENSSL_NO_DEPRECATED 1
#include <openssl/opensslv.h>
#include <openssl/opensslconf.h>
#include <openssl/crypto.h>
#include <openssl/ssl.h>
#include <openssl/err.h>