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
105 lines
3.4 KiB
C
105 lines
3.4 KiB
C
/* Copyright 2019 Google LLC. All rights reserved. This file and proprietary */
|
|
/* source code may only be used and distributed under the Widevine Master */
|
|
/* License Agreement. */
|
|
|
|
#ifndef WIDEVINE_ODK_SRC_ODK_STRUCTS_PRIV_H_
|
|
#define WIDEVINE_ODK_SRC_ODK_STRUCTS_PRIV_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "OEMCryptoCENCCommon.h"
|
|
#include "odk_structs.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
ODK_License_Request_Type = 1,
|
|
ODK_License_Response_Type = 2,
|
|
ODK_Renewal_Request_Type = 3,
|
|
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 {
|
|
uint32_t message_type;
|
|
uint32_t message_length;
|
|
ODK_NonceValues nonce_values;
|
|
} ODK_CoreMessage;
|
|
|
|
typedef struct {
|
|
ODK_CoreMessage core_message;
|
|
} ODK_PreparedLicenseRequest;
|
|
|
|
typedef struct {
|
|
ODK_CoreMessage core_message;
|
|
uint64_t playback_time;
|
|
} ODK_PreparedRenewalRequest;
|
|
|
|
typedef struct {
|
|
ODK_CoreMessage core_message;
|
|
uint32_t device_id_length;
|
|
uint8_t device_id[ODK_DEVICE_ID_LEN_MAX];
|
|
} ODK_PreparedProvisioningRequest;
|
|
|
|
typedef struct {
|
|
ODK_PreparedLicenseRequest request;
|
|
ODK_ParsedLicense* parsed_license;
|
|
uint8_t request_hash[ODK_SHA256_HASH_SIZE];
|
|
} ODK_LicenseResponse;
|
|
|
|
typedef struct {
|
|
ODK_PreparedRenewalRequest request;
|
|
uint64_t renewal_duration_seconds;
|
|
} ODK_RenewalResponse;
|
|
|
|
typedef struct {
|
|
ODK_PreparedProvisioningRequest request;
|
|
ODK_ParsedProvisioning* parsed_provisioning;
|
|
} ODK_ProvisioningResponse;
|
|
|
|
/* These are the sum of sizeof of each individual member of the request structs
|
|
*/
|
|
/* without any padding added by the compiler. Make sure they get updated when */
|
|
/* request structs change. Refer to test suite OdkSizeTest in */
|
|
/* ../test/odk_test.cpp for validations of each of the defined request sizes. */
|
|
#define ODK_LICENSE_REQUEST_SIZE 20
|
|
#define ODK_RENEWAL_REQUEST_SIZE 28
|
|
#define ODK_PROVISIONING_REQUEST_SIZE 88
|
|
|
|
/* These are the possible timer status values. */
|
|
#define ODK_CLOCK_TIMER_STATUS_UNDEFINED 0 /* Should not happen. */
|
|
/* When the structure has been initialized, but no license is loaded. */
|
|
#define ODK_CLOCK_TIMER_STATUS_LICENSE_NOT_LOADED 1
|
|
/* After the license is loaded, before a successful decrypt. */
|
|
#define ODK_CLOCK_TIMER_STATUS_LICENSE_LOADED 2
|
|
/* After the license is loaded, if a renewal has also been loaded. */
|
|
#define ODK_CLOCK_TIMER_STATUS_RENEWAL_LOADED 3
|
|
/* The first decrypt has occurred and the timer is active. */
|
|
#define ODK_CLOCK_TIMER_STATUS_ACTIVE 4
|
|
/* The first decrypt has occurred and the timer is unlimited. */
|
|
#define ODK_CLOCK_TIMER_STATUS_UNLIMITED 5
|
|
/* The timer has transitioned from active to expired. */
|
|
#define ODK_CLOCK_TIMER_STATUS_EXPIRED 6
|
|
/* The license has been marked as inactive. */
|
|
#define ODK_CLOCK_TIMER_STATUS_LICENSE_INACTIVE 7
|
|
|
|
/* A helper function for computing timer limits when a renewal is loaded. */
|
|
OEMCryptoResult ODK_ComputeRenewalDuration(const ODK_TimerLimits* timer_limits,
|
|
ODK_ClockValues* clock_values,
|
|
uint64_t system_time_seconds,
|
|
uint64_t new_renewal_duration,
|
|
uint64_t* timer_value);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* WIDEVINE_ODK_SRC_ODK_STRUCTS_PRIV_H_ */
|