@@ -195,6 +195,40 @@ pub unsafe extern "C" fn parsec_provider_kmgmt_set_params(
195
195
}
196
196
}
197
197
198
+ /*
199
+ should return 1 if all the selected data subsets are contained in the given keydata or 0 otherwise.
200
+ For algorithms where some selection is not meaningful the function should just return 1 as the
201
+ selected subset is not really missing in the key.
202
+ */
203
+ pub unsafe extern "C" fn parsec_provider_ecdsa_kmgmt_has (
204
+ keydata : VOID_PTR ,
205
+ selection : std:: os:: raw:: c_int ,
206
+ ) -> std:: os:: raw:: c_int {
207
+ let result = super :: r#catch ( Some ( || super :: Error :: PROVIDER_KEYMGMT_HAS ) , || {
208
+ Arc :: increment_strong_count ( keydata as * const RwLock < ParsecProviderKeyObject > ) ;
209
+ let key_data = Arc :: from_raw ( keydata as * const RwLock < ParsecProviderKeyObject > ) ;
210
+
211
+ if selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY as std:: os:: raw:: c_int != 0 {
212
+ if reader_key_data. get_ecdsa_key ( ) . is_none ( ) {
213
+ return Err ( "ECDSA key has not been set." . into ( ) ) ;
214
+ }
215
+ }
216
+
217
+ if selection & OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS as std:: os:: raw:: c_int != 0 {
218
+ let reader_key_data = key_data. read ( ) . unwrap ( ) ;
219
+ if reader_key_data. get_key_name ( ) . is_none ( ) {
220
+ return Err ( "key name has not been set." . into ( ) ) ;
221
+ }
222
+ }
223
+ Ok ( OPENSSL_SUCCESS )
224
+ } ) ;
225
+
226
+ match result {
227
+ Ok ( result) => result,
228
+ Err ( ( ) ) => OPENSSL_ERROR ,
229
+ }
230
+ }
231
+
198
232
/*
199
233
should return 1 if all the selected data subsets are contained in the given keydata or 0 otherwise.
200
234
For algorithms where some selection is not meaningful the function should just return 1 as the
@@ -595,6 +629,7 @@ const OSSL_FUNC_KEYMGMT_DUP_PTR: KeyMgmtDupPtr = parsec_provider_keymgmt_dup;
595
629
const OSSL_FUNC_KEYMGMT_NEW_PTR : KeyMgmtNewPtr = parsec_provider_kmgmt_new;
596
630
const OSSL_FUNC_KEYMGMT_FREE_PTR : KeyMgmtFreePtr = parsec_provider_kmgmt_free;
597
631
const OSSL_FUNC_KEYMGMT_HAS_PTR : KeyMgmtHasPtr = parsec_provider_kmgmt_has;
632
+ const OSSL_FUNC_KEYMGMT_ECDSA_HAS_PTR : KeyMgmtHasPtr = parsec_provider_ecdsa_kmgmt_has;
598
633
const OSSL_FUNC_KEYMGMT_IMPORT_PTR : KeyMgmtImportPtr = parsec_provider_kmgmt_import;
599
634
const OSSL_FUNC_KEYMGMT_ECDSA_IMPORT_PTR : KeyMgmtImportPtr = parsec_provider_ecdsa_kmgmt_import;
600
635
const OSSL_FUNC_KEYMGMT_IMPORT_TYPES_PTR : KeyMgmtImportTypesPtr =
@@ -659,7 +694,7 @@ const PARSEC_PROVIDER_KEYMGMT_IMPL: [OSSL_DISPATCH; 13] = [
659
694
const PARSEC_PROVIDER_KEYMGMT_ECDSA_IMPL : [ OSSL_DISPATCH ; 12 ] = [
660
695
unsafe { ossl_dispatch ! ( OSSL_FUNC_KEYMGMT_NEW , OSSL_FUNC_KEYMGMT_NEW_PTR ) } ,
661
696
unsafe { ossl_dispatch ! ( OSSL_FUNC_KEYMGMT_FREE , OSSL_FUNC_KEYMGMT_FREE_PTR ) } ,
662
- unsafe { ossl_dispatch ! ( OSSL_FUNC_KEYMGMT_HAS , OSSL_FUNC_KEYMGMT_HAS_PTR ) } ,
697
+ unsafe { ossl_dispatch ! ( OSSL_FUNC_KEYMGMT_HAS , OSSL_FUNC_KEYMGMT_ECDSA_HAS_PTR ) } ,
663
698
unsafe { ossl_dispatch ! ( OSSL_FUNC_KEYMGMT_IMPORT , OSSL_FUNC_KEYMGMT_ECDSA_IMPORT_PTR ) } ,
664
699
unsafe {
665
700
ossl_dispatch ! (
0 commit comments