scd:openpgp: Drop support for GnuPG 1.

--

It does not make sense to keep support form GnuPG 1 here given that we
don't intend to ever backport any of the current stuff to the legacy
version.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-11-16 17:09:09 +01:00
parent 1049f06c6d
commit 3274eb4637
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 1 additions and 36 deletions

View File

@ -51,17 +51,7 @@
#include <assert.h> #include <assert.h>
#include <time.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" #include "scdaemon.h"
#endif /* GNUPG_MAJOR_VERSION != 1 */
#include "../common/util.h" #include "../common/util.h"
#include "../common/i18n.h" #include "../common/i18n.h"
@ -1293,7 +1283,6 @@ get_remaining_tries (app_t app, int adminpw)
the according hex representation to FPR. Caller must have provide the according hex representation to FPR. Caller must have provide
a buffer at FPR of least 41 bytes. Returns 0 on success or an a buffer at FPR of least 41 bytes. Returns 0 on success or an
error code. */ error code. */
#if GNUPG_MAJOR_VERSION > 1
static gpg_error_t static gpg_error_t
retrieve_fpr_from_card (app_t app, int keyno, char *fpr) retrieve_fpr_from_card (app_t app, int keyno, char *fpr)
{ {
@ -1312,7 +1301,6 @@ retrieve_fpr_from_card (app_t app, int keyno, char *fpr)
xfree (relptr); xfree (relptr);
return err; return err;
} }
#endif /*GNUPG_MAJOR_VERSION > 1*/
/* Retrieve the public key material for the RSA key, whose fingerprint /* Retrieve the public key material for the RSA key, whose fingerprint
@ -1321,7 +1309,6 @@ retrieve_fpr_from_card (app_t app, int keyno, char *fpr)
public exponent at E and ELEN. Returns zero on success, an error public exponent at E and ELEN. Returns zero on success, an error
code on failure. Caller must release the allocated buffers at M code on failure. Caller must release the allocated buffers at M
and E if the function returns success. */ and E if the function returns success. */
#if GNUPG_MAJOR_VERSION > 1
static gpg_error_t static gpg_error_t
retrieve_key_material (FILE *fp, const char *hexkeyid, retrieve_key_material (FILE *fp, const char *hexkeyid,
const unsigned char **m, size_t *mlen, const unsigned char **m, size_t *mlen,
@ -1426,7 +1413,6 @@ retrieve_key_material (FILE *fp, const char *hexkeyid,
xfree (line); xfree (line);
return err; return err;
} }
#endif /*GNUPG_MAJOR_VERSION > 1*/
static gpg_error_t static gpg_error_t
@ -1727,7 +1713,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 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 use the same code in gpg 1.4, we can't use the gcry S-expression
here but need to open encode it. */ here but need to open encode it. */
#if GNUPG_MAJOR_VERSION > 1
static gpg_error_t static gpg_error_t
get_public_key (app_t app, int keyno) get_public_key (app_t app, int keyno)
{ {
@ -1876,8 +1861,6 @@ get_public_key (app_t app, int keyno)
xfree (buffer); xfree (buffer);
return err; return err;
} }
#endif /* GNUPG_MAJOR_VERSION > 1 */
/* Send the KEYPAIRINFO back. KEY needs to be in the range [1,3]. /* Send the KEYPAIRINFO back. KEY needs to be in the range [1,3].
@ -1887,9 +1870,6 @@ send_keypair_info (app_t app, ctrl_t ctrl, int key)
{ {
int keyno = key - 1; int keyno = key - 1;
gpg_error_t err = 0; 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]; char idbuf[50];
const char *usage; const char *usage;
@ -1917,8 +1897,6 @@ send_keypair_info (app_t app, ctrl_t ctrl, int key)
NULL, (size_t)0); NULL, (size_t)0);
leave: leave:
#endif /* GNUPG_MAJOR_VERSION > 1 */
return err; return err;
} }
@ -2006,7 +1984,6 @@ static gpg_error_t
do_readkey (app_t app, int advanced, const char *keyid, do_readkey (app_t app, int advanced, const char *keyid,
unsigned char **pk, size_t *pklen) unsigned char **pk, size_t *pklen)
{ {
#if GNUPG_MAJOR_VERSION > 1
gpg_error_t err; gpg_error_t err;
int keyno; int keyno;
unsigned char *buf; unsigned char *buf;
@ -2064,9 +2041,6 @@ do_readkey (app_t app, int advanced, const char *keyid,
} }
return 0; return 0;
#else
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
#endif
} }
/* Read the standard certificate of an OpenPGP v2 card. It is /* Read the standard certificate of an OpenPGP v2 card. It is
@ -2077,7 +2051,6 @@ static gpg_error_t
do_readcert (app_t app, const char *certid, do_readcert (app_t app, const char *certid,
unsigned char **cert, size_t *certlen) unsigned char **cert, size_t *certlen)
{ {
#if GNUPG_MAJOR_VERSION > 1
gpg_error_t err; gpg_error_t err;
unsigned char *buffer; unsigned char *buffer;
size_t buflen; size_t buflen;
@ -2106,9 +2079,6 @@ do_readcert (app_t app, const char *certid,
} }
xfree (relptr); xfree (relptr);
return err; return err;
#else
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
#endif
} }
@ -2509,13 +2479,11 @@ verify_chv3 (app_t app,
{ {
int rc = 0; int rc = 0;
#if GNUPG_MAJOR_VERSION != 1
if (!opt.allow_admin) if (!opt.allow_admin)
{ {
log_info (_("access to admin commands is not configured\n")); log_info (_("access to admin commands is not configured\n"));
return gpg_error (GPG_ERR_EACCES); return gpg_error (GPG_ERR_EACCES);
} }
#endif
if (!app->did_chv3) if (!app->did_chv3)
{ {
@ -2704,7 +2672,7 @@ do_writecert (app_t app, ctrl_t ctrl,
const unsigned char *certdata, size_t certdatalen) const unsigned char *certdata, size_t certdatalen)
{ {
(void)ctrl; (void)ctrl;
#if GNUPG_MAJOR_VERSION > 1
if (strcmp (certidstr, "OPENPGP.3")) if (strcmp (certidstr, "OPENPGP.3"))
return gpg_error (GPG_ERR_INV_ID); return gpg_error (GPG_ERR_INV_ID);
if (!certdata || !certdatalen) if (!certdata || !certdatalen)
@ -2714,9 +2682,6 @@ do_writecert (app_t app, ctrl_t ctrl,
if (certdatalen > app->app_local->extcap.max_certlen_3) if (certdatalen > app->app_local->extcap.max_certlen_3)
return gpg_error (GPG_ERR_TOO_LARGE); return gpg_error (GPG_ERR_TOO_LARGE);
return do_setattr (app, "CERT-3", pincb, pincb_arg, certdata, certdatalen); return do_setattr (app, "CERT-3", pincb, pincb_arg, certdata, certdatalen);
#else
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
#endif
} }