Skip to content

Commit

Permalink
Merge pull request #274 from Superhepper/auth_policy_method
Browse files Browse the repository at this point in the history
Added auth_policy method to ther Public structure.
  • Loading branch information
ionut-arm authored Oct 14, 2021
2 parents cedb8c6 + be5355b commit c45d4d4
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 c45d4d4

Please sign in to comment.