Do Keymaster HMAC key agreement in vold.

Bug: 79307225
Test: Boot
Change-Id: I6682e86076aa568907d94024ef175dbdede86557
This commit is contained in:
Shawn Willden 2018-05-09 08:12:10 -06:00
parent 4a04cad4ec
commit 2807536fc4
2 changed files with 7 additions and 0 deletions

View file

@ -96,8 +96,14 @@ bool KeymasterOperation::finish(std::string* output) {
return true; return true;
} }
/* static */ bool Keymaster::hmacKeyGenerated = false;
Keymaster::Keymaster() { Keymaster::Keymaster() {
auto devices = KmDevice::enumerateAvailableDevices(); auto devices = KmDevice::enumerateAvailableDevices();
if (!hmacKeyGenerated) {
KmDevice::performHmacKeyAgreement(devices);
hmacKeyGenerated = true;
}
for (auto& dev : devices) { for (auto& dev : devices) {
// Explicitly avoid using STRONGBOX for now. // Explicitly avoid using STRONGBOX for now.
// TODO: Re-enable STRONGBOX, since it's what we really want. b/77338527 // TODO: Re-enable STRONGBOX, since it's what we really want. b/77338527

View file

@ -117,6 +117,7 @@ class Keymaster {
private: private:
std::unique_ptr<KmDevice> mDevice; std::unique_ptr<KmDevice> mDevice;
DISALLOW_COPY_AND_ASSIGN(Keymaster); DISALLOW_COPY_AND_ASSIGN(Keymaster);
static bool hmacKeyGenerated;
}; };
} // namespace vold } // namespace vold