Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Add sealing key support #9

Merged
merged 3 commits into from
Sep 11, 2024
Merged

Add sealing key support #9

merged 3 commits into from
Sep 11, 2024

Conversation

L0czek
Copy link
Collaborator

@L0czek L0czek commented Sep 5, 2024

This add support for reading key material used in sealing keys derivation.

Signed-off-by: Michał Szaknis <m.szaknis@samsung.com>
Signed-off-by: Michał Szaknis <m.szaknis@samsung.com>
@L0czek L0czek marked this pull request as ready for review September 6, 2024 10:22
@L0czek L0czek requested a review from Havner September 6, 2024 10:23
@L0czek
Copy link
Collaborator Author

L0czek commented Sep 6, 2024

The modified rsi kernel modules canbe found at https://github.com/islet-project/realm-manager/tree/dev/m.szaknis/key_sealing/realm/linux-rsi

pub(super) realm_sealing_key: [u8; 32]
}

impl RsiSealingKey {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!!


nix::ioctl_read!(abi_version, b'x', 190u8, u64);
nix::ioctl_readwrite_buf!(measurement_read, b'x', 192u8, RsiMeasurement);
nix::ioctl_write_buf!(measurement_extend, b'x', 193u8, RsiMeasurement);
nix::ioctl_readwrite_buf!(attestation_token, b'x', 194u8, RsiAttestation);
nix::ioctl_readwrite_buf!(sealing_key, b'x', 195u8, RsiSealingKey);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those numbers were take from somewhere, SMCC? They were not random, hence 191 is unused here. Maybe don't use 195, but something higher? Might be wise to find where did I take it from ;-)

@@ -154,3 +154,34 @@ pub(crate) fn verify_platform(args: &VerifyPlatformArgs) -> GenericResult
tools::verify_print_platform(&token, &key)?;
Ok(())
}

#[derive(ValueEnum, Debug, Copy, Clone)]
pub(crate) enum SealingKeyFlags {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!!

@@ -49,3 +52,26 @@ pub(crate) fn verify_print_platform(token: &[u8], key: &[u8]) -> Result<(), rust
rust_rsi::print_token_platform(&token);
Ok(())
}

impl From<&SealingKeyFlags> for u64 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!!

Signed-off-by: Michał Szaknis <m.szaknis@samsung.com>
@Havner Havner merged commit 2756507 into main Sep 11, 2024
1 check passed
@Havner Havner deleted the dev/m.szaknis/key_sealing branch September 11, 2024 15:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants