projects
/
project
/
ustream-ssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
polarssl: init certificate storage
[project/ustream-ssl.git]
/
ustream-polarssl.c
diff --git
a/ustream-polarssl.c
b/ustream-polarssl.c
index e1a6da0dcf4baa78c10f57c806ec74c2ccc9cf77..7135d3c3952773cf12af3fb22cbf2db946c58fbe 100644
(file)
--- a/
ustream-polarssl.c
+++ b/
ustream-polarssl.c
@@
-99,11
+99,9
@@
__ustream_ssl_context_new(bool server)
return NULL;
ctx->server = server;
return NULL;
ctx->server = server;
-#ifdef USE_VERSION_1_3
pk_init(&ctx->key);
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;
}
return ctx;
}
@@
-112,11
+110,7
@@
__hidden int __ustream_ssl_add_ca_crt_file(struct ustream_ssl_ctx *ctx, const ch
{
int ret;
{
int ret;
-#ifdef USE_VERSION_1_3
ret = x509_crt_parse_file(&ctx->ca_cert, file);
ret = x509_crt_parse_file(&ctx->ca_cert, file);
-#else
- ret = x509parse_crtfile(&ctx->ca_cert, file);
-#endif
if (ret)
return -1;
if (ret)
return -1;
@@
-127,11
+121,7
@@
__hidden int __ustream_ssl_set_crt_file(struct ustream_ssl_ctx *ctx, const char
{
int ret;
{
int ret;
-#ifdef USE_VERSION_1_3
ret = x509_crt_parse_file(&ctx->cert, file);
ret = x509_crt_parse_file(&ctx->cert, file);
-#else
- ret = x509parse_crtfile(&ctx->cert, file);
-#endif
if (ret)
return -1;
if (ret)
return -1;
@@
-142,11
+132,7
@@
__hidden int __ustream_ssl_set_key_file(struct ustream_ssl_ctx *ctx, const char
{
int ret;
{
int ret;
-#ifdef USE_VERSION_1_3
ret = pk_parse_keyfile(&ctx->key, file, NULL);
ret = pk_parse_keyfile(&ctx->key, file, NULL);
-#else
- ret = x509parse_keyfile(&ctx->key, file, NULL);
-#endif
if (ret)
return -1;
if (ret)
return -1;
@@
-155,13
+141,9
@@
__hidden int __ustream_ssl_set_key_file(struct ustream_ssl_ctx *ctx, const char
__hidden void __ustream_ssl_context_free(struct ustream_ssl_ctx *ctx)
{
__hidden void __ustream_ssl_context_free(struct ustream_ssl_ctx *ctx)
{
-#ifdef USE_VERSION_1_3
pk_free(&ctx->key);
pk_free(&ctx->key);
+ x509_crt_free(&ctx->ca_cert);
x509_crt_free(&ctx->cert);
x509_crt_free(&ctx->cert);
-#else
- rsa_free(&ctx->key);
- x509_free(&ctx->cert);
-#endif
free(ctx);
}
free(ctx);
}
@@
-338,7
+320,7
@@
__hidden void *__ustream_ssl_session_new(struct ustream_ssl_ctx *ctx)
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.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->c
a_c
ert, NULL, NULL);
}
ssl_session_reset(ssl);
}
ssl_session_reset(ssl);