diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-11-25 00:51:37 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-11-25 12:23:33 +1100 |
commit | b7e74ea072919b31391bc0f5ff653f80b9f5e84f (patch) | |
tree | adb2a736c1b9f6346d342600877818631f9dbb3d /monitor.c | |
parent | d2b0f88178ec9e3f11b606bf1004ac2fe541a2c3 (diff) |
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.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor.c,v 1.201 2019/11/19 22:21:15 djm Exp $ */ | 1 | /* $OpenBSD: monitor.c,v 1.202 2019/11/25 00:51:37 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
4 | * Copyright 2002 Markus Friedl <markus@openbsd.org> | 4 | * Copyright 2002 Markus Friedl <markus@openbsd.org> |
@@ -1391,6 +1391,7 @@ mm_answer_keyverify(struct ssh *ssh, int sock, struct sshbuf *m) | |||
1391 | char *sigalg; | 1391 | char *sigalg; |
1392 | size_t signaturelen, datalen, bloblen; | 1392 | size_t signaturelen, datalen, bloblen; |
1393 | int r, ret, valid_data = 0, encoded_ret; | 1393 | int r, ret, valid_data = 0, encoded_ret; |
1394 | struct sshkey_sig_details *sig_details = NULL; | ||
1394 | 1395 | ||
1395 | if ((r = sshbuf_get_string(m, &blob, &bloblen)) != 0 || | 1396 | if ((r = sshbuf_get_string(m, &blob, &bloblen)) != 0 || |
1396 | (r = sshbuf_get_string(m, &signature, &signaturelen)) != 0 || | 1397 | (r = sshbuf_get_string(m, &signature, &signaturelen)) != 0 || |
@@ -1430,7 +1431,7 @@ mm_answer_keyverify(struct ssh *ssh, int sock, struct sshbuf *m) | |||
1430 | fatal("%s: bad signature data blob", __func__); | 1431 | fatal("%s: bad signature data blob", __func__); |
1431 | 1432 | ||
1432 | ret = sshkey_verify(key, signature, signaturelen, data, datalen, | 1433 | ret = sshkey_verify(key, signature, signaturelen, data, datalen, |
1433 | sigalg, ssh->compat); | 1434 | sigalg, ssh->compat, &sig_details); |
1434 | debug3("%s: %s %p signature %s%s%s", __func__, auth_method, key, | 1435 | debug3("%s: %s %p signature %s%s%s", __func__, auth_method, key, |
1435 | (ret == 0) ? "verified" : "unverified", | 1436 | (ret == 0) ? "verified" : "unverified", |
1436 | (ret != 0) ? ": " : "", (ret != 0) ? ssh_err(ret) : ""); | 1437 | (ret != 0) ? ": " : "", (ret != 0) ? ssh_err(ret) : ""); |
@@ -1450,8 +1451,15 @@ mm_answer_keyverify(struct ssh *ssh, int sock, struct sshbuf *m) | |||
1450 | 1451 | ||
1451 | /* encode ret != 0 as positive integer, since we're sending u32 */ | 1452 | /* encode ret != 0 as positive integer, since we're sending u32 */ |
1452 | encoded_ret = (ret != 0); | 1453 | encoded_ret = (ret != 0); |
1453 | if ((r = sshbuf_put_u32(m, encoded_ret)) != 0) | 1454 | if ((r = sshbuf_put_u32(m, encoded_ret)) != 0 || |
1455 | (r = sshbuf_put_u8(m, sig_details != NULL != 0)) != 0) | ||
1454 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 1456 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
1457 | if (sig_details != NULL) { | ||
1458 | if ((r = sshbuf_put_u32(m, sig_details->sk_counter)) != 0 || | ||
1459 | (r = sshbuf_put_u8(m, sig_details->sk_flags)) != 0) | ||
1460 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | ||
1461 | } | ||
1462 | sshkey_sig_details_free(sig_details); | ||
1455 | mm_request_send(sock, MONITOR_ANS_KEYVERIFY, m); | 1463 | mm_request_send(sock, MONITOR_ANS_KEYVERIFY, m); |
1456 | 1464 | ||
1457 | return ret == 0; | 1465 | return ret == 0; |