//
// Copyright 2024 The Project Oak Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// An attachment is a shim between the actual binary and the endorsement.
// The endorsement mentions the digest of the attachment, and the
// attachment in turn contains hashes related to the actual binary.

syntax = "proto3";

package oak.attestation.v1;

import "proto/digest.proto";

option go_package = "proto/oak/attestation/v1";
option java_multiple_files = true;
option java_package = "com.google.oak.attestation.v1";

// The Transparent Release attachment for Oak Stage 0. Measurements
// are produced with:
// https://github.com/project-oak/oak/tree/main/snp_measurement
message FirmwareAttachment {
  // Digest of the unmodified firmware-type binary. This field can remain
  // empty for attestation verification. It is only needed if identifying
  // the binary given the attachement is a requirement.
  HexDigest binary = 2;

  // Maps number of vCPUs to measurement of the modified firmware binary.
  map<int32, HexDigest> configs = 1;
}

// The Transparent Release attachment for bzImage-like kernels.
// Measurements are produced with:
// https://github.com/project-oak/oak/tree/main/oak_kernel_measurement
message KernelAttachment {
  // Digest of the unmodified bzImage. This field can remain empty for
  // attestation verification. It is only needed if identifying the
  // bzImage given the attachement is a requirement.
  HexDigest bz_image = 3;

  // Digest of the kernel image part of the bzImage.
  HexDigest image = 1;

  // Digest of the setup data part of the bzImage.
  HexDigest setup_data = 2;
}

// The Transparent Release attachment for MPMs.
message MpmAttachment {
  // The name of the MPM.
  string package_name = 1;

  // The version of the MPM.
  string package_version = 2;
}
