From 905b6a36d3ca21b2f619721e1de892398e5eb759 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 6 Nov 2012 12:02:25 +0100 Subject: Allow decryption with card keys > 3072 bits * scd/command.c (MAXLEN_SETDATA): New. (cmd_setdata): Add option --append. * agent/call-scd.c (agent_card_pkdecrypt): Use new option for long data. * scd/app-openpgp.c (struct app_local_s): Add field manufacturer. (app_select_openpgp): Store manufacturer. (do_decipher): Print a note for broken cards. -- Please note that I was not able to run a full test because I only have broken cards (S/N < 346) available. --- agent/call-scd.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'agent/call-scd.c') diff --git a/agent/call-scd.c b/agent/call-scd.c index 8fc00542e..2bda3779d 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -926,17 +926,22 @@ agent_card_pkdecrypt (ctrl_t ctrl, return rc; /* FIXME: use secure memory where appropriate */ - if (indatalen*2 + 50 > DIM(line)) - return unlock_scd (ctrl, gpg_error (GPG_ERR_GENERAL)); - sprintf (line, "SETDATA "); - p = line + strlen (line); - for (i=0; i < indatalen ; i++, p += 2 ) - sprintf (p, "%02X", indata[i]); - rc = assuan_transact (ctrl->scd_local->ctx, line, - NULL, NULL, NULL, NULL, NULL, NULL); - if (rc) - return unlock_scd (ctrl, rc); + for (len = 0; len < indatalen;) + { + p = stpcpy (line, "SETDATA "); + if (len) + p = stpcpy (p, "--append "); + for (i=0; len < indatalen && (i*2 < DIM(line)-50); i++, len++) + { + sprintf (p, "%02X", indata[len]); + p += 2; + } + rc = assuan_transact (ctrl->scd_local->ctx, line, + NULL, NULL, NULL, NULL, NULL, NULL); + if (rc) + return unlock_scd (ctrl, rc); + } init_membuf (&data, 1024); inqparm.ctx = ctrl->scd_local->ctx; -- cgit v1.2.3