cunit: added more test data to licensing unit test

This commit is contained in:
Marc-André Moreau
2011-07-13 12:17:38 -04:00
parent 5659f3b901
commit 9ce4ec492a
3 changed files with 57 additions and 10 deletions

View File

@@ -236,16 +236,37 @@ uint8 client_platform_challenge_response[66] =
"\x00\x0a";
uint8 client_random[32] =
"\xdc\x73\xa0\xc8\x69\x25\x6b\x18"
"\xaf\x0b\x94\x7a\xa9\xa5\x20\xaf"
"\x8b\xbc\x0d\xcc\xa3\x95\xb7\xb9"
"\xeb\x81\x5d\xbe\x0a\x10\x9c\xd8";
"\xdc\x73\xa0\xc8\x69\x25\x6b\x18\xaf\x0b\x94\x7a\xa9\xa5\x20\xaf"
"\x8b\xbc\x0d\xcc\xa3\x95\xb7\xb9\xeb\x81\x5d\xbe\x0a\x10\x9c\xd8";
uint8 server_random[32] =
"\x84\xef\xae\x20\xb1\xd5\x9e\x36\x49\x1a\xe8\x2e\x0a\x99\x89\xac"
"\x49\xa6\x47\x4f\x33\x9b\x5a\xb9\x95\x03\xa6\xc6\xc2\x3c\x3f\x61";
uint8 premaster_secret[48] =
"\xcf\x7a\xdb\xcb\xfb\x0e\x15\x23\x87\x1c\x84\x81\xba\x9d\x4e\x15"
"\xbb\xd2\x56\xbd\xd8\xf7\xf3\x16\xcc\x35\x3b\xe1\x93\x42\x78\xdd"
"\x92\x9a\xe4\x7a\xe2\x99\xd4\x73\xb1\xaa\x6f\x55\x94\x3b\xc9\xbc";
uint8 encrypted_premaster_secret[264] =
"\xda\x9c\x5d\xa6\x68\x9d\xa3\x90\x67\x24\xf3\x3a\xea\xa1\xe2\x68"
"\xad\x12\xf5\xf6\x0b\x7a\xac\x92\xb1\x69\x6f\x42\x55\x8a\xa0\xe2"
"\x9b\x2c\xd0\xc7\xee\x33\x6c\x47\x79\xc3\x1e\xbf\x03\x8b\x95\x70"
"\x07\xa2\xbe\xee\x54\x02\x68\xf8\x90\xd7\xfe\x2c\x08\xe1\x6b\x2d"
"\xff\x94\x76\x72\x5f\x7a\x76\x75\x32\x55\xcc\x58\x61\x63\xa5\x64"
"\xf1\x6e\xc3\x07\x81\x82\x6f\x88\x73\x62\xfc\x28\x65\x91\xc2\xc8"
"\x9f\x05\xb0\xd3\x93\x12\xbf\x6a\x50\x18\x99\x2d\x4d\xc4\x7f\x74"
"\xd3\x30\x9f\x16\x78\xa5\xdf\xaa\x83\x65\x4f\x77\x30\x42\xe0\xd7"
"\x69\xc8\x4d\xa5\x73\x11\x59\x35\xb9\xa7\xe2\xb0\xf6\xe3\xb9\x39"
"\xc3\xd4\xe4\x6b\xca\x40\x9a\xac\x66\xe6\x1a\xa4\x1b\x39\x7e\x09"
"\xe3\x72\x99\xdd\x90\x62\x55\x97\xa9\x04\xc7\x51\xaa\xa2\x01\xcb"
"\x5a\x63\x4d\x1a\xe5\x99\xc3\xb1\x2a\x73\xe8\x9a\x00\x46\x92\x59"
"\x39\xa3\x80\xa1\xac\x90\x52\xea\x63\x81\x49\x7d\xf3\x2d\x5c\xc3"
"\x19\x9f\xed\xfe\x81\x1d\x8c\x04\x1c\xd9\x23\xd2\x6d\x80\x84\xf3"
"\x00\xf2\xb1\x69\x2f\xcd\xb3\x9f\x69\xee\x60\x3e\x4b\xb5\xbe\x5a"
"\x09\x83\x0b\xbc\x3d\x3e\x05\x47\x65\x96\x31\x8c\x6b\xc5\xe6\xa0"
"\x00\x00\x00\x00\x00\x00\x00\x00";
void test_license(void)
{
STREAM* s;
@@ -259,5 +280,32 @@ void test_license(void)
license_read_license_request_packet(license, s);
/* the encrypted premaster secret is 256 bytes long, with 8 bytes of padding */
printf("\n");
printf("client random:\n");
freerdp_hexdump(license->client_random, 32);
printf("\n");
printf("server random:\n");
freerdp_hexdump(license->server_random, 32);
printf("\n");
printf("premaster secret:\n");
freerdp_hexdump(license->premaster_secret, 48);
printf("\n");
printf("master secret:\n");
freerdp_hexdump(license->master_secret, 48);
printf("\n");
printf("session key blob:\n");
freerdp_hexdump(license->session_key_blob, 48);
printf("\n");
/* the encrypted premaster secret is 256 + 8 bytes long, with 8 bytes of padding */
printf("encrypted premaster secret:\n");
freerdp_hexdump(license->encrypted_pre_master_secret->data,
license->encrypted_pre_master_secret->length);
printf("\n");
}

View File

@@ -166,15 +166,13 @@ void license_generate_keys(rdpLicense* license)
/* EncryptedPremasterSecret */
license->encrypted_pre_master_secret->length = 72;
license->encrypted_pre_master_secret->type = BB_ANY_BLOB;
license->encrypted_pre_master_secret->data = (uint8*) xzalloc(72);
license->encrypted_pre_master_secret->length = RSA_MAX_KEY_LENGTH + 8;
license->encrypted_pre_master_secret->data = (uint8*) xzalloc(RSA_MAX_KEY_LENGTH + 8);
#if 0
crypto_rsa(PREMASTER_SECRET_LENGTH, license->premaster_secret, license->encrypted_pre_master_secret->data,
crypto_rsa(RSA_MAX_KEY_LENGTH, license->premaster_secret, license->encrypted_pre_master_secret->data,
license->certificate->cert_info.modulus.length, license->certificate->cert_info.modulus.data,
license->certificate->cert_info.exponent);
#endif
}
/**

View File

@@ -58,6 +58,7 @@ typedef struct rdp_license rdpLicense;
#define HWID_PLATFORM_ID_LENGTH 4
#define HWID_UNIQUE_DATA_LENGTH 16
#define HWID_LENGTH 20
#define RSA_MAX_KEY_LENGTH 256
/* Licensing Preamble Flags */
#define PREAMBLE_VERSION_2_0 0x02