Source release 19.2.0

This commit is contained in:
Alex Dale
2024-06-25 14:03:53 -07:00
parent b8bdfccebe
commit cd8256726f
89 changed files with 2747 additions and 35949 deletions

View File

@@ -93,6 +93,7 @@ typedef enum OEMCryptoResult {
OEMCrypto_ERROR_DVR_FORBIDDEN = 63,
OEMCrypto_ERROR_INSUFFICIENT_PRIVILEGE = 64,
OEMCrypto_ERROR_INVALID_KEY = 65,
OEMCrypto_ERROR_INVALID_OEM_CERTIFICATE = 66,
/* ODK return values */
ODK_ERROR_BASE = 1000,
ODK_ERROR_CORE_MESSAGE = ODK_ERROR_BASE,

View File

@@ -26,9 +26,9 @@ struct CoreMessageFeatures {
// This is the published version of the ODK Core Message library. The default
// behavior is for the server to restrict messages to at most this version
// number. The default is 19.1.
// number. The default is 19.2.
uint32_t maximum_major_version = 19;
uint32_t maximum_minor_version = 1;
uint32_t maximum_minor_version = 2;
bool operator==(const CoreMessageFeatures &other) const;
bool operator!=(const CoreMessageFeatures &other) const {

View File

@@ -16,10 +16,10 @@ extern "C" {
/* The version of this library. */
#define ODK_MAJOR_VERSION 19
#define ODK_MINOR_VERSION 1
#define ODK_MINOR_VERSION 2
/* ODK Version string. Date changed automatically on each release. */
#define ODK_RELEASE_DATE "ODK v19.1 2024-03-25"
#define ODK_RELEASE_DATE "ODK v19.2 2024-06-11"
/* The lowest version number for an ODK message. */
#define ODK_FIRST_VERSION 16

View File

@@ -33,7 +33,7 @@ CoreMessageFeatures CoreMessageFeatures::DefaultFeatures(
features.maximum_minor_version = 4; // 18.4
break;
case 19:
features.maximum_minor_version = 1; // 19.1
features.maximum_minor_version = 2; // 19.2
break;
default:
features.maximum_minor_version = 0;

View File

@@ -45,7 +45,7 @@ OEMCrypto_Substring GetOecSubstring(std::string_view message,
}
OEMCrypto_KeyObject KeyContainerToOecKey(
const std::string& proto, const video_widevine::License::KeyContainer& k,
std::string_view proto, const video_widevine::License::KeyContainer& k,
const bool uses_padding) {
OEMCrypto_KeyObject obj = {};
obj.key_id = GetOecSubstring(proto, k.id());

View File

@@ -8,6 +8,8 @@
#include "odk_serialize.h"
#include "odk_message.h"
#include "odk_overflow.h"
#include "odk_structs_priv.h"
#include "serialization_base.h"
@@ -237,6 +239,36 @@ static void Unpack_OEMCrypto_KeyObject(ODK_Message* msg,
Unpack_OEMCrypto_Substring(msg, &obj->key_data);
Unpack_OEMCrypto_Substring(msg, &obj->key_control_iv);
Unpack_OEMCrypto_Substring(msg, &obj->key_control);
/*
Edge case for servers that incorrectly process protocol VERSION_2_2 padding.
Key data in proto is present, but each key's position in the core
message is missing.
Use the key_data_iv offset to determine if the key_data is present.
This assumes that the serialized protobuf is deterministically ordered, and
that the content key is always 16 bytes. These assumptions should hold true
for v16 and older servers.
*/
if (ODK_Message_GetStatus(msg) == MESSAGE_STATUS_OK &&
obj->key_data.offset == 0 && obj->key_data.length == 0) {
const size_t kKeyDataProtoHeaderSize = 2;
obj->key_data.offset = obj->key_data_iv.offset + obj->key_data_iv.length +
kKeyDataProtoHeaderSize;
obj->key_data.length = 16u; // assume 16-byte key
// Check for overflow. The offset is relative to the end of the core
// message, so add that length to the calculation.
size_t substring_end = 0; // offset + length
size_t end = 0; // offset + length + message_length
if (odk_add_overflow_ux(obj->key_data.offset, obj->key_data.length,
&substring_end) ||
odk_add_overflow_ux(substring_end, ODK_Message_GetSize(msg), &end) ||
end > ODK_Message_GetCapacity(msg)) {
ODK_Message_SetStatus(msg, MESSAGE_STATUS_OVERFLOW_ERROR);
return;
}
}
}
static void Unpack_ODK_TimerLimits(ODK_Message* msg, ODK_TimerLimits* obj) {

View File

@@ -277,7 +277,7 @@ OEMCryptoResult ODK_InitializeSessionValues(ODK_TimerLimits* timer_limits,
nonce_values->api_minor_version = 4;
break;
case 19:
nonce_values->api_minor_version = 1;
nonce_values->api_minor_version = 2;
break;
default:
nonce_values->api_minor_version = 0;
@@ -355,7 +355,7 @@ OEMCryptoResult ODK_AttemptFirstPlayback(uint64_t system_time_seconds,
return OEMCrypto_ERROR_INVALID_CONTEXT;
}
if (rental_time < timer_limits->earliest_playback_start_seconds) {
clock_values->timer_status = ODK_TIMER_EXPIRED;
clock_values->timer_status = ODK_CLOCK_TIMER_STATUS_EXPIRED;
return ODK_TIMER_EXPIRED;
}
/* If the license is inactive or not loaded, then playback is not allowed. */

View File

@@ -10,6 +10,7 @@
#include "odk.h"
#include "odk_attributes.h"
#include "odk_structs.h"
#include "odk_target.h"
namespace oemcrypto_core_message {
using features::CoreMessageFeatures;
@@ -148,7 +149,7 @@ bool kdo_serialize_LicenseResponse(const ODK_ParseLicense_Args* args,
parsed_license.key_array_length = parsed_lic.key_array_length;
std::vector<OEMCrypto_KeyObject> key_array;
size_t i;
for (i = 0; i < parsed_lic.key_array_length; i++) {
for (i = 0; i < parsed_lic.key_array_length && i < ODK_MAX_NUM_KEYS; i++) {
key_array.push_back(parsed_lic.key_array[i]);
}
parsed_license.key_array = key_array.data();

View File

@@ -1275,7 +1275,7 @@ std::vector<VersionParameters> TestCases() {
{16, ODK_MAJOR_VERSION, ODK_MINOR_VERSION, 16, 5},
{17, ODK_MAJOR_VERSION, ODK_MINOR_VERSION, 17, 2},
{18, ODK_MAJOR_VERSION, ODK_MINOR_VERSION, 18, 4},
{19, ODK_MAJOR_VERSION, ODK_MINOR_VERSION, 19, 1},
{19, ODK_MAJOR_VERSION, ODK_MINOR_VERSION, 19, 2},
// Here are some known good versions. Make extra sure they work.
{ODK_MAJOR_VERSION, 16, 3, 16, 3},
{ODK_MAJOR_VERSION, 16, 4, 16, 4},
@@ -1287,6 +1287,7 @@ std::vector<VersionParameters> TestCases() {
{ODK_MAJOR_VERSION, 18, 3, 18, 3},
{ODK_MAJOR_VERSION, 19, 0, 19, 0},
{ODK_MAJOR_VERSION, 19, 1, 19, 1},
{ODK_MAJOR_VERSION, 19, 2, 19, 2},
{0, 16, 3, 16, 3},
{0, 16, 4, 16, 4},
{0, 16, 5, 16, 5},
@@ -1296,6 +1297,7 @@ std::vector<VersionParameters> TestCases() {
{0, 18, 4, 18, 4},
{0, 19, 0, 19, 0},
{0, 19, 1, 19, 1},
{0, 19, 2, 19, 2},
};
return test_cases;
}