Android-cuttlefish cvd tool
|
#include <hmac_serializable.h>
Public Member Functions | |
HmacSerializable (TpmResourceManager &, std::function< TpmObjectSlot(TpmResourceManager &)>, uint32_t digest_size, Serializable *, const Serializable *aad) | |
size_t | SerializedSize () const override |
uint8_t * | Serialize (uint8_t *buf, const uint8_t *end) const override |
bool | Deserialize (const uint8_t **buf_ptr, const uint8_t *end) override |
Private Member Functions | |
std::optional< std::vector< uint8_t > > | AppendAad (const uint8_t *sensitive, size_t sensitive_size) const |
Private Attributes | |
TpmResourceManager & | resource_manager_ |
std::function< TpmObjectSlot(TpmResourceManager &)> | signing_key_fn_ |
uint32_t | digest_size_ |
Serializable * | wrapped_ |
const Serializable * | aad_ |
A keymaster::Serializable that wraps another keymaster::Serializable, protecting it from tampering while it is stored elsewhere. This stores the serialized data of the other type together with a signature over that serialized data. When deserializing, it will attempt to make the same signature over the data. If the signature or data has been tampered with, the signatures won't match and it won't attempt to deserialize the wrapped type.
The serialization format is: [uint32_t: wrapped_size] [wrapped_data] [uint32_t: signature_size] [signature_data]
While this class currently assumes all signatures will use the same key and algorithm and therefore be the same size, the serialization format is future-proof to accommodate signature changes.
cuttlefish::HmacSerializable::HmacSerializable | ( | TpmResourceManager & | resource_manager, |
std::function< TpmObjectSlot(TpmResourceManager &)> | signing_key_fn, | ||
uint32_t | digest_size, | ||
Serializable * | wrapped, | ||
const Serializable * | aad | ||
) |
|
private |
|
override |
|
override |
|
override |
|
private |
|
private |
|
private |
|
private |
|
private |