@@ -602,17 +602,17 @@ impl SslAlert {
602
602
603
603
/// An error returned from an ALPN selection callback.
604
604
///
605
- /// Requires OpenSSL 1.0.2 or LibreSSL 2.6.1 or newer.
606
- #[ cfg( any( ossl102, libressl261) ) ]
605
+ /// Requires BoringSSL or OpenSSL 1.0.2 or LibreSSL 2.6.1 or newer.
606
+ #[ cfg( any( ossl102, libressl261, boringssl ) ) ]
607
607
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
608
608
pub struct AlpnError ( c_int ) ;
609
609
610
- #[ cfg( any( ossl102, libressl261) ) ]
610
+ #[ cfg( any( ossl102, libressl261, boringssl ) ) ]
611
611
impl AlpnError {
612
612
/// Terminate the handshake with a fatal alert.
613
613
///
614
- /// Requires OpenSSL 1.1.0 or newer.
615
- #[ cfg( ossl110) ]
614
+ /// Requires BoringSSL or OpenSSL 1.1.0 or newer.
615
+ #[ cfg( any ( ossl110, boringssl ) ) ]
616
616
pub const ALERT_FATAL : AlpnError = AlpnError ( ffi:: SSL_TLSEXT_ERR_ALERT_FATAL ) ;
617
617
618
618
/// Do not select a protocol, but continue the handshake.
@@ -1267,23 +1267,30 @@ impl SslContextBuilder {
1267
1267
/// of those protocols on success. The [`select_next_proto`] function implements the standard
1268
1268
/// protocol selection algorithm.
1269
1269
///
1270
- /// Requires OpenSSL 1.0.2 or LibreSSL 2.6.1 or newer.
1270
+ /// Requires BoringSSL or OpenSSL 1.0.2 or LibreSSL 2.6.1 or newer.
1271
1271
///
1272
1272
/// [`SslContextBuilder::set_alpn_protos`]: struct.SslContextBuilder.html#method.set_alpn_protos
1273
1273
/// [`select_next_proto`]: fn.select_next_proto.html
1274
1274
#[ corresponds( SSL_CTX_set_alpn_select_cb ) ]
1275
- #[ cfg( any( ossl102, libressl261) ) ]
1275
+ #[ cfg( any( ossl102, libressl261, boringssl ) ) ]
1276
1276
pub fn set_alpn_select_callback < F > ( & mut self , callback : F )
1277
1277
where
1278
1278
F : for < ' a > Fn ( & mut SslRef , & ' a [ u8 ] ) -> Result < & ' a [ u8 ] , AlpnError > + ' static + Sync + Send ,
1279
1279
{
1280
1280
unsafe {
1281
1281
self . set_ex_data ( SslContext :: cached_ex_index :: < F > ( ) , callback) ;
1282
+ #[ cfg( not( boringssl) ) ]
1282
1283
ffi:: SSL_CTX_set_alpn_select_cb__fixed_rust (
1283
1284
self . as_ptr ( ) ,
1284
1285
Some ( callbacks:: raw_alpn_select :: < F > ) ,
1285
1286
ptr:: null_mut ( ) ,
1286
1287
) ;
1288
+ #[ cfg( boringssl) ]
1289
+ ffi:: SSL_CTX_set_alpn_select_cb (
1290
+ self . as_ptr ( ) ,
1291
+ Some ( callbacks:: raw_alpn_select :: < F > ) ,
1292
+ ptr:: null_mut ( ) ,
1293
+ ) ;
1287
1294
}
1288
1295
}
1289
1296
0 commit comments