6
6
* GnuPG is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
8
* the Free Software Foundation; either version 3 of the License, or
9
9
* (at your option) any later version.
11
11
* GnuPG is distributed in the hope that it will be useful,
14
14
* GNU General Public License for more details.
16
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
17
* along with this program; if not, see <http://www.gnu.org/licenses/>.
21
20
#include <config.h>
149
148
asnlen = DIM(asn);
149
if (!algo || gcry_md_test_algo (algo))
150
return gpg_error (GPG_ERR_DIGEST_ALGO);
150
151
if (gcry_md_algo_info (algo, GCRYCTL_GET_ASNOID, asn, &asnlen))
152
153
log_error ("no object identifier for algo %d\n", algo);
235
236
else if (maxbuf == 1) /* Open the pinentry. */
237
rc = agent_popup_message_start (ctrl, info, NULL, NULL);
238
rc = agent_popup_message_start (ctrl, info, NULL);
240
241
rc = gpg_error (GPG_ERR_INV_VALUE);
248
249
pi = gcry_calloc_secure (1, sizeof (*pi) + maxbuf + 10);
250
return gpg_error_from_errno (errno);
251
return gpg_error_from_syserror ();
251
252
pi->max_length = maxbuf-1;
252
253
pi->min_digits = 0; /* we want a real passphrase */
253
254
pi->max_digits = 8;
311
divert_pksign (CTRL ctrl,
312
divert_pksign (ctrl_t ctrl,
312
313
const unsigned char *digest, size_t digestlen, int algo,
313
314
const unsigned char *shadow_info, unsigned char **r_sig)
318
unsigned char *sigval;
319
unsigned char *sigval = NULL;
322
321
rc = ask_for_card (ctrl, shadow_info, &kid);
326
rc = encode_md_for_card (digest, digestlen, algo,
331
rc = agent_card_pksign (ctrl, kid, getpin_cb, ctrl,
332
data, ndata, &sigval, &siglen);
325
if (algo == GCRY_MD_USER_TLS_MD5SHA1)
327
int save = ctrl->use_auth_call;
328
ctrl->use_auth_call = 1;
329
rc = agent_card_pksign (ctrl, kid, getpin_cb, ctrl,
330
digest, digestlen, &sigval, &siglen);
331
ctrl->use_auth_call = save;
338
rc = encode_md_for_card (digest, digestlen, algo, &data, &ndata);
341
rc = agent_card_pksign (ctrl, kid, getpin_cb, ctrl,
342
data, ndata, &sigval, &siglen);
343
357
key identified by SHADOW_INFO and return the plaintext in an
344
358
allocated buffer in R_BUF. */
346
divert_pkdecrypt (CTRL ctrl,
360
divert_pkdecrypt (ctrl_t ctrl,
347
361
const unsigned char *cipher,
348
362
const unsigned char *shadow_info,
349
363
char **r_buf, size_t *r_len)
409
divert_generic_cmd (CTRL ctrl, const char *cmdline, void *assuan_context)
423
divert_generic_cmd (ctrl_t ctrl, const char *cmdline, void *assuan_context)
411
425
return agent_card_scd (ctrl, cmdline, getpin_cb, ctrl, assuan_context);