@@ -47,7 +47,7 @@ use crate::dh::Dh;
47
47
use crate :: dsa:: Dsa ;
48
48
use crate :: ec:: EcKey ;
49
49
use crate :: error:: ErrorStack ;
50
- #[ cfg( any( ossl110, boringssl) ) ]
50
+ #[ cfg( any( ossl110, boringssl, libressl370 ) ) ]
51
51
use crate :: pkey_ctx:: PkeyCtx ;
52
52
use crate :: rsa:: Rsa ;
53
53
use crate :: symm:: Cipher ;
@@ -89,11 +89,11 @@ impl Id {
89
89
#[ cfg( ossl110) ]
90
90
pub const HKDF : Id = Id ( ffi:: EVP_PKEY_HKDF ) ;
91
91
92
- #[ cfg( any( ossl111, boringssl) ) ]
92
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
93
93
pub const ED25519 : Id = Id ( ffi:: EVP_PKEY_ED25519 ) ;
94
94
#[ cfg( ossl111) ]
95
95
pub const ED448 : Id = Id ( ffi:: EVP_PKEY_ED448 ) ;
96
- #[ cfg( any( ossl111, boringssl) ) ]
96
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
97
97
pub const X25519 : Id = Id ( ffi:: EVP_PKEY_X25519 ) ;
98
98
#[ cfg( ossl111) ]
99
99
pub const X448 : Id = Id ( ffi:: EVP_PKEY_X448 ) ;
@@ -252,7 +252,7 @@ where
252
252
/// This function only works for algorithms that support raw public keys.
253
253
/// Currently this is: [`Id::X25519`], [`Id::ED25519`], [`Id::X448`] or [`Id::ED448`].
254
254
#[ corresponds( EVP_PKEY_get_raw_public_key ) ]
255
- #[ cfg( any( ossl111, boringssl) ) ]
255
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
256
256
pub fn raw_public_key ( & self ) -> Result < Vec < u8 > , ErrorStack > {
257
257
unsafe {
258
258
let mut len = 0 ;
@@ -303,7 +303,7 @@ where
303
303
/// This function only works for algorithms that support raw private keys.
304
304
/// Currently this is: [`Id::HMAC`], [`Id::X25519`], [`Id::ED25519`], [`Id::X448`] or [`Id::ED448`].
305
305
#[ corresponds( EVP_PKEY_get_raw_private_key ) ]
306
- #[ cfg( any( ossl111, boringssl) ) ]
306
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
307
307
pub fn raw_private_key ( & self ) -> Result < Vec < u8 > , ErrorStack > {
308
308
unsafe {
309
309
let mut len = 0 ;
@@ -503,7 +503,7 @@ impl PKey<Private> {
503
503
ctx. keygen ( )
504
504
}
505
505
506
- #[ cfg( any( ossl111, boringssl) ) ]
506
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
507
507
fn generate_eddsa ( id : Id ) -> Result < PKey < Private > , ErrorStack > {
508
508
let mut ctx = PkeyCtx :: new_id ( id) ?;
509
509
ctx. keygen_init ( ) ?;
@@ -533,7 +533,7 @@ impl PKey<Private> {
533
533
/// assert_eq!(secret.len(), 32);
534
534
/// # Ok(()) }
535
535
/// ```
536
- #[ cfg( any( ossl111, boringssl) ) ]
536
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
537
537
pub fn generate_x25519 ( ) -> Result < PKey < Private > , ErrorStack > {
538
538
PKey :: generate_eddsa ( Id :: X25519 )
539
539
}
@@ -587,7 +587,7 @@ impl PKey<Private> {
587
587
/// assert_eq!(signature.len(), 64);
588
588
/// # Ok(()) }
589
589
/// ```
590
- #[ cfg( any( ossl111, boringssl) ) ]
590
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
591
591
pub fn generate_ed25519 ( ) -> Result < PKey < Private > , ErrorStack > {
592
592
PKey :: generate_eddsa ( Id :: ED25519 )
593
593
}
@@ -737,7 +737,7 @@ impl PKey<Private> {
737
737
///
738
738
/// Algorithm types that support raw private keys are HMAC, X25519, ED25519, X448 or ED448
739
739
#[ corresponds( EVP_PKEY_new_raw_private_key ) ]
740
- #[ cfg( any( ossl111, boringssl) ) ]
740
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
741
741
pub fn private_key_from_raw_bytes (
742
742
bytes : & [ u8 ] ,
743
743
key_type : Id ,
@@ -778,7 +778,7 @@ impl PKey<Public> {
778
778
///
779
779
/// Algorithm types that support raw public keys are X25519, ED25519, X448 or ED448
780
780
#[ corresponds( EVP_PKEY_new_raw_public_key ) ]
781
- #[ cfg( any( ossl111, boringssl) ) ]
781
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
782
782
pub fn public_key_from_raw_bytes (
783
783
bytes : & [ u8 ] ,
784
784
key_type : Id ,
@@ -1084,7 +1084,7 @@ mod tests {
1084
1084
assert_eq ! ( & g, dh_. generator( ) ) ;
1085
1085
}
1086
1086
1087
- #[ cfg( any( ossl111, boringssl) ) ]
1087
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
1088
1088
fn test_raw_public_key ( gen : fn ( ) -> Result < PKey < Private > , ErrorStack > , key_type : Id ) {
1089
1089
// Generate a new key
1090
1090
let key = gen ( ) . unwrap ( ) ;
@@ -1100,7 +1100,7 @@ mod tests {
1100
1100
) ;
1101
1101
}
1102
1102
1103
- #[ cfg( any( ossl111, boringssl) ) ]
1103
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
1104
1104
fn test_raw_private_key ( gen : fn ( ) -> Result < PKey < Private > , ErrorStack > , key_type : Id ) {
1105
1105
// Generate a new key
1106
1106
let key = gen ( ) . unwrap ( ) ;
@@ -1116,25 +1116,25 @@ mod tests {
1116
1116
) ;
1117
1117
}
1118
1118
1119
- #[ cfg( any( ossl111, boringssl) ) ]
1119
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
1120
1120
#[ test]
1121
1121
fn test_raw_public_key_bytes ( ) {
1122
1122
test_raw_public_key ( PKey :: generate_x25519, Id :: X25519 ) ;
1123
1123
test_raw_public_key ( PKey :: generate_ed25519, Id :: ED25519 ) ;
1124
- #[ cfg( not( boringssl) ) ]
1124
+ #[ cfg( all ( not( boringssl) , not ( libressl370 ) ) ) ]
1125
1125
test_raw_public_key ( PKey :: generate_x448, Id :: X448 ) ;
1126
- #[ cfg( not( boringssl) ) ]
1126
+ #[ cfg( all ( not( boringssl) , not ( libressl370 ) ) ) ]
1127
1127
test_raw_public_key ( PKey :: generate_ed448, Id :: ED448 ) ;
1128
1128
}
1129
1129
1130
- #[ cfg( any( ossl111, boringssl) ) ]
1130
+ #[ cfg( any( ossl111, boringssl, libressl370 ) ) ]
1131
1131
#[ test]
1132
1132
fn test_raw_private_key_bytes ( ) {
1133
1133
test_raw_private_key ( PKey :: generate_x25519, Id :: X25519 ) ;
1134
1134
test_raw_private_key ( PKey :: generate_ed25519, Id :: ED25519 ) ;
1135
- #[ cfg( not( boringssl) ) ]
1135
+ #[ cfg( all ( not( boringssl) , not ( libressl370 ) ) ) ]
1136
1136
test_raw_private_key ( PKey :: generate_x448, Id :: X448 ) ;
1137
- #[ cfg( not( boringssl) ) ]
1137
+ #[ cfg( all ( not( boringssl) , not ( libressl370 ) ) ) ]
1138
1138
test_raw_private_key ( PKey :: generate_ed448, Id :: ED448 ) ;
1139
1139
}
1140
1140
0 commit comments