1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

Always enable SRS_SSL

This commit is contained in:
winlin 2018-12-22 20:03:40 +08:00
parent 8e294709b0
commit 0bc7fdbb35
12 changed files with 4 additions and 70 deletions

View file

@ -103,12 +103,6 @@ else
srs_undefine_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H
fi fi
if [ $SRS_SSL = YES ]; then
srs_define_macro "SRS_AUTO_SSL" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_SSL" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_MEM_WATCH = YES ]; then if [ $SRS_MEM_WATCH = YES ]; then
srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
else else

View file

@ -17,7 +17,6 @@ help=no
# feature options # feature options
SRS_HDS=RESERVED SRS_HDS=RESERVED
SRS_NGINX=RESERVED SRS_NGINX=RESERVED
SRS_SSL=RESERVED
SRS_FFMPEG_TOOL=RESERVED SRS_FFMPEG_TOOL=RESERVED
SRS_INGEST=RESERVED SRS_INGEST=RESERVED
SRS_STREAM_CASTER=RESERVED SRS_STREAM_CASTER=RESERVED
@ -39,6 +38,7 @@ SRS_GPERF_CP=RESERVED
SRS_GPROF=RESERVED SRS_GPROF=RESERVED
# #
# Always enable the bellow features. # Always enable the bellow features.
SRS_SSL=YES
SRS_STAT=YES SRS_STAT=YES
SRS_TRANSCODE=YES SRS_TRANSCODE=YES
SRS_HTTP_CALLBACK=YES SRS_HTTP_CALLBACK=YES
@ -681,6 +681,7 @@ function apply_user_detail_options() {
# Always enable HTTP utilies. # Always enable HTTP utilies.
if [ $SRS_HTTP_CORE = NO ]; then SRS_HTTP_CORE=YES; echo -e "${YELLOW}[WARN] Always enable HTTP utilies.${BLACK}"; fi if [ $SRS_HTTP_CORE = NO ]; then SRS_HTTP_CORE=YES; echo -e "${YELLOW}[WARN] Always enable HTTP utilies.${BLACK}"; fi
if [ $SRS_SSL = NO ]; then SRS_SSL=YES; echo -e "${YELLOW}[WARN] Always enable SSL.${BLACK}"; fi
if [ $SRS_STAT = NO ]; then SRS_STAT=YES; echo -e "${YELLOW}[WARN] Always enable Statistic.${BLACK}"; fi if [ $SRS_STAT = NO ]; then SRS_STAT=YES; echo -e "${YELLOW}[WARN] Always enable Statistic.${BLACK}"; fi
if [ $SRS_TRANSCODE = NO ]; then SRS_TRANSCODE=YES; echo -e "${YELLOW}[WARN] Always enable Transcode.${BLACK}"; fi if [ $SRS_TRANSCODE = NO ]; then SRS_TRANSCODE=YES; echo -e "${YELLOW}[WARN] Always enable Transcode.${BLACK}"; fi
if [ $SRS_HTTP_CALLBACK = NO ]; then SRS_HTTP_CALLBACK=YES; echo -e "${YELLOW}[WARN] Always enable HTTP callback.${BLACK}"; fi if [ $SRS_HTTP_CALLBACK = NO ]; then SRS_HTTP_CALLBACK=YES; echo -e "${YELLOW}[WARN] Always enable HTTP callback.${BLACK}"; fi

View file

@ -51,10 +51,7 @@ using namespace std;
#include <srs_app_utility.hpp> #include <srs_app_utility.hpp>
#include <srs_app_http_hooks.hpp> #include <srs_app_http_hooks.hpp>
#include <srs_protocol_format.hpp> #include <srs_protocol_format.hpp>
#ifdef SRS_AUTO_SSL
#include <openssl/rand.h> #include <openssl/rand.h>
#endif
// drop the segment when duration of ts too small. // drop the segment when duration of ts too small.
#define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100 #define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100
@ -80,10 +77,8 @@ void SrsHlsSegment::config_cipher(unsigned char* key,unsigned char* iv)
{ {
memcpy(this->iv, iv,16); memcpy(this->iv, iv,16);
#ifdef SRS_AUTO_SSL
SrsEncFileWriter* fw = (SrsEncFileWriter*)writer; SrsEncFileWriter* fw = (SrsEncFileWriter*)writer;
fw->config_cipher(key, iv); fw->config_cipher(key, iv);
#endif
} }
SrsDvrAsyncCallOnHls::SrsDvrAsyncCallOnHls(int c, SrsRequest* r, string p, string t, string m, string mu, int s, double d) SrsDvrAsyncCallOnHls::SrsDvrAsyncCallOnHls(int c, SrsRequest* r, string p, string t, string m, string mu, int s, double d)
@ -334,11 +329,7 @@ srs_error_t SrsHlsMuxer::update_config(SrsRequest* r, string entry_prefix,
} }
if(hls_keys) { if(hls_keys) {
#ifdef SRS_AUTO_SSL
writer = new SrsEncFileWriter(); writer = new SrsEncFileWriter();
#else
writer = new SrsFileWriter();
#endif
} else { } else {
writer = new SrsFileWriter(); writer = new SrsFileWriter();
} }
@ -656,13 +647,10 @@ srs_error_t SrsHlsMuxer::write_hls_key()
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
#ifndef SRS_AUTO_SSL
if (hls_keys) { if (hls_keys) {
srs_warn("SSL is disabled, ignore HLS key"); srs_warn("SSL is disabled, ignore HLS key");
} }
#endif
#ifdef SRS_AUTO_SSL
if (hls_keys && current->sequence_no % hls_fragments_per_key == 0) { if (hls_keys && current->sequence_no % hls_fragments_per_key == 0) {
if (RAND_bytes(key, 16) < 0) { if (RAND_bytes(key, 16) < 0) {
return srs_error_wrap(err, "rand key failed."); return srs_error_wrap(err, "rand key failed.");
@ -691,7 +679,6 @@ srs_error_t SrsHlsMuxer::write_hls_key()
if (hls_keys) { if (hls_keys) {
current->config_cipher(key, iv); current->config_cipher(key, iv);
} }
#endif
return err; return err;
} }
@ -774,8 +761,7 @@ srs_error_t SrsHlsMuxer::_refresh_m3u8(string m3u8_file)
// #EXT-X-DISCONTINUITY\n // #EXT-X-DISCONTINUITY\n
ss << "#EXT-X-DISCONTINUITY" << SRS_CONSTS_LF; ss << "#EXT-X-DISCONTINUITY" << SRS_CONSTS_LF;
} }
#ifdef SRS_AUTO_SSL
if(hls_keys && ((segment->sequence_no % hls_fragments_per_key) == 0)) { if(hls_keys && ((segment->sequence_no % hls_fragments_per_key) == 0)) {
char hexiv[33]; char hexiv[33];
srs_data_to_hex(hexiv, segment->iv, 16); srs_data_to_hex(hexiv, segment->iv, 16);
@ -792,7 +778,6 @@ srs_error_t SrsHlsMuxer::_refresh_m3u8(string m3u8_file)
ss << "#EXT-X-KEY:METHOD=AES-128,URI=" << "\"" << key_path << "\",IV=0x" << hexiv << SRS_CONSTS_LF; ss << "#EXT-X-KEY:METHOD=AES-128,URI=" << "\"" << key_path << "\",IV=0x" << hexiv << SRS_CONSTS_LF;
} }
#endif
// "#EXTINF:4294967295.208,\n" // "#EXTINF:4294967295.208,\n"
ss.precision(3); ss.precision(3);

