Merge pull request #385 from darconeous/patch-2

Allow PKCS15 cache to work with PIV cards (if enabled)
This commit is contained in:
Doug Engert 2015-02-21 21:51:50 -06:00
commit 58d1f1db3f
1 changed files with 7 additions and 5 deletions

View File

@ -735,11 +735,13 @@ static int sc_pkcs15emu_piv_init(sc_pkcs15_card_t *p15card)
ckis[i].cert_found = 1;
/* cache it using the PKCS15 emulation objects */
/* as it does not change */
if (cert_der.value) {
cert_info.value.value = cert_der.value;
cert_info.value.len = cert_der.len;
cert_info.path.len = 0; /* use in mem cert from now on */
}
if (cert_der.value) {
cert_info.value.value = cert_der.value;
cert_info.value.len = cert_der.len;
if (!p15card->opts.use_file_cache) {
cert_info.path.len = 0; /* use in mem cert from now on */
}
}
/* following will find the cached cert in cert_info */
r = sc_pkcs15_read_certificate(p15card, &cert_info, &cert_out);
if (r < 0 || cert_out->key == NULL) {