Fixed use fo crypto_rsa_public_encrypt in license module

This commit is contained in:
akallabeth 2021-04-15 15:55:43 +02:00 committed by akallabeth
parent d4ebf8546f
commit c10a030ec6

View File

@ -747,9 +747,14 @@ BOOL license_encrypt_premaster_secret(rdpLicense* license)
license->EncryptedPremasterSecret->type = BB_RANDOM_BLOB;
license->EncryptedPremasterSecret->length = PREMASTER_SECRET_LENGTH;
#ifndef LICENSE_NULL_PREMASTER_SECRET
license->EncryptedPremasterSecret->length = crypto_rsa_public_encrypt(
license->PremasterSecret, PREMASTER_SECRET_LENGTH, license->ModulusLength, license->Modulus,
license->Exponent, EncryptedPremasterSecret);
{
SSIZE_T length = crypto_rsa_public_encrypt(
license->PremasterSecret, PREMASTER_SECRET_LENGTH, license->ModulusLength,
license->Modulus, license->Exponent, EncryptedPremasterSecret);
if ((length < 0) || (length > UINT16_MAX))
return FALSE;
license->EncryptedPremasterSecret->length = (UINT16)length;
}
#endif
license->EncryptedPremasterSecret->data = EncryptedPremasterSecret;
return TRUE;