[attestation] Add the first version of DeviceInfo
For CSRs originating from AVF, device info is currently not
important. To facilitate the parsing of AVF CSRs by the RKP
server, avf fields have been introduced into various entries.
Bug: 301592917
Test: atest rialto_test
Change-Id: I306683e8a2fdcc637e3798755bfa0aa4889bd7e3
diff --git a/rialto/Android.bp b/rialto/Android.bp
index c102c89..d7aac35 100644
--- a/rialto/Android.bp
+++ b/rialto/Android.bp
@@ -133,11 +133,11 @@
"libandroid_logger",
"libanyhow",
"libbssl_avf_nostd",
- "libciborium",
"libclient_vm_csr",
"libcoset",
"liblibc",
"liblog_rust",
+ "libhwtrust",
"libservice_vm_comm",
"libservice_vm_fake_chain",
"libservice_vm_manager",
diff --git a/rialto/tests/test.rs b/rialto/tests/test.rs
index c918db5..9eb6a79 100644
--- a/rialto/tests/test.rs
+++ b/rialto/tests/test.rs
@@ -23,9 +23,9 @@
};
use anyhow::{bail, Context, Result};
use bssl_avf::{sha256, EcKey, PKey};
-use ciborium::value::Value;
use client_vm_csr::generate_attestation_key_and_csr;
use coset::{CborSerializable, CoseMac0, CoseSign};
+use hwtrust::{rkp, session::Session};
use log::info;
use service_vm_comm::{
ClientVmAttestationParams, Csr, CsrPayload, EcdsaP256KeyPair, GenerateCertificateRequestParams,
@@ -37,7 +37,6 @@
use service_vm_manager::ServiceVm;
use std::fs;
use std::fs::File;
-use std::io;
use std::panic;
use std::path::PathBuf;
use std::str::FromStr;
@@ -272,16 +271,8 @@
Ok(())
}
-/// TODO(b/300625792): Check the CSR with libhwtrust once the CSR is complete.
fn check_csr(csr: Vec<u8>) -> Result<()> {
- let mut reader = io::Cursor::new(csr);
- let csr: Value = ciborium::from_reader(&mut reader)?;
- match csr {
- Value::Array(arr) => {
- assert_eq!(4, arr.len());
- }
- _ => bail!("Incorrect CSR format: {csr:?}"),
- }
+ let _csr = rkp::Csr::from_cbor(&Session::default(), &csr[..]).context("Failed to parse CSR")?;
Ok(())
}