Cleanup old support for pre PolarSSL 1.0.0
authorMartin Johansson <martin@fatbob.nu>
Sat, 4 May 2013 20:44:37 +0000 (22:44 +0200)
committerMartin Johansson <martin@fatbob.nu>
Sat, 4 May 2013 20:44:37 +0000 (22:44 +0200)
src/ssl.c
src/ssl.h

index 9c5236ec6815dff9d70f16890e1d5c973b436b7f..dc7218d0f0459859409c630996459a4ceac668ab 100644 (file)
--- 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;
 }
index aa0fe9381754d8fe9c1df157f6f569f5b69d00ba..86cd7bcd5ef5be3ee7d93ca20ed54e913bb6b5b4 100644 (file)
--- a/src/ssl.h
+++ b/src/ssl.h
 #include <polarssl/ssl.h>
 #include <polarssl/version.h>
 
-#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