| | 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 | } |