summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-11-25 00:51:37 +0000
committerDamien Miller <djm@mindrot.org>2019-11-25 12:23:33 +1100
commitb7e74ea072919b31391bc0f5ff653f80b9f5e84f (patch)
treeadb2a736c1b9f6346d342600877818631f9dbb3d /monitor.c
parentd2b0f88178ec9e3f11b606bf1004ac2fe541a2c3 (diff)
downloadopenssh-git-b7e74ea072919b31391bc0f5ff653f80b9f5e84f.tar.gz
upstream: Add new structure for signature options
This is populated during signature verification with additional fields that are present in and covered by the signature. At the moment, it is only used to record security key-specific options, especially the flags field. with and ok markus@ OpenBSD-Commit-ID: 338a1f0e04904008836130bedb9ece4faafd4e49
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/monitor.c b/monitor.c
index 1186c1dd..40ff43ee 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.201 2019/11/19 22:21:15 djm Exp $ */
+/* $OpenBSD: monitor.c,v 1.202 2019/11/25 00:51:37 djm Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -1391,6 +1391,7 @@ mm_answer_keyverify(struct ssh *ssh, int sock, struct sshbuf *m)
char *sigalg;
size_t signaturelen, datalen, bloblen;
int r, ret, valid_data = 0, encoded_ret;
+ struct sshkey_sig_details *sig_details = NULL;
if ((r = sshbuf_get_string(m, &blob, &bloblen)) != 0 ||
(r = sshbuf_get_string(m, &signature, &signaturelen)) != 0 ||
@@ -1430,7 +1431,7 @@ mm_answer_keyverify(struct ssh *ssh, int sock, struct sshbuf *m)
fatal("%s: bad signature data blob", __func__);
ret = sshkey_verify(key, signature, signaturelen, data, datalen,
- sigalg, ssh->compat);
+ sigalg, ssh->compat, &sig_details);
debug3("%s: %s %p signature %s%s%s", __func__, auth_method, key,
(ret == 0) ? "verified" : "unverified",
(ret != 0) ? ": " : "", (ret != 0) ? ssh_err(ret) : "");
@@ -1450,8 +1451,15 @@ mm_answer_keyverify(struct ssh *ssh, int sock, struct sshbuf *m)
/* encode ret != 0 as positive integer, since we're sending u32 */
encoded_ret = (ret != 0);
- if ((r = sshbuf_put_u32(m, encoded_ret)) != 0)
+ if ((r = sshbuf_put_u32(m, encoded_ret)) != 0 ||
+ (r = sshbuf_put_u8(m, sig_details != NULL != 0)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
+ if (sig_details != NULL) {
+ if ((r = sshbuf_put_u32(m, sig_details->sk_counter)) != 0 ||
+ (r = sshbuf_put_u8(m, sig_details->sk_flags)) != 0)
+ fatal("%s: buffer error: %s", __func__, ssh_err(r));
+ }
+ sshkey_sig_details_free(sig_details);
mm_request_send(sock, MONITOR_ANS_KEYVERIFY, m);
return ret == 0;