ES384\_PK\_NEW(3) Library Functions Manual ES384\_PK\_NEW(3)

# [NAME](#NAME)

`es384_pk_new`, `es384_pk_free`, `es384_pk_from_EC_KEY`, `es384_pk_from_EVP_PKEY`, `es384_pk_from_ptr`, `es384_pk_to_EVP_PKEY` — FIDO2 COSE ES384 API

# [SYNOPSIS](#SYNOPSIS)

`#include <openssl/ec.h>`  
`#include <fido/es384.h>`

`es384_pk_t *`  
`es384_pk_new`(`void`);

`void`  
`es384_pk_free`(`es384_pk_t **pkp`);

`int`  
`es384_pk_from_EC_KEY`(`es384_pk_t *pk`, `const EC_KEY *ec`);

`int`  
`es384_pk_from_EVP_PKEY`(`es384_pk_t *pk`, `const EVP_PKEY *pkey`);

`int`  
`es384_pk_from_ptr`(`es384_pk_t *pk`, `const void *ptr`, `size_t len`);

`EVP_PKEY *`  
`es384_pk_to_EVP_PKEY`(`const es384_pk_t *pk`);

# [DESCRIPTION](#DESCRIPTION)

ES384 is the name given in the CBOR Object Signing and Encryption (COSE) RFC to ECDSA over P-384 with SHA-384. The COSE ES384 API of *libfido2* is an auxiliary API with routines to convert between the different ECDSA public key types used in *libfido2* and [*OpenSSL*](#OpenSSL).

In *libfido2*, ES384 public keys are abstracted by the `es384_pk_t` type.

The [`es384_pk_new`](#es384_pk_new)() function returns a pointer to a newly allocated, empty `es384_pk_t` type. If memory cannot be allocated, NULL is returned.

The [`es384_pk_free`](#es384_pk_free)() function releases the memory backing `*pkp`, where `*pkp` must have been previously allocated by `es384_pk_new`(). On return, `*pkp` is set to NULL. Either `pkp` or `*pkp` may be NULL, in which case `es384_pk_free`() is a NOP.

The [`es384_pk_from_EC_KEY`](#es384_pk_from_EC_KEY)() function fills `pk` with the contents of `ec`. No references to `ec` are kept.

The [`es384_pk_from_EVP_PKEY`](#es384_pk_from_EVP_PKEY)() function fills `pk` with the contents of `pkey`. No references to `pkey` are kept.

The [`es384_pk_from_ptr`](#es384_pk_from_ptr)() function fills `pk` with the contents of `ptr`, where `ptr` points to `len` bytes. The `ptr` pointer may point to an uncompressed point, or to the concatenation of the x and y coordinates. No references to `ptr` are kept.

The [`es384_pk_to_EVP_PKEY`](#es384_pk_to_EVP_PKEY)() function converts `pk` to a newly allocated `EVP_PKEY` type with a reference count of 1. No internal references to the returned pointer are kept. If an error occurs, `es384_pk_to_EVP_PKEY`() returns NULL.

# [RETURN VALUES](#RETURN_VALUES)

The `es384_pk_from_EC_KEY`(), `es384_pk_from_EVP_PKEY`(), and `es384_pk_from_ptr`() functions return `FIDO_OK` on success. On error, a different error code defined in `<fido/err.h>` is returned.

# [SEE ALSO](#SEE_ALSO)

[eddsa\_pk\_new(3)](/man/os/libfido2/eddsa_pk_new.3), [es256\_pk\_new(3)](/man/os/libfido2/es256_pk_new.3), [fido\_assert\_verify(3)](/man/os/libfido2/fido_assert_verify.3), [fido\_cred\_pubkey\_ptr(3)](/man/os/libfido2/fido_cred_pubkey_ptr.3), [rs256\_pk\_new(3)](/man/os/libfido2/rs256_pk_new.3)

July 15, 2022 Linux 4.19.0-gvisor

---

Document: es384_pk_from_EC_KEY(3) from libfido2 1.17.0-r8 (Chainguard OS)
Source: https://github.com/Yubico/libfido2
