Skip to content

Commit

Permalink
Remove export_files target under oak_attestation_verification/testdata.
Browse files Browse the repository at this point in the history
ACKNOWLEDGE_FAILING_COPYBARA_IMPORT=Will import manually/fix separately.

Bug: 365744326
Change-Id: Ifba60d53e21b074d08c7b8c955935aeaf1ef7bbb
  • Loading branch information
thmsbinder committed Sep 12, 2024
1 parent 28a96f3 commit ef579fe
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 50 deletions.
5 changes: 1 addition & 4 deletions cc/utils/cose/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,11 @@ cc_test(
name = "cwt_test",
size = "small",
srcs = ["cwt_test.cc"],
data = [
"//oak_attestation_verification/testdata:oc_evidence.textproto",
],
data = ["//oak_attestation_verification/testdata:evidence"],
deps = [
":cwt",
"//proto/attestation:evidence_cc_proto",
"@com_google_absl//absl/strings",
"@com_google_googletest//:gtest_main",
"@com_google_protobuf//:protobuf",
],
)
21 changes: 7 additions & 14 deletions cc/utils/cose/cwt_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

#include "absl/strings/string_view.h"
#include "gmock/gmock.h"
#include "google/protobuf/io/zero_copy_stream_impl.h"
#include "google/protobuf/text_format.h"
#include "gtest/gtest.h"
#include "proto/attestation/evidence.pb.h"

Expand All @@ -36,7 +34,8 @@ using ::oak::attestation::v1::Evidence;
using ::testing::ElementsAreArray;

constexpr absl::string_view kTestEvidencePath =
"oak_attestation_verification/testdata/oc_evidence.textproto";
"oak_attestation_verification/testdata/oc_evidence.binarypb";

// Public key extracted from the `kTestEvidencePath`
// `encryption_public_key_certificate`.
constexpr uint8_t kTestPublicKey[] = {169, 153, 134, 149, 237, 126, 255, 33,
Expand All @@ -47,18 +46,12 @@ constexpr uint8_t kTestPublicKey[] = {169, 153, 134, 149, 237, 126, 255, 33,
class CertificateTest : public testing::Test {
protected:
void SetUp() override {
std::ifstream test_evidence_file(kTestEvidencePath.data());
ASSERT_TRUE(test_evidence_file);
google::protobuf::io::IstreamInputStream test_evidence_protobuf_stream(
&test_evidence_file);

auto test_evidence = std::make_unique<Evidence>();
bool parse_success = google::protobuf::TextFormat::Parse(
&test_evidence_protobuf_stream, test_evidence.get());
ASSERT_TRUE(parse_success);

std::ifstream stream(kTestEvidencePath.data());
ASSERT_TRUE(stream);
auto evidence = std::make_unique<Evidence>();
ASSERT_TRUE(evidence->ParseFromIstream(&stream));
public_key_certificate_ =
test_evidence->application_keys().encryption_public_key_certificate();
evidence->application_keys().encryption_public_key_certificate();
}

std::string public_key_certificate_;
Expand Down
56 changes: 24 additions & 32 deletions oak_attestation_verification/testdata/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,39 @@ filegroup(
)

filegroup(
name = "evidence",
name = "cb_evidence",
srcs = [
"cb_endorsement.binarypb",
"cb_evidence.binarypb",
"cb_reference_values.binarypb",
],
visibility = ["//visibility:private"],
)

filegroup(
name = "fake_evidence",
srcs = [
"fake_evidence.binarypb",
"fake_expected_values.binarypb",
],
)

filegroup(
name = "evidence",
srcs = [
":cb_evidence",
":fake_evidence",
"genoa_oc_evidence.binarypb",
"genoa_oc_reference_values.binarypb",
"oc_evidence.binarypb",
# The VCEK cert needs to match the hardware ID of the attestation report in the
# test evidence proto. The additional parameters in the URL encode the reported
# TCB version in the attestation report.
#
# URL for downloading the VCEK cert:
# https://kdsintf.amd.com/vcek/v1/Milan/cd3c4e6b5b64026ac135d76f888ea6bcc1351ec610d64b0af4028422b84c17ad2571905acfe2eb2181c119df4241e94a926d1b06c02e82845416202151212fdd?ucodeSPL=168&snpSPL=8&teeSPL=0&blSPL=3
# ARPT reported TCB version: ucodeSPL=168&snpSPL=8&teeSPL=0&blSPL=3
# ARPT current TCB version: ucodeSPL=209&snpSPL=14&teeSPL=0&blSPL=3
"oc_vcek_milan.der",
"oc_vcek_milan.pem",
"rk_evidence.binarypb",
Expand All @@ -52,34 +75,3 @@ filegroup(
"vcek_genoa.der",
],
)

# DEPRECATED: Don't access files directly and from everywhere.
# We should restrict access to all testdata to oak_attestation_verification.
exports_files([
"cb_evidence.binarypb",
"cb_endorsement.binarypb",
"cb_reference_values.binarypb",
"fake_evidence.binarypb",
"fake_expected_values.binarypb",
"genoa_oc_evidence.binarypb",
"genoa_oc_reference_values.binarypb",
"oc_evidence.binarypb",
# TBD: Remove - we should only export binary protos, not the textproto version.
"oc_evidence.textproto",
# The VCEK cert needs to match the hardware ID of the attestation report in the
# test evidence proto. The additional parameters in the URL encode the reported
# TCB version in the attestation report.
#
# URL for downloading the VCEK cert:
# https://kdsintf.amd.com/vcek/v1/Milan/cd3c4e6b5b64026ac135d76f888ea6bcc1351ec610d64b0af4028422b84c17ad2571905acfe2eb2181c119df4241e94a926d1b06c02e82845416202151212fdd?ucodeSPL=168&snpSPL=8&teeSPL=0&blSPL=3
# ARPT reported TCB version: ucodeSPL=168&snpSPL=8&teeSPL=0&blSPL=3
# ARPT current TCB version: ucodeSPL=209&snpSPL=14&teeSPL=0&blSPL=3
"oc_vcek_milan.der",
"oc_vcek_milan.pem",
"rekor_public_key.pem",
"rk_evidence.binarypb",
"rk_evidence_20240312.binarypb",
"rk_vcek_milan.der",
"rk_vcek_milan.pem",
"vcek_genoa.der",
])

0 comments on commit ef579fe

Please sign in to comment.