give the main context a type instead of making it void *
[project/ustream-ssl.git] / ustream-polarssl.h
index 86bdc361bfc2065f5ac518900e4356b2a1633098..70e8b42805287cf77bf93e2aa32c4036d25c6e35 100644 (file)
 #include <polarssl/x509.h>
 #include <polarssl/rsa.h>
 #include <polarssl/error.h>
+#include <polarssl/version.h>
 
-struct ustream_polarssl_ctx {
-       x509_cert cert;
+#if POLARSSL_VERSION_MAJOR > 1 || POLARSSL_VERSION_MINOR >= 3
+#define USE_VERSION_1_3
+#else
+#define x509_crt x509_cert
+#endif
+
+struct ustream_ssl_ctx {
+#ifdef USE_VERSION_1_3
+       pk_context key;
+#else
        rsa_context key;
+#endif
+       x509_crt cert;
        bool server;
 };
 
@@ -39,6 +50,6 @@ static inline char *__ustream_ssl_strerror(int error, char *buffer, int len)
 }
 
 void __ustream_ssl_session_free(void *ssl);
-void *__ustream_ssl_session_new(void *ctx);
+void *__ustream_ssl_session_new(struct ustream_ssl_ctx *ctx);
 
 #endif