summaryrefslogtreecommitdiff
path: root/sshsig.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshsig.c')
-rw-r--r--sshsig.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sshsig.c b/sshsig.c
index 15f9cead6..658b8c852 100644
--- a/sshsig.c
+++ b/sshsig.c
@@ -151,7 +151,7 @@ done:
151 151
152static int 152static int
153sshsig_wrap_sign(struct sshkey *key, const char *hashalg, 153sshsig_wrap_sign(struct sshkey *key, const char *hashalg,
154 const char *sk_provider, const struct sshbuf *h_message, 154 const char *sk_provider, const char *sk_pin, const struct sshbuf *h_message,
155 const char *sig_namespace, struct sshbuf **out, 155 const char *sig_namespace, struct sshbuf **out,
156 sshsig_signer *signer, void *signer_ctx) 156 sshsig_signer *signer, void *signer_ctx)
157{ 157{
@@ -185,14 +185,14 @@ sshsig_wrap_sign(struct sshkey *key, const char *hashalg,
185 if (signer != NULL) { 185 if (signer != NULL) {
186 if ((r = signer(key, &sig, &slen, 186 if ((r = signer(key, &sig, &slen,
187 sshbuf_ptr(tosign), sshbuf_len(tosign), 187 sshbuf_ptr(tosign), sshbuf_len(tosign),
188 sign_alg, sk_provider, 0, signer_ctx)) != 0) { 188 sign_alg, sk_provider, sk_pin, 0, signer_ctx)) != 0) {
189 error("Couldn't sign message: %s", ssh_err(r)); 189 error("Couldn't sign message: %s", ssh_err(r));
190 goto done; 190 goto done;
191 } 191 }
192 } else { 192 } else {
193 if ((r = sshkey_sign(key, &sig, &slen, 193 if ((r = sshkey_sign(key, &sig, &slen,
194 sshbuf_ptr(tosign), sshbuf_len(tosign), 194 sshbuf_ptr(tosign), sshbuf_len(tosign),
195 sign_alg, sk_provider, 0)) != 0) { 195 sign_alg, sk_provider, sk_pin, 0)) != 0) {
196 error("Couldn't sign message: %s", ssh_err(r)); 196 error("Couldn't sign message: %s", ssh_err(r));
197 goto done; 197 goto done;
198 } 198 }
@@ -430,7 +430,8 @@ hash_buffer(const struct sshbuf *m, const char *hashalg, struct sshbuf **bp)
430} 430}
431 431
432int 432int
433sshsig_signb(struct sshkey *key, const char *hashalg, const char *sk_provider, 433sshsig_signb(struct sshkey *key, const char *hashalg,
434 const char *sk_provider, const char *sk_pin,
434 const struct sshbuf *message, const char *sig_namespace, 435 const struct sshbuf *message, const char *sig_namespace,
435 struct sshbuf **out, sshsig_signer *signer, void *signer_ctx) 436 struct sshbuf **out, sshsig_signer *signer, void *signer_ctx)
436{ 437{
@@ -445,7 +446,7 @@ sshsig_signb(struct sshkey *key, const char *hashalg, const char *sk_provider,
445 error("%s: hash_buffer failed: %s", __func__, ssh_err(r)); 446 error("%s: hash_buffer failed: %s", __func__, ssh_err(r));
446 goto out; 447 goto out;
447 } 448 }
448 if ((r = sshsig_wrap_sign(key, hashalg, sk_provider, b, 449 if ((r = sshsig_wrap_sign(key, hashalg, sk_provider, sk_pin, b,
449 sig_namespace, out, signer, signer_ctx)) != 0) 450 sig_namespace, out, signer, signer_ctx)) != 0)
450 goto out; 451 goto out;
451 /* success */ 452 /* success */
@@ -558,7 +559,8 @@ hash_file(int fd, const char *hashalg, struct sshbuf **bp)
558} 559}
559 560
560int 561int
561sshsig_sign_fd(struct sshkey *key, const char *hashalg, const char *sk_provider, 562sshsig_sign_fd(struct sshkey *key, const char *hashalg,
563 const char *sk_provider, const char *sk_pin,
562 int fd, const char *sig_namespace, struct sshbuf **out, 564 int fd, const char *sig_namespace, struct sshbuf **out,
563 sshsig_signer *signer, void *signer_ctx) 565 sshsig_signer *signer, void *signer_ctx)
564{ 566{
@@ -573,7 +575,7 @@ sshsig_sign_fd(struct sshkey *key, const char *hashalg, const char *sk_provider,
573 error("%s: hash_file failed: %s", __func__, ssh_err(r)); 575 error("%s: hash_file failed: %s", __func__, ssh_err(r));
574 return r; 576 return r;
575 } 577 }
576 if ((r = sshsig_wrap_sign(key, hashalg, sk_provider, b, 578 if ((r = sshsig_wrap_sign(key, hashalg, sk_provider, sk_pin, b,
577 sig_namespace, out, signer, signer_ctx)) != 0) 579 sig_namespace, out, signer, signer_ctx)) != 0)
578 goto out; 580 goto out;
579 /* success */ 581 /* success */