aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-openpgp.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-01-13 16:53:49 +0000
committerWerner Koch <[email protected]>2020-01-13 16:53:49 +0000
commit60502c3606ee425d07c84b175ab310368c12b0ad (patch)
tree304132e714b9e140a1f443550b4e3b713d4f59b8 /scd/app-openpgp.c
parentagent: Avoid multiple calls to scd for KEYINFO. (diff)
downloadgnupg-60502c3606ee425d07c84b175ab310368c12b0ad.tar.gz
gnupg-60502c3606ee425d07c84b175ab310368c12b0ad.zip
scd:piv: Implement PIN cache.
* scd/command.c (pincache_put): Add arg pinlen and change all callers to provide it. * scd/app-piv.c (cache_pin): New. (pin_from_cache): New. (ask_and_prepare_chv): Add args no_cache and r_unpaddedpinlen. Take PIN from the cache. Return the unpadded length. (verify_chv): Add arg ctrl. Cache the PIN. (do_change_chv): Clear PIN cache. -- The PIV pins are padded but we want to store the unpadded PIN. Thus the changes to the function. Code has has been tested by commenting the no_cache parameter because we the current test certificate was created for PIV.9C which requires a verification for each use. More testing is required. GnuPG-bug-id: 4791 Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/app-openpgp.c')
-rw-r--r--scd/app-openpgp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index 2301ba3f5..ad88eb619 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -2225,7 +2225,8 @@ cache_pin (app_t app, ctrl_t ctrl, int chvno, const char *pin)
default: return;
}
- pincache_put (ctrl, app_get_slot (app), "openpgp", keyref, pin);
+ pincache_put (ctrl, app_get_slot (app), "openpgp", keyref,
+ pin, pin? strlen (pin):0);
}