Source release 17.1.2
This commit is contained in:
@@ -139,6 +139,7 @@ typedef enum OEMCrypto_LicenseType {
|
||||
typedef enum OEMCrypto_PrivateKeyType {
|
||||
OEMCrypto_RSA_Private_Key = 0,
|
||||
OEMCrypto_ECC_Private_Key = 1,
|
||||
OEMCrypto_PrivateKeyType_MaxValue = OEMCrypto_ECC_Private_Key,
|
||||
} OEMCrypto_PrivateKeyType;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,10 +25,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 16.5, the last version used by Chrome. This will
|
||||
// change to 17.0 when v17 has been released.
|
||||
// number. The default is 17.2.
|
||||
uint32_t maximum_major_version = 17;
|
||||
uint32_t maximum_minor_version = 0;
|
||||
uint32_t maximum_minor_version = 2;
|
||||
|
||||
bool operator==(const CoreMessageFeatures &other) const;
|
||||
bool operator!=(const CoreMessageFeatures &other) const {
|
||||
|
||||
@@ -36,10 +36,12 @@ extern "C" {
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define ALIGNED __attribute__((aligned))
|
||||
#elif _MSC_VER
|
||||
#define ALIGNED __declspec(align(8))
|
||||
#else
|
||||
#define ALIGNED
|
||||
#error ODK_Message must be aligned to the maximum useful alignment of the \
|
||||
machine you are compiling for. Define the ALIGNED macro accordingly.
|
||||
machine you are compiling for. Define the ALIGNED macro accordingly.
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
@@ -61,7 +63,8 @@ typedef enum {
|
||||
MESSAGE_STATUS_NOT_INITIALIZED = 0x2990b6c6,
|
||||
MESSAGE_STATUS_OUT_OF_MEMORY = 0x7c5c64cc,
|
||||
MESSAGE_STATUS_MAP_SHARED_MEMORY_FAILED = 0x7afecacf,
|
||||
MESSAGE_STATUS_SECURE_BUFFER_ERROR = 0x78f0e873
|
||||
MESSAGE_STATUS_SECURE_BUFFER_ERROR = 0x78f0e873,
|
||||
MESSAGE_STATUS_BUFFER_TOO_LARGE = 0x5bfcfb21
|
||||
} ODK_MessageStatus;
|
||||
|
||||
/*
|
||||
|
||||
@@ -16,10 +16,10 @@ extern "C" {
|
||||
|
||||
/* The version of this library. */
|
||||
#define ODK_MAJOR_VERSION 17
|
||||
#define ODK_MINOR_VERSION 1
|
||||
#define ODK_MINOR_VERSION 2
|
||||
|
||||
/* ODK Version string. Date changed automatically on each release. */
|
||||
#define ODK_RELEASE_DATE "ODK v17.1 2022-06-17"
|
||||
#define ODK_RELEASE_DATE "ODK v17.2 2022-11-21"
|
||||
|
||||
/* The lowest version number for an ODK message. */
|
||||
#define ODK_FIRST_VERSION 16
|
||||
|
||||
@@ -23,7 +23,7 @@ CoreMessageFeatures CoreMessageFeatures::DefaultFeatures(
|
||||
features.maximum_minor_version = 5; // 16.5
|
||||
break;
|
||||
case 17:
|
||||
features.maximum_minor_version = 1; // 17.1
|
||||
features.maximum_minor_version = 2; // 17.2
|
||||
break;
|
||||
default:
|
||||
features.maximum_minor_version = 0;
|
||||
|
||||
@@ -25,6 +25,14 @@ extern "C" {
|
||||
#define oemcrypto_be32toh OSSwapBigToHostInt32
|
||||
#define oemcrypto_htobe64 OSSwapHostToBigInt64
|
||||
#define oemcrypto_be64toh OSSwapBigToHostInt64
|
||||
#elif defined(_WIN32)
|
||||
#include <winsock2.h>
|
||||
#define oemcrypto_htobe16 htons
|
||||
#define oemcrypto_be16toh ntohs
|
||||
#define oemcrypto_htobe32 htonl
|
||||
#define oemcrypto_be32toh ntohl
|
||||
#define oemcrypto_htobe64 htonll
|
||||
#define oemcrypto_be64toh ntohll
|
||||
#else /* defined(__linux__) || defined(__ANDROID__) */
|
||||
uint32_t oemcrypto_htobe16(uint16_t u16);
|
||||
uint32_t oemcrypto_be16toh(uint16_t u16);
|
||||
|
||||
@@ -212,7 +212,7 @@ static void Unpack_ODK_ParsedLicense(ODK_Message* msg, ODK_ParsedLicense* obj) {
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->enc_mac_keys);
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->pst);
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->srm_restriction_data);
|
||||
obj->license_type = (OEMCrypto_LicenseType)Unpack_enum(msg);
|
||||
Unpack_OEMCrypto_LicenseType(msg, &obj->license_type);
|
||||
Unpack_bool(msg, &obj->nonce_required);
|
||||
Unpack_ODK_TimerLimits(msg, &obj->timer_limits);
|
||||
Unpack_uint32_t(msg, &obj->watermarking);
|
||||
@@ -270,7 +270,7 @@ static void Unpack_ODK_ParsedLicenseV16(ODK_Message* msg,
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->enc_mac_keys);
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->pst);
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->srm_restriction_data);
|
||||
obj->license_type = (OEMCrypto_LicenseType)Unpack_enum(msg);
|
||||
Unpack_OEMCrypto_LicenseType(msg, &obj->license_type);
|
||||
Unpack_bool(msg, &obj->nonce_required);
|
||||
Unpack_ODK_TimerLimits(msg, &obj->timer_limits);
|
||||
Unpack_uint32_t(msg, &obj->key_array_length);
|
||||
@@ -286,7 +286,7 @@ static void Unpack_ODK_ParsedLicenseV16(ODK_Message* msg,
|
||||
|
||||
static void Unpack_ODK_ParsedProvisioning(ODK_Message* msg,
|
||||
ODK_ParsedProvisioning* obj) {
|
||||
obj->key_type = (OEMCrypto_PrivateKeyType)Unpack_enum(msg);
|
||||
Unpack_OEMCrypto_PrivateKeyType(msg, &obj->key_type);
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->enc_private_key);
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->enc_private_key_iv);
|
||||
Unpack_OEMCrypto_Substring(msg, &obj->encrypted_message_key);
|
||||
|
||||
@@ -108,10 +108,28 @@ static void UnpackBytes(ODK_Message* message, uint8_t* ptr, size_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
int Unpack_enum(ODK_Message* message) {
|
||||
uint32_t v32;
|
||||
void Unpack_OEMCrypto_LicenseType(ODK_Message* message,
|
||||
OEMCrypto_LicenseType* value) {
|
||||
assert(value);
|
||||
uint32_t v32 = 0;
|
||||
Unpack_uint32_t(message, &v32);
|
||||
return (int)v32;
|
||||
if (v32 <= OEMCrypto_LicenseType_MaxValue) {
|
||||
*value = (OEMCrypto_LicenseType)v32;
|
||||
} else {
|
||||
ODK_Message_SetStatus(message, MESSAGE_STATUS_PARSE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void Unpack_OEMCrypto_PrivateKeyType(ODK_Message* message,
|
||||
OEMCrypto_PrivateKeyType* value) {
|
||||
assert(value);
|
||||
uint32_t v32 = 0;
|
||||
Unpack_uint32_t(message, &v32);
|
||||
if (v32 <= OEMCrypto_PrivateKeyType_MaxValue) {
|
||||
*value = (OEMCrypto_PrivateKeyType)v32;
|
||||
} else {
|
||||
ODK_Message_SetStatus(message, MESSAGE_STATUS_PARSE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void Unpack_bool(ODK_Message* message, bool* value) {
|
||||
|
||||
@@ -25,7 +25,10 @@ void PackArray(ODK_Message* message, const uint8_t* base, size_t size);
|
||||
void Pack_OEMCrypto_Substring(ODK_Message* message,
|
||||
const OEMCrypto_Substring* obj);
|
||||
|
||||
int Unpack_enum(ODK_Message* message);
|
||||
void Unpack_OEMCrypto_LicenseType(ODK_Message* message,
|
||||
OEMCrypto_LicenseType* value);
|
||||
void Unpack_OEMCrypto_PrivateKeyType(ODK_Message* message,
|
||||
OEMCrypto_PrivateKeyType* value);
|
||||
void Unpack_bool(ODK_Message* message, bool* value);
|
||||
void Unpack_uint8_t(ODK_Message* message, uint8_t* value);
|
||||
void Unpack_uint16_t(ODK_Message* message, uint16_t* value);
|
||||
|
||||
4134
oemcrypto/odk/test/odk_golden_v16.cpp
Normal file
4134
oemcrypto/odk/test/odk_golden_v16.cpp
Normal file
File diff suppressed because it is too large
Load Diff
3847
oemcrypto/odk/test/odk_golden_v17.cpp
Normal file
3847
oemcrypto/odk/test/odk_golden_v17.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -872,6 +872,7 @@ std::vector<VersionParameters> TestCases() {
|
||||
{17, 16, 5, 16, 5},
|
||||
{17, 17, 0, 17, 0},
|
||||
{17, 17, 1, 17, 1},
|
||||
{17, 17, 2, 17, 2},
|
||||
};
|
||||
return test_cases;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
{
|
||||
'sources': [
|
||||
'odk_golden_v16.cpp',
|
||||
'odk_golden_v17.cpp',
|
||||
'odk_test.cpp',
|
||||
'odk_test_helper.cpp',
|
||||
'odk_test_helper.h',
|
||||
|
||||
Reference in New Issue
Block a user