xref: /freebsd/contrib/libfido2/man/eddsa_pk_new.3 (revision 2ccfa855b2fc331819953e3de1b1c15ce5b95a7e)
1*2ccfa855SEd Maste.\" Copyright (c) 2019-2022 Yubico AB. All rights reserved.
20afa8e06SEd 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 $
290afa8e06SEd Maste.Dt EDDSA_PK_NEW 3
300afa8e06SEd Maste.Os
310afa8e06SEd Maste.Sh NAME
320afa8e06SEd Maste.Nm eddsa_pk_new ,
330afa8e06SEd Maste.Nm eddsa_pk_free ,
340afa8e06SEd Maste.Nm eddsa_pk_from_EVP_PKEY ,
350afa8e06SEd Maste.Nm eddsa_pk_from_ptr ,
360afa8e06SEd Maste.Nm eddsa_pk_to_EVP_PKEY
370afa8e06SEd Maste.Nd FIDO2 COSE EDDSA API
380afa8e06SEd Maste.Sh SYNOPSIS
390afa8e06SEd Maste.In openssl/evp.h
400afa8e06SEd Maste.In fido/eddsa.h
410afa8e06SEd Maste.Ft eddsa_pk_t *
420afa8e06SEd Maste.Fn eddsa_pk_new "void"
430afa8e06SEd Maste.Ft void
440afa8e06SEd Maste.Fn eddsa_pk_free "eddsa_pk_t **pkp"
450afa8e06SEd Maste.Ft int
460afa8e06SEd Maste.Fn eddsa_pk_from_EVP_PKEY "eddsa_pk_t *pk" "const EVP_PKEY *pkey"
470afa8e06SEd Maste.Ft int
480afa8e06SEd Maste.Fn eddsa_pk_from_ptr "eddsa_pk_t *pk" "const void *ptr" "size_t len"
490afa8e06SEd Maste.Ft EVP_PKEY *
500afa8e06SEd Maste.Fn eddsa_pk_to_EVP_PKEY "const eddsa_pk_t *pk"
510afa8e06SEd Maste.Sh DESCRIPTION
520afa8e06SEd MasteEDDSA is the name given in the CBOR Object Signing and Encryption
530afa8e06SEd Maste(COSE) RFC to EDDSA over Curve25519 with SHA-512.
540afa8e06SEd MasteThe COSE EDDSA API of
550afa8e06SEd Maste.Em libfido2
560afa8e06SEd Masteis an auxiliary API with routines to convert between the different
570afa8e06SEd MasteEDDSA public key types used in
580afa8e06SEd Maste.Em libfido2
590afa8e06SEd Masteand
600afa8e06SEd Maste.Em OpenSSL .
610afa8e06SEd Maste.Pp
620afa8e06SEd MasteIn
630afa8e06SEd Maste.Em libfido2 ,
640afa8e06SEd MasteEDDSA public keys are abstracted by the
650afa8e06SEd Maste.Vt eddsa_pk_t
660afa8e06SEd Mastetype.
670afa8e06SEd Maste.Pp
680afa8e06SEd MasteThe
690afa8e06SEd Maste.Fn eddsa_pk_new
700afa8e06SEd Mastefunction returns a pointer to a newly allocated, empty
710afa8e06SEd Maste.Vt eddsa_pk_t
720afa8e06SEd Mastetype.
730afa8e06SEd MasteIf memory cannot be allocated, NULL is returned.
740afa8e06SEd Maste.Pp
750afa8e06SEd MasteThe
760afa8e06SEd Maste.Fn eddsa_pk_free
770afa8e06SEd Mastefunction releases the memory backing
780afa8e06SEd Maste.Fa *pkp ,
790afa8e06SEd Mastewhere
800afa8e06SEd Maste.Fa *pkp
810afa8e06SEd Mastemust have been previously allocated by
820afa8e06SEd Maste.Fn eddsa_pk_new .
830afa8e06SEd MasteOn return,
840afa8e06SEd Maste.Fa *pkp
850afa8e06SEd Masteis set to NULL.
860afa8e06SEd MasteEither
870afa8e06SEd Maste.Fa pkp
880afa8e06SEd Masteor
890afa8e06SEd Maste.Fa *pkp
900afa8e06SEd Mastemay be NULL, in which case
910afa8e06SEd Maste.Fn eddsa_pk_free
920afa8e06SEd Masteis a NOP.
930afa8e06SEd Maste.Pp
940afa8e06SEd MasteThe
950afa8e06SEd Maste.Fn eddsa_pk_from_EVP_PKEY
960afa8e06SEd Mastefunction fills
970afa8e06SEd Maste.Fa pk
980afa8e06SEd Mastewith the contents of
990afa8e06SEd Maste.Fa pkey .
1000afa8e06SEd MasteNo references to
1010afa8e06SEd Maste.Fa pkey
1020afa8e06SEd Masteare kept.
1030afa8e06SEd Maste.Pp
1040afa8e06SEd MasteThe
1050afa8e06SEd Maste.Fn eddsa_pk_from_ptr
1060afa8e06SEd Mastefunction fills
1070afa8e06SEd Maste.Fa pk
1080afa8e06SEd Mastewith the contents of
1090afa8e06SEd Maste.Fa ptr ,
1100afa8e06SEd Mastewhere
1110afa8e06SEd Maste.Fa ptr
1120afa8e06SEd Mastepoints to
1130afa8e06SEd Maste.Fa len
1140afa8e06SEd Mastebytes.
1150afa8e06SEd MasteNo references to
1160afa8e06SEd Maste.Fa ptr
1170afa8e06SEd Masteare kept.
1180afa8e06SEd Maste.Pp
1190afa8e06SEd MasteThe
1200afa8e06SEd Maste.Fn eddsa_pk_to_EVP_PKEY
1210afa8e06SEd Mastefunction converts
1220afa8e06SEd Maste.Fa pk
1230afa8e06SEd Masteto a newly allocated
1240afa8e06SEd Maste.Fa EVP_PKEY
1250afa8e06SEd Mastetype with a reference count of 1.
1260afa8e06SEd MasteNo internal references to the returned pointer are kept.
1270afa8e06SEd MasteIf an error occurs,
1280afa8e06SEd Maste.Fn eddsa_pk_to_EVP_PKEY
1290afa8e06SEd Mastereturns NULL.
1300afa8e06SEd Maste.Sh RETURN VALUES
1310afa8e06SEd MasteThe
1323e696dfbSEd Maste.Fn eddsa_pk_from_EVP_PKEY
1330afa8e06SEd Masteand
1340afa8e06SEd Maste.Fn eddsa_pk_from_ptr
1350afa8e06SEd Mastefunctions return
1360afa8e06SEd Maste.Dv FIDO_OK
1370afa8e06SEd Masteon success.
1380afa8e06SEd MasteOn error, a different error code defined in
1390afa8e06SEd Maste.In fido/err.h
1400afa8e06SEd Masteis returned.
1410afa8e06SEd Maste.Sh SEE ALSO
1420afa8e06SEd Maste.Xr es256_pk_new 3 ,
143*2ccfa855SEd Maste.Xr es384_pk_new 3 ,
1440afa8e06SEd Maste.Xr fido_assert_verify 3 ,
1450afa8e06SEd Maste.Xr fido_cred_pubkey_ptr 3 ,
1460afa8e06SEd Maste.Xr rs256_pk_new 3
147