mirror of https://github.com/FreeRDP/FreeRDP
Unified random functions and remaining MD5.
This commit is contained in:
parent
6e8ea34f06
commit
4ca6b9bf10
|
@ -22,16 +22,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/crypto.h>
|
||||||
#include <winpr/print.h>
|
#include <winpr/print.h>
|
||||||
#include <winpr/windows.h>
|
#include <winpr/windows.h>
|
||||||
|
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/md5.h>
|
|
||||||
#include <openssl/rc4.h>
|
|
||||||
#include <openssl/sha.h>
|
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/aes.h>
|
#include <openssl/aes.h>
|
||||||
#include <openssl/rand.h>
|
|
||||||
#include <openssl/engine.h>
|
#include <openssl/engine.h>
|
||||||
|
|
||||||
#include <freerdp/log.h>
|
#include <freerdp/log.h>
|
||||||
|
@ -523,7 +520,7 @@ char* freerdp_assistance_generate_pass_stub(DWORD flags)
|
||||||
* Example: WB^6HsrIaFmEpi
|
* Example: WB^6HsrIaFmEpi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RAND_bytes((BYTE*) nums, sizeof(nums));
|
winpr_RAND((BYTE*) nums, sizeof(nums));
|
||||||
|
|
||||||
passStub[0] = set1[nums[0] % sizeof(set1)]; /* character 0 */
|
passStub[0] = set1[nums[0] % sizeof(set1)]; /* character 0 */
|
||||||
passStub[1] = set2[nums[1] % sizeof(set2)]; /* character 1 */
|
passStub[1] = set2[nums[1] % sizeof(set2)]; /* character 1 */
|
||||||
|
@ -547,7 +544,7 @@ char* freerdp_assistance_generate_pass_stub(DWORD flags)
|
||||||
BYTE* freerdp_assistance_encrypt_pass_stub(const char* password, const char* passStub, int* pEncryptedSize)
|
BYTE* freerdp_assistance_encrypt_pass_stub(const char* password, const char* passStub, int* pEncryptedSize)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
MD5_CTX md5Ctx;
|
WINPR_MD5_CTX md5Ctx;
|
||||||
int cbPasswordW;
|
int cbPasswordW;
|
||||||
int cbPassStubW;
|
int cbPassStubW;
|
||||||
int EncryptedSize;
|
int EncryptedSize;
|
||||||
|
@ -565,14 +562,29 @@ BYTE* freerdp_assistance_encrypt_pass_stub(const char* password, const char* pas
|
||||||
|
|
||||||
cbPasswordW = (status - 1) * 2;
|
cbPasswordW = (status - 1) * 2;
|
||||||
|
|
||||||
MD5_Init(&md5Ctx);
|
if (!winpr_MD5_Init(&md5Ctx))
|
||||||
MD5_Update(&md5Ctx, PasswordW, cbPasswordW);
|
{
|
||||||
MD5_Final((void*) PasswordHash, &md5Ctx);
|
free (PasswordW);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!winpr_MD5_Update(&md5Ctx, (BYTE*)PasswordW, cbPasswordW))
|
||||||
|
{
|
||||||
|
free (PasswordW);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!winpr_MD5_Final(&md5Ctx, (BYTE*) PasswordHash))
|
||||||
|
{
|
||||||
|
free (PasswordW);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
status = ConvertToUnicode(CP_UTF8, 0, passStub, -1, &PassStubW, 0);
|
status = ConvertToUnicode(CP_UTF8, 0, passStub, -1, &PassStubW, 0);
|
||||||
|
|
||||||
if (status <= 0)
|
if (status <= 0)
|
||||||
|
{
|
||||||
|
free (PasswordW);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cbPassStubW = (status - 1) * 2;
|
cbPassStubW = (status - 1) * 2;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crypto.h>
|
||||||
|
|
||||||
#include "autodetect.h"
|
#include "autodetect.h"
|
||||||
|
|
||||||
#define RDP_RTT_REQUEST_TYPE_CONTINUOUS 0x0001
|
#define RDP_RTT_REQUEST_TYPE_CONTINUOUS 0x0001
|
||||||
|
@ -173,7 +175,7 @@ BOOL autodetect_send_bandwidth_measure_payload(rdpContext* context, UINT16 paylo
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RAND_bytes(buffer, payloadLength);
|
winpr_RAND(buffer, payloadLength);
|
||||||
Stream_Write(s, buffer, payloadLength);
|
Stream_Write(s, buffer, payloadLength);
|
||||||
|
|
||||||
bResult = rdp_send_message_channel_pdu(context->rdp, s, SEC_AUTODETECT_REQ);
|
bResult = rdp_send_message_channel_pdu(context->rdp, s, SEC_AUTODETECT_REQ);
|
||||||
|
@ -225,7 +227,7 @@ static BOOL autodetect_send_bandwidth_measure_stop(rdpContext* context, UINT16 p
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RAND_bytes(buffer, payloadLength);
|
winpr_RAND(buffer, payloadLength);
|
||||||
Stream_Write(s, buffer, payloadLength);
|
Stream_Write(s, buffer, payloadLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
#include <winpr/dsparse.h>
|
#include <winpr/dsparse.h>
|
||||||
#include <winpr/winhttp.h>
|
#include <winpr/winhttp.h>
|
||||||
|
|
||||||
#include <openssl/rand.h>
|
|
||||||
|
|
||||||
#define TAG FREERDP_TAG("core.gateway.ntlm")
|
#define TAG FREERDP_TAG("core.gateway.ntlm")
|
||||||
|
|
||||||
wStream* rpc_ntlm_http_request(rdpRpc* rpc, HttpContext* http, const char* method, int contentLength, SecBuffer* ntlmToken)
|
wStream* rpc_ntlm_http_request(rdpRpc* rpc, HttpContext* http, const char* method, int contentLength, SecBuffer* ntlmToken)
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <winpr/dsparse.h>
|
#include <winpr/dsparse.h>
|
||||||
|
|
||||||
#include <freerdp/log.h>
|
#include <freerdp/log.h>
|
||||||
#include <openssl/rand.h>
|
|
||||||
|
|
||||||
#include "http.h"
|
#include "http.h"
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include <freerdp/log.h>
|
#include <freerdp/log.h>
|
||||||
|
|
||||||
#include <openssl/rand.h>
|
|
||||||
#include <openssl/bio.h>
|
#include <openssl/bio.h>
|
||||||
|
|
||||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/crypto.h>
|
||||||
#include <winpr/winhttp.h>
|
#include <winpr/winhttp.h>
|
||||||
|
|
||||||
#include <freerdp/log.h>
|
#include <freerdp/log.h>
|
||||||
|
@ -422,7 +423,7 @@ int rts_ping_traffic_sent_notify_command_write(BYTE* buffer, UINT32 PingTrafficS
|
||||||
|
|
||||||
void rts_generate_cookie(BYTE* cookie)
|
void rts_generate_cookie(BYTE* cookie)
|
||||||
{
|
{
|
||||||
RAND_pseudo_bytes(cookie, 16);
|
winpr_RAND(cookie, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CONN/A Sequence */
|
/* CONN/A Sequence */
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/crypto.h>
|
||||||
|
|
||||||
#include <freerdp/log.h>
|
#include <freerdp/log.h>
|
||||||
#include <freerdp/crypto/crypto.h>
|
#include <freerdp/crypto/crypto.h>
|
||||||
|
@ -290,7 +291,7 @@ void crypto_reverse(BYTE* data, int length)
|
||||||
|
|
||||||
void crypto_nonce(BYTE* nonce, int size)
|
void crypto_nonce(BYTE* nonce, int size)
|
||||||
{
|
{
|
||||||
RAND_bytes((void*) nonce, size);
|
winpr_RAND((void*) nonce, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* crypto_cert_fingerprint(X509* xcert)
|
char* crypto_cert_fingerprint(X509* xcert)
|
||||||
|
|
Loading…
Reference in New Issue