aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-03-31 09:57:19 +0000
committerWerner Koch <[email protected]>2020-04-01 13:01:43 +0000
commit368f006a2840cd6b37caf7b4b98a16b818ac2289 (patch)
tree4fcf4b58b00fee51f33999ef6a0646fac470ebd6
parentscd: Add function for binary read in extended mode. (diff)
downloadgnupg-368f006a2840cd6b37caf7b4b98a16b818ac2289.tar.gz
gnupg-368f006a2840cd6b37caf7b4b98a16b818ac2289.zip
scd:p15: Read certificates in extended mode.
* scd/app-p15.c (readcert_by_cdf): Allow reading in extended mode. * scd/app-common.h (app_get_slot): New. -- Signed-off-by: Werner Koch <[email protected]> (Back ported from master) Added app_get_slot.
-rw-r--r--scd/app-common.h13
-rw-r--r--scd/app-p15.c5
2 files changed, 17 insertions, 1 deletions
diff --git a/scd/app-common.h b/scd/app-common.h
index 2619823dc..6bf432e65 100644
--- a/scd/app-common.h
+++ b/scd/app-common.h
@@ -119,6 +119,19 @@ struct app_ctx_s {
} fnc;
};
+
+/* Helper to get the slot from an APP object. */
+static inline int
+app_get_slot (app_t app)
+{
+ /* Note that this is a similar function of the one in 2.3 which we
+ * use to make back porting easier. */
+ if (app)
+ return app->slot;
+ return -1;
+}
+
+
/*-- app-help.c --*/
unsigned int app_help_count_bits (const unsigned char *a, size_t len);
gpg_error_t app_help_get_keygrip_string (ksba_cert_t cert, char *hexkeygrip);
diff --git a/scd/app-p15.c b/scd/app-p15.c
index 11c93dc7b..68b024fa3 100644
--- a/scd/app-p15.c
+++ b/scd/app-p15.c
@@ -659,6 +659,8 @@ read_ef_odf (app_t app, unsigned short odf_fid)
app->app_local->home_df = home_df;
log_info ("p15: application directory detected as 0x%04hX\n",
home_df);
+ /* We assume that direct path selection is possible. */
+ app->app_local->direct_path_selection = 1;
}
/* We only allow a full path if all files are at the same
@@ -2713,7 +2715,8 @@ readcert_by_cdf (app_t app, cdf_object_t cdf,
if (err)
goto leave;
- err = iso7816_read_binary (app->slot, cdf->off, cdf->len, &buffer, &buflen);
+ err = iso7816_read_binary_ext (app_get_slot (app), 1, cdf->off, cdf->len,
+ &buffer, &buflen);
if (!err && (!buflen || *buffer == 0xff))
err = gpg_error (GPG_ERR_NOT_FOUND);
if (err)