summaryrefslogtreecommitdiff
path: root/krl.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-01-26 02:59:11 +0000
committerDamien Miller <djm@mindrot.org>2015-01-27 00:00:36 +1100
commit60b1825262b1f1e24fc72050b907189c92daf18e (patch)
tree055273fcc45bad93e82480da7c55c1845a41acb8 /krl.c
parenta5a3e3328ddce91e76f71ff479022d53e35c60c9 (diff)
upstream commit
small refactor and add some convenience functions; ok markus
Diffstat (limited to 'krl.c')
-rw-r--r--krl.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/krl.c b/krl.c
index 363bf122f..3fe29c8b1 100644
--- a/krl.c
+++ b/krl.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: krl.c,v 1.29 2015/01/20 23:14:00 deraadt Exp $ */ 17/* $OpenBSD: krl.c,v 1.30 2015/01/26 02:59:11 djm Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
@@ -555,13 +555,10 @@ revoked_certs_generate(struct revoked_certs *rc, struct sshbuf *buf)
555 return SSH_ERR_ALLOC_FAIL; 555 return SSH_ERR_ALLOC_FAIL;
556 556
557 /* Store the header: CA scope key, reserved */ 557 /* Store the header: CA scope key, reserved */
558 if ((r = sshkey_to_blob_buf(rc->ca_key, sect)) != 0 || 558 if ((r = sshkey_puts(rc->ca_key, buf)) != 0 ||
559 (r = sshbuf_put_stringb(buf, sect)) != 0 ||
560 (r = sshbuf_put_string(buf, NULL, 0)) != 0) 559 (r = sshbuf_put_string(buf, NULL, 0)) != 0)
561 goto out; 560 goto out;
562 561
563 sshbuf_reset(sect);
564
565 /* Store the revoked serials. */ 562 /* Store the revoked serials. */
566 for (rs = RB_MIN(revoked_serial_tree, &rc->revoked_serials); 563 for (rs = RB_MIN(revoked_serial_tree, &rc->revoked_serials);
567 rs != NULL; 564 rs != NULL;
@@ -759,14 +756,10 @@ ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf,
759 } 756 }
760 757
761 for (i = 0; i < nsign_keys; i++) { 758 for (i = 0; i < nsign_keys; i++) {
762 sshbuf_reset(sect); 759 KRL_DBG(("%s: signature key %s", __func__,
763 if ((r = sshkey_to_blob_buf(sign_keys[i], sect)) != 0) 760 sshkey_ssh_name(sign_keys[i])));
764 goto out;
765
766 KRL_DBG(("%s: signature key len %zu", __func__,
767 sshbuf_len(sect)));
768 if ((r = sshbuf_put_u8(buf, KRL_SECTION_SIGNATURE)) != 0 || 761 if ((r = sshbuf_put_u8(buf, KRL_SECTION_SIGNATURE)) != 0 ||
769 (r = sshbuf_put_stringb(buf, sect)) != 0) 762 (r = sshkey_puts(sign_keys[i], buf)) != 0)
770 goto out; 763 goto out;
771 764
772 if ((r = sshkey_sign(sign_keys[i], &sblob, &slen, 765 if ((r = sshkey_sign(sign_keys[i], &sblob, &slen,