diff --git a/tacd/src/server.rs b/tacd/src/server.rs index 86840da..8a9c7c5 100644 --- a/tacd/src/server.rs +++ b/tacd/src/server.rs @@ -1,12 +1,17 @@ use acme_common::error::Error; use log::debug; use openssl::pkey::{PKey, Private}; -use openssl::ssl::{self, SslAcceptor, SslMethod}; +use openssl::ssl::{self, AlpnError, SslAcceptor, SslMethod}; use openssl::x509::X509; use std::net::TcpListener; use std::sync::Arc; use std::thread; +#[cfg(ossl110)] +const ALPN_ERROR: AlpnError = AlpnError::ALERT_FATAL; +#[cfg(not(ossl110))] +const ALPN_ERROR: AlpnError = AlpnError::NOACK; + pub fn start( listen_addr: &str, certificate: &X509, @@ -16,7 +21,7 @@ pub fn start( acceptor.set_alpn_select_callback(|_, client| { debug!("ALPN negociation"); ssl::select_next_proto(crate::ALPN_ACME_PROTO_NAME, client) - .ok_or(ssl::AlpnError::ALERT_FATAL) + .ok_or(ALPN_ERROR) }); acceptor.set_private_key(private_key)?; acceptor.set_certificate(certificate)?;