rust/pv: Rename additional-data size constant

Rename 'ATT_ADD_HASH_SIZE' to 'PHKH_SIZE'. The new name describes the
value better. It is the size of the Public Host-Key Hash and not the
size of a generic additional-data item.
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Steffen Eiden
2024-11-18 14:50:03 +01:00
parent 667a8d714b
commit 413adbe7bb
2 changed files with 5 additions and 5 deletions

View File

@@ -10,9 +10,9 @@ use std::fmt::Display;
use zerocopy::FromBytes;
/// Hash for additional-data stuff used for parsing [`AdditionalData`]
pub(crate) type AttAddHash = [u8; ATT_ADD_HASH_SIZE as usize];
pub(crate) const ATT_ADD_HASH_SIZE: u32 = 0x20;
static_assert!(Keyslot::PHKH_SIZE == ATT_ADD_HASH_SIZE);
pub(crate) type AttAddHash = [u8; PHKH_SIZE as usize];
pub(super) const PHKH_SIZE: u32 = 0x20;
static_assert!(Keyslot::PHKH_SIZE == PHKH_SIZE);
/// Struct describing the additional-data of an Attestation Request
#[derive(Serialize, Debug)]

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
//
// Copyright IBM Corp. 2024
use super::{additional::ATT_ADD_HASH_SIZE, AttNonce};
use super::{additional::PHKH_SIZE, AttNonce};
use crate::{
assert_size,
attest::{AttestationMagic, AttestationMeasAlg},
@@ -310,7 +310,7 @@ static_assert!(AttestationFlags::FLAG_TO_ADD_SIZE.len() < 64);
impl AttestationFlags {
/// Maps the flag to the (maximum) required size for the additional data
pub(crate) const FLAG_TO_ADD_SIZE: [u32; 4] = [0, 0, ATT_ADD_HASH_SIZE, ATT_ADD_HASH_SIZE];
pub(crate) const FLAG_TO_ADD_SIZE: [u32; 4] = [0, 0, PHKH_SIZE, PHKH_SIZE];
/// Returns the maximum size this flag requires for additional data
pub fn expected_additional_size(&self) -> u32 {