return NULL;
ctx->server = server;
-#ifdef USE_VERSION_1_3
pk_init(&ctx->key);
-#else
- rsa_init(&ctx->key, RSA_PKCS_V15, 0);
-#endif
return ctx;
}
{
int ret;
-#ifdef USE_VERSION_1_3
ret = x509_crt_parse_file(&ctx->ca_cert, file);
-#else
- ret = x509parse_crtfile(&ctx->ca_cert, file);
-#endif
if (ret)
return -1;
{
int ret;
-#ifdef USE_VERSION_1_3
ret = x509_crt_parse_file(&ctx->cert, file);
-#else
- ret = x509parse_crtfile(&ctx->cert, file);
-#endif
if (ret)
return -1;
{
int ret;
-#ifdef USE_VERSION_1_3
ret = pk_parse_keyfile(&ctx->key, file, NULL);
-#else
- ret = x509parse_keyfile(&ctx->key, file, NULL);
-#endif
if (ret)
return -1;
__hidden void __ustream_ssl_context_free(struct ustream_ssl_ctx *ctx)
{
-#ifdef USE_VERSION_1_3
pk_free(&ctx->key);
x509_crt_free(&ctx->cert);
-#else
- rsa_free(&ctx->key);
- x509_free(&ctx->cert);
-#endif
free(ctx);
}
#include <polarssl/version.h>
#include <polarssl/entropy.h>
-#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 ca_cert;
x509_crt cert;
bool server;