diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2022-10-28 00:36:32 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2022-10-28 00:36:32 +0000 |
commit | 1182589d27021ed1c94c7ff64f6bdc65924353e6 (patch) | |
tree | 34c7161ffa50682a2905f6a40097208dc5afd7ea /usr.bin/ssh/ssh-xmss.c | |
parent | 7147ac5a57e9efd455d0816c08c26e9c4ca03347 (diff) |
factor out sshkey_equal_public()
feedback/ok markus@
Diffstat (limited to 'usr.bin/ssh/ssh-xmss.c')
-rw-r--r-- | usr.bin/ssh/ssh-xmss.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/ssh/ssh-xmss.c b/usr.bin/ssh/ssh-xmss.c index 5309ba801b2..1936af55cd3 100644 --- a/usr.bin/ssh/ssh-xmss.c +++ b/usr.bin/ssh/ssh-xmss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-xmss.c,v 1.6 2022/10/28 00:35:40 djm Exp $*/ +/* $OpenBSD: ssh-xmss.c,v 1.7 2022/10/28 00:36:31 djm Exp $*/ /* * Copyright (c) 2017 Stefan-Lukas Gazdag. * Copyright (c) 2017 Markus Friedl. @@ -48,6 +48,18 @@ ssh_xmss_cleanup(struct sshkey *k) k->xmss_filename = NULL; } +static int +ssh_xmss_equal(const struct sshkey *a, const struct sshkey *b) +{ + if (a->xmss_pk == NULL || b->xmss_pk == NULL) + return 0; + if (sshkey_xmss_pklen(a) != sshkey_xmss_pklen(b)) + return 0; + if (memcmp(a->xmss_pk, b->xmss_pk, sshkey_xmss_pklen(a)) != 0) + return 0; + return 1; +} + int ssh_xmss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, const u_char *data, size_t datalen, u_int compat) @@ -200,6 +212,7 @@ static const struct sshkey_impl_funcs sshkey_xmss_funcs = { /* .size = */ NULL, /* .alloc = */ NULL, /* .cleanup = */ ssh_xmss_cleanup, + /* .equal = */ ssh_xmss_equal, }; const struct sshkey_impl sshkey_xmss_impl = { |