diff options
Diffstat (limited to 'agent')
-rw-r--r-- | agent/ChangeLog | 4 | ||||
-rw-r--r-- | agent/command.c | 4 | ||||
-rw-r--r-- | agent/divert-scd.c | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog index fc0308255..d95b040df 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,7 @@ +2006-10-05 Werner Koch <[email protected]> + + * divert-scd.c (encode_md_for_card): Check that the algo is valid. + 2006-10-04 Werner Koch <[email protected]> * call-pinentry.c (agent_get_passphrase): Changed to return the diff --git a/agent/command.c b/agent/command.c index 900bfee01..a8a701f95 100644 --- a/agent/command.c +++ b/agent/command.c @@ -470,7 +470,7 @@ cmd_sethash (assuan_context_t ctx, char *line) char *endp; int algo; - /* parse the algo number and check it */ + /* Parse the algo number and check it. */ algo = (int)strtoul (line, &endp, 10); for (line = endp; *line == ' ' || *line == '\t'; line++) ; @@ -478,7 +478,7 @@ cmd_sethash (assuan_context_t ctx, char *line) return set_error (GPG_ERR_UNSUPPORTED_ALGORITHM, NULL); ctrl->digest.algo = algo; - /* parse the hash value */ + /* Parse the hash value. */ rc = parse_hexstring (ctx, line, &n); if (rc) return rc; diff --git a/agent/divert-scd.c b/agent/divert-scd.c index 9ba0b3b6d..89f177e64 100644 --- a/agent/divert-scd.c +++ b/agent/divert-scd.c @@ -148,6 +148,8 @@ encode_md_for_card (const unsigned char *digest, size_t digestlen, int algo, *r_len = 0; asnlen = DIM(asn); + if (!algo || gcry_md_test_algo (algo)) + return gpg_error (GPG_ERR_DIGEST_ALGO); if (gcry_md_algo_info (algo, GCRYCTL_GET_ASNOID, asn, &asnlen)) { log_error ("no object identifier for algo %d\n", algo); |