diff options
| author | beck <> | 2016-11-02 15:18:42 +0000 |
|---|---|---|
| committer | beck <> | 2016-11-02 15:18:42 +0000 |
| commit | 5418ce1f48164f4ba5618463049fa69568460f4f (patch) | |
| tree | d759e28afc9aedffba6861487c1680a3f8e3331d /src/lib/libtls/tls.c | |
| parent | cc11de9530a463cf1046e63cc0a8b635aa93cdae (diff) | |
| download | openbsd-5418ce1f48164f4ba5618463049fa69568460f4f.tar.gz openbsd-5418ce1f48164f4ba5618463049fa69568460f4f.tar.bz2 openbsd-5418ce1f48164f4ba5618463049fa69568460f4f.zip | |
Add OCSP client side support to libtls.
- Provide access to certificate OCSP URL
- Provide ability to check a raw OCSP reply against an
established TLS ctx
- Check and validate OCSP stapling info in the TLS handshake
if a stapled OCSP response is provided.`
Add example code to show OCSP URL and stapled info
into netcat.
ok jsing@
Diffstat (limited to 'src/lib/libtls/tls.c')
| -rw-r--r-- | src/lib/libtls/tls.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libtls/tls.c b/src/lib/libtls/tls.c index 00564edb3c..cccdb00531 100644 --- a/src/lib/libtls/tls.c +++ b/src/lib/libtls/tls.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls.c,v 1.49 2016/09/04 12:26:43 bcook Exp $ */ | 1 | /* $OpenBSD: tls.c,v 1.50 2016/11/02 15:18:42 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -419,6 +419,9 @@ tls_reset(struct tls *ctx) | |||
| 419 | tls_conninfo_free(ctx->conninfo); | 419 | tls_conninfo_free(ctx->conninfo); |
| 420 | ctx->conninfo = NULL; | 420 | ctx->conninfo = NULL; |
| 421 | 421 | ||
| 422 | tls_ocsp_ctx_free(ctx->ocsp_ctx); | ||
| 423 | ctx->ocsp_ctx = NULL; | ||
| 424 | |||
| 422 | for (sni = ctx->sni_ctx; sni != NULL; sni = nsni) { | 425 | for (sni = ctx->sni_ctx; sni != NULL; sni = nsni) { |
| 423 | nsni = sni->next; | 426 | nsni = sni->next; |
| 424 | tls_sni_ctx_free(sni); | 427 | tls_sni_ctx_free(sni); |
| @@ -499,6 +502,8 @@ tls_handshake(struct tls *ctx) | |||
| 499 | ctx->ssl_peer_cert = SSL_get_peer_certificate(ctx->ssl_conn); | 502 | ctx->ssl_peer_cert = SSL_get_peer_certificate(ctx->ssl_conn); |
| 500 | if (tls_conninfo_populate(ctx) == -1) | 503 | if (tls_conninfo_populate(ctx) == -1) |
| 501 | rv = -1; | 504 | rv = -1; |
| 505 | if (ctx->ocsp_ctx == NULL) | ||
| 506 | ctx->ocsp_ctx = tls_ocsp_setup_from_peer(ctx); | ||
| 502 | } | 507 | } |
| 503 | out: | 508 | out: |
| 504 | /* Prevent callers from performing incorrect error handling */ | 509 | /* Prevent callers from performing incorrect error handling */ |
