Resize signature buffer
There is an ambiguity in the use of the signature length in OEMCrypto_GenerateRSASignature. If the pointer to the vector is null, the function should set the length parameter to be the size of the buffer needed. This ambiguity has been clarified in the documentation: the length returned should be the exact length of the buffer. It will be corrected in a future release of Qualcomm's L1. However, we are putting this change in both as a stop-gap and as a belt-and-suspenders fix. Bug: 8878371 Merge of https://widevine-internal-review.googlesource.com/#/c/5494/ from the Widevine CDM repository Change-Id: I7574874884ca10da68d15674c971a565d015767d
This commit is contained in:
@@ -410,6 +410,9 @@ bool CryptoSession::GenerateSignature(const std::string& message,
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO(fredgc): remove in K, when L1 library reports correct length.
|
||||
signature->resize(length);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -556,6 +559,8 @@ bool CryptoSession::RewrapDeviceRSAKey(const std::string& message,
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(wrapped_rsa_key->data())),
|
||||
&wrapped_rsa_key_length);
|
||||
|
||||
// TODO(fredgc): remove in K, when L1 library reports correct length.
|
||||
wrapped_rsa_key->resize(wrapped_rsa_key_length);
|
||||
if (OEMCrypto_SUCCESS != status) {
|
||||
LOGE("OEMCrypto_RewrapDeviceRSAKey fails with %d", status);
|
||||
return false;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user