Skip to content

Commit

Permalink
Merge "Add ROLLBACK_RESISTANCE tag to key usage" into sc-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
TreeHugger Robot authored and Android (Google) Code Review committed Aug 11, 2021
2 parents 0f74bd4 + 2601eb7 commit 8f19fd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion KeyStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ static bool encryptWithKeymasterKey(Keymaster& keymaster, const std::string& dir
const km::AuthorizationSet& keyParams,
const KeyBuffer& message, std::string* ciphertext) {
km::AuthorizationSet opParams =
km::AuthorizationSetBuilder().Authorization(km::TAG_PURPOSE, km::KeyPurpose::ENCRYPT);
km::AuthorizationSetBuilder()
.Authorization(km::TAG_ROLLBACK_RESISTANCE)
.Authorization(km::TAG_PURPOSE, km::KeyPurpose::ENCRYPT);
km::AuthorizationSet outParams;
auto opHandle = BeginKeymasterOp(keymaster, dir, keyParams, opParams, &outParams);
if (!opHandle) return false;
Expand Down Expand Up @@ -408,6 +410,7 @@ static bool decryptWithKeymasterKey(Keymaster& keymaster, const std::string& dir
auto bodyAndMac = ciphertext.substr(GCM_NONCE_BYTES);
auto opParams = km::AuthorizationSetBuilder()
.Authorization(km::TAG_NONCE, nonce)
.Authorization(km::TAG_ROLLBACK_RESISTANCE)
.Authorization(km::TAG_PURPOSE, km::KeyPurpose::DECRYPT);
auto opHandle = BeginKeymasterOp(keymaster, dir, keyParams, opParams, nullptr);
if (!opHandle) return false;
Expand Down

0 comments on commit 8f19fd9

Please sign in to comment.