summaryrefslogtreecommitdiff
path: root/ssh-ed25519-sk.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2022-10-28 00:37:24 +0000
committerDamien Miller <djm@mindrot.org>2022-10-28 12:46:57 +1100
commit591fed94e66a016acf87f4b7cd416ce812f2abe8 (patch)
tree03a5ee7575f669585607ae1502d7c05e8292f9f1 /ssh-ed25519-sk.c
parent1e78844ae2b2dc01ba735d5ae740904c57e13685 (diff)
downloadopenssh-git-591fed94e66a016acf87f4b7cd416ce812f2abe8.tar.gz
upstream: factor out public key serialization
feedback/ok markus@ OpenBSD-Commit-ID: a3570c4b97290c5662890aea7328d87f55939033
Diffstat (limited to 'ssh-ed25519-sk.c')
-rw-r--r--ssh-ed25519-sk.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/ssh-ed25519-sk.c b/ssh-ed25519-sk.c
index 4c0fc707..b95227c0 100644
--- a/ssh-ed25519-sk.c
+++ b/ssh-ed25519-sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-ed25519-sk.c,v 1.8 2022/10/28 00:36:31 djm Exp $ */
+/* $OpenBSD: ssh-ed25519-sk.c,v 1.9 2022/10/28 00:37:24 djm Exp $ */
/*
* Copyright (c) 2019 Markus Friedl. All rights reserved.
*
@@ -55,6 +55,21 @@ ssh_ed25519_sk_equal(const struct sshkey *a, const struct sshkey *b)
return 1;
}
+static int
+ssh_ed25519_sk_serialize_public(const struct sshkey *key, struct sshbuf *b,
+ const char *typename, enum sshkey_serialize_rep opts)
+{
+ int r;
+
+ if ((r = sshkey_ed25519_funcs.serialize_public(key, b,
+ typename, opts)) != 0)
+ return r;
+ if ((r = sshkey_serialize_sk(key, b)) != 0)
+ return r;
+
+ return 0;
+}
+
int
ssh_ed25519_sk_verify(const struct sshkey *key,
const u_char *signature, size_t signaturelen,
@@ -187,6 +202,7 @@ static const struct sshkey_impl_funcs sshkey_ed25519_sk_funcs = {
/* .alloc = */ NULL,
/* .cleanup = */ ssh_ed25519_sk_cleanup,
/* .equal = */ ssh_ed25519_sk_equal,
+ /* .ssh_serialize_public = */ ssh_ed25519_sk_serialize_public,
};
const struct sshkey_impl sshkey_ed25519_sk_impl = {