aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-05-16 06:24:29 +0000
committerWerner Koch <[email protected]>2019-05-16 06:24:42 +0000
commit79c99921e35921140c83d7c101829d95f038f3da (patch)
treefc7e6e6255f0d84f5e0b941c384a71ae3bccba5e
parentagent,scd: Scan and load all public keys for availability. (diff)
downloadgnupg-79c99921e35921140c83d7c101829d95f038f3da.tar.gz
gnupg-79c99921e35921140c83d7c101829d95f038f3da.zip
scd: Remove unused cruft from GnuPG 1.x
* scd/apdu.c: Remove code used only by GnuPG 1. * scd/app-openpgp.c: Ditto. * scd/ccid-driver.c: Ditto. * scd/iso7816.c: Ditto. Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--scd/apdu.c22
-rw-r--r--scd/app-openpgp.c33
-rw-r--r--scd/ccid-driver.c20
-rw-r--r--scd/iso7816.c17
4 files changed, 14 insertions, 78 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index 816938ac5..ffa28c689 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -43,22 +43,12 @@
#endif /*USE_G10CODE_RAPDU*/
#if defined(GNUPG_SCD_MAIN_HEADER)
-#include GNUPG_SCD_MAIN_HEADER
-#elif GNUPG_MAJOR_VERSION == 1
-/* This is used with GnuPG version < 1.9. The code has been source
- copied from the current GnuPG >= 1.9 and is maintained over
- there. */
-#include "../common/options.h"
-#include "errors.h"
-#include "memory.h"
-#include "../common/util.h"
-#include "../common/i18n.h"
-#include "dynload.h"
-#include "cardglue.h"
-#else /* GNUPG_MAJOR_VERSION != 1 */
-#include "scdaemon.h"
-#include "../common/exechelp.h"
-#endif /* GNUPG_MAJOR_VERSION != 1 */
+# include GNUPG_SCD_MAIN_HEADER
+#else /*!GNUPG_SCD_MAIN_HEADER*/
+# include "scdaemon.h"
+# include "../common/exechelp.h"
+#endif /*!GNUPG_SCD_MAIN_HEADER*/
+
#include "../common/host2net.h"
#include "iso7816.h"
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index 95df43828..aa21529c6 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -50,18 +50,7 @@
#include <assert.h>
#include <time.h>
-#if GNUPG_MAJOR_VERSION == 1
-/* This is used with GnuPG version < 1.9. The code has been source
- copied from the current GnuPG >= 1.9 and is maintained over
- there. */
-#include "options.h"
-#include "errors.h"
-#include "memory.h"
-#include "cardglue.h"
-#else /* GNUPG_MAJOR_VERSION != 1 */
#include "scdaemon.h"
-#endif /* GNUPG_MAJOR_VERSION != 1 */
-
#include "../common/util.h"
#include "../common/i18n.h"
#include "iso7816.h"
@@ -1229,7 +1218,6 @@ get_remaining_tries (app_t app, int adminpw)
the according hex representation to FPR. Caller must have provide
a buffer at FPR of least 41 bytes. Returns 0 on success or an
error code. */
-#if GNUPG_MAJOR_VERSION > 1
static gpg_error_t
retrieve_fpr_from_card (app_t app, int keyno, char *fpr)
{
@@ -1248,7 +1236,6 @@ retrieve_fpr_from_card (app_t app, int keyno, char *fpr)
xfree (relptr);
return err;
}
-#endif /*GNUPG_MAJOR_VERSION > 1*/
/* Retrieve the public key material for the RSA key, whose fingerprint
@@ -1257,7 +1244,6 @@ retrieve_fpr_from_card (app_t app, int keyno, char *fpr)
public exponent at E and ELEN. Returns zero on success, an error
code on failure. Caller must release the allocated buffers at M
and E if the function returns success. */
-#if GNUPG_MAJOR_VERSION > 1
static gpg_error_t
retrieve_key_material (FILE *fp, const char *hexkeyid,
const unsigned char **m, size_t *mlen,
@@ -1362,7 +1348,6 @@ retrieve_key_material (FILE *fp, const char *hexkeyid,
xfree (line);
return err;
}
-#endif /*GNUPG_MAJOR_VERSION > 1*/
static gpg_error_t
@@ -1662,7 +1647,6 @@ read_public_key (app_t app, ctrl_t ctrl, u32 created_at, int keyno,
consuming to send it just for the fun of it. However, given that we
use the same code in gpg 1.4, we can't use the gcry S-expression
here but need to open encode it. */
-#if GNUPG_MAJOR_VERSION > 1
static gpg_error_t
get_public_key (app_t app, int keyno)
{
@@ -1804,8 +1788,6 @@ get_public_key (app_t app, int keyno)
xfree (buffer);
return err;
}
-#endif /* GNUPG_MAJOR_VERSION > 1 */
-
/* Send the KEYPAIRINFO back. KEY needs to be in the range [1,3].
@@ -1815,9 +1797,6 @@ send_keypair_info (app_t app, ctrl_t ctrl, int key)
{
int keyno = key - 1;
gpg_error_t err = 0;
- /* Note that GnuPG 1.x does not need this and it would be too time
- consuming to send it just for the fun of it. */
-#if GNUPG_MAJOR_VERSION > 1
char idbuf[50];
const char *usage;
@@ -1845,8 +1824,6 @@ send_keypair_info (app_t app, ctrl_t ctrl, int key)
NULL, (size_t)0);
leave:
-#endif /* GNUPG_MAJOR_VERSION > 1 */
-
return err;
}
@@ -1956,7 +1933,6 @@ static gpg_error_t
do_readcert (app_t app, const char *certid,
unsigned char **cert, size_t *certlen)
{
-#if GNUPG_MAJOR_VERSION > 1
gpg_error_t err;
unsigned char *buffer;
size_t buflen;
@@ -1985,9 +1961,6 @@ do_readcert (app_t app, const char *certid,
}
xfree (relptr);
return err;
-#else
- return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
-#endif
}
@@ -2374,13 +2347,11 @@ verify_chv3 (app_t app,
{
int rc = 0;
-#if GNUPG_MAJOR_VERSION != 1
if (!opt.allow_admin)
{
log_info (_("access to admin commands is not configured\n"));
return gpg_error (GPG_ERR_EACCES);
}
-#endif
if (!app->did_chv3)
{
@@ -2569,7 +2540,6 @@ do_writecert (app_t app, ctrl_t ctrl,
const unsigned char *certdata, size_t certdatalen)
{
(void)ctrl;
-#if GNUPG_MAJOR_VERSION > 1
if (strcmp (certidstr, "OPENPGP.3"))
return gpg_error (GPG_ERR_INV_ID);
if (!certdata || !certdatalen)
@@ -2579,9 +2549,6 @@ do_writecert (app_t app, ctrl_t ctrl,
if (certdatalen > app->app_local->extcap.max_certlen_3)
return gpg_error (GPG_ERR_TOO_LARGE);
return do_setattr (app, "CERT-3", pincb, pincb_arg, certdata, certdatalen);
-#else
- return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
-#endif
}
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index dca8340ba..657766e30 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -112,22 +112,10 @@
#define CCID_CMD_TIMEOUT (5*1000)
/* Depending on how this source is used we either define our error
- output to go to stderr or to the GnuPG based logging functions. We
- use the latter when GNUPG_MAJOR_VERSION or GNUPG_SCD_MAIN_HEADER
- are defined. */
-#if defined(GNUPG_MAJOR_VERSION) || defined(GNUPG_SCD_MAIN_HEADER)
-
+ * output to go to stderr or to the GnuPG based logging functions. We
+ * use the latter when GNUPG_SCD_MAIN_HEADER is defined. */
#if defined(GNUPG_SCD_MAIN_HEADER)
-# include GNUPG_SCD_MAIN_HEADER
-#elif GNUPG_MAJOR_VERSION == 1 /* GnuPG Version is < 1.9. */
-# include "options.h"
-# include "util.h"
-# include "memory.h"
-# include "cardglue.h"
-# else /* This is the modularized GnuPG 1.9 or later. */
-# include "scdaemon.h"
-#endif
-
+# include GNUPG_SCD_MAIN_HEADER
# define DEBUGOUT(t) do { if (debug_level) \
log_debug (DRVNAME t); } while (0)
@@ -173,7 +161,7 @@
# define DEBUGOUT_LF() do { if (debug_level) \
putc ('\n', stderr); } while (0)
-#endif /* This source not used by scdaemon. */
+#endif /* This source is not used by scdaemon. */
#ifndef EAGAIN
diff --git a/scd/iso7816.c b/scd/iso7816.c
index d9f3336c7..b09354f16 100644
--- a/scd/iso7816.c
+++ b/scd/iso7816.c
@@ -24,19 +24,10 @@
#include <string.h>
#if defined(GNUPG_SCD_MAIN_HEADER)
-#include GNUPG_SCD_MAIN_HEADER
-#elif GNUPG_MAJOR_VERSION == 1
-/* This is used with GnuPG version < 1.9. The code has been source
- copied from the current GnuPG >= 1.9 and is maintained over
- there. */
-#include "options.h"
-#include "errors.h"
-#include "memory.h"
-#include "../common/util.h"
-#include "../common/i18n.h"
-#else /* GNUPG_MAJOR_VERSION != 1 */
-#include "scdaemon.h"
-#endif /* GNUPG_MAJOR_VERSION != 1 */
+# include GNUPG_SCD_MAIN_HEADER
+#else
+# include "scdaemon.h"
+#endif /*!GNUPG_SCD_MAIN_HEADER*/
#include "iso7816.h"
#include "apdu.h"