Merge "vold: Generate storage key without rollback resistance" am: 4f5e9c196f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1426109 Change-Id: Ibf06476010946d799c4b1fa5143ed4eac96f301a
This commit is contained in:
commit
b6d1a31949
1 changed files with 5 additions and 2 deletions
|
@ -141,9 +141,12 @@ bool generateWrappedStorageKey(KeyBuffer* key) {
|
||||||
if (!keymaster) return false;
|
if (!keymaster) return false;
|
||||||
std::string key_temp;
|
std::string key_temp;
|
||||||
auto paramBuilder = km::AuthorizationSetBuilder().AesEncryptionKey(AES_KEY_BYTES * 8);
|
auto paramBuilder = km::AuthorizationSetBuilder().AesEncryptionKey(AES_KEY_BYTES * 8);
|
||||||
paramBuilder.Authorization(km::TAG_ROLLBACK_RESISTANCE);
|
|
||||||
paramBuilder.Authorization(km::TAG_STORAGE_KEY);
|
paramBuilder.Authorization(km::TAG_STORAGE_KEY);
|
||||||
|
auto paramsWithRollback = paramBuilder;
|
||||||
|
paramsWithRollback.Authorization(km::TAG_ROLLBACK_RESISTANCE);
|
||||||
|
if (!keymaster.generateKey(paramsWithRollback, &key_temp)) {
|
||||||
if (!keymaster.generateKey(paramBuilder, &key_temp)) return false;
|
if (!keymaster.generateKey(paramBuilder, &key_temp)) return false;
|
||||||
|
}
|
||||||
*key = KeyBuffer(key_temp.size());
|
*key = KeyBuffer(key_temp.size());
|
||||||
memcpy(reinterpret_cast<void*>(key->data()), key_temp.c_str(), key->size());
|
memcpy(reinterpret_cast<void*>(key->data()), key_temp.c_str(), key->size());
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue