libfreerdp-core: enable non-null licensing client random
This commit is contained in:
parent
d2873081ea
commit
0de89ab4c9
@ -40,7 +40,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EXPONENT_MAX_SIZE 4
|
#define EXPONENT_MAX_SIZE 4
|
||||||
#define MODULUS_MAX_SIZE 256
|
|
||||||
|
|
||||||
#include <freerdp/api.h>
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
|
|
||||||
#include "license.h"
|
#include "license.h"
|
||||||
|
|
||||||
#define LICENSE_NULL_RANDOM 1
|
//#define LICENSE_NULL_CLIENT_RANDOM 1
|
||||||
|
#define LICENSE_NULL_PREMASTER_SECRET 1
|
||||||
|
|
||||||
#ifdef WITH_DEBUG_LICENSE
|
#ifdef WITH_DEBUG_LICENSE
|
||||||
|
|
||||||
@ -304,11 +305,14 @@ BOOL license_recv(rdpLicense* license, STREAM* s)
|
|||||||
|
|
||||||
void license_generate_randoms(rdpLicense* license)
|
void license_generate_randoms(rdpLicense* license)
|
||||||
{
|
{
|
||||||
#ifdef LICENSE_NULL_RANDOM
|
|
||||||
ZeroMemory(license->ClientRandom, CLIENT_RANDOM_LENGTH); /* ClientRandom */
|
ZeroMemory(license->ClientRandom, CLIENT_RANDOM_LENGTH); /* ClientRandom */
|
||||||
ZeroMemory(license->PremasterSecret, PREMASTER_SECRET_LENGTH); /* PremasterSecret */
|
ZeroMemory(license->PremasterSecret, PREMASTER_SECRET_LENGTH); /* PremasterSecret */
|
||||||
#else
|
|
||||||
|
#ifndef LICENSE_NULL_CLIENT_RANDOM
|
||||||
crypto_nonce(license->ClientRandom, CLIENT_RANDOM_LENGTH); /* ClientRandom */
|
crypto_nonce(license->ClientRandom, CLIENT_RANDOM_LENGTH); /* ClientRandom */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LICENSE_NULL_PREMASTER_SECRET
|
||||||
crypto_nonce(license->PremasterSecret, PREMASTER_SECRET_LENGTH); /* PremasterSecret */
|
crypto_nonce(license->PremasterSecret, PREMASTER_SECRET_LENGTH); /* PremasterSecret */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -421,24 +425,17 @@ void license_encrypt_premaster_secret(rdpLicense* license)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LICENSE_NULL_RANDOM
|
EncryptedPremasterSecret = (BYTE*) malloc(ModulusLength);
|
||||||
EncryptedPremasterSecret = (BYTE*) malloc(MODULUS_MAX_SIZE);
|
ZeroMemory(EncryptedPremasterSecret, ModulusLength);
|
||||||
ZeroMemory(EncryptedPremasterSecret, MODULUS_MAX_SIZE);
|
|
||||||
|
|
||||||
license->EncryptedPremasterSecret->type = BB_RANDOM_BLOB;
|
|
||||||
license->EncryptedPremasterSecret->length = PREMASTER_SECRET_LENGTH;
|
|
||||||
license->EncryptedPremasterSecret->data = EncryptedPremasterSecret;
|
|
||||||
#else
|
|
||||||
EncryptedPremasterSecret = (BYTE*) malloc(MODULUS_MAX_SIZE);
|
|
||||||
ZeroMemory(EncryptedPremasterSecret, MODULUS_MAX_SIZE);
|
|
||||||
|
|
||||||
|
#ifndef LICENSE_NULL_PREMASTER_SECRET
|
||||||
crypto_rsa_public_encrypt(license->PremasterSecret, PREMASTER_SECRET_LENGTH,
|
crypto_rsa_public_encrypt(license->PremasterSecret, PREMASTER_SECRET_LENGTH,
|
||||||
ModulusLength, Modulus, Exponent, EncryptedPremasterSecret);
|
ModulusLength, Modulus, Exponent, EncryptedPremasterSecret);
|
||||||
|
#endif
|
||||||
|
|
||||||
license->EncryptedPremasterSecret->type = BB_RANDOM_BLOB;
|
license->EncryptedPremasterSecret->type = BB_RANDOM_BLOB;
|
||||||
license->EncryptedPremasterSecret->length = PREMASTER_SECRET_LENGTH;
|
license->EncryptedPremasterSecret->length = PREMASTER_SECRET_LENGTH;
|
||||||
license->EncryptedPremasterSecret->data = EncryptedPremasterSecret;
|
license->EncryptedPremasterSecret->data = EncryptedPremasterSecret;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void license_decrypt_platform_challenge(rdpLicense* license)
|
void license_decrypt_platform_challenge(rdpLicense* license)
|
||||||
|
@ -172,8 +172,8 @@ typedef enum
|
|||||||
struct rdp_license
|
struct rdp_license
|
||||||
{
|
{
|
||||||
LICENSE_STATE state;
|
LICENSE_STATE state;
|
||||||
struct rdp_rdp* rdp;
|
rdpRdp* rdp;
|
||||||
struct rdp_certificate* certificate;
|
rdpCertificate* certificate;
|
||||||
BYTE* Modulus;
|
BYTE* Modulus;
|
||||||
UINT32 ModulusLength;
|
UINT32 ModulusLength;
|
||||||
BYTE Exponent[4];
|
BYTE Exponent[4];
|
||||||
|
Loading…
Reference in New Issue
Block a user