Add mutex lock around InstallTestRootOfTrust
Merge from Widevine repo of http://go/wvgerrit/71323 When running multithreaded tests, we need to make sure there are no other OEMCrypto calls between OEMCrypto_Initialize and the installation of the test keybox. bug: 123319961 test: ran juce's threading test Change-Id: Ibd8951c764f6538da4afa9ad146a6a72064eb13a
This commit is contained in:
@@ -198,8 +198,16 @@ bool TestCryptoSession::GenerateNonce(uint32_t* nonce) {
|
||||
|
||||
class TestCryptoSessionFactory : public CryptoSessionFactory {
|
||||
CryptoSession* MakeCryptoSession(metrics::CryptoMetrics* crypto_metrics) {
|
||||
// We need to add extra locking here because we need to make sure that there
|
||||
// are no other OEMCrypto calls between OEMCrypto_Initialize and
|
||||
// InstallTestRootOfTrust. OEMCrypto_Initialize is called in the production
|
||||
// CryptoSession::Init and is wrapped in crypto_lock_, but
|
||||
// InstallTestRootOfTrust is only called in the constructor of the
|
||||
// TestCryptoSession, above.
|
||||
std::unique_lock<std::mutex> auto_lock(init_lock_);
|
||||
return new TestCryptoSession(crypto_metrics);
|
||||
}
|
||||
std::mutex init_lock_;
|
||||
};
|
||||
|
||||
void WvCdmTestBase::SetUp() {
|
||||
|
||||
Reference in New Issue
Block a user