xref: /freebsd/contrib/libfido2/man/es384_pk_new.3 (revision 2ccfa855b2fc331819953e3de1b1c15ce5b95a7e)
1*2ccfa855SEd Maste.\" Copyright (c) 2022 Yubico AB. All rights reserved.
2*2ccfa855SEd Maste.\"
3*2ccfa855SEd Maste.\" Redistribution and use in source and binary forms, with or without
4*2ccfa855SEd Maste.\" modification, are permitted provided that the following conditions are
5*2ccfa855SEd Maste.\" met:
6*2ccfa855SEd Maste.\"
7*2ccfa855SEd Maste.\"    1. Redistributions of source code must retain the above copyright
8*2ccfa855SEd Maste.\"       notice, this list of conditions and the following disclaimer.
9*2ccfa855SEd Maste.\"    2. Redistributions in binary form must reproduce the above copyright
10*2ccfa855SEd Maste.\"       notice, this list of conditions and the following disclaimer in
11*2ccfa855SEd Maste.\"       the documentation and/or other materials provided with the
12*2ccfa855SEd Maste.\"       distribution.
13*2ccfa855SEd Maste.\"
14*2ccfa855SEd Maste.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15*2ccfa855SEd Maste.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16*2ccfa855SEd Maste.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17*2ccfa855SEd Maste.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18*2ccfa855SEd Maste.\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19*2ccfa855SEd Maste.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20*2ccfa855SEd Maste.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*2ccfa855SEd Maste.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*2ccfa855SEd Maste.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*2ccfa855SEd Maste.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24*2ccfa855SEd Maste.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*2ccfa855SEd Maste.\"
26*2ccfa855SEd Maste.\" SPDX-License-Identifier: BSD-2-Clause
27*2ccfa855SEd Maste.\"
28*2ccfa855SEd Maste.Dd $Mdocdate: July 15 2022 $
29*2ccfa855SEd Maste.Dt ES384_PK_NEW 3
30*2ccfa855SEd Maste.Os
31*2ccfa855SEd Maste.Sh NAME
32*2ccfa855SEd Maste.Nm es384_pk_new ,
33*2ccfa855SEd Maste.Nm es384_pk_free ,
34*2ccfa855SEd Maste.Nm es384_pk_from_EC_KEY ,
35*2ccfa855SEd Maste.Nm es384_pk_from_EVP_PKEY ,
36*2ccfa855SEd Maste.Nm es384_pk_from_ptr ,
37*2ccfa855SEd Maste.Nm es384_pk_to_EVP_PKEY
38*2ccfa855SEd Maste.Nd FIDO2 COSE ES384 API
39*2ccfa855SEd Maste.Sh SYNOPSIS
40*2ccfa855SEd Maste.In openssl/ec.h
41*2ccfa855SEd Maste.In fido/es384.h
42*2ccfa855SEd Maste.Ft es384_pk_t *
43*2ccfa855SEd Maste.Fn es384_pk_new "void"
44*2ccfa855SEd Maste.Ft void
45*2ccfa855SEd Maste.Fn es384_pk_free "es384_pk_t **pkp"
46*2ccfa855SEd Maste.Ft int
47*2ccfa855SEd Maste.Fn es384_pk_from_EC_KEY "es384_pk_t *pk" "const EC_KEY *ec"
48*2ccfa855SEd Maste.Ft int
49*2ccfa855SEd Maste.Fn es384_pk_from_EVP_PKEY "es384_pk_t *pk" "const EVP_PKEY *pkey"
50*2ccfa855SEd Maste.Ft int
51*2ccfa855SEd Maste.Fn es384_pk_from_ptr "es384_pk_t *pk" "const void *ptr" "size_t len"
52*2ccfa855SEd Maste.Ft EVP_PKEY *
53*2ccfa855SEd Maste.Fn es384_pk_to_EVP_PKEY "const es384_pk_t *pk"
54*2ccfa855SEd Maste.Sh DESCRIPTION
55*2ccfa855SEd MasteES384 is the name given in the CBOR Object Signing and Encryption
56*2ccfa855SEd Maste(COSE) RFC to ECDSA over P-384 with SHA-384.
57*2ccfa855SEd MasteThe COSE ES384 API of
58*2ccfa855SEd Maste.Em libfido2
59*2ccfa855SEd Masteis an auxiliary API with routines to convert between the different
60*2ccfa855SEd MasteECDSA public key types used in
61*2ccfa855SEd Maste.Em libfido2
62*2ccfa855SEd Masteand
63*2ccfa855SEd Maste.Em OpenSSL .
64*2ccfa855SEd Maste.Pp
65*2ccfa855SEd MasteIn
66*2ccfa855SEd Maste.Em libfido2 ,
67*2ccfa855SEd MasteES384 public keys are abstracted by the
68*2ccfa855SEd Maste.Vt es384_pk_t
69*2ccfa855SEd Mastetype.
70*2ccfa855SEd Maste.Pp
71*2ccfa855SEd MasteThe
72*2ccfa855SEd Maste.Fn es384_pk_new
73*2ccfa855SEd Mastefunction returns a pointer to a newly allocated, empty
74*2ccfa855SEd Maste.Vt es384_pk_t
75*2ccfa855SEd Mastetype.
76*2ccfa855SEd MasteIf memory cannot be allocated, NULL is returned.
77*2ccfa855SEd Maste.Pp
78*2ccfa855SEd MasteThe
79*2ccfa855SEd Maste.Fn es384_pk_free
80*2ccfa855SEd Mastefunction releases the memory backing
81*2ccfa855SEd Maste.Fa *pkp ,
82*2ccfa855SEd Mastewhere
83*2ccfa855SEd Maste.Fa *pkp
84*2ccfa855SEd Mastemust have been previously allocated by
85*2ccfa855SEd Maste.Fn es384_pk_new .
86*2ccfa855SEd MasteOn return,
87*2ccfa855SEd Maste.Fa *pkp
88*2ccfa855SEd Masteis set to NULL.
89*2ccfa855SEd MasteEither
90*2ccfa855SEd Maste.Fa pkp
91*2ccfa855SEd Masteor
92*2ccfa855SEd Maste.Fa *pkp
93*2ccfa855SEd Mastemay be NULL, in which case
94*2ccfa855SEd Maste.Fn es384_pk_free
95*2ccfa855SEd Masteis a NOP.
96*2ccfa855SEd Maste.Pp
97*2ccfa855SEd MasteThe
98*2ccfa855SEd Maste.Fn es384_pk_from_EC_KEY
99*2ccfa855SEd Mastefunction fills
100*2ccfa855SEd Maste.Fa pk
101*2ccfa855SEd Mastewith the contents of
102*2ccfa855SEd Maste.Fa ec .
103*2ccfa855SEd MasteNo references to
104*2ccfa855SEd Maste.Fa ec
105*2ccfa855SEd Masteare kept.
106*2ccfa855SEd Maste.Pp
107*2ccfa855SEd MasteThe
108*2ccfa855SEd Maste.Fn es384_pk_from_EVP_PKEY
109*2ccfa855SEd Mastefunction fills
110*2ccfa855SEd Maste.Fa pk
111*2ccfa855SEd Mastewith the contents of
112*2ccfa855SEd Maste.Fa pkey .
113*2ccfa855SEd MasteNo references to
114*2ccfa855SEd Maste.Fa pkey
115*2ccfa855SEd Masteare kept.
116*2ccfa855SEd Maste.Pp
117*2ccfa855SEd MasteThe
118*2ccfa855SEd Maste.Fn es384_pk_from_ptr
119*2ccfa855SEd Mastefunction fills
120*2ccfa855SEd Maste.Fa pk
121*2ccfa855SEd Mastewith the contents of
122*2ccfa855SEd Maste.Fa ptr ,
123*2ccfa855SEd Mastewhere
124*2ccfa855SEd Maste.Fa ptr
125*2ccfa855SEd Mastepoints to
126*2ccfa855SEd Maste.Fa len
127*2ccfa855SEd Mastebytes.
128*2ccfa855SEd MasteThe
129*2ccfa855SEd Maste.Fa ptr
130*2ccfa855SEd Mastepointer may point to an uncompressed point, or to the
131*2ccfa855SEd Masteconcatenation of the x and y coordinates.
132*2ccfa855SEd MasteNo references to
133*2ccfa855SEd Maste.Fa ptr
134*2ccfa855SEd Masteare kept.
135*2ccfa855SEd Maste.Pp
136*2ccfa855SEd MasteThe
137*2ccfa855SEd Maste.Fn es384_pk_to_EVP_PKEY
138*2ccfa855SEd Mastefunction converts
139*2ccfa855SEd Maste.Fa pk
140*2ccfa855SEd Masteto a newly allocated
141*2ccfa855SEd Maste.Fa EVP_PKEY
142*2ccfa855SEd Mastetype with a reference count of 1.
143*2ccfa855SEd MasteNo internal references to the returned pointer are kept.
144*2ccfa855SEd MasteIf an error occurs,
145*2ccfa855SEd Maste.Fn es384_pk_to_EVP_PKEY
146*2ccfa855SEd Mastereturns NULL.
147*2ccfa855SEd Maste.Sh RETURN VALUES
148*2ccfa855SEd MasteThe
149*2ccfa855SEd Maste.Fn es384_pk_from_EC_KEY ,
150*2ccfa855SEd Maste.Fn es384_pk_from_EVP_PKEY ,
151*2ccfa855SEd Masteand
152*2ccfa855SEd Maste.Fn es384_pk_from_ptr
153*2ccfa855SEd Mastefunctions return
154*2ccfa855SEd Maste.Dv FIDO_OK
155*2ccfa855SEd Masteon success.
156*2ccfa855SEd MasteOn error, a different error code defined in
157*2ccfa855SEd Maste.In fido/err.h
158*2ccfa855SEd Masteis returned.
159*2ccfa855SEd Maste.Sh SEE ALSO
160*2ccfa855SEd Maste.Xr eddsa_pk_new 3 ,
161*2ccfa855SEd Maste.Xr es256_pk_new 3 ,
162*2ccfa855SEd Maste.Xr fido_assert_verify 3 ,
163*2ccfa855SEd Maste.Xr fido_cred_pubkey_ptr 3 ,
164*2ccfa855SEd Maste.Xr rs256_pk_new 3
165