Cherry pick cdm udc-widevine-release changes to udc-widevine-dev to be in sync with 18.3 release

Merged from go/wvgerrit/178231

Bug: 290252845
Test: WVTS tests seem to be running and passing
Change-Id: Ifff9123a73e173e835a6e89ba7c2760e1cd500fd
(cherry picked from commit 6889845d2e7e24f22c00b333335c34259b3fc96e)
This commit is contained in:
Vicky Min
2023-07-12 18:59:13 +00:00
parent 42a5f26c5a
commit bc20b9dac9
460 changed files with 16767 additions and 3215 deletions

View File

@@ -207,7 +207,9 @@ OEMCryptoResult OemCertificate::GetPublicCertificate(
return OEMCrypto_ERROR_SHORT_BUFFER;
}
*public_cert_length = cert_data.size();
memcpy(public_cert, cert_data.data(), cert_data.size());
if (public_cert != nullptr) {
memcpy(public_cert, cert_data.data(), cert_data.size());
}
return OEMCrypto_SUCCESS;
}

View File

@@ -92,7 +92,7 @@ bool ParseRsaPrivateKeyInfo(const uint8_t* buffer, size_t length,
}
ScopedBio bio;
// Check allowed scheme type.
if (!memcmp("SIGN", buffer, 4)) {
if (memcmp("SIGN", buffer, 4) == 0) {
uint32_t allowed_schemes_bno;
memcpy(&allowed_schemes_bno, reinterpret_cast<const uint8_t*>(&buffer[4]),
4);
@@ -811,7 +811,9 @@ OEMCryptoResult RsaPublicKey::EncryptOaep(const uint8_t* message,
return OEMCrypto_ERROR_SHORT_BUFFER;
}
*enc_message_length = enc_size;
memcpy(enc_message, encrypt_buffer.data(), enc_size);
if (enc_message != nullptr) {
memcpy(enc_message, encrypt_buffer.data(), enc_size);
}
return OEMCrypto_SUCCESS;
}