diff options
Diffstat (limited to 'sm/call-agent.c')
-rw-r--r-- | sm/call-agent.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/sm/call-agent.c b/sm/call-agent.c index 4f2b83f56..b37c2e53d 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -409,19 +409,19 @@ gpgsm_scd_pksign (ctrl_t ctrl, const char *keyid, const char *desc, { case GCRY_PK_RSA: rc = gcry_sexp_build (&sig, NULL, "(sig-val(rsa(s%b)))", - sigbuflen, sigbuf); + (int)sigbuflen, sigbuf); break; case GCRY_PK_ECC: rc = gcry_sexp_build (&sig, NULL, "(sig-val(ecdsa(r%b)(s%b)))", - sigbuflen/2, sigbuf, - sigbuflen/2, sigbuf + sigbuflen/2); + (int)sigbuflen/2, sigbuf, + (int)sigbuflen/2, sigbuf + sigbuflen/2); break; case GCRY_PK_EDDSA: rc = gcry_sexp_build (&sig, NULL, "(sig-val(eddsa(r%b)(s%b)))", - sigbuflen/2, sigbuf, - sigbuflen/2, sigbuf + sigbuflen/2); + (int)sigbuflen/2, sigbuf, + (int)sigbuflen/2, sigbuf + sigbuflen/2); break; default: @@ -785,9 +785,9 @@ scd_keypairinfo_status_cb (void *opaque, const char *line) { sl = append_to_strlist (listaddr, line); p = sl->d; - /* Make sure that we only have two tokes so that future - extensions of the format won't change the format expected by - the caller. */ + /* Make sure that we only have two tokens so that future + * extensions of the format won't change the format expected by + * the caller. */ while (*p && !spacep (p)) p++; if (*p) @@ -796,7 +796,22 @@ scd_keypairinfo_status_cb (void *opaque, const char *line) p++; while (*p && !spacep (p)) p++; - *p = 0; + if (*p) + { + *p++ = 0; + while (spacep (p)) + p++; + while (*p && !spacep (p)) + { + switch (*p++) + { + case 'c': sl->flags |= GCRY_PK_USAGE_CERT; break; + case 's': sl->flags |= GCRY_PK_USAGE_SIGN; break; + case 'e': sl->flags |= GCRY_PK_USAGE_ENCR; break; + case 'a': sl->flags |= GCRY_PK_USAGE_AUTH; break; + } + } + } } } @@ -806,7 +821,7 @@ scd_keypairinfo_status_cb (void *opaque, const char *line) /* Call the agent to read the keypairinfo lines of the current card. The list is returned as a string made up of the keygrip, a space - and the keyid. */ + and the keyid. The flags of the string carry the usage bits. */ int gpgsm_agent_scd_keypairinfo (ctrl_t ctrl, strlist_t *r_list) { @@ -821,7 +836,7 @@ gpgsm_agent_scd_keypairinfo (ctrl_t ctrl, strlist_t *r_list) inq_parm.ctrl = ctrl; inq_parm.ctx = agent_ctx; - rc = assuan_transact (agent_ctx, "SCD LEARN --force", + rc = assuan_transact (agent_ctx, "SCD LEARN --keypairinfo", NULL, NULL, default_inq_cb, &inq_parm, scd_keypairinfo_status_cb, &list); |