@@ -33,17 +33,12 @@ foreign_type_and_impl_send_sync! {
33
33
pub struct OsslParamRef ;
34
34
}
35
35
36
- impl OsslParam { }
37
-
38
36
impl OsslParamRef {
39
37
/// Locates the `OsslParam` in the `OsslParam` array
40
38
#[ corresponds( OSSL_PARAM_locate ) ]
41
- pub fn locate ( & self , key : & [ u8 ] ) -> Result < & OsslParamRef , ErrorStack > {
39
+ pub fn locate ( & self , key : & CStr ) -> Result < & OsslParamRef , ErrorStack > {
42
40
unsafe {
43
- let param = cvt_p ( ffi:: OSSL_PARAM_locate (
44
- self . as_ptr ( ) ,
45
- key. as_ptr ( ) as * const c_char ,
46
- ) ) ?;
41
+ let param = cvt_p ( ffi:: OSSL_PARAM_locate ( self . as_ptr ( ) , key. as_ptr ( ) ) ) ?;
47
42
Ok ( OsslParamRef :: from_ptr ( param) )
48
43
}
49
44
}
@@ -109,7 +104,7 @@ impl OsslParamBuilder {
109
104
110
105
/// Constructs the `OsslParam`.
111
106
#[ corresponds( OSSL_PARAM_BLD_to_param ) ]
112
- pub fn to_param ( & self ) -> Result < OsslParam , ErrorStack > {
107
+ pub fn to_param ( & mut self ) -> Result < OsslParam , ErrorStack > {
113
108
unsafe {
114
109
let params = cvt_p ( ffi:: OSSL_PARAM_BLD_to_param ( self . 0 ) ) ?;
115
110
Ok ( OsslParam :: from_ptr ( params) )
@@ -122,11 +117,11 @@ impl OsslParamBuilderRef {
122
117
///
123
118
/// Note, that both key and bn need to exist until the `to_param` is called!
124
119
#[ corresponds( OSSL_PARAM_BLD_push_BN ) ]
125
- pub fn add_bn ( & self , key : & [ u8 ] , bn : & BigNumRef ) -> Result < ( ) , ErrorStack > {
120
+ pub fn add_bn ( & mut self , key : & CStr , bn : & BigNumRef ) -> Result < ( ) , ErrorStack > {
126
121
unsafe {
127
122
cvt ( ffi:: OSSL_PARAM_BLD_push_BN (
128
123
self . as_ptr ( ) ,
129
- key. as_ptr ( ) as * const c_char ,
124
+ key. as_ptr ( ) ,
130
125
bn. as_ptr ( ) ,
131
126
) )
132
127
. map ( |_| ( ) )
@@ -137,11 +132,11 @@ impl OsslParamBuilderRef {
137
132
///
138
133
/// Note, that both `key` and `buf` need to exist until the `to_param` is called!
139
134
#[ corresponds( OSSL_PARAM_BLD_push_utf8_string ) ]
140
- pub fn add_utf8_string ( & self , key : & [ u8 ] , buf : & str ) -> Result < ( ) , ErrorStack > {
135
+ pub fn add_utf8_string ( & mut self , key : & CStr , buf : & str ) -> Result < ( ) , ErrorStack > {
141
136
unsafe {
142
137
cvt ( ffi:: OSSL_PARAM_BLD_push_utf8_string (
143
138
self . as_ptr ( ) ,
144
- key. as_ptr ( ) as * const c_char ,
139
+ key. as_ptr ( ) ,
145
140
buf. as_ptr ( ) as * const c_char ,
146
141
buf. len ( ) ,
147
142
) )
@@ -153,11 +148,11 @@ impl OsslParamBuilderRef {
153
148
///
154
149
/// Note, that both `key` and `buf` need to exist until the `to_param` is called!
155
150
#[ corresponds( OSSL_PARAM_BLD_push_octet_string ) ]
156
- pub fn add_octet_string ( & self , key : & [ u8 ] , buf : & [ u8 ] ) -> Result < ( ) , ErrorStack > {
151
+ pub fn add_octet_string ( & mut self , key : & CStr , buf : & [ u8 ] ) -> Result < ( ) , ErrorStack > {
157
152
unsafe {
158
153
cvt ( ffi:: OSSL_PARAM_BLD_push_octet_string (
159
154
self . as_ptr ( ) ,
160
- key. as_ptr ( ) as * const c_char ,
155
+ key. as_ptr ( ) ,
161
156
buf. as_ptr ( ) as * const c_void ,
162
157
buf. len ( ) ,
163
158
) )
@@ -169,11 +164,11 @@ impl OsslParamBuilderRef {
169
164
///
170
165
/// Note, that both `key` and `buf` need to exist until the `to_param` is called!
171
166
#[ corresponds( OSSL_PARAM_BLD_push_uint ) ]
172
- pub fn add_uint ( & self , key : & [ u8 ] , val : u32 ) -> Result < ( ) , ErrorStack > {
167
+ pub fn add_uint ( & mut self , key : & CStr , val : u32 ) -> Result < ( ) , ErrorStack > {
173
168
unsafe {
174
169
cvt ( ffi:: OSSL_PARAM_BLD_push_uint (
175
170
self . as_ptr ( ) ,
176
- key. as_ptr ( ) as * const c_char ,
171
+ key. as_ptr ( ) ,
177
172
val as c_uint ,
178
173
) )
179
174
. map ( |_| ( ) )
0 commit comments