=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/ssh-xmss.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- src/usr.bin/ssh/ssh-xmss.c 2022/10/28 00:36:31 1.7 +++ src/usr.bin/ssh/ssh-xmss.c 2022/10/28 00:37:24 1.8 @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-xmss.c,v 1.7 2022/10/28 00:36:31 djm Exp $*/ +/* $OpenBSD: ssh-xmss.c,v 1.8 2022/10/28 00:37:24 djm Exp $*/ /* * Copyright (c) 2017 Stefan-Lukas Gazdag. * Copyright (c) 2017 Markus Friedl. @@ -60,6 +60,25 @@ return 1; } +static int +ssh_xmss_serialize_public(const struct sshkey *key, struct sshbuf *b, + const char *typename, enum sshkey_serialize_rep opts) +{ + int r; + + if (key->xmss_name == NULL || key->xmss_pk == NULL || + sshkey_xmss_pklen(key) == 0) + return SSH_ERR_INVALID_ARGUMENT; + if ((r = sshbuf_put_cstring(b, typename)) != 0 || + (r = sshbuf_put_cstring(b, key->xmss_name)) != 0 || + (r = sshbuf_put_string(b, key->xmss_pk, + sshkey_xmss_pklen(key))) != 0 || + (r = sshkey_xmss_serialize_pk_info(key, b, opts)) != 0) + return r; + + return 0; +} + int ssh_xmss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, const u_char *data, size_t datalen, u_int compat) @@ -213,6 +232,7 @@ /* .alloc = */ NULL, /* .cleanup = */ ssh_xmss_cleanup, /* .equal = */ ssh_xmss_equal, + /* .ssh_serialize_public = */ ssh_xmss_serialize_public, }; const struct sshkey_impl sshkey_xmss_impl = {