main #6
@ -1591,9 +1591,13 @@ namespace WebSocketWrapper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// TODO: SHA1
|
std::vector<uint8_t> result(SHA_DIGEST_LENGTH, 0);
|
||||||
kinc_log(KINC_LOG_LEVEL_WARNING, "WebSocket: SHA1 not implemented for this platform");
|
SHA1(reinterpret_cast<const unsigned char*>(data.data()),
|
||||||
return std::vector<uint8_t>(20, 0);
|
data.size(), result.data());
|
||||||
|
#ifdef DEBUG_NETWORK
|
||||||
|
kinc_log(KINC_LOG_LEVEL_INFO, "WebSocket: SHA1 hash computed successfully");
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1666,12 +1670,24 @@ namespace WebSocketWrapper {
|
|||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
if (ssl_initialized_) {
|
ssl_socket_ = sock;
|
||||||
return true;
|
|
||||||
|
if (!initWSL()) {
|
||||||
|
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: Failed to initialize SSL context");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
// TODO: OpenSSL
|
|
||||||
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: SSL not supported on this platform");
|
if (!performWSLHandshake(sock, host)) {
|
||||||
return false;
|
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: SSL handshake failed");
|
||||||
|
cleanupWSL();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssl_initialized_ = true;
|
||||||
|
#ifdef DEBUG_NETWORK
|
||||||
|
kinc_log(KINC_LOG_LEVEL_INFO, "WebSocket: SSL/TLS initialized successfully");
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: SSL not compiled in");
|
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: SSL not compiled in");
|
||||||
|
|||||||
36
kfile.js
36
kfile.js
@ -140,16 +140,27 @@ if (flags.with_rtc && (platform === Platform.Windows || platform === Platform.Li
|
|||||||
project.addLib('bcrypt');
|
project.addLib('bcrypt');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
project.addLib(root + '/libdatachannel/lib/libdatachannel-static.a');
|
project.addLinkerFlag(root + '/libdatachannel/lib/libdatachannel-static.a');
|
||||||
project.addLib(root + '/libdatachannel/lib/libjuice-static.a');
|
project.addLinkerFlag(root + '/libdatachannel/lib/libjuice-static.a');
|
||||||
project.addLib(root + '/libdatachannel/lib/libusrsctp.a');
|
project.addLinkerFlag(root + '/libdatachannel/lib/libusrsctp.a');
|
||||||
project.addLib(root + '/libdatachannel/lib/libMbedTLS.a');
|
project.addLinkerFlag(root + '/libdatachannel/lib/libsrtp2.a');
|
||||||
|
project.addLinkerFlag(root + '/libdatachannel/lib/libMbedTLS.a');
|
||||||
|
if (platform === Platform.OSX) {
|
||||||
|
const odir = '/opt/homebrew/opt/openssl@3/lib';
|
||||||
|
project.addLinkerFlag(path.join(odir, 'libssl.a'));
|
||||||
|
project.addLinkerFlag(path.join(odir, 'libcrypto.a'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.with_networking && platform !== Platform.Windows) {
|
if (flags.with_networking && platform !== Platform.Windows) {
|
||||||
project.addLib('ssl');
|
// On macOS with RTC, libdatachannel's static OpenSSL must be the only
|
||||||
project.addLib('crypto');
|
// TLS impl; adding -lssl/-lcrypto would bind some EVP symbols to the
|
||||||
|
// system LibreSSL dylibs and crash inside srtp_init.
|
||||||
|
if (!(flags.with_rtc && platform === Platform.OSX)) {
|
||||||
|
project.addLib('ssl');
|
||||||
|
project.addLib('crypto');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.with_worker) {
|
if (flags.with_worker) {
|
||||||
@ -200,10 +211,15 @@ else if (platform === Platform.OSX) {
|
|||||||
project.addLinkerFlag('-framework AppKit');
|
project.addLinkerFlag('-framework AppKit');
|
||||||
}
|
}
|
||||||
if (flags.with_networking) {
|
if (flags.with_networking) {
|
||||||
project.addIncludeDir('apple-libressl-sdk/include');
|
if (flags.with_rtc) {
|
||||||
project.addLinkerFlag('-L' + root + '/apple-libressl-sdk/lib');
|
project.addIncludeDir('/opt/homebrew/opt/openssl@3/include');
|
||||||
project.addLinkerFlag('-lssl');
|
}
|
||||||
project.addLinkerFlag('-lcrypto');
|
else {
|
||||||
|
project.addIncludeDir('apple-libressl-sdk/include');
|
||||||
|
project.addLinkerFlag('-L' + root + '/apple-libressl-sdk/lib');
|
||||||
|
project.addLinkerFlag('-lssl');
|
||||||
|
project.addLinkerFlag('-lcrypto');
|
||||||
|
}
|
||||||
project.addLinkerFlag('-framework Security');
|
project.addLinkerFlag('-framework Security');
|
||||||
project.addLinkerFlag('-framework SystemConfiguration');
|
project.addLinkerFlag('-framework SystemConfiguration');
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
libdatachannel/lib/libMbedTLS.a
Normal file
BIN
libdatachannel/lib/libMbedTLS.a
Normal file
Binary file not shown.
BIN
libdatachannel/lib/libdatachannel-static.a
Normal file
BIN
libdatachannel/lib/libdatachannel-static.a
Normal file
Binary file not shown.
BIN
libdatachannel/lib/libjuice-static.a
Normal file
BIN
libdatachannel/lib/libjuice-static.a
Normal file
Binary file not shown.
BIN
libdatachannel/lib/libsrtp2.a
Normal file
BIN
libdatachannel/lib/libsrtp2.a
Normal file
Binary file not shown.
BIN
libdatachannel/lib/libusrsctp.a
Normal file
BIN
libdatachannel/lib/libusrsctp.a
Normal file
Binary file not shown.
Reference in New Issue
Block a user