Silence "sec_process_crypt_info(), failed to parse crypt info" msgs

If sec_parse_crypt_info returns false, it's not always a problem with
parsing the crypt info. It could very well be that Enhanced RDP
Security is used, which would trigger a false return value from the
function.

This commit adds new log messages to sec_parse_crypt_info for cases it
would return false and removes the incorrect catch-all message from
the caller.
This commit is contained in:
Karl Mikaelsson 2017-03-31 17:19:36 +02:00
parent 1aaafc80c0
commit a27c0ac4c8

View File

@ -557,6 +557,7 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
if (crypt_level == 0) if (crypt_level == 0)
{ {
/* no encryption */ /* no encryption */
logger(Protocol, Debug, "sec_parse_crypt_info(), got ENCRYPTION_LEVEL_NONE");
return False; return False;
} }
@ -575,7 +576,10 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
/* RSA info */ /* RSA info */
end = s->p + rsa_info_len; end = s->p + rsa_info_len;
if (end > s->end) if (end > s->end)
{
logger(Protocol, Error, "sec_parse_crypt_info(), end > s->end");
return False; return False;
}
in_uint32_le(s, flags); /* 1 = RDP4-style, 0x80000002 = X.509 */ in_uint32_le(s, flags); /* 1 = RDP4-style, 0x80000002 = X.509 */
if (flags & 1) if (flags & 1)
@ -595,7 +599,11 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
{ {
case SEC_TAG_PUBKEY: case SEC_TAG_PUBKEY:
if (!sec_parse_public_key(s, modulus, exponent)) if (!sec_parse_public_key(s, modulus, exponent))
{
logger(Protocol, Error,
"sec_parse_crypt_info(), invalid public key");
return False; return False;
}
logger(Protocol, Debug, logger(Protocol, Debug,
"sec_parse_crypt_info(), got public key"); "sec_parse_crypt_info(), got public key");
@ -603,7 +611,11 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
case SEC_TAG_KEYSIG: case SEC_TAG_KEYSIG:
if (!sec_parse_public_sig(s, length, modulus, exponent)) if (!sec_parse_public_sig(s, length, modulus, exponent))
{
logger(Protocol, Error,
"sec_parse_crypt_info(), invalid public sig");
return False; return False;
}
break; break;
default: default:
@ -727,10 +739,7 @@ sec_process_crypt_info(STREAM s)
memset(modulus, 0, sizeof(modulus)); memset(modulus, 0, sizeof(modulus));
memset(exponent, 0, sizeof(exponent)); memset(exponent, 0, sizeof(exponent));
if (!sec_parse_crypt_info(s, &rc4_key_size, &server_random, modulus, exponent)) if (!sec_parse_crypt_info(s, &rc4_key_size, &server_random, modulus, exponent))
{
logger(Protocol, Error, "sec_process_crypt_info(), failed to parse crypt info");
return; return;
}
logger(Protocol, Debug, "sec_parse_crypt_info(), generating client random"); logger(Protocol, Debug, "sec_parse_crypt_info(), generating client random");
generate_random(g_client_random); generate_random(g_client_random);