Support for upstream mbedtls versions 2 and 3 when compiled with SRTP support

Co-authored-by: Thulinma <jaron@vietors.com>
This commit is contained in:
Gijs Peskens 2024-02-22 00:21:15 +01:00 committed by Thulinma
parent 3987cfec3f
commit ebe783666f
7 changed files with 147 additions and 18 deletions

View file

@ -239,7 +239,11 @@ namespace Mist{
}
// Read key from cmdline option
#if MBEDTLS_VERSION_MAJOR > 2
ret = mbedtls_pk_parse_keyfile(&pkey, config->getString("key").c_str(), NULL, mbedtls_ctr_drbg_random, &ctr_drbg);
#else
ret = mbedtls_pk_parse_keyfile(&pkey, config->getString("key").c_str(), 0);
#endif
if (ret != 0){
FAIL_MSG("Could not load any keys from file: %s", config->getString("key").c_str());
return;

View file

@ -1,9 +1,16 @@
#pragma once
#include "output.h"
#include <mbedtls/version.h>
#if MBEDTLS_VERSION_MAJOR == 2
#include <mbedtls/certs.h>
#endif
#include <mbedtls/ctr_drbg.h>
#include <mbedtls/entropy.h>
#if !HAVE_UPSTREAM_MBEDTLS_SRTP
#include <mbedtls/net.h>
#else
#include <mbedtls/net_sockets.h>
#endif
#include <mbedtls/ssl.h>
#include <mbedtls/timing.h>
#include <mbedtls/x509.h>
@ -29,6 +36,7 @@ namespace Mist{
static mbedtls_ssl_config sslConf;
static mbedtls_x509_crt srvcert;
static mbedtls_pk_context pkey;
};
}// namespace Mist