From 3d6597697af81724a9be288af0354c987a696114 Mon Sep 17 00:00:00 2001 From: Martin Johansson Date: Sat, 4 May 2013 22:44:37 +0200 Subject: [PATCH] Cleanup old support for pre PolarSSL 1.0.0 --- src/ssl.c | 16 ---------------- src/ssl.h | 9 ++++----- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 9c5236e..dc7218d 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -257,11 +257,7 @@ SSL_handle_t *SSLi_newconnection(int *fd, bool_t *SSLready) ssl_set_dbg(ssl, pssl_debug, NULL); ssl_set_bio(ssl, net_recv, fd, net_send, fd); -#ifdef POLARSSL_API_V1 ssl_set_ciphersuites(ssl, ciphers); -#else - ssl_set_ciphers(ssl, ciphers); -#endif #ifdef POLARSSL_API_V1_2 ssl_set_session(ssl, ssn); @@ -282,11 +278,7 @@ int SSLi_nonblockaccept(SSL_handle_t *ssl, bool_t *SSLready) rc = ssl_handshake(ssl); if (rc != 0) { -#ifdef POLARSSL_API_V1 if (rc == POLARSSL_ERR_NET_WANT_READ || rc == POLARSSL_ERR_NET_WANT_WRITE) { -#else - if (rc == POLARSSL_ERR_NET_TRY_AGAIN) { -#endif return 0; } else if (POLARSSL_ERR_X509_CERT_VERIFY_FAILED) { /* Allow this (selfsigned etc) */ return 0; @@ -304,11 +296,7 @@ int SSLi_read(SSL_handle_t *ssl, uint8_t *buf, int len) int rc; rc = ssl_read(ssl, buf, len); -#ifdef POLARSSL_API_V1 if (rc == POLARSSL_ERR_NET_WANT_READ) -#else - if (rc == POLARSSL_ERR_NET_TRY_AGAIN) -#endif return SSLI_ERROR_WANT_READ; return rc; } @@ -318,11 +306,7 @@ int SSLi_write(SSL_handle_t *ssl, uint8_t *buf, int len) int rc; rc = ssl_write(ssl, buf, len); -#ifdef POLARSSL_API_V1 if (rc == POLARSSL_ERR_NET_WANT_WRITE) -#else - if (rc == POLARSSL_ERR_NET_TRY_AGAIN) -#endif return SSLI_ERROR_WANT_WRITE; return rc; } diff --git a/src/ssl.h b/src/ssl.h index aa0fe93..86cd7bc 100644 --- a/src/ssl.h +++ b/src/ssl.h @@ -40,7 +40,10 @@ #include #include -#define POLARSSL_API_V1 +#if (POLARSSL_VERSION_MAJOR < 1) +#error PolarSSL version 1.0.0 or later is required! +#endif + #ifdef USE_POLARSSL_HAVEGE #if (POLARSSL_VERSION_MINOR >= 1) #define HAVEGE_RAND (havege_random) @@ -77,11 +80,7 @@ int urandom_bytes(void *ctx, unsigned char *dest, size_t len); #define SSLI_ERROR_WANT_READ -0x0F300 /* PolarSSL v0.x.x uses -0x0f00 -> --0x0f90, v1.x.x uses -0x7080 -> -0x7e80 */ #define SSLI_ERROR_WANT_WRITE -0x0F310 -#ifdef POLARSSL_API_V1 #define SSLI_ERROR_ZERO_RETURN 0 -#else -#define SSLI_ERROR_ZERO_RETURN POLARSSL_ERR_NET_CONN_RESET -#endif #define SSLI_ERROR_CONNRESET POLARSSL_ERR_NET_CONN_RESET #define SSLI_ERROR_SYSCALL POLARSSL_ERR_NET_RECV_FAILED -- 2.30.2