update libressl to v2.7.4
[unleashed.git] / lib / libssl / man / SSL_get_client_random.3
blobeda74db355d3bd88c82e5a5ee15f125a66b04727
1 .\" $OpenBSD: SSL_get_client_random.3,v 1.2 2018/03/24 00:55:37 schwarze Exp $
2 .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3 .\"
4 .\" This file was written by Nick Mathewson <nickm@torproject.org>
5 .\" Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\"
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\"
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\"    notice, this list of conditions and the following disclaimer in
16 .\"    the documentation and/or other materials provided with the
17 .\"    distribution.
18 .\"
19 .\" 3. All advertising materials mentioning features or use of this
20 .\"    software must display the following acknowledgment:
21 .\"    "This product includes software developed by the OpenSSL Project
22 .\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23 .\"
24 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25 .\"    endorse or promote products derived from this software without
26 .\"    prior written permission. For written permission, please contact
27 .\"    openssl-core@openssl.org.
28 .\"
29 .\" 5. Products derived from this software may not be called "OpenSSL"
30 .\"    nor may "OpenSSL" appear in their names without prior written
31 .\"    permission of the OpenSSL Project.
32 .\"
33 .\" 6. Redistributions of any form whatsoever must retain the following
34 .\"    acknowledgment:
35 .\"    "This product includes software developed by the OpenSSL Project
36 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37 .\"
38 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
42 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
50 .\"
51 .Dd $Mdocdate: March 24 2018 $
52 .Dt SSL_GET_CLIENT_RANDOM 3
53 .Os
54 .Sh NAME
55 .Nm SSL_get_client_random ,
56 .Nm SSL_get_server_random ,
57 .Nm SSL_SESSION_get_master_key
58 .Nd get internal TLS handshake random values and master key
59 .Sh SYNOPSIS
60 .In openssl/ssl.h
61 .Ft size_t
62 .Fo SSL_get_client_random
63 .Fa "const SSL *ssl"
64 .Fa "unsigned char *out"
65 .Fa "size_t outlen"
66 .Fc
67 .Ft size_t
68 .Fo SSL_get_server_random
69 .Fa "const SSL *ssl"
70 .Fa "unsigned char *out"
71 .Fa "size_t outlen"
72 .Fc
73 .Ft size_t
74 .Fo SSL_SESSION_get_master_key
75 .Fa "const SSL_SESSION *session"
76 .Fa "unsigned char *out"
77 .Fa "size_t outlen"
78 .Fc
79 .Sh DESCRIPTION
80 .Fn SSL_get_client_random
81 extracts the random value that was sent from the client to the server
82 during the initial TLS handshake.
83 It copies at most
84 .Fa outlen
85 bytes of this value into the buffer
86 .Fa out .
88 .Fa outlen
89 is zero, nothing is copied.
90 .Pp
91 .Fn SSL_get_server_random
92 behaves the same, but extracts the random value that was sent
93 from the server to the client during the initial TLS handshake.
94 .Pp
95 .Fn SSL_SESSION_get_master_key
96 behaves the same, but extracts the master secret used to guarantee the
97 security of the TLS session.
98 The security of the TLS session depends on keeping the master key
99 secret: do not expose it, or any information about it, to anybody.
100 To calculate another secret value that depends on the master secret,
102 .Xr SSL_export_keying_material 3
103 instead.
105 All these functions expose internal values from the TLS handshake,
106 for use in low-level protocols.
107 Avoid using them unless implementing a feature
108 that requires access to the internal protocol details.
110 Despite the names of
111 .Fn SSL_get_client_random
113 .Fn SSL_get_server_random ,
114 they are not random number generators.
115 Instead, they return the mostly-random values that were already
116 generated and used in the TLS protocol.
118 In current versions of the TLS protocols,
119 the length of client_random and server_random is always
120 .Dv SSL3_RANDOM_SIZE
121 bytes.
122 Support for other
123 .Fa outlen
124 arguments is provided for the unlikely event that a future
125 version or variant of TLS uses some other length.
127 Finally, though the client_random and server_random values are called
128 .Dq random ,
129 many TLS implementations generate four bytes of those values
130 based on their view of the current time.
131 .Sh RETURN VALUES
133 .Fa outlen
134 is greater than 0, these functions return the number of bytes
135 actually copied, which is less than or equal to
136 .Fa outlen .
138 .Fa outlen
139 is 0, these functions return the maximum number of bytes they would
140 copy \(em that is, the length of the underlying field.
141 .Sh SEE ALSO
142 .Xr ssl 3 ,
143 .Xr SSL_export_keying_material 3 ,
144 .Xr SSL_SESSION_get_id 3 ,
145 .Xr SSL_SESSION_get_time 3 ,
146 .Xr SSL_SESSION_new 3
147 .Sh HISTORY
148 These functions first appeared in OpenSSL 1.1.0
149 and have been available since
150 .Ox 6.3 .