update libressl to v2.7.4
[unleashed.git] / lib / libcrypto / man / EVP_PKEY_cmp.3
blob28484c9022ff43e010838d13fe27fcfb05b37284
1 .\"     $OpenBSD: EVP_PKEY_cmp.3,v 1.8 2018/03/23 00:09:11 schwarze Exp $
2 .\"     OpenSSL 05ea606a May 20 20:52:46 2016 -0400
3 .\"
4 .\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5 .\" Copyright (c) 2006, 2013, 2014, 2016 The OpenSSL Project.
6 .\" All rights reserved.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\"
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\"
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\"    notice, this list of conditions and the following disclaimer in
17 .\"    the documentation and/or other materials provided with the
18 .\"    distribution.
19 .\"
20 .\" 3. All advertising materials mentioning features or use of this
21 .\"    software must display the following acknowledgment:
22 .\"    "This product includes software developed by the OpenSSL Project
23 .\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 .\"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\"    endorse or promote products derived from this software without
27 .\"    prior written permission. For written permission, please contact
28 .\"    openssl-core@openssl.org.
29 .\"
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\"    nor may "OpenSSL" appear in their names without prior written
32 .\"    permission of the OpenSSL Project.
33 .\"
34 .\" 6. Redistributions of any form whatsoever must retain the following
35 .\"    acknowledgment:
36 .\"    "This product includes software developed by the OpenSSL Project
37 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 .\"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
51 .\"
52 .Dd $Mdocdate: March 23 2018 $
53 .Dt EVP_PKEY_CMP 3
54 .Os
55 .Sh NAME
56 .Nm EVP_PKEY_missing_parameters ,
57 .Nm EVP_PKEY_copy_parameters ,
58 .Nm EVP_PKEY_cmp_parameters ,
59 .Nm EVP_PKEY_cmp
60 .Nd public key parameter and comparison functions
61 .Sh SYNOPSIS
62 .In openssl/evp.h
63 .Ft int
64 .Fo EVP_PKEY_missing_parameters
65 .Fa "const EVP_PKEY *pkey"
66 .Fc
67 .Ft int
68 .Fo EVP_PKEY_copy_parameters
69 .Fa "EVP_PKEY *to"
70 .Fa "const EVP_PKEY *from"
71 .Fc
72 .Ft int
73 .Fo EVP_PKEY_cmp_parameters
74 .Fa "const EVP_PKEY *a"
75 .Fa "const EVP_PKEY *b"
76 .Fc
77 .Ft int
78 .Fo EVP_PKEY_cmp
79 .Fa "const EVP_PKEY *a"
80 .Fa "const EVP_PKEY *b"
81 .Fc
82 .Sh DESCRIPTION
83 The function
84 .Fn EVP_PKEY_missing_parameters
85 returns 1 if the public key parameters of
86 .Fa pkey
87 are missing and 0 if they are present or the algorithm doesn't use
88 parameters.
89 .Pp
90 The function
91 .Fn EVP_PKEY_copy_parameters
92 copies the parameters from key
93 .Fa from
94 to key
95 .Fa to .
96 An error is returned if the parameters are missing in
97 .Fa from .
98 .Pp
99 The function
100 .Fn EVP_PKEY_cmp_parameters
101 compares the parameters of keys
102 .Fa a
104 .Fa b .
106 The function
107 .Fn EVP_PKEY_cmp
108 compares the public key components and parameters (if present) of keys
109 .Fa a
111 .Fa b .
113 The main purpose of the functions
114 .Fn EVP_PKEY_missing_parameters
116 .Fn EVP_PKEY_copy_parameters
117 is to handle public keys in certificates where the parameters are
118 sometimes omitted from a public key if they are inherited from the CA
119 that signed it.
121 Since OpenSSL private keys contain public key components too, the
122 function
123 .Fn EVP_PKEY_cmp
124 can also be used to determine if a private key matches a public key.
125 .Sh RETURN VALUES
126 The function
127 .Fn EVP_PKEY_missing_parameters
128 returns 1 if the public key parameters of
129 .Fa pkey
130 are missing and 0 if they are present or the algorithm doesn't use
131 parameters.
133 The function
134 .Fn EVP_PKEY_copy_parameters
135 returns 1 for success and 0 for failure.
137 The functions
138 .Fn EVP_PKEY_cmp_parameters
140 .Fn EVP_PKEY_cmp
141 return 1 if the keys match, 0 if they don't match, -1 if the key types
142 are different and -2 if the operation is not supported.
143 .Sh SEE ALSO
144 .Xr EVP_PKEY_asn1_set_public 3 ,
145 .Xr EVP_PKEY_CTX_new 3 ,
146 .Xr EVP_PKEY_keygen 3
147 .Sh HISTORY
148 .Fn EVP_PKEY_missing_parameters
150 .Fn EVP_PKEY_copy_parameters
151 appeared in SSLeay 0.8.1b or earlier.
152 .Fn EVP_PKEY_cmp_parameters
153 first appeared in SSLeay 0.9.0.
154 These functions have been available since
155 .Ox 2.4 .
157 .Fn EVP_PKEY_cmp
158 first appeared in OpenSSL 0.9.8 and has been available since
159 .Ox 4.5 .