Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9f71461
add remote attestation test inside UEFI app
Apr 11, 2022
fb4f905
Stub missing symbols
Apr 11, 2022
c4b2bea
improve comment spelling somewhat
Apr 11, 2022
63c22a9
Use ___chkstk_ms from go
Apr 11, 2022
8c49af0
simplify test to aid debugging: just test ring source of randomness
Apr 11, 2022
d73e848
log random data in test
Apr 12, 2022
d8111c8
patch rdrand availability check for debuggingnd enable KVM
Apr 13, 2022
b20fe50
Merge branch 'main' into uefi-test-remote-attestation
Apr 14, 2022
837660c
Add test to check that the byte array has in fact been filled
Apr 14, 2022
3227a63
add remote attestation handshake test
Apr 14, 2022
d2009a3
Update config to match #2725
Apr 14, 2022
d8de7d6
Remoe test of ring, as remote attestation is now tested
Apr 14, 2022
7a94c05
remove debugging logs from remote attestation test
Apr 14, 2022
2779e2a
wip
Apr 14, 2022
e69748c
Merge branch 'main' into uefi-test-remote-attestation
Apr 14, 2022
17960fd
Revert "wip"
Apr 14, 2022
b458198
Move the UEFI remote attestation test into it's own module
Apr 14, 2022
9d43182
remove now unneeded crate imports in the main UEFI app
Apr 14, 2022
2e0bc9a
finalize moving remote attestation test
Apr 14, 2022
7f0889b
redundant surplus qemu cpu flags
Apr 14, 2022
7bb2381
Add anyhow as dev dep for test
Apr 14, 2022
56e0e25
Add extra context to ring stubs
Apr 14, 2022
6f66c52
Only run remote attestation tests if the hosts supports kvm, and the …
Apr 14, 2022
ca2cea7
improve comment for clarity
Apr 14, 2022
0c424d5
improve comment copy
Apr 14, 2022
8f1e760
Merge branch 'main' into uefi-test-remote-attestation
Apr 14, 2022
8d258a5
disable ring default features to fix duplicate lang items
Apr 14, 2022
26082d0
bust CI cache
Apr 14, 2022
eebf47c
toggle tests that require kvm by disabling a default flag, as xtask e…
Apr 14, 2022
6c27bf0
Clarify comment
Apr 14, 2022
23a3508
Improve comments for accuracy and clarity
Apr 19, 2022
9e03123
Don't lint target subdirectories created by cargo fuzz
Apr 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 2 additions & 230 deletions experimental/uefi/app/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion experimental/uefi/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ license = "Apache-2.0"
uefi = { version = "*", features = ["exts"] }
uefi-services = "*"
log = { version = "*" }
oak_remote_attestation = { path = "../../../remote_attestation/rust" }
ring = { path = "../../../third_party/ring" }
anyhow = { version = "*", default-features = false }

[dev-dependencies]
uefi-services = { version = "*", features = ["qemu"] }
13 changes: 13 additions & 0 deletions experimental/uefi/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#[macro_use]
extern crate log;
extern crate alloc;
extern crate anyhow;

use uefi::{
prelude::*,
Expand All @@ -36,6 +38,9 @@ use uefi::{
},
};

#[cfg(test)]
use ring::rand::SecureRandom;

// The main entry point of the UEFI application.
//
// The choice of name (`_start`) is entirely arbitrary; what matters is that
Expand Down Expand Up @@ -130,3 +135,11 @@ fn test_simple() {
let x = 1;
assert_eq!(x, 1);
}

// Simple test source of randomness, for more straightforward debugging
#[test_case]
fn random_test() {
let rng = ring::rand::SystemRandom::new();
let mut buf = alloc::vec::Vec::with_capacity(8);
assert_eq!(rng.fill(&mut buf).is_err(), false);
}
2 changes: 2 additions & 0 deletions third_party/ring/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ include = [
"benches/*.rs",
"build.rs",

"stubs.c",

"crypto/chacha/asm/chacha-armv4.pl",
"crypto/chacha/asm/chacha-armv8.pl",
"crypto/chacha/asm/chacha-x86.pl",
Expand Down
1 change: 1 addition & 0 deletions third_party/ring/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const RING_SRCS: &[(&[&str], &str)] = &[
(&[X86], "crypto/chacha/asm/chacha-x86.pl"),
(&[X86], "crypto/fipsmodule/modes/asm/ghash-x86.pl"),

(&[X86_64], "stubs.c"),
(&[X86_64], "crypto/chacha/asm/chacha-x86_64.pl"),
(&[X86_64], "crypto/fipsmodule/aes/asm/aesni-x86_64.pl"),
(&[X86_64], "crypto/fipsmodule/aes/asm/vpaes-x86_64.pl"),
Expand Down
28 changes: 28 additions & 0 deletions third_party/ring/stubs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <stddef.h>

/**
*
Stub function for win64 error handler API call inserted by nasm.
Stubbed as it is unavailable in UEFI.
Ref: https://github.com/openssl/openssl/issues/12712.
Inspired by: https://github.com/tianocore/edk2/blob/7c0ad2c33810ead45b7919f8f8d0e282dae52e71/CryptoPkg/Library/OpensslLib/X64/ApiHooks.c
**/
void *
__imp_RtlVirtualUnwind (
void *Args
)
{
return NULL;
}

/**
Stub function for win64 routine used for exceedingly large variables.
Inserted Mby inGW, stubbed as it is unavailable in UEFI.
Ref 1: https://metricpanda.com/rival-fortress-update-45-dealing-with-__chkstk-__chkstk_ms-when-cross-compiling-for-windows/
Ref 2: https://github.com/golang/go/issues/6305
Inspired by: https://android.googlesource.com/platform/external/compiler-rt/+/ccaafe6%5E%21/#F1
**/
void ___chkstk_ms(void)
{
}