diff options
Diffstat (limited to 'src/lib/libtls/tls.c')
| -rw-r--r-- | src/lib/libtls/tls.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/libtls/tls.c b/src/lib/libtls/tls.c index df610fe238..85faedd56d 100644 --- a/src/lib/libtls/tls.c +++ b/src/lib/libtls/tls.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls.c,v 1.47 2016/08/22 14:51:37 jsing Exp $ */ | 1 | /* $OpenBSD: tls.c,v 1.48 2016/08/22 17:12:35 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -387,7 +387,9 @@ tls_free(struct tls *ctx) | |||
| 387 | { | 387 | { |
| 388 | if (ctx == NULL) | 388 | if (ctx == NULL) |
| 389 | return; | 389 | return; |
| 390 | |||
| 390 | tls_reset(ctx); | 391 | tls_reset(ctx); |
| 392 | |||
| 391 | free(ctx); | 393 | free(ctx); |
| 392 | } | 394 | } |
| 393 | 395 | ||
| @@ -414,8 +416,7 @@ tls_reset(struct tls *ctx) | |||
| 414 | ctx->error.msg = NULL; | 416 | ctx->error.msg = NULL; |
| 415 | ctx->error.num = -1; | 417 | ctx->error.num = -1; |
| 416 | 418 | ||
| 417 | tls_free_conninfo(ctx->conninfo); | 419 | tls_conninfo_free(ctx->conninfo); |
| 418 | free(ctx->conninfo); | ||
| 419 | ctx->conninfo = NULL; | 420 | ctx->conninfo = NULL; |
| 420 | 421 | ||
| 421 | for (sni = ctx->sni_ctx; sni != NULL; sni = nsni) { | 422 | for (sni = ctx->sni_ctx; sni != NULL; sni = nsni) { |
| @@ -485,10 +486,6 @@ tls_handshake(struct tls *ctx) | |||
| 485 | goto out; | 486 | goto out; |
| 486 | } | 487 | } |
| 487 | 488 | ||
| 488 | if (ctx->conninfo == NULL && | ||
| 489 | (ctx->conninfo = calloc(1, sizeof(*ctx->conninfo))) == NULL) | ||
| 490 | goto out; | ||
| 491 | |||
| 492 | if ((ctx->flags & TLS_CLIENT) != 0) | 489 | if ((ctx->flags & TLS_CLIENT) != 0) |
| 493 | rv = tls_handshake_client(ctx); | 490 | rv = tls_handshake_client(ctx); |
| 494 | else if ((ctx->flags & TLS_SERVER_CONN) != 0) | 491 | else if ((ctx->flags & TLS_SERVER_CONN) != 0) |
| @@ -496,7 +493,7 @@ tls_handshake(struct tls *ctx) | |||
| 496 | 493 | ||
| 497 | if (rv == 0) { | 494 | if (rv == 0) { |
| 498 | ctx->ssl_peer_cert = SSL_get_peer_certificate(ctx->ssl_conn); | 495 | ctx->ssl_peer_cert = SSL_get_peer_certificate(ctx->ssl_conn); |
| 499 | if (tls_get_conninfo(ctx) == -1) | 496 | if (tls_conninfo_populate(ctx) == -1) |
| 500 | rv = -1; | 497 | rv = -1; |
| 501 | } | 498 | } |
| 502 | out: | 499 | out: |
