fix(tee-key-preexec): don't hash public key

No need to hash the public key for the attestation report data.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2024-02-15 10:28:52 +01:00
parent 761d5463c5
commit dc4434938e
Signed by: harald
GPG key ID: F519A1143B3FBE32
3 changed files with 1 additions and 6 deletions

1
Cargo.lock generated
View file

@ -2401,7 +2401,6 @@ dependencies = [
"hex", "hex",
"k256", "k256",
"rand", "rand",
"sha2",
"teepot", "teepot",
"tracing", "tracing",
"tracing-log", "tracing-log",

View file

@ -13,7 +13,6 @@ anyhow.workspace = true
hex.workspace = true hex.workspace = true
k256.workspace = true k256.workspace = true
rand.workspace = true rand.workspace = true
sha2.workspace = true
teepot.workspace = true teepot.workspace = true
tracing-log.workspace = true tracing-log.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true

View file

@ -9,8 +9,6 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use hex::ToHex; use hex::ToHex;
use k256::ecdsa::SigningKey; use k256::ecdsa::SigningKey;
use sha2::Digest;
use sha2::Sha256;
use std::env; use std::env;
use std::os::unix::process::CommandExt; use std::os::unix::process::CommandExt;
use std::process::Command; use std::process::Command;
@ -41,9 +39,8 @@ fn main_with_error() -> Result<()> {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let signing_key = SigningKey::random(&mut rng); let signing_key = SigningKey::random(&mut rng);
let verifying_key_bytes = signing_key.verifying_key().to_sec1_bytes(); let verifying_key_bytes = signing_key.verifying_key().to_sec1_bytes();
let hash_verifying_key = Sha256::digest(verifying_key_bytes);
let signing_key_string = signing_key.to_bytes().encode_hex::<String>(); let signing_key_string = signing_key.to_bytes().encode_hex::<String>();
let tee_type = match get_quote(&hash_verifying_key) { let tee_type = match get_quote(&verifying_key_bytes) {
Ok(quote) => { Ok(quote) => {
// save quote to file // save quote to file
std::fs::write(TEE_QUOTE_FILE, quote)?; std::fs::write(TEE_QUOTE_FILE, quote)?;