Merge pull request #347 from pjd/pullreq
Use of stream_read() / stream_write()
This commit is contained in:
commit
757e41a0d5
@ -237,24 +237,21 @@ static boolean certificate_process_server_public_key(rdpCertificate* certificate
|
||||
uint32 datalen;
|
||||
uint32 modlen;
|
||||
|
||||
memcpy(magic, s->p, 4);
|
||||
|
||||
stream_read(s, magic, 4);
|
||||
if (memcmp(magic, "RSA1", 4) != 0)
|
||||
{
|
||||
printf("gcc_process_server_public_key: magic error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
stream_seek(s, 4);
|
||||
stream_read_uint32(s, keylen);
|
||||
stream_read_uint32(s, bitlen);
|
||||
stream_read_uint32(s, datalen);
|
||||
memcpy(certificate->cert_info.exponent, s->p, 4);
|
||||
stream_seek(s, 4);
|
||||
stream_read(s, certificate->cert_info.exponent, 4);
|
||||
modlen = keylen - 8;
|
||||
freerdp_blob_alloc(&(certificate->cert_info.modulus), modlen);
|
||||
memcpy(certificate->cert_info.modulus.data, s->p, modlen);
|
||||
stream_seek(s, keylen);
|
||||
stream_read(s, certificate->cert_info.modulus.data, modlen);
|
||||
stream_seek(s, 8);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -219,8 +219,7 @@ static boolean rdp_establish_keys(rdpRdp* rdp)
|
||||
stream_write_uint32(s, 1); /* SEC_CLIENT_RANDOM */
|
||||
length = key_len + 8;
|
||||
stream_write_uint32(s, length);
|
||||
memcpy(s->p, crypt_client_random, length);
|
||||
stream_seek(s, length);
|
||||
stream_write(s, crypt_client_random, length);
|
||||
if (transport_write(rdp->mcs->transport, s) < 0)
|
||||
{
|
||||
return false;
|
||||
|
@ -797,8 +797,7 @@ boolean gcc_read_server_security_data(STREAM* s, rdpSettings *settings)
|
||||
{
|
||||
/* serverRandom */
|
||||
freerdp_blob_alloc(settings->server_random, serverRandomLen);
|
||||
memcpy(settings->server_random->data, s->p, serverRandomLen);
|
||||
stream_seek(s, serverRandomLen);
|
||||
stream_read(s, settings->server_random->data, serverRandomLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -809,8 +808,7 @@ boolean gcc_read_server_security_data(STREAM* s, rdpSettings *settings)
|
||||
{
|
||||
/* serverCertificate */
|
||||
freerdp_blob_alloc(settings->server_certificate, serverCertLen);
|
||||
memcpy(settings->server_certificate->data, s->p, serverCertLen);
|
||||
stream_seek(s, serverCertLen);
|
||||
stream_read(s, settings->server_certificate->data, serverCertLen);
|
||||
certificate_free(settings->server_cert);
|
||||
settings->server_cert = certificate_new();
|
||||
data = settings->server_certificate->data;
|
||||
|
@ -347,8 +347,17 @@ boolean security_establish_keys(uint8* client_random, rdpRdp* rdp)
|
||||
|
||||
memcpy(rdp->sign_key, session_key_blob, 16);
|
||||
|
||||
security_md5_16_32_32(&session_key_blob[16], client_random, server_random, rdp->decrypt_key);
|
||||
security_md5_16_32_32(&session_key_blob[32], client_random, server_random, rdp->encrypt_key);
|
||||
if (rdp->settings->server_mode) {
|
||||
security_md5_16_32_32(&session_key_blob[16], client_random,
|
||||
server_random, rdp->encrypt_key);
|
||||
security_md5_16_32_32(&session_key_blob[32], client_random,
|
||||
server_random, rdp->decrypt_key);
|
||||
} else {
|
||||
security_md5_16_32_32(&session_key_blob[16], client_random,
|
||||
server_random, rdp->decrypt_key);
|
||||
security_md5_16_32_32(&session_key_blob[32], client_random,
|
||||
server_random, rdp->encrypt_key);
|
||||
}
|
||||
|
||||
if (settings->encryption_method == 1) /* 40 and 56 bit */
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user