Update ODK Library to 16.3
Merge from Widevine repo of http://go/wvgerrit/101130 https://cr/314253512 ODK Library: roll version number to 16.3 https://cr/314253425 ODK Library: Accept release request as renewal request To support forward compatibility, the v16 server should parse a release request as a renewal request. https://cr/314213725 ODK: Accept larger message sizes The ODK should accept a message size that is larger than the current API requires. This allows for future API versions to append fields to a message that current the current license SDK will ignore. https://cr/313962712 ODK: accept messages with future API version numbers This CL updates the ODK parse functions to accept future versions of the message. This will allow a v16 server to talk to a v17 device. https://cr/313814938 ODK Version String Add an automatically generated version string to odk_structs.h Bug: 157030231 Bug: 157512150 Bug: 157822248 Bug: 157512322 Test: unit tests on taimen Change-Id: I346f73c41bc984fe17856d3b61cd08cf92b39919
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
The ODK Library is used to generate and parse core OEMCrypto messages for
|
||||
This ODK Library is used to generate and parse core OEMCrypto messages for
|
||||
OEMCrypto v16 and above.
|
||||
|
||||
This library is used by both OEMCrypto on a device, and by Widevine license and
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
/* The version of this library. */
|
||||
#define ODK_MAJOR_VERSION 16
|
||||
#define ODK_MINOR_VERSION 2
|
||||
#define ODK_MINOR_VERSION 3
|
||||
|
||||
/* ODK Version string. Date changed automatically on each release. */
|
||||
#define ODK_RELEASE_DATE "ODK v16.2 2020-05-30"
|
||||
#define ODK_RELEASE_DATE "ODK v16.2 2020-06-02"
|
||||
|
||||
/* The lowest version number for an ODK message. */
|
||||
#define ODK_FIRST_VERSION 16
|
||||
|
||||
@@ -67,8 +67,20 @@ bool ParseRequest(uint32_t message_type,
|
||||
// Other versions do not (yet) have a restriction on minor number.
|
||||
// In particular, future versions are accepted for forward compatibility.
|
||||
}
|
||||
return core_message.message_type == message_type &&
|
||||
core_message.message_length == GetOffset(msg);
|
||||
// For v16, a release and a renewal use the same message structure.
|
||||
// However, for future API versions, the release might be a separate
|
||||
// message. Otherwise, we expect an exact match of message types.
|
||||
if (core_message.message_type != message_type &&
|
||||
!(message_type == ODK_Renewal_Request_Type &&
|
||||
core_message.message_type == ODK_Release_Request_Type)) {
|
||||
return false;
|
||||
}
|
||||
// Verify that the amount of buffer we read, which is GetOffset, is not more
|
||||
// than the total message size. We allow the total message size to be larger
|
||||
// for forward compatibility because future messages might have extra fields
|
||||
// that we can ignore.
|
||||
if (core_message.message_length < GetOffset(msg)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -87,8 +87,7 @@ bool CreateCoreLicenseResponseFromProto(const std::string& serialized_license,
|
||||
}
|
||||
parsed_lic.enc_mac_keys_iv =
|
||||
GetOecSubstring(serialized_license, k.iv());
|
||||
std::string mac_keys(k.key(), k.key().size());
|
||||
parsed_lic.enc_mac_keys = GetOecSubstring(serialized_license, mac_keys);
|
||||
parsed_lic.enc_mac_keys = GetOecSubstring(serialized_license, k.key());
|
||||
break;
|
||||
}
|
||||
case video_widevine::License_KeyContainer::CONTENT: {
|
||||
|
||||
@@ -10,11 +10,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if (__STDC_VERSION__ >= 201112L)
|
||||
# include <assert.h>
|
||||
# define odk_static_assert static_assert
|
||||
#include <assert.h>
|
||||
#define odk_static_assert static_assert
|
||||
#else
|
||||
# define odk_static_assert(msg, e) \
|
||||
enum { odk_static_assert = 1 / (!!((msg) && (e))) };
|
||||
#define odk_static_assert(msg, e) \
|
||||
enum { odk_static_assert = 1 / (!!((msg) && (e))) };
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -10,11 +10,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__ANDROID__)
|
||||
# include <endian.h>
|
||||
# define oemcrypto_htobe32 htobe32
|
||||
# define oemcrypto_be32toh be32toh
|
||||
# define oemcrypto_htobe64 htobe64
|
||||
# define oemcrypto_be64toh be64toh
|
||||
#include <endian.h>
|
||||
#define oemcrypto_htobe32 htobe32
|
||||
#define oemcrypto_be32toh be32toh
|
||||
#define oemcrypto_htobe64 htobe64
|
||||
#define oemcrypto_be64toh be64toh
|
||||
#else /* defined(__linux__) || defined(__ANDROID__) */
|
||||
uint32_t oemcrypto_htobe32(uint32_t u32);
|
||||
uint32_t oemcrypto_be32toh(uint32_t u32);
|
||||
|
||||
@@ -21,6 +21,10 @@ typedef enum {
|
||||
ODK_Renewal_Response_Type = 4,
|
||||
ODK_Provisioning_Request_Type = 5,
|
||||
ODK_Provisioning_Response_Type = 6,
|
||||
|
||||
/* Reserve future message types to support forward compatibility. */
|
||||
ODK_Release_Request_Type = 7,
|
||||
ODK_Release_Response_Type = 8,
|
||||
} ODK_MessageType;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "odk.h"
|
||||
#include "odk_overflow.h"
|
||||
#include "odk_structs_priv.h"
|
||||
|
||||
Reference in New Issue
Block a user