Source release v3.0.2
This commit is contained in:
@@ -243,7 +243,7 @@ typedef enum OEMCrypto_HDCP_Capability {
|
||||
HDCP_V1 = 1, // HDCP version 1.0
|
||||
HDCP_V2 = 2, // HDCP version 2.0
|
||||
HDCP_V2_1 = 3, // HDCP version 2.1
|
||||
HDCP_V2_2 = 4, // HDCP version 2.2
|
||||
HDCP_V2_2 = 4, // HDCP version 2.2 Type 1.
|
||||
HDCP_NO_DIGITAL_OUTPUT = 0xff // No digital output.
|
||||
} OEMCrypto_HDCP_Capability;
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@ typedef struct {
|
||||
|
||||
// Note: The API does not specify a maximum key id length. We specify a
|
||||
// maximum just for these tests, so that we have a fixed message size.
|
||||
const size_t kTestKeyIdMaxLength = 48;
|
||||
// Most content will use a key id that is 12 bytes long.
|
||||
const int kDefaultKeyIdLength = 12;
|
||||
const size_t kTestKeyIdMaxLength = 16;
|
||||
// Most content will use a key id that is 16 bytes long.
|
||||
const int kDefaultKeyIdLength = 16;
|
||||
typedef struct {
|
||||
uint8_t key_id[kTestKeyIdMaxLength];
|
||||
size_t key_id_length;
|
||||
@@ -101,11 +101,6 @@ struct RSAPrivateKeyMessage {
|
||||
uint32_t nonce;
|
||||
};
|
||||
|
||||
struct PaddedPSTReport {
|
||||
OEMCrypto_PST_Report report;
|
||||
uint8_t padding[256];
|
||||
};
|
||||
|
||||
// These are test keyboxes. They will not be accepted by production systems.
|
||||
// By using known keyboxes for these tests, the results for a given set of
|
||||
// inputs to a test are predictable and can be compared to the actual results.
|
||||
@@ -364,239 +359,6 @@ static const uint8_t kTestRSAPKCS8PrivateKeyInfo2_2048[] = {
|
||||
0x72, 0x2c, 0xf7, 0xc1, 0x22, 0x36, 0xd9, 0x18,
|
||||
0x56, 0xfe, 0x39, 0x28, 0x33, 0xe0, 0xdb, 0x03 };
|
||||
|
||||
// A 2048 bit RSA Public key
|
||||
// Used to verify the functions that manipulate RSA keys.
|
||||
static const uint8_t kTestRSAPublicKey2_2048[] = {
|
||||
0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
|
||||
0x00, 0xa7, 0x00, 0x36, 0x60, 0x65, 0xdc, 0xbd,
|
||||
0x54, 0x5a, 0x2a, 0x40, 0xb4, 0xe1, 0x15, 0x94,
|
||||
0x58, 0x11, 0x4f, 0x94, 0x58, 0xdd, 0xde, 0xa7,
|
||||
0x1f, 0x3c, 0x2c, 0xe0, 0x88, 0x09, 0x29, 0x61,
|
||||
0x57, 0x67, 0x5e, 0x56, 0x7e, 0xee, 0x27, 0x8f,
|
||||
0x59, 0x34, 0x9a, 0x2a, 0xaa, 0x9d, 0xb4, 0x4e,
|
||||
0xfa, 0xa7, 0x6a, 0xd4, 0xc9, 0x7a, 0x53, 0xc1,
|
||||
0x4e, 0x9f, 0xe3, 0x34, 0xf7, 0x3d, 0xb7, 0xc9,
|
||||
0x10, 0x47, 0x4f, 0x28, 0xda, 0x3f, 0xce, 0x31,
|
||||
0x7b, 0xfd, 0x06, 0x10, 0xeb, 0xf7, 0xbe, 0x92,
|
||||
0xf9, 0xaf, 0xfb, 0x3e, 0x68, 0xda, 0xee, 0x1a,
|
||||
0x64, 0x4c, 0xf3, 0x29, 0xf2, 0x73, 0x9e, 0x39,
|
||||
0xd8, 0xf6, 0x6f, 0xd8, 0xb2, 0x80, 0x82, 0x71,
|
||||
0x8e, 0xb5, 0xa4, 0xf2, 0xc2, 0x3e, 0xcd, 0x0a,
|
||||
0xca, 0xb6, 0x04, 0xcd, 0x9a, 0x13, 0x8b, 0x54,
|
||||
0x73, 0x54, 0x25, 0x54, 0x8c, 0xbe, 0x98, 0x7a,
|
||||
0x67, 0xad, 0xda, 0xb3, 0x4e, 0xb3, 0xfa, 0x82,
|
||||
0xa8, 0x4a, 0x67, 0x98, 0x56, 0x57, 0x54, 0x71,
|
||||
0xcd, 0x12, 0x7f, 0xed, 0xa3, 0x01, 0xc0, 0x6a,
|
||||
0x8b, 0x24, 0x03, 0x96, 0x88, 0xbe, 0x97, 0x66,
|
||||
0x2a, 0xbc, 0x53, 0xc9, 0x83, 0x06, 0x51, 0x5a,
|
||||
0x88, 0x65, 0x13, 0x18, 0xe4, 0x3a, 0xed, 0x6b,
|
||||
0xf1, 0x61, 0x5b, 0x4c, 0xc8, 0x1e, 0xf4, 0xc2,
|
||||
0xae, 0x08, 0x5e, 0x2d, 0x5f, 0xf8, 0x12, 0x7f,
|
||||
0xa2, 0xfc, 0xbb, 0x21, 0x18, 0x30, 0xda, 0xfe,
|
||||
0x40, 0xfb, 0x01, 0xca, 0x2e, 0x37, 0x0e, 0xce,
|
||||
0xdd, 0x76, 0x87, 0x82, 0x46, 0x0b, 0x3a, 0x77,
|
||||
0x8f, 0xc0, 0x72, 0x07, 0x2c, 0x7f, 0x9d, 0x1e,
|
||||
0x86, 0x5b, 0xed, 0x27, 0x29, 0xdf, 0x03, 0x97,
|
||||
0x62, 0xef, 0x44, 0xd3, 0x5b, 0x3d, 0xdb, 0x9c,
|
||||
0x5e, 0x1b, 0x7b, 0x39, 0xb4, 0x0b, 0x6d, 0x04,
|
||||
0x6b, 0xbb, 0xbb, 0x2c, 0x5f, 0xcf, 0xb3, 0x7a,
|
||||
0x05, 0x02, 0x03, 0x01, 0x00, 0x01 };
|
||||
|
||||
// A second 2048 bit RSA key in PKCS#8 PrivateKeyInfo format
|
||||
// Used to verify the functions that manipulate RSA keys.
|
||||
static const uint8_t kTestRSAPKCS8PrivateKeyInfo3_2048[] = {
|
||||
0x30, 0x82, 0x04, 0xbe, 0x02, 0x01, 0x00, 0x30,
|
||||
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
|
||||
0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82,
|
||||
0x04, 0xa8, 0x30, 0x82, 0x04, 0xa4, 0x02, 0x01,
|
||||
0x00, 0x02, 0x82, 0x01, 0x01, 0x00, 0xa5, 0xd0,
|
||||
0xd7, 0x3e, 0x0e, 0x2d, 0xfb, 0x43, 0x51, 0x99,
|
||||
0xea, 0x40, 0x1e, 0x2d, 0x89, 0xe4, 0xa2, 0x3e,
|
||||
0xfc, 0x51, 0x3d, 0x0e, 0x83, 0xa7, 0xe0, 0xa5,
|
||||
0x41, 0x04, 0x1e, 0x14, 0xc5, 0xa7, 0x5c, 0x61,
|
||||
0x36, 0x44, 0xb3, 0x08, 0x05, 0x5b, 0x14, 0xde,
|
||||
0x01, 0x0c, 0x32, 0x3c, 0x9a, 0x91, 0x00, 0x50,
|
||||
0xa8, 0x1d, 0xcc, 0x9f, 0x8f, 0x35, 0xb7, 0xc2,
|
||||
0x75, 0x08, 0x32, 0x8b, 0x10, 0x3a, 0x86, 0xf9,
|
||||
0xd7, 0x78, 0xa3, 0x9d, 0x74, 0x10, 0xc6, 0x24,
|
||||
0xb1, 0x7f, 0xa5, 0xbf, 0x5f, 0xc2, 0xd7, 0x15,
|
||||
0xa3, 0x1d, 0xe0, 0x15, 0x6b, 0x1b, 0x0e, 0x38,
|
||||
0xba, 0x34, 0xbc, 0x95, 0x47, 0x94, 0x40, 0x70,
|
||||
0xac, 0x99, 0x1f, 0x0b, 0x8e, 0x56, 0x93, 0x36,
|
||||
0x2b, 0x6d, 0x04, 0xe7, 0x95, 0x1a, 0x37, 0xda,
|
||||
0x16, 0x57, 0x99, 0xee, 0x03, 0x68, 0x16, 0x31,
|
||||
0xaa, 0xc3, 0xb7, 0x92, 0x75, 0x53, 0xfc, 0xf6,
|
||||
0x20, 0x55, 0x44, 0xf8, 0xd4, 0x8d, 0x78, 0x15,
|
||||
0xc7, 0x1a, 0xb6, 0xde, 0x6c, 0xe8, 0x49, 0x5d,
|
||||
0xaf, 0xa8, 0x4e, 0x6f, 0x7c, 0xe2, 0x6a, 0x4c,
|
||||
0xd5, 0xe7, 0x8c, 0x8f, 0x0b, 0x5d, 0x3a, 0x09,
|
||||
0xd6, 0xb3, 0x44, 0xab, 0xe0, 0x35, 0x52, 0x7c,
|
||||
0x66, 0x85, 0xa4, 0x40, 0xd7, 0x20, 0xec, 0x24,
|
||||
0x05, 0x06, 0xd9, 0x84, 0x51, 0x5a, 0xd2, 0x38,
|
||||
0xd5, 0x1d, 0xea, 0x70, 0x2a, 0x21, 0xe6, 0x82,
|
||||
0xfd, 0xa4, 0x46, 0x1c, 0x4f, 0x59, 0x6e, 0x29,
|
||||
0x3d, 0xae, 0xb8, 0x8e, 0xee, 0x77, 0x1f, 0x15,
|
||||
0x33, 0xcf, 0x94, 0x1d, 0x87, 0x3c, 0x37, 0xc5,
|
||||
0x89, 0xe8, 0x7d, 0x85, 0xb3, 0xbc, 0xe8, 0x62,
|
||||
0x6a, 0x84, 0x7f, 0xfe, 0x9a, 0x85, 0x3f, 0x39,
|
||||
0xe8, 0xaa, 0x16, 0xa6, 0x8f, 0x87, 0x7f, 0xcb,
|
||||
0xc1, 0xd6, 0xf2, 0xec, 0x2b, 0xa7, 0xdd, 0x49,
|
||||
0x98, 0x7b, 0x6f, 0xdd, 0x69, 0x6d, 0x02, 0x03,
|
||||
0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x00, 0x43,
|
||||
0x8f, 0x19, 0x83, 0xb1, 0x27, 0x4e, 0xee, 0x98,
|
||||
0xba, 0xcb, 0x54, 0xa0, 0x77, 0x11, 0x6d, 0xd4,
|
||||
0x25, 0x31, 0x8c, 0xb0, 0x01, 0xcf, 0xe6, 0x80,
|
||||
0x83, 0x14, 0x40, 0x67, 0x39, 0x33, 0x67, 0x03,
|
||||
0x1e, 0xa0, 0x8b, 0xd1, 0x1d, 0xfd, 0x80, 0xa4,
|
||||
0xb9, 0xe7, 0x57, 0x5e, 0xc8, 0x8e, 0x79, 0x71,
|
||||
0xd5, 0x6b, 0x09, 0xe9, 0x2b, 0x41, 0xa0, 0x33,
|
||||
0x64, 0xc9, 0x66, 0x33, 0xa1, 0xb1, 0x55, 0x07,
|
||||
0x55, 0x98, 0x53, 0x10, 0xe6, 0xc0, 0x39, 0x6d,
|
||||
0x61, 0xd9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0xad, 0x87,
|
||||
0x88, 0xa0, 0x77, 0xaf, 0x3b, 0x23, 0xd1, 0x66,
|
||||
0x0b, 0x31, 0x2b, 0xaf, 0xef, 0xd5, 0x41, 0x02,
|
||||
0x81, 0x81, 0x00, 0xdb, 0xc1, 0xe7, 0xdd, 0xba,
|
||||
0x3c, 0x1f, 0x9c, 0x64, 0xca, 0xa0, 0x63, 0xdb,
|
||||
0xd2, 0x47, 0x5c, 0x6e, 0x8a, 0xa3, 0x16, 0xd5,
|
||||
0xda, 0xc2, 0x25, 0x64, 0x0a, 0x02, 0xbc, 0x7d,
|
||||
0x7f, 0x50, 0xab, 0xe0, 0x66, 0x03, 0x53, 0x7d,
|
||||
0x77, 0x6d, 0x6c, 0x61, 0x58, 0x09, 0x73, 0xcd,
|
||||
0x18, 0xe9, 0x53, 0x0b, 0x5c, 0xa2, 0x71, 0x14,
|
||||
0x02, 0xfd, 0x55, 0xda, 0xe9, 0x77, 0x24, 0x7c,
|
||||
0x2a, 0x4e, 0xb9, 0xd9, 0x5d, 0x58, 0xf6, 0x26,
|
||||
0xd0, 0xd8, 0x3d, 0xcf, 0x8c, 0x89, 0x65, 0x6c,
|
||||
0x35, 0x19, 0xb6, 0x63, 0xff, 0xa0, 0x71, 0x49,
|
||||
0xcd, 0x6d, 0x5b, 0x3d, 0x8f, 0xea, 0x6f, 0xa9,
|
||||
0xba, 0x43, 0xe5, 0xdd, 0x39, 0x3a, 0x78, 0x8f,
|
||||
0x07, 0xb8, 0xab, 0x58, 0x07, 0xb7, 0xd2, 0xf8,
|
||||
0x07, 0x02, 0x9b, 0x79, 0x26, 0x32, 0x22, 0x38,
|
||||
0x91, 0x01, 0x90, 0x81, 0x29, 0x94, 0xad, 0x77,
|
||||
0xeb, 0x86, 0xb9, 0x02, 0x81, 0x81, 0x00, 0xc1,
|
||||
0x29, 0x88, 0xbd, 0x96, 0x31, 0x33, 0x7b, 0x77,
|
||||
0x5d, 0x32, 0x12, 0x5e, 0xdf, 0x28, 0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x7d, 0x40, 0xfe, 0x95, 0x32, 0x5b, 0xd3,
|
||||
0x6f, 0x90, 0x11, 0x01, 0x92, 0xc9, 0xe5, 0x1d,
|
||||
0xc5, 0xc7, 0x78, 0x72, 0x82, 0xae, 0xb5, 0x4b,
|
||||
0xcb, 0x78, 0xad, 0x7e, 0xfe, 0xb6, 0xb1, 0x23,
|
||||
0x63, 0x01, 0x94, 0x9a, 0x99, 0x05, 0x63, 0xda,
|
||||
0xea, 0xf1, 0x98, 0xfd, 0x26, 0xd2, 0xd9, 0x8b,
|
||||
0x35, 0xec, 0xcb, 0x0b, 0x43, 0xb8, 0x8e, 0x84,
|
||||
0xb8, 0x09, 0x93, 0x81, 0xe8, 0xac, 0x6f, 0x3c,
|
||||
0x7c, 0x95, 0x81, 0x45, 0xc4, 0xd9, 0x94, 0x08,
|
||||
0x09, 0x8f, 0x91, 0x17, 0x65, 0x4c, 0xff, 0x6e,
|
||||
0xbc, 0x51, 0x02, 0x81, 0x81, 0x00, 0xc1, 0x0d,
|
||||
0x9d, 0xd8, 0xbd, 0xaf, 0x56, 0xe0, 0xe3, 0x1f,
|
||||
0x85, 0xd7, 0xce, 0x72, 0x02, 0x38, 0xf2, 0x0f,
|
||||
0x9c, 0x27, 0x9e, 0xc4, 0x1d, 0x60, 0x00, 0x8d,
|
||||
0x02, 0x19, 0xe5, 0xdf, 0xdb, 0x8e, 0xc5, 0xfb,
|
||||
0x61, 0x8e, 0xe6, 0xb8, 0xfc, 0x07, 0x3c, 0xd1,
|
||||
0x1b, 0x16, 0x7c, 0x83, 0x3c, 0x37, 0xf5, 0x26,
|
||||
0xb2, 0xbd, 0x22, 0xf2, 0x4d, 0x19, 0x33, 0x11,
|
||||
0xc5, 0xdd, 0xf9, 0xdb, 0x4e, 0x48, 0x52, 0xd8,
|
||||
0xe6, 0x4b, 0x15, 0x90, 0x68, 0xbe, 0xca, 0xc1,
|
||||
0x7c, 0xd3, 0x51, 0x6b, 0x45, 0x46, 0x54, 0x11,
|
||||
0x1a, 0x71, 0xd3, 0xcd, 0x6b, 0x8f, 0x79, 0x22,
|
||||
0x83, 0x02, 0x08, 0x4f, 0xba, 0x6a, 0x98, 0xed,
|
||||
0x32, 0xd8, 0xb4, 0x5b, 0x51, 0x88, 0x53, 0xec,
|
||||
0x2c, 0x7e, 0xa4, 0x89, 0xdc, 0xbf, 0xf9, 0x0d,
|
||||
0x32, 0xc8, 0xc3, 0xec, 0x6d, 0x2e, 0xf1, 0xbc,
|
||||
0x70, 0x4e, 0xf6, 0x9e, 0xbc, 0x31, 0x02, 0x81,
|
||||
0x81, 0x00, 0xd3, 0x35, 0x1b, 0x19, 0x75, 0x3f,
|
||||
0x61, 0xf2, 0x55, 0x03, 0xce, 0x25, 0xa9, 0xdf,
|
||||
0x0c, 0x0a, 0x3b, 0x47, 0x42, 0xdc, 0x38, 0x4b,
|
||||
0x13, 0x4d, 0x1f, 0x86, 0x58, 0x4f, 0xd8, 0xee,
|
||||
0xfa, 0x76, 0x15, 0xfb, 0x6e, 0x55, 0x31, 0xf2,
|
||||
0xd2, 0x62, 0x32, 0xa5, 0xc4, 0x23, 0x5e, 0x08,
|
||||
0xa9, 0x83, 0x07, 0xac, 0x8c, 0xa3, 0x7e, 0x18,
|
||||
0xc0, 0x1c, 0x57, 0x63, 0x8d, 0x05, 0x17, 0x47,
|
||||
0x1b, 0xd3, 0x74, 0x73, 0x20, 0x04, 0xfb, 0xc8,
|
||||
0x1a, 0x43, 0x04, 0x36, 0xc8, 0x19, 0xbe, 0xdc,
|
||||
0xa6, 0xe5, 0x0f, 0x25, 0x62, 0x24, 0x96, 0x92,
|
||||
0xb6, 0xb3, 0x97, 0xad, 0x57, 0x9a, 0x90, 0x37,
|
||||
0x4e, 0x31, 0x44, 0x74, 0xfa, 0x7c, 0xb4, 0xea,
|
||||
0xfc, 0x15, 0xa7, 0xb0, 0x51, 0xcc, 0xee, 0x1e,
|
||||
0xed, 0x5b, 0x98, 0x18, 0x0e, 0x65, 0xb6, 0x4b,
|
||||
0x69, 0x0b, 0x21, 0xdc, 0x86, 0x17, 0x6e, 0xc8,
|
||||
0xee, 0x24 };
|
||||
|
||||
// A second 2048 bit RSA Public key
|
||||
// Used to verify the functions that manipulate RSA keys.
|
||||
static const uint8_t kTestRSAPublicKey3_2048[] = {
|
||||
0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
|
||||
0x00, 0xa5, 0xd0, 0xd7, 0x3e, 0x0e, 0x2d, 0xfb,
|
||||
0x43, 0x51, 0x99, 0xea, 0x40, 0x1e, 0x2d, 0x89,
|
||||
0xe4, 0xa2, 0x3e, 0xfc, 0x51, 0x3d, 0x0e, 0x83,
|
||||
0xa7, 0xe0, 0xa5, 0x41, 0x04, 0x1e, 0x14, 0xc5,
|
||||
0xa7, 0x5c, 0x61, 0x36, 0x44, 0xb3, 0x08, 0x05,
|
||||
0x5b, 0x14, 0xde, 0x01, 0x0c, 0x32, 0x3c, 0x9a,
|
||||
0x91, 0x00, 0x50, 0xa8, 0x1d, 0xcc, 0x9f, 0x8f,
|
||||
0x35, 0xb7, 0xc2, 0x75, 0x08, 0x32, 0x8b, 0x10,
|
||||
0x3a, 0x86, 0xf9, 0xd7, 0x78, 0xa3, 0x9d, 0x74,
|
||||
0x10, 0xc6, 0x24, 0xb1, 0x7f, 0xa5, 0xbf, 0x5f,
|
||||
0xc2, 0xd7, 0x15, 0xa3, 0x1d, 0xe0, 0x15, 0x6b,
|
||||
0x1b, 0x0e, 0x38, 0xba, 0x34, 0xbc, 0x95, 0x47,
|
||||
0x94, 0x40, 0x70, 0xac, 0x99, 0x1f, 0x0b, 0x8e,
|
||||
0x56, 0x93, 0x36, 0x2b, 0x6d, 0x04, 0xe7, 0x95,
|
||||
0x1a, 0x37, 0xda, 0x16, 0x57, 0x99, 0xee, 0x03,
|
||||
0x68, 0x16, 0x31, 0xaa, 0xc3, 0xb7, 0x92, 0x75,
|
||||
0x53, 0xfc, 0xf6, 0x20, 0x55, 0x44, 0xf8, 0xd4,
|
||||
0x8d, 0x78, 0x15, 0xc7, 0x1a, 0xb6, 0xde, 0x6c,
|
||||
0xe8, 0x49, 0x5d, 0xaf, 0xa8, 0x4e, 0x6f, 0x7c,
|
||||
0xe2, 0x6a, 0x4c, 0xd5, 0xe7, 0x8c, 0x8f, 0x0b,
|
||||
0x5d, 0x3a, 0x09, 0xd6, 0xb3, 0x44, 0xab, 0xe0,
|
||||
0x35, 0x52, 0x7c, 0x66, 0x85, 0xa4, 0x40, 0xd7,
|
||||
0x20, 0xec, 0x24, 0x05, 0x06, 0xd9, 0x84, 0x51,
|
||||
0x5a, 0xd2, 0x38, 0xd5, 0x1d, 0xea, 0x70, 0x2a,
|
||||
0x21, 0xe6, 0x82, 0xfd, 0xa4, 0x46, 0x1c, 0x4f,
|
||||
0x59, 0x6e, 0x29, 0x3d, 0xae, 0xb8, 0x8e, 0xee,
|
||||
0x77, 0x1f, 0x15, 0x33, 0xcf, 0x94, 0x1d, 0x87,
|
||||
0x3c, 0x37, 0xc5, 0x89, 0xe8, 0x7d, 0x85, 0xb3,
|
||||
0xbc, 0xe8, 0x62, 0x6a, 0x84, 0x7f, 0xfe, 0x9a,
|
||||
0x85, 0x3f, 0x39, 0xe8, 0xaa, 0x16, 0xa6, 0x8f,
|
||||
0x87, 0x7f, 0xcb, 0xc1, 0xd6, 0xf2, 0xec, 0x2b,
|
||||
0xa7, 0xdd, 0x49, 0x98, 0x7b, 0x6f, 0xdd, 0x69,
|
||||
0x6d, 0x02, 0x03, 0x01, 0x00, 0x01 };
|
||||
|
||||
DeviceFeatures global_features;
|
||||
|
||||
void DeviceFeatures::Initialize(bool is_cast_receiver, bool force_load_test_keybox) {
|
||||
@@ -1364,7 +1126,8 @@ class Session {
|
||||
int status = RSA_public_encrypt(session_key.size(), &session_key[0],
|
||||
&(enc_session_key->front()), public_rsa_,
|
||||
RSA_PKCS1_OAEP_PADDING);
|
||||
if (static_cast<unsigned>(status) != RSA_size(public_rsa_)) {
|
||||
int size = static_cast<int>(RSA_size(public_rsa_));
|
||||
if (status != size) {
|
||||
cout << "GenerateRSASessionKey error encrypting session key. ";
|
||||
dump_openssl_error();
|
||||
return false;
|
||||
@@ -1403,16 +1166,17 @@ class Session {
|
||||
size_t length = 0;
|
||||
OEMCryptoResult sts = OEMCrypto_ReportUsage(
|
||||
session_id(), reinterpret_cast<const uint8_t*>(pst.c_str()),
|
||||
pst.length(), &pst_report_.report, &length);
|
||||
pst.length(), pst_report(), &length);
|
||||
if (expect_success) {
|
||||
ASSERT_EQ(OEMCrypto_ERROR_SHORT_BUFFER, sts);
|
||||
}
|
||||
if (sts == OEMCrypto_ERROR_SHORT_BUFFER) {
|
||||
ASSERT_GE(sizeof(PaddedPSTReport), length);
|
||||
ASSERT_LE(sizeof(OEMCrypto_PST_Report), length);
|
||||
pst_report_buffer_.resize(length);
|
||||
}
|
||||
sts = OEMCrypto_ReportUsage(session_id(),
|
||||
reinterpret_cast<const uint8_t*>(pst.c_str()),
|
||||
pst.length(), &pst_report_.report, &length);
|
||||
pst.length(), pst_report(), &length);
|
||||
if (!expect_success) {
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
return;
|
||||
@@ -1421,16 +1185,19 @@ class Session {
|
||||
vector<uint8_t> computed_signature(SHA_DIGEST_LENGTH);
|
||||
unsigned int sig_len = SHA_DIGEST_LENGTH;
|
||||
HMAC(EVP_sha1(), &mac_key_client_[0], mac_key_client_.size(),
|
||||
reinterpret_cast<uint8_t*>(&pst_report_.report) + SHA_DIGEST_LENGTH,
|
||||
reinterpret_cast<uint8_t*>(pst_report()) + SHA_DIGEST_LENGTH,
|
||||
length - SHA_DIGEST_LENGTH, &computed_signature[0], &sig_len);
|
||||
EXPECT_EQ(0, memcmp(&computed_signature[0], pst_report_.report.signature,
|
||||
EXPECT_EQ(0, memcmp(&computed_signature[0], pst_report()->signature,
|
||||
SHA_DIGEST_LENGTH));
|
||||
EXPECT_GE(kInactive, pst_report_.report.status);
|
||||
EXPECT_GE(kHardwareSecureClock, pst_report_.report.clock_security_level);
|
||||
EXPECT_EQ(pst.length(), pst_report_.report.pst_length);
|
||||
EXPECT_EQ(0, memcmp(pst.c_str(), pst_report_.report.pst, pst.length()));
|
||||
EXPECT_GE(kInactive, pst_report()->status);
|
||||
EXPECT_GE(kHardwareSecureClock, pst_report()->clock_security_level);
|
||||
EXPECT_EQ(pst.length(), pst_report()->pst_length);
|
||||
EXPECT_EQ(0, memcmp(pst.c_str(), pst_report()->pst, pst.length()));
|
||||
}
|
||||
|
||||
OEMCrypto_PST_Report* pst_report() {
|
||||
return reinterpret_cast<OEMCrypto_PST_Report*>(&pst_report_buffer_[0]);
|
||||
}
|
||||
OEMCrypto_PST_Report* pst_report() { return &pst_report_.report; }
|
||||
|
||||
void DeleteEntry(const std::string& pst) {
|
||||
uint8_t* pst_ptr = encrypted_license_.pst;
|
||||
@@ -1465,7 +1232,7 @@ class Session {
|
||||
vector<uint8_t> enc_key_;
|
||||
uint32_t nonce_;
|
||||
RSA* public_rsa_;
|
||||
PaddedPSTReport pst_report_;
|
||||
vector<uint8_t> pst_report_buffer_;
|
||||
MessageData license_;
|
||||
MessageData encrypted_license_;
|
||||
OEMCrypto_KeyObject key_array_[kNumKeys];
|
||||
@@ -2445,7 +2212,6 @@ INSTANTIATE_TEST_CASE_P(TestRefreshEachKeys, SessionTestRefreshKeyTest,
|
||||
// Decrypt Tests
|
||||
//
|
||||
TEST_F(OEMCryptoSessionTests, Decrypt) {
|
||||
OEMCryptoResult sts;
|
||||
Session s;
|
||||
s.open();
|
||||
|
||||
@@ -2526,7 +2292,6 @@ TEST_F(OEMCryptoSessionTests, DecryptPerformance) {
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoSessionTests, DecryptZeroDuration) {
|
||||
OEMCryptoResult sts;
|
||||
Session s;
|
||||
s.open();
|
||||
|
||||
@@ -2592,9 +2357,9 @@ class OEMCryptoSessionTestsDecryptEdgeCases : public OEMCryptoSessionTests {
|
||||
s.FillSimpleMessage(kDuration, 0, 0);
|
||||
s.EncryptAndSign();
|
||||
s.LoadTestKeys();
|
||||
// Select the key (from FillSimpleMessage)
|
||||
vector<uint8_t> keyId = wvcdm::a2b_hex("000000000000000000000000");
|
||||
sts = OEMCrypto_SelectKey(s.session_id(), &keyId[0], keyId.size());
|
||||
sts = OEMCrypto_SelectKey(s.session_id(),
|
||||
s.license().keys[0].key_id,
|
||||
s.license().keys[0].key_id_length);
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
|
||||
|
||||
// We decrypt three subsamples. each with a block offset.
|
||||
@@ -2797,7 +2562,6 @@ TEST_F(OEMCryptoSessionTests, DecryptUnencryptedNoKey) {
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoSessionTests, DecryptSecureToClear) {
|
||||
OEMCryptoResult sts;
|
||||
Session s;
|
||||
s.open();
|
||||
s.GenerateTestSessionKeys();
|
||||
@@ -2809,7 +2573,6 @@ TEST_F(OEMCryptoSessionTests, DecryptSecureToClear) {
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoSessionTests, KeyDuration) {
|
||||
OEMCryptoResult sts;
|
||||
Session s;
|
||||
s.open();
|
||||
s.GenerateTestSessionKeys();
|
||||
@@ -2846,7 +2609,8 @@ class OEMCryptoLoadsCertificate : public OEMCryptoSessionTestKeyboxTest {
|
||||
s.RewrapRSAKey(encrypted, signature, wrapped_key, force);
|
||||
// Verify that the clear key is not contained in the wrapped key.
|
||||
// It should be encrypted.
|
||||
ASSERT_EQ(NULL, find(*wrapped_key, encoded_rsa_key_)); }
|
||||
ASSERT_EQ(NULL, find(*wrapped_key, encoded_rsa_key_));
|
||||
}
|
||||
|
||||
std::vector<uint8_t> encoded_rsa_key_;
|
||||
};
|
||||
@@ -4622,7 +4386,6 @@ TEST_F(GenericCryptoTest, KeyDurationDecrypt) {
|
||||
}
|
||||
|
||||
TEST_F(GenericCryptoTest, KeyDurationSign) {
|
||||
OEMCryptoResult sts;
|
||||
EncryptAndLoadKeys();
|
||||
|
||||
unsigned int key_index = 2;
|
||||
@@ -4655,7 +4418,6 @@ TEST_F(GenericCryptoTest, KeyDurationSign) {
|
||||
}
|
||||
|
||||
TEST_F(GenericCryptoTest, KeyDurationVerify) {
|
||||
OEMCryptoResult sts;
|
||||
EncryptAndLoadKeys();
|
||||
|
||||
unsigned int key_index = 3;
|
||||
@@ -4692,10 +4454,20 @@ class GenericCryptoKeyIdLengthTest : public GenericCryptoTest {
|
||||
session_.FillSimpleMessage(kDuration, wvoec_mock::kControlAllowDecrypt,
|
||||
kNoNonce);
|
||||
// We are testing that the key ids do not have to have the same length.
|
||||
session_.SetKeyId(0, "123456789012"); // 12 bytes (default key id length).
|
||||
session_.SetKeyId(0, "123456789012"); // 12 bytes (common key id length).
|
||||
session_.SetKeyId(1, "12345"); // short key id.
|
||||
session_.SetKeyId(2, "123456789012-very-long-key-id");
|
||||
ASSERT_EQ(2, kLongKeyId);
|
||||
session_.SetKeyId(2, "1234567890123456"); // 16 byte key id. (default)
|
||||
session_.SetKeyId(3, "12345678901234"); // 14 byte. (uncommon)
|
||||
ASSERT_EQ(2u, kLongKeyId);
|
||||
}
|
||||
|
||||
// Make all four keys have the same length.
|
||||
void SetUniformKeyIdLength(size_t key_id_length) {
|
||||
for(unsigned int i = 0; i < 4; i++) {
|
||||
string key_id;
|
||||
key_id.resize(key_id_length, i + 'a');
|
||||
session_.SetKeyId(i, key_id);
|
||||
}
|
||||
}
|
||||
|
||||
void TestWithKey(unsigned int key_index) {
|
||||
@@ -4738,6 +4510,16 @@ TEST_F(GenericCryptoKeyIdLengthTest, LongKeyId) {
|
||||
TestWithKey(2);
|
||||
}
|
||||
|
||||
TEST_F(GenericCryptoKeyIdLengthTest, UniformShortKeyId) {
|
||||
SetUniformKeyIdLength(5);
|
||||
TestWithKey(2);
|
||||
}
|
||||
|
||||
TEST_F(GenericCryptoKeyIdLengthTest, UniformLongKeyId) {
|
||||
SetUniformKeyIdLength(kTestKeyIdMaxLength);
|
||||
TestWithKey(2);
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoClientTest, UpdateUsageTableTest) {
|
||||
EXPECT_EQ(OEMCrypto_SUCCESS, OEMCrypto_UpdateUsageTable());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user