mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Refine DTLS code.
This commit is contained in:
parent
6807299ed2
commit
0bf0a61401
3 changed files with 5 additions and 4 deletions
|
@ -153,8 +153,8 @@ srs_error_t SrsRtcDtls::initialize(SrsRequest* r)
|
|||
return srs_error_wrap(err, "DTLS init");
|
||||
}
|
||||
|
||||
// TODO: FIXME: Support config by vhost to use RSA or ECDSA certificate.
|
||||
if ((dtls = SSL_new(SrsDtls::instance()->get_dtls_ctx(r))) == NULL) {
|
||||
// TODO: FIXME: Leak for SSL_CTX* return by build_dtls_ctx.
|
||||
if ((dtls = SSL_new(SrsDtls::instance()->build_dtls_ctx())) == NULL) {
|
||||
return srs_error_new(ERROR_OpenSslCreateSSL, "SSL_new dtls");
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ SrsDtls* SrsDtls::instance()
|
|||
return _instance;
|
||||
}
|
||||
|
||||
SSL_CTX* SrsDtls::get_dtls_ctx(SrsRequest* r)
|
||||
SSL_CTX* SrsDtls::build_dtls_ctx()
|
||||
{
|
||||
SSL_CTX* dtls_ctx;
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10002000L // v1.0.2
|
||||
|
@ -228,6 +228,7 @@ SSL_CTX* SrsDtls::get_dtls_ctx(SrsRequest* r)
|
|||
#endif
|
||||
|
||||
// Whether use ECDSA certificate.
|
||||
// TODO: FIXME: Support config by vhost to use RSA or ECDSA certificate.
|
||||
bool is_ecdsa = _srs_config->get_rtc_server_ecdsa();
|
||||
if (is_ecdsa) { // By ECDSA, https://stackoverflow.com/a/6006898
|
||||
EC_KEY* eckey = EC_KEY_new();
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
srs_error_t init(SrsRequest* r);
|
||||
public:
|
||||
static SrsDtls* instance();
|
||||
SSL_CTX* get_dtls_ctx(SrsRequest* r);
|
||||
SSL_CTX* build_dtls_ctx();
|
||||
public:
|
||||
std::string get_fingerprint() const;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue