Ticket #715: xrelayd-using-polarssl.patch

File xrelayd-using-polarssl.patch, 5.9 KB (added by er13, 6 months ago)
  • make/xrelayd/patches/010-use-polarssl.patch

     
     1--- Makefile 
     2+++ Makefile 
     3@@ -1,7 +1,7 @@ 
     4 # $Id: Makefile 2 2007-09-01 10:00:28Z lo $ 
     5 #  
     6-# if you want to compile against a compiled but not installed xyssl sourcetree 
     7-# XYSSL_SOURCE=/path/to/xyssl-src 
     8+# if you want to compile against a compiled but not installed polarssl sourcetree 
     9+# POLARSSL_SOURCE=/path/to/polarssl-src 
     10  
     11 DSTROOT=/usr/local 
     12 BINDIR=$(DSTROOT)/bin 
     13@@ -10,11 +10,11 @@ 
     14 LD=gcc 
     15  
     16 CFLAGS=-g -Wall 
     17-LIBS=-lxyssl 
     18+LIBS=-lpolarssl 
     19  
     20-ifneq ($(XYSSL_SOURCE),) 
     21-       CPPFLAGS+=-I$(XYSSL_SOURCE)/include 
     22-       LDFLAGS+=-L$(XYSSL_SOURCE)/library 
     23+ifneq ($(POLARSSL_SOURCE),) 
     24+       CPPFLAGS+=-I$(POLARSSL_SOURCE)/include 
     25+       LDFLAGS+=-L$(POLARSSL_SOURCE)/library 
     26 endif 
     27  
     28 # source files 
     29--- xrelayd.c 
     30+++ xrelayd.c 
     31@@ -55,13 +55,13 @@ 
     32 #define SYSLOG_NAMES 
     33 #include <syslog.h> 
     34  
     35-/* xassl includes */ 
     36-#include <xyssl/config.h> 
     37-#include <xyssl/havege.h> 
     38-#include <xyssl/certs.h> 
     39-#include <xyssl/x509.h> 
     40-#include <xyssl/ssl.h> 
     41-#include <xyssl/net.h> 
     42+/* polarssl includes */ 
     43+#include <polarssl/config.h> 
     44+#include <polarssl/havege.h> 
     45+#include <polarssl/certs.h> 
     46+#include <polarssl/x509.h> 
     47+#include <polarssl/ssl.h> 
     48+#include <polarssl/net.h> 
     49  
     50 // FIXME. implement some sort of DDOS prevention 
     51 #define MAXCONNCOUNT 16 
     52@@ -91,14 +91,14 @@ 
     53  */ 
     54 int xrly_ciphers[] = 
     55 { 
     56-#if defined(XYSSL_AES_C) 
     57+#if defined(POLARSSL_AES_C) 
     58     SSL_RSA_AES_128_SHA, 
     59     SSL_RSA_AES_256_SHA, 
     60 #endif 
     61-#if defined(XYSSL_DES_C) 
     62+#if defined(POLARSSL_DES_C) 
     63     SSL_RSA_DES_168_SHA, 
     64 #endif 
     65-#if defined(XYSSL_ARC4_C) 
     66+#if defined(POLARSSL_ARC4_C) 
     67     SSL_RSA_RC4_128_SHA, 
     68     SSL_RSA_RC4_128_MD5, 
     69 #endif 
     70@@ -240,16 +240,16 @@ 
     71     if(res>0) return 0; 
     72      
     73     switch( res ) { 
     74-        case XYSSL_ERR_NET_TRY_AGAIN: 
     75+        case POLARSSL_ERR_NET_TRY_AGAIN: 
     76             DLOG( "%s operation on %s connection would block",op,conn); 
     77         case 0: 
     78             return 0; 
     79              
     80-        case XYSSL_ERR_SSL_PEER_CLOSE_NOTIFY: 
     81+        case POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY: 
     82             ILOG( "%s connection closed by peer during %s operation",conn,op); 
     83             break; 
     84  
     85-        case XYSSL_ERR_NET_CONN_RESET: 
     86+        case POLARSSL_ERR_NET_CONN_RESET: 
     87             ILOG( "%s connection was reset by peer during %s operation",conn,op); 
     88             break; 
     89              
     90@@ -340,13 +340,13 @@ 
     91     int     ret=0; 
     92     while(len) { 
     93         if ((ret = f_send(ctx,buf,len)) <= 0) { 
     94-            if( ret == XYSSL_ERR_NET_TRY_AGAIN ) continue; 
     95+            if( ret == POLARSSL_ERR_NET_TRY_AGAIN ) continue; 
     96             break; 
     97         } 
     98         len-=ret; 
     99         buf+=ret; 
     100     } 
     101-    *eof |= (ret == XYSSL_ERR_NET_CONN_RESET); 
     102+    *eof |= (ret == POLARSSL_ERR_NET_CONN_RESET); 
     103     return ret; 
     104 } 
     105  
     106@@ -355,7 +355,7 @@ 
     107 { 
     108     int     ret=0; 
     109     ret = f_recv(ctx,buf,len); 
     110-    *eof |= (ret == XYSSL_ERR_NET_CONN_RESET); 
     111+    *eof |= (ret == POLARSSL_ERR_NET_CONN_RESET); 
     112     return ret; 
     113 } 
     114  
     115@@ -406,7 +406,7 @@ 
     116     ssl_set_ciphers( &ssl, xrly_ciphers ); 
     117      
     118     if(cert && key) { 
     119-        ssl_set_ca_chain( &ssl, cert->next, NULL ); 
     120+        ssl_set_ca_chain( &ssl, cert->next, NULL, NULL ); 
     121         ssl_set_own_cert( &ssl, cert, key ); 
     122     } 
     123      
     124@@ -432,7 +432,7 @@ 
     125     if(sslserver) { 
     126         ILOG("Performing ssl handshake"); 
     127         while( ( ret = ssl_handshake( &ssl ) ) != 0 ) { 
     128-            if( ret != XYSSL_ERR_NET_TRY_AGAIN ) { 
     129+            if( ret != POLARSSL_ERR_NET_TRY_AGAIN ) { 
     130                 ELOG("SSL handshake failed: %08x", ret); 
     131                 return; 
     132             } 
  • make/xrelayd/Config.in

     
    11config FREETZ_PACKAGE_XRELAYD 
    22        bool "Xrelayd 0.2.1pre2" 
    3         select FREETZ_LIB_libxyssl 
     3        select FREETZ_LIB_libpolarssl 
    44        default n 
    55        help 
    6                 SSL tunnel based on XySSL. Xrelayd is a stripped down version of 
    7                 stunnel based on XySSL library. Essentially, this package makes your 
     6                SSL tunnel based on PolarSSL. Xrelayd is a stripped down version of 
     7                stunnel based on PolarSSL library. Essentially, this package makes your 
    88                router's websrv or httpd SSL-enabled, offering you the option of remote 
    99                configuration via WWW or secure remote use of features like Rudi-Shell. 
    1010 
    1111                This package will eventually replace Matrixtunnel, even though the 
    12                 XySSL library is somewhat bigger than MatrixSSL. Its command line 
     12                PolarSSL library is somewhat bigger than MatrixSSL. Its command line 
    1313                interface is identical to Matrixtunnel's, so switching should be easy 
    1414                for all users. 
  • make/xrelayd/xrelayd.mk

     
    11$(call PKG_INIT_BIN, 0.2.1pre2) 
    22$(PKG)_SOURCE:=$(pkg)-$($(PKG)_VERSION).tar.gz 
     3$(PKG)_SOURCE_MD5:=05f242295fa864bb3b0b7f0712b4dfa3 
     4 
    35$(PKG)_SITE:=http://znerol.ch/files 
    46$(PKG)_BINARY:=$($(PKG)_DIR)/xrelayd 
    57$(PKG)_TARGET_BINARY:=$($(PKG)_DEST_DIR)/usr/sbin/xrelayd 
    6 $(PKG)_SOURCE_MD5:=05f242295fa864bb3b0b7f0712b4dfa3 
    78 
    8 $(PKG)_DEPENDS_ON := xyssl 
     9$(PKG)_DEPENDS_ON := polarssl 
    910 
    1011$(PKG_SOURCE_DOWNLOAD) 
    1112$(PKG_UNPACKED) 
     
    1516        $(SUBMAKE) -C $(XRELAYD_DIR) \ 
    1617                CC="$(TARGET_CC)" \ 
    1718                CFLAGS="$(TARGET_CFLAGS)" \ 
    18                 LD="$(TARGET_CC)" \ 
     19                LD="$(TARGET_CC)" 
    1920 
    2021$($(PKG)_TARGET_BINARY): $($(PKG)_BINARY) 
    2122        $(INSTALL_BINARY_STRIP)