Unverified 提交 0b770e7e authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi 提交者: GitHub

Merge pull request #808 from nazar-pc/meson-updates

Meson dependencies updates
...@@ -44,5 +44,3 @@ ...@@ -44,5 +44,3 @@
# Meson. # Meson.
/worker/subprojects/* /worker/subprojects/*
!/worker/subprojects/*.wrap !/worker/subprojects/*.wrap
# Temporarily included meson.build files
!/worker/subprojects/packagefiles
# Changelog # Changelog
### WIP
* Update worker dependencies:
* OpenSSL 3.0.2.
* abseil-cpp 20211102.0.
* nlohmann_json 3.10.5.
* usrsctp snapshot 4e06feb01cadcd127d119486b98a4bd3d64aa1e7.
* wingetopt 1.00.
### 3.9.9 ### 3.9.9
* Optimize RTP header extension handling (PR #786). * Optimize RTP header extension handling (PR #786).
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
"worker/scripts/*.js", "worker/scripts/*.js",
"worker/scripts/*.json", "worker/scripts/*.json",
"worker/src", "worker/src",
"worker/subprojects/packagefiles",
"worker/subprojects/*.wrap", "worker/subprojects/*.wrap",
"worker/test/include", "worker/test/include",
"worker/test/src", "worker/test/src",
......
# Changelog # Changelog
### WIP
* Update worker dependencies:
* OpenSSL 3.0.2.
* abseil-cpp 20211102.0.
* nlohmann_json 3.10.5.
* usrsctp snapshot 4e06feb01cadcd127d119486b98a4bd3d64aa1e7.
* wingetopt 1.00.
# 0.9.3 # 0.9.3
* Fix a segfaults in tests and under multithreaded executor * Fix a segfaults in tests and under multithreaded executor
......
...@@ -15,7 +15,6 @@ include = [ ...@@ -15,7 +15,6 @@ include = [
"/scripts", "/scripts",
"!/scripts/node_modules", "!/scripts/node_modules",
"/src", "/src",
"/subprojects/packagefiles",
"/subprojects/*.wrap", "/subprojects/*.wrap",
"/test/include", "/test/include",
"/test/src", "/test/src",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define MS_UTILS_HPP #define MS_UTILS_HPP
#include "common.hpp" #include "common.hpp"
#include <openssl/hmac.h> #include <openssl/evp.h>
#include <cmath> #include <cmath>
#include <cstring> // std::memcmp(), std::memcpy() #include <cstring> // std::memcmp(), std::memcpy()
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
...@@ -255,7 +255,8 @@ namespace Utils ...@@ -255,7 +255,8 @@ namespace Utils
private: private:
thread_local static uint32_t seed; thread_local static uint32_t seed;
thread_local static HMAC_CTX* hmacSha1Ctx; thread_local static EVP_MAC* mac;
thread_local static EVP_MAC_CTX* hmacSha1Ctx;
thread_local static uint8_t hmacSha1Buffer[]; thread_local static uint8_t hmacSha1Buffer[];
static const uint32_t crc32Table[256]; static const uint32_t crc32Table[256];
}; };
......
...@@ -315,7 +315,7 @@ mediasoup_worker_test = executable( ...@@ -315,7 +315,7 @@ mediasoup_worker_test = executable(
test( test(
'mediasoup-worker-test', 'mediasoup-worker-test',
mediasoup_worker_test, mediasoup_worker_test,
workdir: meson.source_root(), workdir: meson.project_source_root(),
) )
if host_machine.system() == 'linux' if host_machine.system() == 'linux'
......
...@@ -6,11 +6,8 @@ ...@@ -6,11 +6,8 @@
#include "MediaSoupErrors.hpp" #include "MediaSoupErrors.hpp"
#include "Settings.hpp" #include "Settings.hpp"
#include "Utils.hpp" #include "Utils.hpp"
#include <openssl/asn1.h>
#include <openssl/bn.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/rsa.h>
#include <uv.h> #include <uv.h>
#include <cstdio> // std::sprintf(), std::fopen() #include <cstdio> // std::sprintf(), std::fopen()
#include <cstring> // std::memcpy(), std::strcmp() #include <cstring> // std::memcpy(), std::strcmp()
...@@ -157,56 +154,20 @@ namespace RTC ...@@ -157,56 +154,20 @@ namespace RTC
MS_TRACE(); MS_TRACE();
int ret{ 0 }; int ret{ 0 };
EC_KEY* ecKey{ nullptr };
X509_NAME* certName{ nullptr }; X509_NAME* certName{ nullptr };
std::string subject = std::string subject =
std::string("mediasoup") + std::to_string(Utils::Crypto::GetRandomUInt(100000, 999999)); std::string("mediasoup") + std::to_string(Utils::Crypto::GetRandomUInt(100000, 999999));
// Create key with curve. // Create key with curve.
ecKey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); DtlsTransport::privateKey = EVP_EC_gen(SN_X9_62_prime256v1);
if (!ecKey)
{
LOG_OPENSSL_ERROR("EC_KEY_new_by_curve_name() failed");
goto error;
}
EC_KEY_set_asn1_flag(ecKey, OPENSSL_EC_NAMED_CURVE);
// NOTE: This can take some time.
ret = EC_KEY_generate_key(ecKey);
if (ret == 0)
{
LOG_OPENSSL_ERROR("EC_KEY_generate_key() failed");
goto error;
}
// Create a private key object.
DtlsTransport::privateKey = EVP_PKEY_new();
if (!DtlsTransport::privateKey) if (!DtlsTransport::privateKey)
{ {
LOG_OPENSSL_ERROR("EVP_PKEY_new() failed"); LOG_OPENSSL_ERROR("EVP_EC_gen() failed");
goto error;
}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast)
ret = EVP_PKEY_assign_EC_KEY(DtlsTransport::privateKey, ecKey);
if (ret == 0)
{
LOG_OPENSSL_ERROR("EVP_PKEY_assign_EC_KEY() failed");
goto error; goto error;
} }
// The EC key now belongs to the private key, so don't clean it up separately.
ecKey = nullptr;
// Create the X509 certificate. // Create the X509 certificate.
DtlsTransport::certificate = X509_new(); DtlsTransport::certificate = X509_new();
...@@ -278,11 +239,8 @@ namespace RTC ...@@ -278,11 +239,8 @@ namespace RTC
error: error:
if (ecKey)
EC_KEY_free(ecKey);
if (DtlsTransport::privateKey) if (DtlsTransport::privateKey)
EVP_PKEY_free(DtlsTransport::privateKey); // NOTE: This also frees the EC key. EVP_PKEY_free(DtlsTransport::privateKey);
if (DtlsTransport::certificate) if (DtlsTransport::certificate)
X509_free(DtlsTransport::certificate); X509_free(DtlsTransport::certificate);
......
...@@ -10,7 +10,8 @@ namespace Utils ...@@ -10,7 +10,8 @@ namespace Utils
/* Static variables. */ /* Static variables. */
thread_local uint32_t Crypto::seed; thread_local uint32_t Crypto::seed;
thread_local HMAC_CTX* Crypto::hmacSha1Ctx{ nullptr }; thread_local EVP_MAC* Crypto::mac{ nullptr };
thread_local EVP_MAC_CTX* Crypto::hmacSha1Ctx{ nullptr };
thread_local uint8_t Crypto::hmacSha1Buffer[SHA_DIGEST_LENGTH]; thread_local uint8_t Crypto::hmacSha1Buffer[SHA_DIGEST_LENGTH];
// clang-format off // clang-format off
const uint32_t Crypto::crc32Table[] = const uint32_t Crypto::crc32Table[] =
...@@ -61,7 +62,8 @@ namespace Utils ...@@ -61,7 +62,8 @@ namespace Utils
Crypto::seed = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(std::addressof(Crypto::seed))); Crypto::seed = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(std::addressof(Crypto::seed)));
// Create an OpenSSL HMAC_CTX context for HMAC SHA1 calculation. // Create an OpenSSL HMAC_CTX context for HMAC SHA1 calculation.
Crypto::hmacSha1Ctx = HMAC_CTX_new(); Crypto::mac = EVP_MAC_fetch(nullptr, "HMAC", nullptr);
Crypto::hmacSha1Ctx = EVP_MAC_CTX_new(mac);
} }
void Crypto::ClassDestroy() void Crypto::ClassDestroy()
...@@ -69,7 +71,10 @@ namespace Utils ...@@ -69,7 +71,10 @@ namespace Utils
MS_TRACE(); MS_TRACE();
if (Crypto::hmacSha1Ctx != nullptr) if (Crypto::hmacSha1Ctx != nullptr)
HMAC_CTX_free(Crypto::hmacSha1Ctx); EVP_MAC_CTX_free(Crypto::hmacSha1Ctx);
if (Crypto::mac != nullptr)
EVP_MAC_free(Crypto::mac);
} }
const uint8_t* Crypto::GetHmacSha1(const std::string& key, const uint8_t* data, size_t len) const uint8_t* Crypto::GetHmacSha1(const std::string& key, const uint8_t* data, size_t len)
...@@ -78,26 +83,29 @@ namespace Utils ...@@ -78,26 +83,29 @@ namespace Utils
int ret; int ret;
ret = HMAC_Init_ex(Crypto::hmacSha1Ctx, key.c_str(), key.length(), EVP_sha1(), nullptr); OSSL_PARAM sha1[] = { { "digest", OSSL_PARAM_UTF8_STRING, (void*)"sha1", 4, 0 }, OSSL_PARAM_END };
ret = EVP_MAC_init(
Crypto::hmacSha1Ctx, reinterpret_cast<const unsigned char*>(key.c_str()), key.length(), sha1);
MS_ASSERT(ret == 1, "OpenSSL HMAC_Init_ex() failed with key '%s'", key.c_str()); MS_ASSERT(ret == 1, "OpenSSL EVP_MAC_init() failed with key '%s'", key.c_str());
ret = HMAC_Update(Crypto::hmacSha1Ctx, data, static_cast<int>(len)); ret = EVP_MAC_update(Crypto::hmacSha1Ctx, data, len);
MS_ASSERT( MS_ASSERT(
ret == 1, ret == 1,
"OpenSSL HMAC_Update() failed with key '%s' and data length %zu bytes", "OpenSSL EVP_MAC_update() failed with key '%s' and data length %zu bytes",
key.c_str(), key.c_str(),
len); len);
uint32_t resultLen; size_t resultLen;
ret = HMAC_Final(Crypto::hmacSha1Ctx, (uint8_t*)Crypto::hmacSha1Buffer, &resultLen); ret = EVP_MAC_final(Crypto::hmacSha1Ctx, Crypto::hmacSha1Buffer, &resultLen, SHA_DIGEST_LENGTH);
MS_ASSERT( MS_ASSERT(
ret == 1, "OpenSSL HMAC_Final() failed with key '%s' and data length %zu bytes", key.c_str(), len); ret == 1, "OpenSSL HMAC_Final() failed with key '%s' and data length %zu bytes", key.c_str(), len);
MS_ASSERT( MS_ASSERT(
resultLen == SHA_DIGEST_LENGTH, "OpenSSL HMAC_Final() resultLen is %u instead of 20", resultLen); resultLen == SHA_DIGEST_LENGTH, "OpenSSL HMAC_Final() resultLen is %zu instead of 20", resultLen);
return Crypto::hmacSha1Buffer; return Crypto::hmacSha1Buffer;
} }
......
[wrap-file] [wrap-file]
directory = abseil-cpp-20210324.2 directory = abseil-cpp-20211102.0
source_url = https://github.com/abseil/abseil-cpp/archive/20210324.2.tar.gz source_url = https://github.com/abseil/abseil-cpp/archive/20211102.0.tar.gz
source_filename = abseil-cpp-20210324.2.tar.gz source_filename = abseil-cpp-20211102.0.tar.gz
source_hash = 59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f source_hash = dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4
patch_filename = abseil-cpp_20210324.2-2_patch.zip patch_filename = abseil-cpp_20211102.0-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20210324.2-2/get_patch patch_url = https://wrapdb.mesonbuild.com/v2/abseil-cpp_20211102.0-2/get_patch
patch_hash = 49440e58e4969bf0ec77d1d38ead7e56ea8163d1ba19012a0f838238d0f6950c patch_hash = 9463930367b0db984435350c7d7614e400faa8811a7e9a2def5a63ff39fdb325
[provide] [provide]
absl_base = absl_base_dep absl_base = absl_base_dep
......
[wrap-file] [wrap-file]
directory = nlohmann_json-3.9.1 directory = nlohmann_json-3.10.5
lead_directory_missing = true lead_directory_missing = true
source_url = https://github.com/nlohmann/json/releases/download/v3.9.1/include.zip source_url = https://github.com/nlohmann/json/releases/download/v3.10.5/include.zip
source_filename = nlohmann_json-3.9.1.zip source_filename = nlohmann_json-3.10.5.zip
source_hash = 6bea5877b1541d353bd77bdfbdb2696333ae5ed8f9e8cc22df657192218cad91 source_hash = b94997df68856753b72f0d7a3703b7d484d4745c567f3584ef97c96c25a5798e
patch_url = https://wrapdb.mesonbuild.com/v2/nlohmann_json_3.9.1-1/get_patch
patch_filename = nlohmann_json-3.9.1-1-wrap.zip
patch_hash = 1774e5506fbe3897d652f67e41973194b948d2ab851cf464a742f35f160a1435
[provide] [provide]
nlohmann_json = nlohmann_json_dep nlohmann_json = nlohmann_json_dep
......
[wrap-file] [wrap-file]
directory = openssl-1.1.1l directory = openssl-3.0.2
source_url = https://www.openssl.org/source/openssl-1.1.1l.tar.gz source_url = https://www.openssl.org/source/openssl-3.0.2.tar.gz
source_filename = openssl-1.1.1l.tar.gz source_filename = openssl-3.0.2.tar.gz
source_hash = 0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1 source_hash = 98e91ccead4d4756ae3c9cde5e09191a8e586d9f4d50838e7ec09d6411dfdb63
patch_filename = openssl_1.1.1l-2_patch.zip patch_filename = openssl_3.0.2-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/openssl_1.1.1l-2/get_patch patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.2-1/get_patch
patch_hash = 852521fb016fa2deee8ebf9ffeeee0292c6de86a03c775cf72ac04e86f9f177e patch_hash = 762ab4ea94d02178d6a1d3eb63409c2c4d61315d358391cdac62df15211174d4
[provide] [provide]
libcrypto = libcrypto_dep libcrypto = libcrypto_dep
......
project(
'wingetopt',
'c',
version: '0.95',
license : ['ISC', 'BSD-3-Clause'],
meson_version: '>= 0.55',
default_options: [
'warning_level=1',
],
)
compiler = meson.get_compiler('c')
c_args = []
if compiler.get_id() == 'msvc'
c_args += [
'-D_CRT_SECURE_NO_WARNINGS',
]
if get_option('default_library') == 'shared'
c_args += [
'-DBUILDING_WINGETOPT_DLL',
'-DWINGETOPT_SHARED_LIB',
]
endif
endif
wingetopt_lib = library(
'wingetopt',
'src/getopt.c',
include_directories: include_directories(
'src',
),
c_args: c_args,
)
wingetopt_dep = declare_dependency(
link_with: wingetopt_lib,
include_directories: include_directories(
'src',
),
)
[wrap-file] [wrap-file]
directory = usrsctp-9d6b99b10a70f7a63d21cd80d03c353da9ac19d3 directory = usrsctp-4e06feb01cadcd127d119486b98a4bd3d64aa1e7
source_url = https://github.com/sctplab/usrsctp/archive/9d6b99b10a70f7a63d21cd80d03c353da9ac19d3.zip source_url = https://github.com/sctplab/usrsctp/archive/4e06feb01cadcd127d119486b98a4bd3d64aa1e7.zip
source_filename = 9d6b99b10a70f7a63d21cd80d03c353da9ac19d3.zip source_filename = 4e06feb01cadcd127d119486b98a4bd3d64aa1e7.zip
source_hash = d9b7b3350ea0be2a3d1437e404d4852df741c4984b734729c5edc337ff4b7611 source_hash = 15f7844c4c4ca93228ae0fe844182c72edd1d809b461cb97b1bb687a804dd4fc
[provide] [provide]
usrsctp = usrsctp_dep usrsctp = usrsctp_dep
[wrap-file] [wrap-file]
directory = wingetopt-0.95 directory = wingetopt-1.00
source_url = https://github.com/alex85k/wingetopt/archive/v0.95.zip source_url = https://github.com/alex85k/wingetopt/archive/v1.00.zip
source_filename = wingetopt-0.95.zip source_filename = wingetopt-1.00.zip
source_hash = 7b535dd753b93446539504a76cd561282e9a8a9969fe06e0d8691fc3048987c5 source_hash = 4454ca03a59702a4ca4d1488ca8fa6168b0c8d77dc739a6fe2825c3dd8609d87
patch_directory = wingetopt
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论