mediasoup 3.9.9 → 3.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node/lib/Worker.js +1 -1
- package/node/lib/index.d.ts +1 -1
- package/node/lib/index.js +1 -1
- package/package.json +9 -10
- package/worker/Makefile +10 -0
- package/worker/include/RTC/RtpPacket.hpp +1 -1
- package/worker/include/Utils.hpp +3 -2
- package/worker/meson.build +1 -1
- package/worker/scripts/package-lock.json +6 -6
- package/worker/src/RTC/DtlsTransport.cpp +29 -51
- package/worker/src/RTC/RtpPacket.cpp +1 -6
- package/worker/src/RTC/SimulcastConsumer.cpp +7 -12
- package/worker/src/RTC/SvcConsumer.cpp +10 -1
- package/worker/src/Utils/Crypto.cpp +18 -10
- package/worker/subprojects/abseil-cpp.wrap +7 -7
- package/worker/subprojects/nlohmann_json.wrap +4 -7
- package/worker/subprojects/openssl.wrap +7 -7
- package/worker/subprojects/usrsctp.wrap +4 -4
- package/worker/subprojects/wingetopt.wrap +4 -5
- package/worker/subprojects/packagefiles/wingetopt/meson.build +0 -43
package/node/lib/Worker.js
CHANGED
|
@@ -81,7 +81,7 @@ class Worker extends EnhancedEventEmitter_1.EnhancedEventEmitter {
|
|
|
81
81
|
// options
|
|
82
82
|
{
|
|
83
83
|
env: {
|
|
84
|
-
MEDIASOUP_VERSION: '3.9.
|
|
84
|
+
MEDIASOUP_VERSION: '3.9.12',
|
|
85
85
|
// Let the worker process inherit all environment variables, useful
|
|
86
86
|
// if a custom and not in the path GCC is used so the user can set
|
|
87
87
|
// LD_LIBRARY_PATH environment variable for runtime.
|
package/node/lib/index.d.ts
CHANGED
package/node/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediasoup",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.12",
|
|
4
4
|
"description": "Cutting Edge WebRTC Video Conferencing",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"worker/scripts/*.js",
|
|
31
31
|
"worker/scripts/*.json",
|
|
32
32
|
"worker/src",
|
|
33
|
-
"worker/subprojects/packagefiles",
|
|
34
33
|
"worker/subprojects/*.wrap",
|
|
35
34
|
"worker/test/include",
|
|
36
35
|
"worker/test/src",
|
|
@@ -70,24 +69,24 @@
|
|
|
70
69
|
},
|
|
71
70
|
"dependencies": {
|
|
72
71
|
"@types/node": "^16.11.10",
|
|
73
|
-
"debug": "^4.3.
|
|
72
|
+
"debug": "^4.3.4",
|
|
74
73
|
"h264-profile-level-id": "^1.0.1",
|
|
75
|
-
"supports-color": "^9.2.
|
|
74
|
+
"supports-color": "^9.2.2",
|
|
76
75
|
"uuid": "^8.3.2"
|
|
77
76
|
},
|
|
78
77
|
"devDependencies": {
|
|
79
78
|
"@types/debug": "^4.1.7",
|
|
80
79
|
"@types/uuid": "^8.3.4",
|
|
81
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
82
|
-
"@typescript-eslint/parser": "^5.
|
|
83
|
-
"eslint": "^8.
|
|
84
|
-
"eslint-plugin-jest": "^26.1.
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
|
81
|
+
"@typescript-eslint/parser": "^5.22.0",
|
|
82
|
+
"eslint": "^8.14.0",
|
|
83
|
+
"eslint-plugin-jest": "^26.1.5",
|
|
85
84
|
"jest": "^27.5.1",
|
|
86
85
|
"jest-tobetype": "^1.2.3",
|
|
87
86
|
"open-cli": "^7.0.1",
|
|
88
87
|
"pick-port": "^1.0.0",
|
|
89
88
|
"sctp": "^1.0.0",
|
|
90
|
-
"tsc-watch": "^
|
|
91
|
-
"typescript": "^4.6.
|
|
89
|
+
"tsc-watch": "^5.0.3",
|
|
90
|
+
"typescript": "^4.6.4"
|
|
92
91
|
}
|
|
93
92
|
}
|
package/worker/Makefile
CHANGED
|
@@ -7,6 +7,11 @@ PYTHON ?= $(shell command -v python3 2> /dev/null || echo python)
|
|
|
7
7
|
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
8
8
|
CORES ?= $(shell ${ROOT_DIR}/scripts/cpu_cores.sh || echo 4)
|
|
9
9
|
MEDIASOUP_OUT_DIR ?= $(shell pwd)/out
|
|
10
|
+
# Controls build types, `Release` and `Debug` are presets optimized for those use cases.
|
|
11
|
+
# Other build types are possible too, but they are not presets and will require `MESON_ARGS` use to customize build
|
|
12
|
+
# configuration.
|
|
13
|
+
# Check the meaning of useful macros in the `worker/include/Logger.hpp` header file if you want to enable tracing or
|
|
14
|
+
# other debug information.
|
|
10
15
|
MEDIASOUP_BUILDTYPE ?= Release
|
|
11
16
|
GULP = ./scripts/node_modules/.bin/gulp
|
|
12
17
|
LCOV = ./deps/lcov/bin/lcov
|
|
@@ -15,6 +20,11 @@ PIP_DIR = $(MEDIASOUP_OUT_DIR)/pip
|
|
|
15
20
|
INSTALL_DIR ?= $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)
|
|
16
21
|
BUILD_DIR ?= $(MEDIASOUP_OUT_DIR)/$(MEDIASOUP_BUILDTYPE)/build
|
|
17
22
|
MESON ?= $(PIP_DIR)/bin/meson
|
|
23
|
+
# `MESON_ARGS` can be used to provide extra configuration parameters to Meson, such as adding defines or changing
|
|
24
|
+
# optimization options. For instance, use `MESON_ARGS="-DMS_LOG_TRACE -DMS_LOG_FILE_LINE" npm i` to compile worker with
|
|
25
|
+
# tracing and enabled.
|
|
26
|
+
#
|
|
27
|
+
# NOTE: On Windows make sure to add `--vsenv` or have MSVS environment already active if you override this parameter.
|
|
18
28
|
MESON_ARGS ?= ""
|
|
19
29
|
# Workaround for NixOS and Guix that don't work with pre-built binaries, see:
|
|
20
30
|
# https://github.com/NixOS/nixpkgs/issues/142383.
|
|
@@ -602,7 +602,7 @@ namespace RTC
|
|
|
602
602
|
this->payloadDescriptorHandler.reset(payloadDescriptorHandler);
|
|
603
603
|
}
|
|
604
604
|
|
|
605
|
-
bool ProcessPayload(RTC::Codecs::EncodingContext* context);
|
|
605
|
+
bool ProcessPayload(RTC::Codecs::EncodingContext* context, bool& marker);
|
|
606
606
|
|
|
607
607
|
void RestorePayload();
|
|
608
608
|
|
package/worker/include/Utils.hpp
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#define MS_UTILS_HPP
|
|
3
3
|
|
|
4
4
|
#include "common.hpp"
|
|
5
|
-
#include <openssl/
|
|
5
|
+
#include <openssl/evp.h>
|
|
6
6
|
#include <cmath>
|
|
7
7
|
#include <cstring> // std::memcmp(), std::memcpy()
|
|
8
8
|
#include <nlohmann/json.hpp>
|
|
@@ -255,7 +255,8 @@ namespace Utils
|
|
|
255
255
|
|
|
256
256
|
private:
|
|
257
257
|
thread_local static uint32_t seed;
|
|
258
|
-
thread_local static
|
|
258
|
+
thread_local static EVP_MAC* mac;
|
|
259
|
+
thread_local static EVP_MAC_CTX* hmacSha1Ctx;
|
|
259
260
|
thread_local static uint8_t hmacSha1Buffer[];
|
|
260
261
|
static const uint32_t crc32Table[256];
|
|
261
262
|
};
|
package/worker/meson.build
CHANGED
|
@@ -3015,9 +3015,9 @@
|
|
|
3015
3015
|
}
|
|
3016
3016
|
},
|
|
3017
3017
|
"node_modules/minimist": {
|
|
3018
|
-
"version": "1.2.
|
|
3019
|
-
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.
|
|
3020
|
-
"integrity": "sha512-
|
|
3018
|
+
"version": "1.2.6",
|
|
3019
|
+
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
|
3020
|
+
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
|
3021
3021
|
"dev": true
|
|
3022
3022
|
},
|
|
3023
3023
|
"node_modules/mixin-deep": {
|
|
@@ -7917,9 +7917,9 @@
|
|
|
7917
7917
|
}
|
|
7918
7918
|
},
|
|
7919
7919
|
"minimist": {
|
|
7920
|
-
"version": "1.2.
|
|
7921
|
-
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.
|
|
7922
|
-
"integrity": "sha512-
|
|
7920
|
+
"version": "1.2.6",
|
|
7921
|
+
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
|
7922
|
+
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
|
7923
7923
|
"dev": true
|
|
7924
7924
|
},
|
|
7925
7925
|
"mixin-deep": {
|
|
@@ -6,11 +6,8 @@
|
|
|
6
6
|
#include "MediaSoupErrors.hpp"
|
|
7
7
|
#include "Settings.hpp"
|
|
8
8
|
#include "Utils.hpp"
|
|
9
|
-
#include <openssl/asn1.h>
|
|
10
|
-
#include <openssl/bn.h>
|
|
11
9
|
#include <openssl/err.h>
|
|
12
10
|
#include <openssl/evp.h>
|
|
13
|
-
#include <openssl/rsa.h>
|
|
14
11
|
#include <uv.h>
|
|
15
12
|
#include <cstdio> // std::sprintf(), std::fopen()
|
|
16
13
|
#include <cstring> // std::memcpy(), std::strcmp()
|
|
@@ -157,56 +154,20 @@ namespace RTC
|
|
|
157
154
|
MS_TRACE();
|
|
158
155
|
|
|
159
156
|
int ret{ 0 };
|
|
160
|
-
EC_KEY* ecKey{ nullptr };
|
|
161
157
|
X509_NAME* certName{ nullptr };
|
|
162
158
|
std::string subject =
|
|
163
159
|
std::string("mediasoup") + std::to_string(Utils::Crypto::GetRandomUInt(100000, 999999));
|
|
164
160
|
|
|
165
161
|
// Create key with curve.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (!ecKey)
|
|
169
|
-
{
|
|
170
|
-
LOG_OPENSSL_ERROR("EC_KEY_new_by_curve_name() failed");
|
|
171
|
-
|
|
172
|
-
goto error;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
EC_KEY_set_asn1_flag(ecKey, OPENSSL_EC_NAMED_CURVE);
|
|
176
|
-
|
|
177
|
-
// NOTE: This can take some time.
|
|
178
|
-
ret = EC_KEY_generate_key(ecKey);
|
|
179
|
-
|
|
180
|
-
if (ret == 0)
|
|
181
|
-
{
|
|
182
|
-
LOG_OPENSSL_ERROR("EC_KEY_generate_key() failed");
|
|
183
|
-
|
|
184
|
-
goto error;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Create a private key object.
|
|
188
|
-
DtlsTransport::privateKey = EVP_PKEY_new();
|
|
162
|
+
DtlsTransport::privateKey = EVP_EC_gen(SN_X9_62_prime256v1);
|
|
189
163
|
|
|
190
164
|
if (!DtlsTransport::privateKey)
|
|
191
165
|
{
|
|
192
|
-
LOG_OPENSSL_ERROR("
|
|
193
|
-
|
|
194
|
-
goto error;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast)
|
|
198
|
-
ret = EVP_PKEY_assign_EC_KEY(DtlsTransport::privateKey, ecKey);
|
|
199
|
-
|
|
200
|
-
if (ret == 0)
|
|
201
|
-
{
|
|
202
|
-
LOG_OPENSSL_ERROR("EVP_PKEY_assign_EC_KEY() failed");
|
|
166
|
+
LOG_OPENSSL_ERROR("EVP_EC_gen() failed");
|
|
203
167
|
|
|
204
168
|
goto error;
|
|
205
169
|
}
|
|
206
170
|
|
|
207
|
-
// The EC key now belongs to the private key, so don't clean it up separately.
|
|
208
|
-
ecKey = nullptr;
|
|
209
|
-
|
|
210
171
|
// Create the X509 certificate.
|
|
211
172
|
DtlsTransport::certificate = X509_new();
|
|
212
173
|
|
|
@@ -278,11 +239,8 @@ namespace RTC
|
|
|
278
239
|
|
|
279
240
|
error:
|
|
280
241
|
|
|
281
|
-
if (ecKey)
|
|
282
|
-
EC_KEY_free(ecKey);
|
|
283
|
-
|
|
284
242
|
if (DtlsTransport::privateKey)
|
|
285
|
-
EVP_PKEY_free(DtlsTransport::privateKey);
|
|
243
|
+
EVP_PKEY_free(DtlsTransport::privateKey);
|
|
286
244
|
|
|
287
245
|
if (DtlsTransport::certificate)
|
|
288
246
|
X509_free(DtlsTransport::certificate);
|
|
@@ -1030,17 +988,22 @@ namespace RTC
|
|
|
1030
988
|
uv_timeval_t dtlsTimeout{ 0, 0 };
|
|
1031
989
|
uint64_t timeoutMs;
|
|
1032
990
|
|
|
1033
|
-
// NOTE: If ret == 0 then ignore the value in dtlsTimeout.
|
|
1034
991
|
// NOTE: No DTLSv_1_2_get_timeout() or DTLS_get_timeout() in OpenSSL 1.1.0-dev.
|
|
1035
992
|
ret = DTLSv1_get_timeout(this->ssl, static_cast<void*>(&dtlsTimeout)); // NOLINT
|
|
1036
993
|
|
|
1037
994
|
if (ret == 0)
|
|
995
|
+
{
|
|
996
|
+
OnTimer(this->timer);
|
|
997
|
+
|
|
1038
998
|
return true;
|
|
999
|
+
}
|
|
1039
1000
|
|
|
1040
1001
|
timeoutMs = (dtlsTimeout.tv_sec * static_cast<uint64_t>(1000)) + (dtlsTimeout.tv_usec / 1000);
|
|
1041
1002
|
|
|
1042
1003
|
if (timeoutMs == 0)
|
|
1043
1004
|
{
|
|
1005
|
+
OnTimer(this->timer);
|
|
1006
|
+
|
|
1044
1007
|
return true;
|
|
1045
1008
|
}
|
|
1046
1009
|
else if (timeoutMs < 30000)
|
|
@@ -1461,12 +1424,27 @@ namespace RTC
|
|
|
1461
1424
|
return;
|
|
1462
1425
|
}
|
|
1463
1426
|
|
|
1464
|
-
DTLSv1_handle_timeout(this->ssl);
|
|
1427
|
+
auto ret = DTLSv1_handle_timeout(this->ssl);
|
|
1465
1428
|
|
|
1466
|
-
//
|
|
1467
|
-
|
|
1429
|
+
// -1 means that too many timeouts had expired without progress or an
|
|
1430
|
+
// error occurs.
|
|
1431
|
+
if (ret == -1)
|
|
1432
|
+
{
|
|
1433
|
+
MS_WARN_TAG(dtls, "DTLSv1_handle_timeout() failed");
|
|
1434
|
+
|
|
1435
|
+
Reset();
|
|
1436
|
+
|
|
1437
|
+
// Set state and notify the listener.
|
|
1438
|
+
this->state = DtlsState::FAILED;
|
|
1439
|
+
this->listener->OnDtlsTransportFailed(this);
|
|
1440
|
+
}
|
|
1441
|
+
else
|
|
1442
|
+
{
|
|
1443
|
+
// If required, send DTLS data.
|
|
1444
|
+
SendPendingOutgoingDtlsData();
|
|
1468
1445
|
|
|
1469
|
-
|
|
1470
|
-
|
|
1446
|
+
// Set the DTLS timer again.
|
|
1447
|
+
SetTimeout();
|
|
1448
|
+
}
|
|
1471
1449
|
}
|
|
1472
1450
|
} // namespace RTC
|
|
@@ -782,20 +782,15 @@ namespace RTC
|
|
|
782
782
|
return true;
|
|
783
783
|
}
|
|
784
784
|
|
|
785
|
-
bool RtpPacket::ProcessPayload(RTC::Codecs::EncodingContext* context)
|
|
785
|
+
bool RtpPacket::ProcessPayload(RTC::Codecs::EncodingContext* context, bool& marker)
|
|
786
786
|
{
|
|
787
787
|
MS_TRACE();
|
|
788
788
|
|
|
789
789
|
if (!this->payloadDescriptorHandler)
|
|
790
790
|
return true;
|
|
791
791
|
|
|
792
|
-
bool marker{ false };
|
|
793
|
-
|
|
794
792
|
if (this->payloadDescriptorHandler->Process(context, this->payload, marker))
|
|
795
793
|
{
|
|
796
|
-
if (marker)
|
|
797
|
-
SetMarker(true);
|
|
798
|
-
|
|
799
794
|
return true;
|
|
800
795
|
}
|
|
801
796
|
else
|
|
@@ -13,7 +13,6 @@ namespace RTC
|
|
|
13
13
|
{
|
|
14
14
|
/* Static. */
|
|
15
15
|
|
|
16
|
-
static constexpr uint8_t StreamGoodScore{ 5u };
|
|
17
16
|
static constexpr uint64_t StreamMinActiveMs{ 2000u }; // In ms.
|
|
18
17
|
static constexpr uint64_t BweDowngradeConservativeMs{ 10000u }; // In ms.
|
|
19
18
|
static constexpr uint64_t BweDowngradeMinActiveMs{ 8000u }; // In ms.
|
|
@@ -444,7 +443,7 @@ namespace RTC
|
|
|
444
443
|
auto* producerRtpStream = this->producerRtpStreams.at(spatialLayer);
|
|
445
444
|
|
|
446
445
|
// Producer stream does not exist or it's not good. Ignore.
|
|
447
|
-
if (!producerRtpStream
|
|
446
|
+
if (!producerRtpStream)
|
|
448
447
|
continue;
|
|
449
448
|
|
|
450
449
|
// If the stream has not been active time enough and we have an active one
|
|
@@ -822,6 +821,8 @@ namespace RTC
|
|
|
822
821
|
this->keyFrameForTsOffsetRequested = false;
|
|
823
822
|
}
|
|
824
823
|
|
|
824
|
+
bool marker{ false };
|
|
825
|
+
|
|
825
826
|
if (shouldSwitchCurrentSpatialLayer)
|
|
826
827
|
{
|
|
827
828
|
// Update current spatial layer.
|
|
@@ -841,14 +842,14 @@ namespace RTC
|
|
|
841
842
|
EmitScore();
|
|
842
843
|
|
|
843
844
|
// Rewrite payload if needed.
|
|
844
|
-
packet->ProcessPayload(this->encodingContext.get());
|
|
845
|
+
packet->ProcessPayload(this->encodingContext.get(), marker);
|
|
845
846
|
}
|
|
846
847
|
else
|
|
847
848
|
{
|
|
848
849
|
auto previousTemporalLayer = this->encodingContext->GetCurrentTemporalLayer();
|
|
849
850
|
|
|
850
851
|
// Rewrite payload if needed. Drop packet if necessary.
|
|
851
|
-
if (!packet->ProcessPayload(this->encodingContext.get()))
|
|
852
|
+
if (!packet->ProcessPayload(this->encodingContext.get(), marker))
|
|
852
853
|
{
|
|
853
854
|
this->rtpSeqManager.Drop(packet->GetSequenceNumber());
|
|
854
855
|
|
|
@@ -1295,17 +1296,11 @@ namespace RTC
|
|
|
1295
1296
|
if (!CanSwitchToSpatialLayer(spatialLayer))
|
|
1296
1297
|
continue;
|
|
1297
1298
|
|
|
1298
|
-
// If the stream score is worse than the best seen and not good enough, ignore
|
|
1299
|
-
// this stream.
|
|
1300
|
-
if (producerScore < maxProducerScore && producerScore < StreamGoodScore)
|
|
1301
|
-
continue;
|
|
1302
|
-
|
|
1303
1299
|
newTargetSpatialLayer = spatialLayer;
|
|
1304
1300
|
maxProducerScore = producerScore;
|
|
1305
1301
|
|
|
1306
|
-
// If this is the preferred or higher spatial layer
|
|
1307
|
-
|
|
1308
|
-
if (spatialLayer >= this->preferredSpatialLayer && producerScore >= StreamGoodScore)
|
|
1302
|
+
// If this is the preferred or higher spatial layer take it and exit.
|
|
1303
|
+
if (spatialLayer >= this->preferredSpatialLayer)
|
|
1309
1304
|
break;
|
|
1310
1305
|
}
|
|
1311
1306
|
|
|
@@ -581,7 +581,10 @@ namespace RTC
|
|
|
581
581
|
auto previousSpatialLayer = this->encodingContext->GetCurrentSpatialLayer();
|
|
582
582
|
auto previousTemporalLayer = this->encodingContext->GetCurrentTemporalLayer();
|
|
583
583
|
|
|
584
|
-
|
|
584
|
+
bool marker{ false };
|
|
585
|
+
bool origMarker = packet->HasMarker();
|
|
586
|
+
|
|
587
|
+
if (!packet->ProcessPayload(this->encodingContext.get(), marker))
|
|
585
588
|
{
|
|
586
589
|
this->rtpSeqManager.Drop(packet->GetSequenceNumber());
|
|
587
590
|
|
|
@@ -612,6 +615,11 @@ namespace RTC
|
|
|
612
615
|
packet->SetSsrc(this->rtpParameters.encodings[0].ssrc);
|
|
613
616
|
packet->SetSequenceNumber(seq);
|
|
614
617
|
|
|
618
|
+
if (marker)
|
|
619
|
+
{
|
|
620
|
+
packet->SetMarker(true);
|
|
621
|
+
}
|
|
622
|
+
|
|
615
623
|
if (isSyncPacket)
|
|
616
624
|
{
|
|
617
625
|
MS_DEBUG_TAG(
|
|
@@ -649,6 +657,7 @@ namespace RTC
|
|
|
649
657
|
// Restore packet fields.
|
|
650
658
|
packet->SetSsrc(origSsrc);
|
|
651
659
|
packet->SetSequenceNumber(origSeq);
|
|
660
|
+
packet->SetMarker(origMarker);
|
|
652
661
|
|
|
653
662
|
// Restore the original payload if needed.
|
|
654
663
|
packet->RestorePayload();
|
|
@@ -10,7 +10,8 @@ namespace Utils
|
|
|
10
10
|
/* Static variables. */
|
|
11
11
|
|
|
12
12
|
thread_local uint32_t Crypto::seed;
|
|
13
|
-
thread_local
|
|
13
|
+
thread_local EVP_MAC* Crypto::mac{ nullptr };
|
|
14
|
+
thread_local EVP_MAC_CTX* Crypto::hmacSha1Ctx{ nullptr };
|
|
14
15
|
thread_local uint8_t Crypto::hmacSha1Buffer[SHA_DIGEST_LENGTH];
|
|
15
16
|
// clang-format off
|
|
16
17
|
const uint32_t Crypto::crc32Table[] =
|
|
@@ -61,7 +62,8 @@ namespace Utils
|
|
|
61
62
|
Crypto::seed = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(std::addressof(Crypto::seed)));
|
|
62
63
|
|
|
63
64
|
// Create an OpenSSL HMAC_CTX context for HMAC SHA1 calculation.
|
|
64
|
-
Crypto::
|
|
65
|
+
Crypto::mac = EVP_MAC_fetch(nullptr, "HMAC", nullptr);
|
|
66
|
+
Crypto::hmacSha1Ctx = EVP_MAC_CTX_new(mac);
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
void Crypto::ClassDestroy()
|
|
@@ -69,7 +71,10 @@ namespace Utils
|
|
|
69
71
|
MS_TRACE();
|
|
70
72
|
|
|
71
73
|
if (Crypto::hmacSha1Ctx != nullptr)
|
|
72
|
-
|
|
74
|
+
EVP_MAC_CTX_free(Crypto::hmacSha1Ctx);
|
|
75
|
+
|
|
76
|
+
if (Crypto::mac != nullptr)
|
|
77
|
+
EVP_MAC_free(Crypto::mac);
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
const uint8_t* Crypto::GetHmacSha1(const std::string& key, const uint8_t* data, size_t len)
|
|
@@ -78,26 +83,29 @@ namespace Utils
|
|
|
78
83
|
|
|
79
84
|
int ret;
|
|
80
85
|
|
|
81
|
-
|
|
86
|
+
OSSL_PARAM sha1[] = { { "digest", OSSL_PARAM_UTF8_STRING, (void*)"sha1", 4, 0 }, OSSL_PARAM_END };
|
|
87
|
+
|
|
88
|
+
ret = EVP_MAC_init(
|
|
89
|
+
Crypto::hmacSha1Ctx, reinterpret_cast<const unsigned char*>(key.c_str()), key.length(), sha1);
|
|
82
90
|
|
|
83
|
-
MS_ASSERT(ret == 1, "OpenSSL
|
|
91
|
+
MS_ASSERT(ret == 1, "OpenSSL EVP_MAC_init() failed with key '%s'", key.c_str());
|
|
84
92
|
|
|
85
|
-
ret =
|
|
93
|
+
ret = EVP_MAC_update(Crypto::hmacSha1Ctx, data, len);
|
|
86
94
|
|
|
87
95
|
MS_ASSERT(
|
|
88
96
|
ret == 1,
|
|
89
|
-
"OpenSSL
|
|
97
|
+
"OpenSSL EVP_MAC_update() failed with key '%s' and data length %zu bytes",
|
|
90
98
|
key.c_str(),
|
|
91
99
|
len);
|
|
92
100
|
|
|
93
|
-
|
|
101
|
+
size_t resultLen;
|
|
94
102
|
|
|
95
|
-
ret =
|
|
103
|
+
ret = EVP_MAC_final(Crypto::hmacSha1Ctx, Crypto::hmacSha1Buffer, &resultLen, SHA_DIGEST_LENGTH);
|
|
96
104
|
|
|
97
105
|
MS_ASSERT(
|
|
98
106
|
ret == 1, "OpenSSL HMAC_Final() failed with key '%s' and data length %zu bytes", key.c_str(), len);
|
|
99
107
|
MS_ASSERT(
|
|
100
|
-
resultLen == SHA_DIGEST_LENGTH, "OpenSSL HMAC_Final() resultLen is %
|
|
108
|
+
resultLen == SHA_DIGEST_LENGTH, "OpenSSL HMAC_Final() resultLen is %zu instead of 20", resultLen);
|
|
101
109
|
|
|
102
110
|
return Crypto::hmacSha1Buffer;
|
|
103
111
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[wrap-file]
|
|
2
|
-
directory = abseil-cpp-
|
|
3
|
-
source_url = https://github.com/abseil/abseil-cpp/archive/
|
|
4
|
-
source_filename = abseil-cpp-
|
|
5
|
-
source_hash =
|
|
6
|
-
patch_filename = abseil-
|
|
7
|
-
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-
|
|
8
|
-
patch_hash =
|
|
2
|
+
directory = abseil-cpp-20211102.0
|
|
3
|
+
source_url = https://github.com/abseil/abseil-cpp/archive/20211102.0.tar.gz
|
|
4
|
+
source_filename = abseil-cpp-20211102.0.tar.gz
|
|
5
|
+
source_hash = dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4
|
|
6
|
+
patch_filename = abseil-cpp_20211102.0-2_patch.zip
|
|
7
|
+
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20211102.0-2/get_patch
|
|
8
|
+
patch_hash = 9463930367b0db984435350c7d7614e400faa8811a7e9a2def5a63ff39fdb325
|
|
9
9
|
|
|
10
10
|
[provide]
|
|
11
11
|
absl_base = absl_base_dep
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
[wrap-file]
|
|
2
|
-
directory = nlohmann_json-3.
|
|
2
|
+
directory = nlohmann_json-3.10.5
|
|
3
3
|
lead_directory_missing = true
|
|
4
|
-
source_url = https://github.com/nlohmann/json/releases/download/v3.
|
|
5
|
-
source_filename = nlohmann_json-3.
|
|
6
|
-
source_hash =
|
|
7
|
-
patch_url = https://wrapdb.mesonbuild.com/v2/nlohmann_json_3.9.1-1/get_patch
|
|
8
|
-
patch_filename = nlohmann_json-3.9.1-1-wrap.zip
|
|
9
|
-
patch_hash = 1774e5506fbe3897d652f67e41973194b948d2ab851cf464a742f35f160a1435
|
|
4
|
+
source_url = https://github.com/nlohmann/json/releases/download/v3.10.5/include.zip
|
|
5
|
+
source_filename = nlohmann_json-3.10.5.zip
|
|
6
|
+
source_hash = b94997df68856753b72f0d7a3703b7d484d4745c567f3584ef97c96c25a5798e
|
|
10
7
|
|
|
11
8
|
[provide]
|
|
12
9
|
nlohmann_json = nlohmann_json_dep
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[wrap-file]
|
|
2
|
-
directory = openssl-
|
|
3
|
-
source_url = https://www.openssl.org/source/openssl-
|
|
4
|
-
source_filename = openssl-
|
|
5
|
-
source_hash =
|
|
6
|
-
patch_filename =
|
|
7
|
-
patch_url = https://wrapdb.mesonbuild.com/v2/
|
|
8
|
-
patch_hash =
|
|
2
|
+
directory = openssl-3.0.2
|
|
3
|
+
source_url = https://www.openssl.org/source/openssl-3.0.2.tar.gz
|
|
4
|
+
source_filename = openssl-3.0.2.tar.gz
|
|
5
|
+
source_hash = 98e91ccead4d4756ae3c9cde5e09191a8e586d9f4d50838e7ec09d6411dfdb63
|
|
6
|
+
patch_filename = openssl_3.0.2-1_patch.zip
|
|
7
|
+
patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.2-1/get_patch
|
|
8
|
+
patch_hash = 762ab4ea94d02178d6a1d3eb63409c2c4d61315d358391cdac62df15211174d4
|
|
9
9
|
|
|
10
10
|
[provide]
|
|
11
11
|
libcrypto = libcrypto_dep
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
[wrap-file]
|
|
2
|
-
directory = usrsctp-
|
|
3
|
-
source_url = https://github.com/sctplab/usrsctp/archive/
|
|
4
|
-
source_filename =
|
|
5
|
-
source_hash =
|
|
2
|
+
directory = usrsctp-4e06feb01cadcd127d119486b98a4bd3d64aa1e7
|
|
3
|
+
source_url = https://github.com/sctplab/usrsctp/archive/4e06feb01cadcd127d119486b98a4bd3d64aa1e7.zip
|
|
4
|
+
source_filename = 4e06feb01cadcd127d119486b98a4bd3d64aa1e7.zip
|
|
5
|
+
source_hash = 15f7844c4c4ca93228ae0fe844182c72edd1d809b461cb97b1bb687a804dd4fc
|
|
6
6
|
|
|
7
7
|
[provide]
|
|
8
8
|
usrsctp = usrsctp_dep
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
[wrap-file]
|
|
2
|
-
directory = wingetopt-
|
|
3
|
-
source_url = https://github.com/alex85k/wingetopt/archive/
|
|
4
|
-
source_filename = wingetopt-
|
|
5
|
-
source_hash =
|
|
6
|
-
patch_directory = wingetopt
|
|
2
|
+
directory = wingetopt-1.00
|
|
3
|
+
source_url = https://github.com/alex85k/wingetopt/archive/v1.00.zip
|
|
4
|
+
source_filename = wingetopt-1.00.zip
|
|
5
|
+
source_hash = 4454ca03a59702a4ca4d1488ca8fa6168b0c8d77dc739a6fe2825c3dd8609d87
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
project(
|
|
2
|
-
'wingetopt',
|
|
3
|
-
'c',
|
|
4
|
-
version: '0.95',
|
|
5
|
-
license : ['ISC', 'BSD-3-Clause'],
|
|
6
|
-
meson_version: '>= 0.55',
|
|
7
|
-
default_options: [
|
|
8
|
-
'warning_level=1',
|
|
9
|
-
],
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
compiler = meson.get_compiler('c')
|
|
13
|
-
|
|
14
|
-
c_args = []
|
|
15
|
-
|
|
16
|
-
if compiler.get_id() == 'msvc'
|
|
17
|
-
c_args += [
|
|
18
|
-
'-D_CRT_SECURE_NO_WARNINGS',
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
if get_option('default_library') == 'shared'
|
|
22
|
-
c_args += [
|
|
23
|
-
'-DBUILDING_WINGETOPT_DLL',
|
|
24
|
-
'-DWINGETOPT_SHARED_LIB',
|
|
25
|
-
]
|
|
26
|
-
endif
|
|
27
|
-
endif
|
|
28
|
-
|
|
29
|
-
wingetopt_lib = library(
|
|
30
|
-
'wingetopt',
|
|
31
|
-
'src/getopt.c',
|
|
32
|
-
include_directories: include_directories(
|
|
33
|
-
'src',
|
|
34
|
-
),
|
|
35
|
-
c_args: c_args,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
wingetopt_dep = declare_dependency(
|
|
39
|
-
link_with: wingetopt_lib,
|
|
40
|
-
include_directories: include_directories(
|
|
41
|
-
'src',
|
|
42
|
-
),
|
|
43
|
-
)
|