Refactor OpenSSL usage into a platform-specific file to allow other crypto backends

This commit is contained in:
Cameron Gutman
2021-04-17 17:47:53 -05:00
parent 5782246b30
commit d62ee951a0
6 changed files with 279 additions and 210 deletions

View File

@@ -1,7 +1,5 @@
#include "Limelight-internal.h"
#include <openssl/rand.h>
#define STUN_RECV_TIMEOUT_SEC 3
#define STUN_MESSAGE_BINDING_REQUEST 0x0001
@@ -85,7 +83,7 @@ int LiFindExternalAddressIP4(const char* stunServer, unsigned short stunPort, un
reqMsg.messageType = htons(STUN_MESSAGE_BINDING_REQUEST);
reqMsg.messageLength = 0;
reqMsg.magicCookie = htonl(STUN_MESSAGE_COOKIE);
RAND_bytes(reqMsg.transactionId, sizeof(reqMsg.transactionId));
PltGenerateRandomData(reqMsg.transactionId, sizeof(reqMsg.transactionId));
bytesRead = SOCKET_ERROR;
for (i = 0; i < STUN_RECV_TIMEOUT_SEC * 1000 / UDP_RECV_POLL_TIMEOUT_MS && bytesRead <= 0; i++) {