1*0afa8e06SEd Maste.\" Copyright (c) 2018 Yubico AB. All rights reserved. 2*0afa8e06SEd Maste.\" Use of this source code is governed by a BSD-style 3*0afa8e06SEd Maste.\" license that can be found in the LICENSE file. 4*0afa8e06SEd Maste.\" 5*0afa8e06SEd Maste.Dd $Mdocdate: May 24 2018 $ 6*0afa8e06SEd Maste.Dt ES256_PK_NEW 3 7*0afa8e06SEd Maste.Os 8*0afa8e06SEd Maste.Sh NAME 9*0afa8e06SEd Maste.Nm es256_pk_new , 10*0afa8e06SEd Maste.Nm es256_pk_free , 11*0afa8e06SEd Maste.Nm es256_pk_from_EC_KEY , 12*0afa8e06SEd Maste.Nm es256_pk_from_ptr , 13*0afa8e06SEd Maste.Nm es256_pk_to_EVP_PKEY 14*0afa8e06SEd Maste.Nd FIDO 2 COSE ES256 API 15*0afa8e06SEd Maste.Sh SYNOPSIS 16*0afa8e06SEd Maste.In openssl/ec.h 17*0afa8e06SEd Maste.In fido/es256.h 18*0afa8e06SEd Maste.Ft es256_pk_t * 19*0afa8e06SEd Maste.Fn es256_pk_new "void" 20*0afa8e06SEd Maste.Ft void 21*0afa8e06SEd Maste.Fn es256_pk_free "es256_pk_t **pkp" 22*0afa8e06SEd Maste.Ft int 23*0afa8e06SEd Maste.Fn es256_pk_from_EC_KEY "es256_pk_t *pk" "const EC_KEY *ec" 24*0afa8e06SEd Maste.Ft int 25*0afa8e06SEd Maste.Fn es256_pk_from_ptr "es256_pk_t *pk" "const void *ptr" "size_t len" 26*0afa8e06SEd Maste.Ft EVP_PKEY * 27*0afa8e06SEd Maste.Fn es256_pk_to_EVP_PKEY "const es256_pk_t *pk" 28*0afa8e06SEd Maste.Sh DESCRIPTION 29*0afa8e06SEd MasteES256 is the name given in the CBOR Object Signing and Encryption 30*0afa8e06SEd Maste(COSE) RFC to ECDSA over P-256 with SHA-256. 31*0afa8e06SEd MasteThe COSE ES256 API of 32*0afa8e06SEd Maste.Em libfido2 33*0afa8e06SEd Masteis an auxiliary API with routines to convert between the different 34*0afa8e06SEd MasteECDSA public key types used in 35*0afa8e06SEd Maste.Em libfido2 36*0afa8e06SEd Masteand 37*0afa8e06SEd Maste.Em OpenSSL . 38*0afa8e06SEd Maste.Pp 39*0afa8e06SEd MasteIn 40*0afa8e06SEd Maste.Em libfido2 , 41*0afa8e06SEd MasteES256 public keys are abstracted by the 42*0afa8e06SEd Maste.Vt es256_pk_t 43*0afa8e06SEd Mastetype. 44*0afa8e06SEd Maste.Pp 45*0afa8e06SEd MasteThe 46*0afa8e06SEd Maste.Fn es256_pk_new 47*0afa8e06SEd Mastefunction returns a pointer to a newly allocated, empty 48*0afa8e06SEd Maste.Vt es256_pk_t 49*0afa8e06SEd Mastetype. 50*0afa8e06SEd MasteIf memory cannot be allocated, NULL is returned. 51*0afa8e06SEd Maste.Pp 52*0afa8e06SEd MasteThe 53*0afa8e06SEd Maste.Fn es256_pk_free 54*0afa8e06SEd Mastefunction releases the memory backing 55*0afa8e06SEd Maste.Fa *pkp , 56*0afa8e06SEd Mastewhere 57*0afa8e06SEd Maste.Fa *pkp 58*0afa8e06SEd Mastemust have been previously allocated by 59*0afa8e06SEd Maste.Fn es256_pk_new . 60*0afa8e06SEd MasteOn return, 61*0afa8e06SEd Maste.Fa *pkp 62*0afa8e06SEd Masteis set to NULL. 63*0afa8e06SEd MasteEither 64*0afa8e06SEd Maste.Fa pkp 65*0afa8e06SEd Masteor 66*0afa8e06SEd Maste.Fa *pkp 67*0afa8e06SEd Mastemay be NULL, in which case 68*0afa8e06SEd Maste.Fn es256_pk_free 69*0afa8e06SEd Masteis a NOP. 70*0afa8e06SEd Maste.Pp 71*0afa8e06SEd MasteThe 72*0afa8e06SEd Maste.Fn es256_pk_from_EC_KEY 73*0afa8e06SEd Mastefunction fills 74*0afa8e06SEd Maste.Fa pk 75*0afa8e06SEd Mastewith the contents of 76*0afa8e06SEd Maste.Fa ec . 77*0afa8e06SEd MasteNo references to 78*0afa8e06SEd Maste.Fa ec 79*0afa8e06SEd Masteare kept. 80*0afa8e06SEd Maste.Pp 81*0afa8e06SEd MasteThe 82*0afa8e06SEd Maste.Fn es256_pk_from_ptr 83*0afa8e06SEd Mastefunction fills 84*0afa8e06SEd Maste.Fa pk 85*0afa8e06SEd Mastewith the contents of 86*0afa8e06SEd Maste.Fa ptr , 87*0afa8e06SEd Mastewhere 88*0afa8e06SEd Maste.Fa ptr 89*0afa8e06SEd Mastepoints to 90*0afa8e06SEd Maste.Fa len 91*0afa8e06SEd Mastebytes. 92*0afa8e06SEd MasteThe 93*0afa8e06SEd Maste.Fa ptr 94*0afa8e06SEd Mastepointer may point to an uncompressed point, or to the 95*0afa8e06SEd Masteconcatenation of the x and y coordinates. 96*0afa8e06SEd MasteNo references to 97*0afa8e06SEd Maste.Fa ptr 98*0afa8e06SEd Masteare kept. 99*0afa8e06SEd Maste.Pp 100*0afa8e06SEd MasteThe 101*0afa8e06SEd Maste.Fn es256_pk_to_EVP_PKEY 102*0afa8e06SEd Mastefunction converts 103*0afa8e06SEd Maste.Fa pk 104*0afa8e06SEd Masteto a newly allocated 105*0afa8e06SEd Maste.Fa EVP_PKEY 106*0afa8e06SEd Mastetype with a reference count of 1. 107*0afa8e06SEd MasteNo internal references to the returned pointer are kept. 108*0afa8e06SEd MasteIf an error occurs, 109*0afa8e06SEd Maste.Fn es256_pk_to_EVP_PKEY 110*0afa8e06SEd Mastereturns NULL. 111*0afa8e06SEd Maste.Sh RETURN VALUES 112*0afa8e06SEd MasteThe 113*0afa8e06SEd Maste.Fn es256_pk_from_EC_KEY 114*0afa8e06SEd Masteand 115*0afa8e06SEd Maste.Fn es256_pk_from_ptr 116*0afa8e06SEd Mastefunctions return 117*0afa8e06SEd Maste.Dv FIDO_OK 118*0afa8e06SEd Masteon success. 119*0afa8e06SEd MasteOn error, a different error code defined in 120*0afa8e06SEd Maste.In fido/err.h 121*0afa8e06SEd Masteis returned. 122*0afa8e06SEd Maste.Sh SEE ALSO 123*0afa8e06SEd Maste.Xr eddsa_pk_new 3 , 124*0afa8e06SEd Maste.Xr fido_assert_verify 3 , 125*0afa8e06SEd Maste.Xr fido_cred_pubkey_ptr 3 , 126*0afa8e06SEd Maste.Xr rs256_pk_new 3 127