diff options
Diffstat (limited to 'ssh-ed25519.c')
-rw-r--r-- | ssh-ed25519.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ssh-ed25519.c b/ssh-ed25519.c index 712cc4022..72c850000 100644 --- a/ssh-ed25519.c +++ b/ssh-ed25519.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-ed25519.c,v 1.12 2022/10/28 00:36:31 djm Exp $ */ +/* $OpenBSD: ssh-ed25519.c,v 1.13 2022/10/28 00:37:24 djm Exp $ */ /* * Copyright (c) 2013 Markus Friedl <markus@openbsd.org> * @@ -51,6 +51,21 @@ ssh_ed25519_equal(const struct sshkey *a, const struct sshkey *b) return 1; } +static int +ssh_ed25519_serialize_public(const struct sshkey *key, struct sshbuf *b, + const char *typename, enum sshkey_serialize_rep opts) +{ + int r; + + if (key->ed25519_pk == NULL) + return SSH_ERR_INVALID_ARGUMENT; + if ((r = sshbuf_put_cstring(b, typename)) != 0 || + (r = sshbuf_put_string(b, key->ed25519_pk, ED25519_PK_SZ)) != 0) + return r; + + return 0; +} + int ssh_ed25519_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, const u_char *data, size_t datalen, u_int compat) @@ -184,6 +199,7 @@ const struct sshkey_impl_funcs sshkey_ed25519_funcs = { /* .alloc = */ NULL, /* .cleanup = */ ssh_ed25519_cleanup, /* .equal = */ ssh_ed25519_equal, + /* .ssh_serialize_public = */ ssh_ed25519_serialize_public, }; const struct sshkey_impl sshkey_ed25519_impl = { |