summaryrefslogtreecommitdiffstats
path: root/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2018-02-17 15:19:43 +0000
committerjsing <jsing@openbsd.org>2018-02-17 15:19:43 +0000
commitd4fca8d7e2f8f280844139479d9cc1a37e39cc7c (patch)
tree4ed6dce6328961a5154d8d7868c343d28d6567d5 /lib/libssl/ssl_lib.c
parentProvide SSL_CTX_get0_certificate() (diff)
downloadwireguard-openbsd-d4fca8d7e2f8f280844139479d9cc1a37e39cc7c.tar.xz
wireguard-openbsd-d4fca8d7e2f8f280844139479d9cc1a37e39cc7c.zip
Provide SSL_get_client_random() and SSL_get_server_random()
Diffstat (limited to 'lib/libssl/ssl_lib.c')
-rw-r--r--lib/libssl/ssl_lib.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c
index 79021d7e0be..e910d85914f 100644
--- a/lib/libssl/ssl_lib.c
+++ b/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_lib.c,v 1.175 2018/02/17 15:13:12 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.176 2018/02/17 15:19:43 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -758,7 +758,8 @@ SSL_CTX_get_verify_depth(const SSL_CTX *ctx)
return (X509_VERIFY_PARAM_get_depth(ctx->param));
}
-int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *)
+int
+(*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *)
{
return (ctx->internal->default_verify_callback);
}
@@ -2645,6 +2646,38 @@ SSL_get_current_expansion(SSL *s)
return (NULL);
}
+size_t
+SSL_get_client_random(const SSL *s, unsigned char *out, size_t max_out)
+{
+ size_t len = sizeof(s->s3->client_random);
+
+ if (out == NULL)
+ return len;
+
+ if (len > max_out)
+ len = max_out;
+
+ memcpy(out, s->s3->client_random, len);
+
+ return len;
+}
+
+size_t
+SSL_get_server_random(const SSL *s, unsigned char *out, size_t max_out)
+{
+ size_t len = sizeof(s->s3->server_random);
+
+ if (out == NULL)
+ return len;
+
+ if (len > max_out)
+ len = max_out;
+
+ memcpy(out, s->s3->server_random, len);
+
+ return len;
+}
+
int
ssl_init_wbio_buffer(SSL *s, int push)
{