EDDSA_PK_NEW(3)

πŸ“¦
version 1.17.0 Β· 2 versions
  • 1.17.0 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.10.0 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– EDDSA_PK_NEW πŸ’– (that's the eddsa_pk_new(3) page, bestie β€” Library Functions Manual, we're in section 3)

okay so picture this: you're deep in FIDO2 land and you need to move EDDSA public keys between libfido2 and OpenSSL. That's literally what this whole API is for. It's the FIDO2 COSE EDDSA API and it's giving ✨glue code✨ but make it iconic. Let's get into it 🫢


✨ NAME ✨

eddsa_pk_new, eddsa_pk_free, eddsa_pk_from_EVP_PKEY, eddsa_pk_from_ptr, eddsa_pk_to_EVP_PKEY β€” FIDO2 COSE EDDSA API πŸŽ€


✨ SYNOPSIS ✨

#include <openssl/evp.h>
#include <fido/eddsa.h>

eddsa_pk_t *
eddsa_pk_new(void);

void
eddsa_pk_free(eddsa_pk_t **pkp);

int
eddsa_pk_from_EVP_PKEY(eddsa_pk_t *pk, const EVP_PKEY *pkey);

int
eddsa_pk_from_ptr(eddsa_pk_t *pk, const void *ptr, size_t len);

EVP_PKEY *
eddsa_pk_to_EVP_PKEY(const eddsa_pk_t *pk);

🌸 DESCRIPTION 🌸

so EDDSA is the name that the CBOR Object Signing and Encryption (COSE) RFC gave to EDDSA over Curve25519 with SHA-512. That's the whole vibe. πŸ’…

The COSE EDDSA API of libfido2 is an auxiliary API β€” like, it's not out here doing main character stuff, it's the supportive bestie with routines to convert between the different EDDSA public key types used in libfido2 and OpenSSL. Very "I got you" energy. 🫢

In libfido2, EDDSA public keys are abstracted by the eddsa_pk_t type. That's the little container everything revolves around, no cap.

  • eddsa_pk_new() β€” returns a pointer to a newly allocated, empty eddsa_pk_t type. If memory cannot be allocated, NULL is returned. 😭 (classic malloc betrayal)
  • eddsa_pk_free() β€” releases the memory backing *pkp, where *pkp must have been previously allocated by eddsa_pk_new(). On return, *pkp is set to NULL. Either pkp or *pkp may be NULL, in which case eddsa_pk_free() is a NOP. so chill of it honestly πŸ’€
  • eddsa_pk_from_EVP_PKEY() β€” fills pk with the contents of pkey. No references to pkey are kept. it copies and dips, no strings attached ✨
  • eddsa_pk_from_ptr() β€” fills pk with the contents of ptr, where ptr points to len bytes. No references to ptr are kept. same energy, different source πŸ¦‹
  • eddsa_pk_to_EVP_PKEY() β€” 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, eddsa_pk_to_EVP_PKEY() returns NULL. πŸ”₯
tiny note bestie: that reference count of 1 on the returned EVP_PKEY? That's yours to manage. The library is not holding your hand on that one, and it keeps no internal references to that pointer. Periodt. πŸ‘‘

πŸ’œ RETURN VALUES πŸ’œ

  • eddsa_pk_from_EVP_PKEY() and eddsa_pk_from_ptr() return FIDO_OK on success. slay. βœ…
  • On error, a different error code defined in <fido/err.h> is returned. go read that header, iykyk πŸ“–

πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group fr fr 🌈


okay that's the page!! This one came from the Debian folks, dated July 15, 2022, and it lives at EDDSA_PK_NEW(3) in the manual. go forth and convert your keys bestie, you're gonna ate πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from