]> granicus.if.org Git - rtmpdump/commitdiff
Fix compat with PolarSSL >= 1.1.0
authorHoward Chu <hyc@highlandsun.com>
Tue, 30 Oct 2012 15:41:49 +0000 (08:41 -0700)
committerHoward Chu <hyc@highlandsun.com>
Tue, 30 Oct 2012 15:41:49 +0000 (08:41 -0700)
librtmp/dh.h
librtmp/rtmp.c
librtmp/rtmp_sys.h

index 99595328bdff4f3b5ed6814aa6b5a906cd49389d..fa264f87f007d9b94380bdfb699d49ff2b6faf56 100644 (file)
@@ -29,6 +29,9 @@
 
 #ifdef USE_POLARSSL
 #include <polarssl/dhm.h>
+#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);
index 52d025414741c869ec5273ee9c158ba73d37126a..76a6b4f26de86efced176d777f210c09cf3dff4a 100644 (file)
@@ -33,6 +33,7 @@
 
 #ifdef CRYPTO
 #ifdef USE_POLARSSL
+#include <polarssl/version.h>
 #include <polarssl/havege.h>
 #elif defined(USE_GNUTLS)
 #include <gnutls/gnutls.h>
index c3fd4a6488f3aadc362fb54c33cc726f686227d5..1bf073530c6f3f65aeae5449eba19cdf295baab8 100644 (file)
 #include "rtmp.h"
 
 #ifdef USE_POLARSSL
+#include <polarssl/version.h>
 #include <polarssl/net.h>
 #include <polarssl/ssl.h>
 #include <polarssl/havege.h>
+#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)