Signed-off-by: Felix Fietkau <nbd@openwrt.org>
return NULL;
uctx->server = server;
return NULL;
uctx->server = server;
+#ifdef USE_VERSION_1_3
+ pk_init(&uctx->key);
+#else
rsa_init(&uctx->key, RSA_PKCS_V15, 0);
rsa_init(&uctx->key, RSA_PKCS_V15, 0);
__hidden int __ustream_ssl_set_crt_file(void *ctx, const char *file)
{
struct ustream_polarssl_ctx *uctx = ctx;
__hidden int __ustream_ssl_set_crt_file(void *ctx, const char *file)
{
struct ustream_polarssl_ctx *uctx = ctx;
- if (x509parse_crtfile(&uctx->cert, file))
+#ifdef USE_VERSION_1_3
+ ret = x509_crt_parse_file(&uctx->cert, file);
+#else
+ ret = x509parse_crtfile(&uctx->cert, file);
+#endif
+ if (ret)
__hidden int __ustream_ssl_set_key_file(void *ctx, const char *file)
{
struct ustream_polarssl_ctx *uctx = ctx;
__hidden int __ustream_ssl_set_key_file(void *ctx, const char *file)
{
struct ustream_polarssl_ctx *uctx = ctx;
- if (x509parse_keyfile(&uctx->key, file, NULL))
+#ifdef USE_VERSION_1_3
+ ret = pk_parse_keyfile(&uctx->key, file, NULL);
+#else
+ ret = x509parse_keyfile(&uctx->key, file, NULL);
+#endif
+ if (ret)
{
struct ustream_polarssl_ctx *uctx = ctx;
{
struct ustream_polarssl_ctx *uctx = ctx;
+#ifdef USE_VERSION_1_3
+ pk_free(&uctx->key);
+ x509_crt_free(&uctx->cert);
+#else
rsa_free(&uctx->key);
x509_free(&uctx->cert);
rsa_free(&uctx->key);
x509_free(&uctx->cert);
#include <polarssl/x509.h>
#include <polarssl/rsa.h>
#include <polarssl/error.h>
#include <polarssl/x509.h>
#include <polarssl/rsa.h>
#include <polarssl/error.h>
+#include <polarssl/version.h>
+
+#if POLARSSL_VERSION_MAJOR > 1 || POLARSSL_VERSION_MINOR >= 3
+#define USE_VERSION_1_3
+#else
+#define x509_crt x509_cert
+#endif
struct ustream_polarssl_ctx {
struct ustream_polarssl_ctx {
+#ifdef USE_VERSION_1_3
+ pk_context key;
+#else