blob: 2e366402ca1dfbf235f0008cdf319665f629aa18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
.\" $OpenBSD: EVP_PKEY_cmp.3,v 1.2 2016/11/06 15:52:50 jmc Exp $
.\"
.Dd $Mdocdate: November 6 2016 $
.Dt EVP_PKEY_CMP 3
.Os
.Sh NAME
.Nm EVP_PKEY_copy_parameters ,
.Nm EVP_PKEY_missing_parameters ,
.Nm EVP_PKEY_cmp_parameters ,
.Nm EVP_PKEY_cmp
.Nd public key parameter and comparison functions
.Sh SYNOPSIS
.In openssl/evp.h
.Ft int
.Fo EVP_PKEY_missing_parameters
.Fa "const EVP_PKEY *pkey"
.Fc
.Ft int
.Fo EVP_PKEY_copy_parameters
.Fa "EVP_PKEY *to"
.Fa "const EVP_PKEY *from"
.Fc
.Ft int
.Fo EVP_PKEY_cmp_parameters
.Fa "const EVP_PKEY *a"
.Fa "const EVP_PKEY *b"
.Fc
.Ft int
.Fo EVP_PKEY_cmp
.Fa "const EVP_PKEY *a"
.Fa "const EVP_PKEY *b"
.Fc
.Sh DESCRIPTION
The function
.Fn EVP_PKEY_missing_parameters
returns 1 if the public key parameters of
.Fa pkey
are missing and 0 if they are present or the algorithm doesn't use
parameters.
.Pp
The function
.Fn EVP_PKEY_copy_parameters
copies the parameters from key
.Fa from
to key
.Fa to .
.Pp
The function
.Fn EVP_PKEY_cmp_parameters
compares the parameters of keys
.Fa a
and
.Fa b .
.Pp
The function
.Fn EVP_PKEY_cmp
compares the public key components and parameters (if present) of keys
.Fa a
and
.Fa b .
.Pp
The main purpose of the functions
.Fn EVP_PKEY_missing_parameters
and
.Fn EVP_PKEY_copy_parameters
is to handle public keys in certificates where the parameters are
sometimes omitted from a public key if they are inherited from the CA
that signed it.
.Pp
Since OpenSSL private keys contain public key components too, the
function
.Fn EVP_PKEY_cmp
can also be used to determine if a private key matches a public key.
.Sh RETURN VALUES
The function
.Fn EVP_PKEY_missing_parameters
returns 1 if the public key parameters of
.Fa pkey
are missing and 0 if they are present or the algorithm doesn't use
parameters.
.Pp
The function
.Fn EVP_PKEY_copy_parameters
returns 1 for success and 0 for failure.
.Pp
The function
.Fn EVP_PKEY_cmp_parameters
and
.Fn EVP_PKEY_cmp
return 1 if the keys match, 0 if they don't match, -1 if the key types
are different and -2 if the operation is not supported.
.Sh SEE ALSO
.Xr EVP_PKEY_CTX_new 3 ,
.Xr EVP_PKEY_keygen 3
|