opensc: bump to git codebase of 20141126 and rebase GnuK patches

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle
2014-11-27 14:52:29 +01:00
parent c67c581264
commit 36ed0c44fc
27 changed files with 1209 additions and 175 deletions
@@ -1,20 +1,20 @@
From 4cdc5f3102f5ad93d263eea2f8206bb5e9fffc6c Mon Sep 17 00:00:00 2001
From 6d138f0199575516bfaad18cbbafcfa2ee61e58f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?=
<ng.hong.quan@gmail.com>
Date: Mon, 4 Mar 2013 11:28:08 +0700
Subject: [PATCH 05/18] OpenPGP: Support erasing (reset) card.
Subject: [PATCH 05/26] OpenPGP: Support erasing (reset) card.
Command: openpgp-tool --erase
---
src/libopensc/card-openpgp.c | 64 ++++++++++++++++++++++++++++++++++++++++++++
src/tools/openpgp-tool.c | 23 +++++++++++++++-
2 files changed, 86 insertions(+), 1 deletion(-)
src/tools/openpgp-tool.c | 22 ++++++++++++++-
2 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c
index ead07ae..42a9684 100644
index 1cc3923..7349876 100644
--- a/src/libopensc/card-openpgp.c
+++ b/src/libopensc/card-openpgp.c
@@ -2197,6 +2197,66 @@ out:
@@ -2195,6 +2195,66 @@ out:
#endif /* ENABLE_OPENSSL */
@@ -81,7 +81,7 @@ index ead07ae..42a9684 100644
/* ABI: card ctl: perform special card-specific operations */
static int pgp_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr)
{
@@ -2221,6 +2281,10 @@ static int pgp_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr)
@@ -2219,6 +2279,10 @@ static int pgp_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr)
LOG_FUNC_RETURN(card->ctx, r);
break;
#endif /* ENABLE_OPENSSL */
@@ -93,53 +93,52 @@ index ead07ae..42a9684 100644
LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_SUPPORTED);
diff --git a/src/tools/openpgp-tool.c b/src/tools/openpgp-tool.c
index 8b5e327..0d360a3 100644
index a24a395..de1c9d4 100644
--- a/src/tools/openpgp-tool.c
+++ b/src/tools/openpgp-tool.c
@@ -76,6 +76,7 @@ static int opt_verify = 0;
static char *verifytype = NULL;
static int opt_pin = 0;
@@ -78,6 +78,7 @@ static int opt_pin = 0;
static char *pin = NULL;
static int opt_dump_do = 0;
static u8 do_dump_idx;
+static int opt_erase = 0;
static const char *app_name = "openpgp-tool";
@@ -92,6 +93,7 @@ static const struct option options[] = {
@@ -94,6 +95,7 @@ static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
+ { "erase", no_argument, NULL, 'E' },
{ "verify", required_argument, NULL, OPT_VERIFY },
{ "pin", required_argument, NULL, OPT_PIN },
{ NULL, 0, NULL, 0 }
@@ -110,6 +112,7 @@ static const char *option_help[] = {
{ "do", required_argument, NULL, 'd' },
@@ -113,6 +115,7 @@ static const char *option_help[] = {
/* h */ "Print this help message",
/* v */ "Verbose operation. Use several times to enable debug output.",
/* V */ "Show version number",
+/* E */ "Erase (reset) the card",
"Verify PIN (CHV1, CHV2, CHV3...)",
"PIN string"
};
@@ -228,7 +231,7 @@ static int decode_options(int argc, char **argv)
"PIN string",
/* d */ "Dump private data object number <arg> (i.e. PRIVATE-DO-<arg>)"
@@ -232,7 +235,7 @@ static int decode_options(int argc, char **argv)
{
int c;
- while ((c = getopt_long(argc, argv,"r:x:CUG:L:hwvV", options, (int *) 0)) != EOF) {
+ while ((c = getopt_long(argc, argv,"r:x:CUG:L:hwvVE", options, (int *) 0)) != EOF) {
- while ((c = getopt_long(argc, argv,"r:x:CUG:L:hwvVd:", options, (int *) 0)) != EOF) {
+ while ((c = getopt_long(argc, argv,"r:x:CUG:L:hwvVd:E", options, (int *) 0)) != EOF) {
switch (c) {
case 'r':
opt_reader = optarg;
@@ -288,6 +291,9 @@ static int decode_options(int argc, char **argv)
show_version();
exit(EXIT_SUCCESS);
break;
@@ -296,6 +299,8 @@ static int decode_options(int argc, char **argv)
do_dump_idx = optarg[0] - '0';
opt_dump_do++;
actions++;
+ case 'E':
+ opt_erase++;
+ break;
break;
default:
util_print_usage_and_die(app_name, options, option_help, NULL);
}
@@ -446,6 +452,18 @@ int do_verify(sc_card_t *card, u8 *type, u8* pin)
@@ -452,6 +457,18 @@ int do_verify(sc_card_t *card, char *type, char *pin)
return r;
}
@@ -158,7 +157,7 @@ index 8b5e327..0d360a3 100644
int main(int argc, char **argv)
{
sc_context_t *ctx = NULL;
@@ -521,6 +539,9 @@ int main(int argc, char **argv)
@@ -531,6 +548,9 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
@@ -169,5 +168,5 @@ index 8b5e327..0d360a3 100644
sc_unlock(card);
sc_disconnect_card(card);
--
1.9.3
2.1.3