Take a Global Write Lock Before Calling OEMCrypto_GenerateNonce()

(This is a merge of http://go/wvgerrit/77803)

In OEMCrypto 15.2, OEMCrypto_GenerateNonce() is a Session Initialization
Function, which means the global OEMCrypto lock must be held before
calling it. There's no harm updating our code to behave this way now,
even before OEMCrypto 15.2 implementations are ready, since it's a
stricter guarantee than the current behavior.

Bug: 131327826
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: Icb6a86dea7298c99596fa9e3d90cec721ebcb8a6
This commit is contained in:
John W. Bruce
2019-05-31 19:02:00 -07:00
parent 643c574775
commit 1d5b7cc8fe

View File

@@ -1489,7 +1489,7 @@ CdmResponseType CryptoSession::GenerateNonce(uint32_t* nonce) {
}
OEMCryptoResult result;
WithOecSessionLock("GenerateNonce", [&] {
WithOecWriteLock("GenerateNonce", [&] {
result = OEMCrypto_GenerateNonce(oec_session_id_, nonce);
});
metrics_->oemcrypto_generate_nonce_.Increment(result);