Skip to content

Commit

Permalink
Added auth_policy method to ther Public structure.
Browse files Browse the repository at this point in the history
- Added auth_policy method to the Public structure
  in order to ber able to retrieve the auth auth_policy
  digest.

- Simplified the hashing_algorithm and object_attributes
  methods.
Signed-off-by: Jesper Brynolf <[email protected]>
  • Loading branch information
Superhepper committed Oct 11, 2021
1 parent c2e2509 commit be5355b
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions tss-esapi/src/structures/buffers/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ impl Public {
match self {
Public::Rsa {
object_attributes, ..
} => *object_attributes,
Public::KeyedHash {
}
| Public::KeyedHash {
object_attributes, ..
} => *object_attributes,
Public::Ecc {
}
| Public::Ecc {
object_attributes, ..
} => *object_attributes,
Public::SymCipher {
}
| Public::SymCipher {
object_attributes, ..
} => *object_attributes,
}
Expand All @@ -346,27 +346,33 @@ impl Public {
pub fn name_hashing_algorithm(&self) -> HashingAlgorithm {
match self {
Public::Rsa {
object_attributes: _,
name_hashing_algorithm,
..
} => *name_hashing_algorithm,
Public::KeyedHash {
object_attributes: _,
}
| Public::KeyedHash {
name_hashing_algorithm,
..
} => *name_hashing_algorithm,
Public::Ecc {
object_attributes: _,
}
| Public::Ecc {
name_hashing_algorithm,
..
} => *name_hashing_algorithm,
Public::SymCipher {
object_attributes: _,
}
| Public::SymCipher {
name_hashing_algorithm,
..
} => *name_hashing_algorithm,
}
}

/// Returns the auth policy digest.
pub fn auth_policy(&self) -> &Digest {
match self {
Public::Rsa { auth_policy, .. }
| Public::KeyedHash { auth_policy, .. }
| Public::Ecc { auth_policy, .. }
| Public::SymCipher { auth_policy, .. } => auth_policy,
}
}
}

impl From<Public> for TPM2B_PUBLIC {
Expand Down

0 comments on commit be5355b

Please sign in to comment.