pub(crate) fn derive_tree_secret(
    secret: &Secret,
    label: &str,
    node: u32,
    generation: u32,
    length: usize,
    backend: &impl OpenMlsCryptoProvider,
) -> Secret {
    log::debug!(
        "Derive tree secret with label \"{}\" for node {} in generation {} of length {}",
        label,
        node,
        generation,
        length
    );
    let tree_context = TreeContext { node, generation };
    log_crypto!(trace, "Input secret {:x?}", secret.as_slice());
    log_crypto!(trace, "Tree context {:?}", tree_context);
    // FIXME: remove unwraps
    let serialized_tree_context = tree_context.tls_serialize_detached().unwrap();
    secret
        .kdf_expand_label(backend, label, &serialized_tree_context, length)
        .unwrap()
}
/// Derives secrets for inner nodes of a SecretTree
Derives secrets for inner nodes of a SecretTree
Derives secrets for inner nodes of a SecretTree
pub(crate) fn derive_tree_secret(
    secret: &Secret,
    label: &str,
    node: u32,
    generation: u32,
    length: usize,
    backend: &impl OpenMlsCryptoProvider,
) -> Secret {
    log::debug!(
        "Derive tree secret with label \"{}\" for node {} in generation {} of length {}",
        label,
        node,
        generation,
        length
    );
    let tree_context = TreeContext { node, generation };
    log_crypto!(trace, "Input secret {:x?}", secret.as_slice());
    log_crypto!(trace, "Tree context {:?}", tree_context);
    // FIXME: remove unwraps
    let serialized_tree_context = tree_context.tls_serialize_detached().unwrap();
    secret
        .kdf_expand_label(backend, label, &serialized_tree_context, length)
        .unwrap()
}
pub ( crate ) fn derive_tree_secret ( secret : & Secret , label : & str , node : u32 , generation : u32 , length : usize , backend : & impl OpenMlsCryptoProvider , ) -> Secret { log :: debug ! ( " \" \" " label node generation length ) ; let tree_context = TreeContext { node , generation } ; log_crypto ! ( trace " " secret as_slice ( ) ) ; log_crypto ! ( trace " " tree_context ) ; // FIXME: remove unwraps let serialized_tree_context = tree_context . tls_serialize_detached ( ) . unwrap ( ) ; secret . kdf_expand_label ( backend , label , & serialized_tree_context , length ) . unwrap ( ) }
Derives secrets for inner nodes of a SecretTree
Derives secrets for inner nodes of a SecretTree
secret
&Secret
label
&str
node
u32
generation
u32
length
usize
backend
&impl OpenMlsCryptoProvider
secret
&Secret
label
&str
node
u32
generation
u32
length
usize
backend
&impl OpenMlsCryptoProvider