diff options
author | djm@openbsd.org <djm@openbsd.org> | 2022-10-28 00:44:17 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2022-10-28 12:47:01 +1100 |
commit | 2519a7077a9332f70935e5242ba91ee670ed6b87 (patch) | |
tree | 2807e57cf1a61c8e7f8c26e273fad586c798ee2d /ssh-ed25519.c | |
parent | 11a768adf98371fe4e43f3b06014024c033385d5 (diff) | |
download | openssh-git-2519a7077a9332f70935e5242ba91ee670ed6b87.tar.gz |
upstream: refactor sshkey_private_serialize_opt()
feedback/ok markus@
OpenBSD-Commit-ID: 61e0fe989897901294efe7c3b6d670cefaf44cbd
Diffstat (limited to 'ssh-ed25519.c')
-rw-r--r-- | ssh-ed25519.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ssh-ed25519.c b/ssh-ed25519.c index 8e6fabed..2707361b 100644 --- a/ssh-ed25519.c +++ b/ssh-ed25519.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-ed25519.c,v 1.17 2022/10/28 00:43:08 djm Exp $ */ +/* $OpenBSD: ssh-ed25519.c,v 1.18 2022/10/28 00:44:17 djm Exp $ */ /* * Copyright (c) 2013 Markus Friedl <markus@openbsd.org> * @@ -66,6 +66,19 @@ ssh_ed25519_serialize_public(const struct sshkey *key, struct sshbuf *b, } static int +ssh_ed25519_serialize_private(const struct sshkey *key, struct sshbuf *b, + enum sshkey_serialize_rep opts) +{ + int r; + + if ((r = sshbuf_put_string(b, key->ed25519_pk, ED25519_PK_SZ)) != 0 || + (r = sshbuf_put_string(b, key->ed25519_sk, ED25519_SK_SZ)) != 0) + return r; + + return 0; +} + +static int ssh_ed25519_generate(struct sshkey *k, int bits) { if ((k->ed25519_pk = malloc(ED25519_PK_SZ)) == NULL || @@ -242,6 +255,7 @@ const struct sshkey_impl_funcs sshkey_ed25519_funcs = { /* .equal = */ ssh_ed25519_equal, /* .ssh_serialize_public = */ ssh_ed25519_serialize_public, /* .ssh_deserialize_public = */ ssh_ed25519_deserialize_public, + /* .ssh_serialize_private = */ ssh_ed25519_serialize_private, /* .generate = */ ssh_ed25519_generate, /* .copy_public = */ ssh_ed25519_copy_public, /* .sign = */ ssh_ed25519_sign, |