View file

@ -588,11 +588,7 @@ srs_error_t SrsGoApiFeatures::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
SrsJsonObject* features = SrsJsonAny::object(); SrsJsonObject* features = SrsJsonAny::object();
data->set("features", features); data->set("features", features);
#ifdef SRS_AUTO_SSL
features->set("ssl", SrsJsonAny::boolean(true)); features->set("ssl", SrsJsonAny::boolean(true));
#else
features->set("ssl", SrsJsonAny::boolean(false));
#endif
features->set("hls", SrsJsonAny::boolean(true)); features->set("hls", SrsJsonAny::boolean(true));
#ifdef SRS_AUTO_HDS #ifdef SRS_AUTO_HDS
features->set("hds", SrsJsonAny::boolean(true)); features->set("hds", SrsJsonAny::boolean(true));

View file

@ -34,11 +34,8 @@
#include <sstream> #include <sstream>
using namespace std; using namespace std;
#ifdef SRS_AUTO_SSL
#include <openssl/aes.h> #include <openssl/aes.h>
#include <cstring> #include <cstring>
#endif
#include <srs_kernel_log.hpp> #include <srs_kernel_log.hpp>
#include <srs_kernel_error.hpp> #include <srs_kernel_error.hpp>
#include <srs_kernel_codec.hpp> #include <srs_kernel_codec.hpp>
@ -2616,7 +2613,6 @@ SrsVideoCodecId SrsTsContextWriter::video_codec()
return vcodec; return vcodec;
} }
#ifdef SRS_AUTO_SSL
SrsEncFileWriter::SrsEncFileWriter() SrsEncFileWriter::SrsEncFileWriter()
{ {
memset(iv,0,16); memset(iv,0,16);
@ -2703,7 +2699,6 @@ void SrsEncFileWriter::close()
SrsFileWriter::close(); SrsFileWriter::close();
} }
#endif
SrsTsMessageCache::SrsTsMessageCache() SrsTsMessageCache::SrsTsMessageCache()
{ {

View file

@ -1572,7 +1572,6 @@ public:
virtual SrsVideoCodecId video_codec(); virtual SrsVideoCodecId video_codec();
}; };
#ifdef SRS_AUTO_SSL
/* /*
* Used for HLS Encryption * Used for HLS Encryption
*/ */
@ -1593,7 +1592,6 @@ private:
char* buf; char* buf;
int nb_buf; int nb_buf;
}; };
#endif
/** /**
* TS messages cache, to group frames to TS message, * TS messages cache, to group frames to TS message,

View file

@ -653,10 +653,6 @@ int srs_rtmp_connect_server(srs_rtmp_t rtmp)
int srs_rtmp_do_complex_handshake(srs_rtmp_t rtmp) int srs_rtmp_do_complex_handshake(srs_rtmp_t rtmp)
{ {
#ifndef SRS_AUTO_SSL
// complex handshake requires ssl
return ERROR_RTMP_HS_SSL_REQUIRE;
#else
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
srs_error_t err = srs_success; srs_error_t err = srs_success;
@ -676,7 +672,6 @@ int srs_rtmp_do_complex_handshake(srs_rtmp_t rtmp)
} }
return ret; return ret;
#endif
} }
int srs_rtmp_do_simple_handshake(srs_rtmp_t rtmp) int srs_rtmp_do_simple_handshake(srs_rtmp_t rtmp)

View file

@ -212,7 +212,7 @@ void show_macro_features()
ss << "features"; ss << "features";
// rch(rtmp complex handshake) // rch(rtmp complex handshake)
ss << ", rch:" << srs_bool2switch(SRS_AUTO_SSL_BOOL); ss << ", rch:" << srs_bool2switch(true);
ss << ", dash:" << "on"; ss << ", dash:" << "on";
ss << ", hls:" << srs_bool2switch(true); ss << ", hls:" << srs_bool2switch(true);
ss << ", hds:" << srs_bool2switch(SRS_AUTO_HDS_BOOL); ss << ", hds:" << srs_bool2switch(SRS_AUTO_HDS_BOOL);

View file

@ -34,8 +34,6 @@
#include <srs_kernel_buffer.hpp> #include <srs_kernel_buffer.hpp>
#include <srs_kernel_utility.hpp> #include <srs_kernel_utility.hpp>
#ifdef SRS_AUTO_SSL
using namespace _srs_internal; using namespace _srs_internal;
// for openssl_HMACsha256 // for openssl_HMACsha256
@ -108,8 +106,6 @@ static int DH_set_length(DH *dh, long length)
return 1; return 1;
} }
#endif
namespace _srs_internal namespace _srs_internal
{ {
// 68bytes FMS key which is used to sign the sever packet. // 68bytes FMS key which is used to sign the sever packet.
@ -1175,13 +1171,6 @@ SrsComplexHandshake::~SrsComplexHandshake()
{ {
} }
#ifndef SRS_AUTO_SSL
srs_error_t SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* /*hs_bytes*/, ISrsProtocolReaderWriter* /*io*/)
{
srs_trace("directly use simple handshake for ssl disabled.");
return srs_error_new(ERROR_RTMP_TRY_SIMPLE_HS, "try simple handshake");
}
#else
srs_error_t SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io) srs_error_t SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
@ -1265,14 +1254,7 @@ srs_error_t SrsComplexHandshake::handshake_with_client(SrsHandshakeBytes* hs_byt
return err; return err;
} }
#endif
#ifndef SRS_AUTO_SSL
srs_error_t SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* /*hs_bytes*/, ISrsProtocolReaderWriter* /*io*/)
{
return srs_error_new(ERROR_RTMP_TRY_SIMPLE_HS, "try simple handshake");
}
#else
srs_error_t SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io) srs_error_t SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrsProtocolReaderWriter* io)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
@ -1346,6 +1328,4 @@ srs_error_t SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* hs_byt
return err; return err;
} }
#endif

