From: Howard Chu Date: Tue, 30 Oct 2012 15:41:49 +0000 (-0700) Subject: Fix compat with PolarSSL >= 1.1.0 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a312ac7770207bd7d07725c1aef43725206e803a;p=rtmpdump Fix compat with PolarSSL >= 1.1.0 --- diff --git a/librtmp/dh.h b/librtmp/dh.h index 9959532..fa264f8 100644 --- a/librtmp/dh.h +++ b/librtmp/dh.h @@ -29,6 +29,9 @@ #ifdef USE_POLARSSL #include +#if POLARSSL_VERSION_NUMBER < 0x01010100 +#define havege_random havege_rand +#endif typedef mpi * MP_t; #define MP_new(m) m = malloc(sizeof(mpi)); mpi_init(m) #define MP_set_w(mpi, w) mpi_lset(mpi, w) @@ -61,7 +64,7 @@ static int MDH_generate_key(MDH *dh) MP_set(&dh->ctx.P, dh->p); MP_set(&dh->ctx.G, dh->g); dh->ctx.len = 128; - dhm_make_public(&dh->ctx, 1024, out, 1, havege_rand, &RTMP_TLS_ctx->hs); + dhm_make_public(&dh->ctx, 1024, out, 1, havege_random, &RTMP_TLS_ctx->hs); MP_new(dh->pub_key); MP_new(dh->priv_key); MP_set(dh->pub_key, &dh->ctx.GX); diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c index 52d0254..76a6b4f 100644 --- a/librtmp/rtmp.c +++ b/librtmp/rtmp.c @@ -33,6 +33,7 @@ #ifdef CRYPTO #ifdef USE_POLARSSL +#include #include #elif defined(USE_GNUTLS) #include diff --git a/librtmp/rtmp_sys.h b/librtmp/rtmp_sys.h index c3fd4a6..1bf0735 100644 --- a/librtmp/rtmp_sys.h +++ b/librtmp/rtmp_sys.h @@ -61,9 +61,13 @@ #include "rtmp.h" #ifdef USE_POLARSSL +#include #include #include #include +#if POLARSSL_VERSION_NUMBER < 0x01010100 +#define havege_random havege_rand +#endif typedef struct tls_ctx { havege_state hs; ssl_session ssn; @@ -71,7 +75,7 @@ typedef struct tls_ctx { #define TLS_CTX tls_ctx * #define TLS_client(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ ssl_set_endpoint(s, SSL_IS_CLIENT); ssl_set_authmode(s, SSL_VERIFY_NONE);\ - ssl_set_rng(s, havege_rand, &ctx->hs);\ + ssl_set_rng(s, havege_random, &ctx->hs);\ ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ ssl_set_session(s, 1, 600, &ctx->ssn) #define TLS_setfd(s,fd) ssl_set_bio(s, net_recv, &fd, net_send, &fd)