@@ -23,13 +23,18 @@ pub struct EvpPkeyCtx {
2323/// Methods for creating and accessing `EvpPkeyCtx`.
2424impl EvpPkeyCtx {
2525 /// Fetches an algorithm by name and returns a wrapper `EvpPkeyCtx`
26- pub fn new ( ctx : & OsslContext , name : & CStr ) -> Result < EvpPkeyCtx , Error > {
26+ pub fn new (
27+ ctx : & OsslContext ,
28+ name : & CStr ,
29+ propq : Option < & CStr > ,
30+ ) -> Result < EvpPkeyCtx , Error > {
31+ let propqp = if let Some ( p) = propq {
32+ p. as_ptr ( )
33+ } else {
34+ std:: ptr:: null ( )
35+ } ;
2736 let ptr = unsafe {
28- EVP_PKEY_CTX_new_from_name (
29- ctx. ptr ( ) ,
30- name. as_ptr ( ) ,
31- std:: ptr:: null ( ) ,
32- )
37+ EVP_PKEY_CTX_new_from_name ( ctx. ptr ( ) , name. as_ptr ( ) , propqp)
3338 } ;
3439 if ptr. is_null ( ) {
3540 trace_ossl ! ( "EVP_PKEY_CTX_new_from_name()" ) ;
@@ -817,8 +822,9 @@ impl EvpPkey {
817822 pkey_name : & CStr ,
818823 pkey_type : u32 ,
819824 params : & OsslParam ,
825+ propq : Option < & CStr > ,
820826 ) -> Result < EvpPkey , Error > {
821- let mut pctx = EvpPkeyCtx :: new ( ctx, pkey_name) ?;
827+ let mut pctx = EvpPkeyCtx :: new ( ctx, pkey_name, propq ) ?;
822828 let res = unsafe { EVP_PKEY_fromdata_init ( pctx. as_mut_ptr ( ) ) } ;
823829 if res != 1 {
824830 trace_ossl ! ( "EVP_PKEY_fromdata_init()" ) ;
@@ -877,11 +883,12 @@ impl EvpPkey {
877883 pub fn generate (
878884 ctx : & OsslContext ,
879885 pkey_type : EvpPkeyType ,
886+ propq : Option < & CStr > ,
880887 ) -> Result < EvpPkey , Error > {
881888 let mut params_builder = OsslParamBuilder :: new ( ) ;
882889 let name = pkey_type_to_params ( & pkey_type, & mut params_builder) ?;
883890 let params = params_builder. finalize ( ) ;
884- let mut pctx = EvpPkeyCtx :: new ( ctx, name) ?;
891+ let mut pctx = EvpPkeyCtx :: new ( ctx, name, propq ) ?;
885892 let res = unsafe { EVP_PKEY_keygen_init ( pctx. as_mut_ptr ( ) ) } ;
886893 if res != 1 {
887894 trace_ossl ! ( "EVP_PKEY_keygen_init()" ) ;
@@ -927,6 +934,7 @@ impl EvpPkey {
927934 ctx : & OsslContext ,
928935 pkey_type : EvpPkeyType ,
929936 data : PkeyData ,
937+ propq : Option < & CStr > ,
930938 ) -> Result < EvpPkey , Error > {
931939 let mut pkey_class: u32 = 0 ;
932940 let mut params_builder = OsslParamBuilder :: with_capacity ( 2 ) ;
@@ -1076,7 +1084,7 @@ impl EvpPkey {
10761084 }
10771085 let params = params_builder. finalize ( ) ;
10781086
1079- EvpPkey :: fromdata ( ctx, name, pkey_class, & params)
1087+ EvpPkey :: fromdata ( ctx, name, pkey_class, & params, propq )
10801088 }
10811089
10821090 /// Export public point in encoded form and/or private key
@@ -1181,6 +1189,7 @@ impl EvpPkey {
11811189 & self ,
11821190 ctx : & OsslContext ,
11831191 public : & [ u8 ] ,
1192+ propq : Option < & CStr > ,
11841193 ) -> Result < EvpPkey , Error > {
11851194 let mut params_builder = OsslParamBuilder :: with_capacity ( 1 ) ;
11861195 params_builder. add_empty_utf8_string (
@@ -1219,7 +1228,7 @@ impl EvpPkey {
12191228 } ) ,
12201229 _ => return Err ( Error :: new ( ErrorKind :: WrapperError ) ) ,
12211230 } ;
1222- Self :: import ( ctx, pkey_type, data)
1231+ Self :: import ( ctx, pkey_type, data, propq )
12231232 }
12241233
12251234 /// Returns a const pointer to the underlying `EVP_PKEY`.
0 commit comments