View file

@ -31,8 +31,6 @@ class SrsComplexHandshake;
class SrsHandshakeBytes; class SrsHandshakeBytes;
class SrsBuffer; class SrsBuffer;
#ifdef SRS_AUTO_SSL
// for openssl. // for openssl.
#include <openssl/hmac.h> #include <openssl/hmac.h>
@ -499,8 +497,6 @@ namespace _srs_internal
}; };
} }
#endif
/** /**
* simple handshake. * simple handshake.
* user can try complex handshake first, * user can try complex handshake first,

View file

@ -214,8 +214,6 @@ srs_error_t MockBufferIO::read(void* buf, size_t size, ssize_t* nread)
#ifdef ENABLE_UTEST_PROTOCOL #ifdef ENABLE_UTEST_PROTOCOL
#ifdef SRS_AUTO_SSL
// verify the sha256 // verify the sha256
VOID TEST(ProtocolHandshakeTest, OpensslSha256) VOID TEST(ProtocolHandshakeTest, OpensslSha256)
{ {
@ -379,8 +377,6 @@ VOID TEST(ProtocolHandshakeTest, ComplexHandshake)
} }
} }
#endif
VOID TEST(ProtocolHandshakeTest, SimpleHandshake) VOID TEST(ProtocolHandshakeTest, SimpleHandshake)
{ {
uint8_t c0c1[] = { uint8_t c0c1[] = {

View file

@ -36,9 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_rtmp_handshake.hpp> #include <srs_rtmp_handshake.hpp>
#include <srs_protocol_stream.hpp> #include <srs_protocol_stream.hpp>
#ifdef SRS_AUTO_SSL
using namespace _srs_internal; using namespace _srs_internal;
#endif
#include <srs_protocol_io.hpp> #include <srs_protocol_io.hpp>