Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spdm_crypt_lib: Expose the base_hash_algo #2633

Closed
wants to merge 2 commits into from

Conversation

alistair23
Copy link
Contributor

The base_hash_algo is useful to know if you are using libspdm as a
library.

Reading it from the libspdm_context_t struct isn't ideal as the struct
is private and also doesn't work if using Rust for the implementation.

This commit exposes the base_hash_algo publicly using a helper
function.

This PR also fixes the documentation in include/library/spdm_crypt_lib.h.

The base_hash_algo is useful to know if you are using libspdm as a
library.

Reading it from the libspdm_context_t struct isn't ideal as the struct
is private and also doesn't work if using Rust for the implementation.

This commit exposes the base_hash_algo publicly using a helper
function.

Signed-off-by: Alistair Francis <[email protected]>
@steven-bellock
Copy link
Contributor

also doesn't work if using Rust for the implementation.

Are you saying that it's difficult / impossible for Rust to get the BaseHashAlgo via libspdm_get_data?

@alistair23
Copy link
Contributor Author

Honestly, I forgot about libspdm_get_data()...

That does work. libspdm_get_data() is a little clunky as you end up with something like this

    let mut spdm_algo_base_hash = SpdmAlgoBaseHash(0);
    let hash_dptr = &mut spdm_algo_base_hash.0 as *mut _ as *mut c_void;

    let ret = libspdm_rs::libspdm_get_data(
        cntx_ptr,
        libspdm_rs::libspdm_data_type_t_LIBSPDM_DATA_BASE_HASH_ALGO,
        &parameter as *const libspdm_rs::libspdm_data_parameter_t,
        hash_dptr,
        &mut data_size,
    );

    if LibspdmReturnStatus::libspdm_status_is_error(ret) {
        return Err(ret);
    }

but it works. I can close this if that's the preferred approach

@jyao1
Copy link
Member

jyao1 commented Apr 1, 2024

if you want to expose, then we need to expose all algorithms, including hash, asym, req_asym, dhe, aead, etc.

@alistair23
Copy link
Contributor Author

No worries. I'm going to close this then

@alistair23 alistair23 closed this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants