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

Use vendored version of ring in remote attestation #2661

Merged
merged 5 commits into from
Apr 8, 2022

Conversation

jul-sh
Copy link
Contributor

@jul-sh jul-sh commented Apr 4, 2022

Uses the vendored version of ring (added in #2681) in our remote attestation crate. This necessitated the following changes:

  • Patch the build script of ring to allow it to build in our repo, see commit message / comment for details.
  • Update our code to accommodate breaking API changes, since the vendored version is newer.

@jul-sh jul-sh force-pushed the uefi-ring branch 7 times, most recently from ba87283 to 1e530b7 Compare April 5, 2022 16:03
@jul-sh jul-sh changed the title Use vendored version of ring from the head of the ring repository Use vendored version of ring in remote attestation Apr 5, 2022
@jul-sh jul-sh added the blocked This pull request is blocked by another pull request or issue label Apr 5, 2022
@jul-sh jul-sh force-pushed the uefi-ring branch 4 times, most recently from ac9b353 to 44f0791 Compare April 6, 2022 16:13
@@ -43,7 +43,6 @@ copyleft = "deny"

[[licenses.clarify]]
name = "ring"
version = "*"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason this needed removing is somewhat counterintuitive:

In cargo, version = "*" does not in fact mean "any version", but instead "any version that is published on crates.io". We need to remove this (optional) key to truly check any version (in our case our vendored version).

Turns out that ring includes pre-generated objects in cargo releases. It uses logic in its build scripts to determine whether the build is from a version published on cargo, or from source code. This logic is somewhat naively implemented by checking for the absence of a `.git` directory. This check falesly leads ring to believe it is building from a version published on crates.io, and fails when it tries to include the pregenerated files not present in the source code. To build from source code we must patch this flag.
@jul-sh jul-sh removed the blocked This pull request is blocked by another pull request or issue label Apr 6, 2022
Requires updating our code to accomodate API changes since the vendored version is newer
Comment on lines +237 to +240
agreement::agree_ephemeral(
self.private_key,
&agreement::UnparsedPublicKey::new(KEY_AGREEMENT_ALGORITHM, peer_public_key),
anyhow!("Couldn't derive session keys"),
|key_material| {
|key_material| -> anyhow::Result<(EncryptionKey, DecryptionKey)> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The updated ring version no longer takes an error as a parameter, but instead returns an additional result

@jul-sh jul-sh marked this pull request as ready for review April 8, 2022 12:40
@jul-sh jul-sh requested a review from a team as a code owner April 8, 2022 12:40
@jul-sh jul-sh requested review from mariaschett, conradgrobler and andrisaar and removed request for a team April 8, 2022 12:40
@jul-sh jul-sh added the approval/any The author expects only one of the reviewers to approve label Apr 8, 2022
Copy link
Collaborator

@conradgrobler conradgrobler left a comment

Choose a reason for hiding this comment

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

Nice, thanks.

@jul-sh jul-sh merged commit 76f1313 into project-oak:main Apr 8, 2022
@jul-sh jul-sh deleted the uefi-ring branch April 8, 2022 13:45
@github-actions
Copy link

github-actions bot commented Apr 8, 2022

Reproducibility Index:

8a7d039cbdea7691dee83744f996b941eb3f174a9eb9376c5b8e06c49fb38f21  ./target/x86_64-unknown-linux-musl/release/oak_functions_loader_base
9142c165d3c22874be1293d4f1c7f15341d18cc363f79f77931b95668d5c98db  ./target/x86_64-unknown-linux-musl/release/oak_functions_loader_unsafe

Reproducibility Index diff:

diff --git a/reproducibility_index b/reproducibility_index
index 3b985fb..728a5d2 100644
--- a/reproducibility_index
+++ b/reproducibility_index
@@ -1,2 +1,2 @@
-a857b407160f424bfc3a9d92b63861f3dc3fe7e49ee160f8febc18434619d0a9  ./target/x86_64-unknown-linux-musl/release/oak_functions_loader_base
-f2a3fd1fcfd96aae2d64c97116f7613a4670589cf11b9416595d18d5b0c59924  ./target/x86_64-unknown-linux-musl/release/oak_functions_loader_unsafe
+8a7d039cbdea7691dee83744f996b941eb3f174a9eb9376c5b8e06c49fb38f21  ./target/x86_64-unknown-linux-musl/release/oak_functions_loader_base
+9142c165d3c22874be1293d4f1c7f15341d18cc363f79f77931b95668d5c98db  ./target/x86_64-unknown-linux-musl/release/oak_functions_loader_unsafe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval/any The author expects only one of the reviewers to approve remote-attestation restricted kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants