#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
+#include <string.h>
#include "ustream-ssl.h"
#include "ustream-internal.h"
return NULL;
ctx->server = server;
-#ifdef USE_VERSION_1_3
pk_init(&ctx->key);
-#else
- rsa_init(&ctx->key, RSA_PKCS_V15, 0);
-#endif
+ x509_crt_init(&ctx->ca_cert);
+ x509_crt_init(&ctx->cert);
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->ca_cert);
x509_crt_free(&ctx->cert);
-#else
- rsa_free(&ctx->key);
- x509_free(&ctx->cert);
-#endif
free(ctx);
}
#endif
#if defined(POLARSSL_DES_C)
TLS_RSA_WITH_3DES_EDE_CBC_SHA,
-#endif
-#if defined(POLARSSL_ARC4_C)
- TLS_RSA_WITH_RC4_128_SHA,
- TLS_RSA_WITH_RC4_128_MD5,
#endif
0
};
ssl_set_ca_chain(ssl, ctx->cert.next, NULL, NULL);
ssl_set_own_cert(ssl, &ctx->cert, &ctx->key);
} else {
- ssl_set_ca_chain(ssl, &ctx->cert, NULL, NULL);
+ ssl_set_ca_chain(ssl, &ctx->ca_cert, NULL, NULL);
}
ssl_session_reset(ssl);