mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Merge branch 'master' of github.com:FreeRDP/FreeRDP
This commit is contained in:
@@ -143,7 +143,7 @@ FREERDP_API int crypto_rsa_private_decrypt(const BYTE* input, int length, UINT32
|
||||
FREERDP_API void crypto_reverse(BYTE* data, int length);
|
||||
FREERDP_API void crypto_nonce(BYTE* nonce, int size);
|
||||
|
||||
FREERDP_API char* crypto_base64_encode(BYTE* data, int length);
|
||||
FREERDP_API void crypto_base64_decode(BYTE* enc_data, int length, BYTE** dec_data, int* res_length);
|
||||
FREERDP_API char* crypto_base64_encode(const BYTE* data, int length);
|
||||
FREERDP_API void crypto_base64_decode(const BYTE* enc_data, int length, BYTE** dec_data, int* res_length);
|
||||
|
||||
#endif /* FREERDP_CRYPTO_H */
|
||||
|
||||
@@ -717,13 +717,7 @@ void key_free(rdpRsaKey* key)
|
||||
|
||||
rdpCertificate* certificate_new()
|
||||
{
|
||||
rdpCertificate* certificate;
|
||||
|
||||
certificate = (rdpCertificate*) calloc(1, sizeof(rdpCertificate));
|
||||
if (!certificate)
|
||||
return NULL;
|
||||
|
||||
return certificate;
|
||||
return (rdpCertificate*) calloc(1, sizeof(rdpCertificate));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -982,37 +982,31 @@ BOOL gcc_read_server_security_data(wStream* s, rdpMcs* mcs)
|
||||
if (Stream_GetRemainingLength(s) < settings->ServerRandomLength + settings->ServerCertificateLength)
|
||||
return FALSE;
|
||||
|
||||
if (settings->ServerRandomLength > 0)
|
||||
{
|
||||
/* serverRandom */
|
||||
settings->ServerRandom = (BYTE*) malloc(settings->ServerRandomLength);
|
||||
Stream_Read(s, settings->ServerRandom, settings->ServerRandomLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((settings->ServerRandomLength <= 0) || (settings->ServerCertificateLength <= 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (settings->ServerCertificateLength > 0)
|
||||
{
|
||||
/* serverCertificate */
|
||||
settings->ServerCertificate = (BYTE*) malloc(settings->ServerCertificateLength);
|
||||
Stream_Read(s, settings->ServerCertificate, settings->ServerCertificateLength);
|
||||
|
||||
certificate_free(settings->RdpServerCertificate);
|
||||
settings->RdpServerCertificate = certificate_new();
|
||||
data = settings->ServerCertificate;
|
||||
length = settings->ServerCertificateLength;
|
||||
|
||||
if (certificate_read_server_certificate(settings->RdpServerCertificate, data, length) < 1)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* serverRandom */
|
||||
settings->ServerRandom = (BYTE*) malloc(settings->ServerRandomLength);
|
||||
if (!settings->ServerRandom)
|
||||
return FALSE;
|
||||
}
|
||||
Stream_Read(s, settings->ServerRandom, settings->ServerRandomLength);
|
||||
|
||||
return TRUE;
|
||||
|
||||
/* serverCertificate */
|
||||
settings->ServerCertificate = (BYTE*) malloc(settings->ServerCertificateLength);
|
||||
if (!settings->ServerCertificate)
|
||||
return FALSE;
|
||||
Stream_Read(s, settings->ServerCertificate, settings->ServerCertificateLength);
|
||||
|
||||
certificate_free(settings->RdpServerCertificate);
|
||||
settings->RdpServerCertificate = certificate_new();
|
||||
if (!settings->RdpServerCertificate)
|
||||
return FALSE;
|
||||
|
||||
data = settings->ServerCertificate;
|
||||
length = settings->ServerCertificateLength;
|
||||
|
||||
return certificate_read_server_certificate(settings->RdpServerCertificate, data, length);
|
||||
}
|
||||
|
||||
static const BYTE initial_signature[] =
|
||||
|
||||
@@ -27,16 +27,18 @@
|
||||
|
||||
static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
char* crypto_base64_encode(BYTE* data, int length)
|
||||
char* crypto_base64_encode(const BYTE* data, int length)
|
||||
{
|
||||
int c;
|
||||
BYTE* q;
|
||||
const BYTE* q;
|
||||
char* p;
|
||||
char* str;
|
||||
char* ret;
|
||||
int i = 0;
|
||||
|
||||
q = data;
|
||||
p = str = (char*) malloc((length + 3) * 4 / 3 + 1);
|
||||
p = ret = (char*) malloc((length + 3) * 4 / 3 + 1);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
while (i < length)
|
||||
{
|
||||
@@ -68,7 +70,7 @@ char* crypto_base64_encode(BYTE* data, int length)
|
||||
|
||||
*p = 0;
|
||||
|
||||
return str;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int base64_decode_char(char c)
|
||||
@@ -94,7 +96,7 @@ static int base64_decode_char(char c)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void* base64_decode(BYTE* s, int length, int* data_len)
|
||||
static void* base64_decode(const BYTE* s, int length, int* data_len)
|
||||
{
|
||||
char* p;
|
||||
int n[4];
|
||||
@@ -142,7 +144,7 @@ static void* base64_decode(BYTE* s, int length, int* data_len)
|
||||
return data;
|
||||
}
|
||||
|
||||
void crypto_base64_decode(BYTE* enc_data, int length, BYTE** dec_data, int* res_length)
|
||||
void crypto_base64_decode(const BYTE* enc_data, int length, BYTE** dec_data, int* res_length)
|
||||
{
|
||||
*dec_data = base64_decode(enc_data, length, res_length);
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WINPR_API void winpr_HexDump(BYTE* data, int length);
|
||||
WINPR_API void winpr_CArrayDump(BYTE* data, int length, int width);
|
||||
WINPR_API void winpr_HexDump(const BYTE* data, int length);
|
||||
WINPR_API void winpr_CArrayDump(const BYTE* data, int length, int width);
|
||||
|
||||
WINPR_API char* winpr_BinToHexString(BYTE* data, int length, BOOL space);
|
||||
WINPR_API char* winpr_BinToHexString(const BYTE* data, int length, BOOL space);
|
||||
|
||||
WINPR_API int wprintfx(const char *fmt, ...);
|
||||
WINPR_API int wvprintfx(const char *fmt, va_list args);
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
#include "trio.h"
|
||||
|
||||
void winpr_HexDump(BYTE* data, int length)
|
||||
void winpr_HexDump(const BYTE* data, int length)
|
||||
{
|
||||
BYTE* p = data;
|
||||
const BYTE* p = data;
|
||||
int i, line, offset = 0;
|
||||
|
||||
while (offset < length)
|
||||
@@ -60,9 +60,9 @@ void winpr_HexDump(BYTE* data, int length)
|
||||
}
|
||||
}
|
||||
|
||||
void winpr_CArrayDump(BYTE* data, int length, int width)
|
||||
void winpr_CArrayDump(const BYTE* data, int length, int width)
|
||||
{
|
||||
BYTE* p = data;
|
||||
const BYTE* p = data;
|
||||
int i, line, offset = 0;
|
||||
|
||||
while (offset < length)
|
||||
@@ -86,7 +86,7 @@ void winpr_CArrayDump(BYTE* data, int length, int width)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
char* winpr_BinToHexString(BYTE* data, int length, BOOL space)
|
||||
char* winpr_BinToHexString(const BYTE* data, int length, BOOL space)
|
||||
{
|
||||
int i;
|
||||
int n;
|
||||
|
||||
Reference in New Issue
Block a user