Skip to content

Commit d95190b

Browse files
keymgmt: Implement ecdsa OSSL_FUNC_KEYMGMT_ECDSA_IMPORT_TYPES
Signed-off-by: Tomás González <[email protected]>
1 parent 61295d7 commit d95190b

File tree

1 file changed

+26
-1
lines changed
  • parsec-openssl-provider/src/keymgmt

1 file changed

+26
-1
lines changed

parsec-openssl-provider/src/keymgmt/mod.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,29 @@ pub unsafe extern "C" fn parsec_provider_kmgmt_import_types(
355355
}
356356
}
357357

358+
/*
359+
should return an array of descriptor OSSL_PARAM for data indicated by selection, for parameters that
360+
OSSL_FUNC_keymgmt_import() can handle
361+
*/
362+
pub unsafe extern "C" fn parsec_provider_ecdsa_kmgmt_import_types(
363+
selection: std::os::raw::c_int,
364+
) -> *const OSSL_PARAM {
365+
if selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY as std::os::raw::c_int != 0 {
366+
static ONCE_INIT: std::sync::Once = std::sync::Once::new();
367+
static mut IMPORT_TYPES_TABLE: [OSSL_PARAM; 1] = [ossl_param!(); 1];
368+
369+
ONCE_INIT.call_once(|| {
370+
IMPORT_TYPES_TABLE = [
371+
ossl_param!(),
372+
];
373+
});
374+
375+
IMPORT_TYPES_TABLE.as_ptr()
376+
} else {
377+
std::ptr::null_mut()
378+
}
379+
}
380+
358381
/*
359382
should check if the data subset indicated by selection in keydata1 and keydata2 match.
360383
It is assumed that the caller has ensured that keydata1 and keydata2 are both owned by the implementation of this function.
@@ -460,6 +483,8 @@ const OSSL_FUNC_KEYMGMT_HAS_PTR: KeyMgmtHasPtr = parsec_provider_kmgmt_has;
460483
const OSSL_FUNC_KEYMGMT_IMPORT_PTR: KeyMgmtImportPtr = parsec_provider_kmgmt_import;
461484
const OSSL_FUNC_KEYMGMT_IMPORT_TYPES_PTR: KeyMgmtImportTypesPtr =
462485
parsec_provider_kmgmt_import_types;
486+
const OSSL_FUNC_KEYMGMT_ECDSA_IMPORT_TYPES_PTR: KeyMgmtImportTypesPtr =
487+
parsec_provider_ecdsa_kmgmt_import_types;
463488
const OSSL_FUNC_KEYMGMT_SET_PARAMS_PTR: KeyMgmtSetParamsPtr = parsec_provider_kmgmt_set_params;
464489
const OSSL_FUNC_KEYMGMT_GET_PARAMS_PTR: KeyMgmtGetParamsPtr = parsec_provider_kmgmt_get_params;
465490
const OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS_PTR: KeyMgmtSettableParamsPtr =
@@ -524,7 +549,7 @@ const PARSEC_PROVIDER_KEYMGMT_ECDSA_IMPL: [OSSL_DISPATCH; 13] = [
524549
unsafe {
525550
ossl_dispatch!(
526551
OSSL_FUNC_KEYMGMT_IMPORT_TYPES,
527-
OSSL_FUNC_KEYMGMT_IMPORT_TYPES_PTR
552+
OSSL_FUNC_KEYMGMT_ECDSA_IMPORT_TYPES_PTR
528553
)
529554
},
530555
unsafe {

0 commit comments

Comments
 (0)