mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
gpg: Remove two unused card related functions.
* g10/call-agent.c (inq_writekey_parms): Remove. (agent_scd_writekey): Remove. (agent_clear_pin_cache): Remove this stub. (cherry picked from commit 334b16b868e771b983263ed20c200869e7e51198)
This commit is contained in:
parent
d410b5f930
commit
c2f87a936a
162
g10/call-agent.c
162
g10/call-agent.c
@ -352,7 +352,7 @@ start_agent (ctrl_t ctrl, int flag_for_card)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
write_status_text (STATUS_CARDCTRL, "4");
|
write_status_text (STATUS_CARDCTRL, "4");
|
||||||
log_info ("selecting openpgp failed: %s\n", gpg_strerror (rc));
|
log_info ("selecting card failed: %s\n", gpg_strerror (rc));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -723,7 +723,12 @@ learn_status_cb (void *opaque, const char *line)
|
|||||||
|
|
||||||
/* Call the scdaemon to learn about a smartcard. Note that in
|
/* Call the scdaemon to learn about a smartcard. Note that in
|
||||||
* contradiction to the function's name, gpg-agent's LEARN command is
|
* contradiction to the function's name, gpg-agent's LEARN command is
|
||||||
* used and not the low-level "SCD LEARN". */
|
* used and not the low-level "SCD LEARN".
|
||||||
|
* Used by:
|
||||||
|
* card-util.c
|
||||||
|
* keyedit_menu
|
||||||
|
* card_store_key_with_backup (Woth force to remove secret key data)
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_learn (struct agent_card_info_s *info, int force)
|
agent_scd_learn (struct agent_card_info_s *info, int force)
|
||||||
{
|
{
|
||||||
@ -813,6 +818,10 @@ agent_scd_apdu (const char *hexapdu, unsigned int *r_sw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Used by:
|
||||||
|
* card_store_subkey
|
||||||
|
* card_store_key_with_backup
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_keytocard (const char *hexgrip, int keyno, int force,
|
agent_keytocard (const char *hexgrip, int keyno, int force,
|
||||||
const char *serialno, const char *timestamp)
|
const char *serialno, const char *timestamp)
|
||||||
@ -840,8 +849,18 @@ agent_keytocard (const char *hexgrip, int keyno, int force,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Call the agent to retrieve a data object. This function returns
|
/* Call the agent to retrieve a data object. This function returns
|
||||||
the data in the same structure as used by the learn command. It is
|
* the data in the same structure as used by the learn command. It is
|
||||||
allowed to update such a structure using this command. */
|
* allowed to update such a structure using this command.
|
||||||
|
*
|
||||||
|
* Used by:
|
||||||
|
* build_sk_list
|
||||||
|
* enum_secret_keys
|
||||||
|
* get_signature_count
|
||||||
|
* card-util.c
|
||||||
|
* generate_keypair (KEY-ATTR)
|
||||||
|
* card_store_key_with_backup (SERIALNO)
|
||||||
|
* generate_card_subkeypair (KEY-ATTR)
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_getattr (const char *name, struct agent_card_info_s *info)
|
agent_scd_getattr (const char *name, struct agent_card_info_s *info)
|
||||||
{
|
{
|
||||||
@ -870,6 +889,7 @@ agent_scd_getattr (const char *name, struct agent_card_info_s *info)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Send an setattr command to the SCdaemon.
|
/* Send an setattr command to the SCdaemon.
|
||||||
* Used by:
|
* Used by:
|
||||||
@ -946,7 +966,10 @@ inq_writecert_parms (void *opaque, const char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Send a WRITECERT command to the SCdaemon. */
|
/* Send a WRITECERT command to the SCdaemon.
|
||||||
|
* Used by:
|
||||||
|
* card-util.c
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_writecert (const char *certidstr,
|
agent_scd_writecert (const char *certidstr,
|
||||||
const unsigned char *certdata, size_t certdatalen)
|
const unsigned char *certdata, size_t certdatalen)
|
||||||
@ -977,60 +1000,6 @@ agent_scd_writecert (const char *certidstr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Handle a KEYDATA inquiry. Note, we only send the data,
|
|
||||||
assuan_transact takes care of flushing and writing the end */
|
|
||||||
static gpg_error_t
|
|
||||||
inq_writekey_parms (void *opaque, const char *line)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
struct writekey_parm_s *parm = opaque;
|
|
||||||
|
|
||||||
if (has_leading_keyword (line, "KEYDATA"))
|
|
||||||
{
|
|
||||||
rc = assuan_send_data (parm->dflt->ctx, parm->keydata, parm->keydatalen);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rc = default_inq_cb (parm->dflt, line);
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Send a WRITEKEY command to the SCdaemon. */
|
|
||||||
int
|
|
||||||
agent_scd_writekey (int keyno, const char *serialno,
|
|
||||||
const unsigned char *keydata, size_t keydatalen)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
char line[ASSUAN_LINELENGTH];
|
|
||||||
struct writekey_parm_s parms;
|
|
||||||
struct default_inq_parm_s dfltparm;
|
|
||||||
|
|
||||||
memset (&dfltparm, 0, sizeof dfltparm);
|
|
||||||
|
|
||||||
(void)serialno;
|
|
||||||
|
|
||||||
rc = start_agent (NULL, 1);
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
memset (&parms, 0, sizeof parms);
|
|
||||||
|
|
||||||
snprintf (line, DIM(line), "SCD WRITEKEY --force OPENPGP.%d", keyno);
|
|
||||||
dfltparm.ctx = agent_ctx;
|
|
||||||
parms.dflt = &dfltparm;
|
|
||||||
parms.keydata = keydata;
|
|
||||||
parms.keydatalen = keydatalen;
|
|
||||||
|
|
||||||
rc = assuan_transact (agent_ctx, line, NULL, NULL,
|
|
||||||
inq_writekey_parms, &parms, NULL, NULL);
|
|
||||||
|
|
||||||
status_sc_op_failure (rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Status callback for the SCD GENKEY command. */
|
/* Status callback for the SCD GENKEY command. */
|
||||||
static gpg_error_t
|
static gpg_error_t
|
||||||
@ -1058,10 +1027,13 @@ scd_genkey_cb (void *opaque, const char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Send a GENKEY command to the SCdaemon. If *CREATETIME is not 0,
|
/* Send a GENKEY command to the SCdaemon. If *CREATETIME is not 0,
|
||||||
the value will be passed to SCDAEMON with --timestamp option so that
|
* the value will be passed to SCDAEMON with --timestamp option so that
|
||||||
the key is created with this. Otherwise, timestamp was generated by
|
* the key is created with this. Otherwise, timestamp was generated by
|
||||||
SCDEAMON. On success, creation time is stored back to
|
* SCDEAMON. On success, creation time is stored back to
|
||||||
CREATETIME. */
|
* CREATETIME.
|
||||||
|
* Used by:
|
||||||
|
* gen_card_key
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_genkey (int keyno, int force, u32 *createtime)
|
agent_scd_genkey (int keyno, int force, u32 *createtime)
|
||||||
{
|
{
|
||||||
@ -1094,9 +1066,17 @@ agent_scd_genkey (int keyno, int force, u32 *createtime)
|
|||||||
status_sc_op_failure (rc);
|
status_sc_op_failure (rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Return the serial number of the card or an appropriate error. The
|
/* Return the serial number of the card or an appropriate error. The
|
||||||
serial number is returned as a hexstring. */
|
* serial number is returned as a hexstring. With DEMAND the active
|
||||||
|
* card is switched to the card with that serialno.
|
||||||
|
* Used by:
|
||||||
|
* card-util.c
|
||||||
|
* build_sk_list
|
||||||
|
* enum_secret_keys
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_serialno (char **r_serialno, const char *demand)
|
agent_scd_serialno (char **r_serialno, const char *demand)
|
||||||
{
|
{
|
||||||
@ -1104,7 +1084,7 @@ agent_scd_serialno (char **r_serialno, const char *demand)
|
|||||||
char *serialno = NULL;
|
char *serialno = NULL;
|
||||||
char line[ASSUAN_LINELENGTH];
|
char line[ASSUAN_LINELENGTH];
|
||||||
|
|
||||||
err = start_agent (NULL, 1 | FLAG_FOR_CARD_SUPPRESS_ERRORS);
|
err = start_agent (NULL, (1 | FLAG_FOR_CARD_SUPPRESS_ERRORS));
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -1125,8 +1105,13 @@ agent_scd_serialno (char **r_serialno, const char *demand)
|
|||||||
*r_serialno = serialno;
|
*r_serialno = serialno;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Send a READCERT command to the SCdaemon. */
|
/* Send a READCERT command to the SCdaemon.
|
||||||
|
* Used by:
|
||||||
|
* card-util.c
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_readcert (const char *certidstr,
|
agent_scd_readcert (const char *certidstr,
|
||||||
void **r_buf, size_t *r_buflen)
|
void **r_buf, size_t *r_buflen)
|
||||||
@ -1164,6 +1149,8 @@ agent_scd_readcert (const char *certidstr,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct card_cardlist_parm_s {
|
struct card_cardlist_parm_s {
|
||||||
int error;
|
int error;
|
||||||
@ -1201,7 +1188,12 @@ card_cardlist_cb (void *opaque, const char *line)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return cardlist. */
|
|
||||||
|
/* Return a list of currently available cards.
|
||||||
|
* Used by:
|
||||||
|
* card-util.c
|
||||||
|
* skclist.c
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_cardlist (strlist_t *result)
|
agent_scd_cardlist (strlist_t *result)
|
||||||
{
|
{
|
||||||
@ -1230,16 +1222,20 @@ agent_scd_cardlist (strlist_t *result)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Change the PIN of an OpenPGP card or reset the retry counter.
|
/* Change the PIN of an OpenPGP card or reset the retry counter.
|
||||||
CHVNO 1: Change the PIN
|
* CHVNO 1: Change the PIN
|
||||||
2: For v1 cards: Same as 1.
|
* 2: For v1 cards: Same as 1.
|
||||||
For v2 cards: Reset the PIN using the Reset Code.
|
* For v2 cards: Reset the PIN using the Reset Code.
|
||||||
3: Change the admin PIN
|
* 3: Change the admin PIN
|
||||||
101: Set a new PIN and reset the retry counter
|
* 101: Set a new PIN and reset the retry counter
|
||||||
102: For v1 cars: Same as 101.
|
* 102: For v1 cars: Same as 101.
|
||||||
For v2 cards: Set a new Reset Code.
|
* For v2 cards: Set a new Reset Code.
|
||||||
SERIALNO is not used.
|
* SERIALNO is not used.
|
||||||
|
* Used by:
|
||||||
|
* card-util.c
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_change_pin (int chvno, const char *serialno)
|
agent_scd_change_pin (int chvno, const char *serialno)
|
||||||
@ -1273,8 +1269,11 @@ agent_scd_change_pin (int chvno, const char *serialno)
|
|||||||
|
|
||||||
|
|
||||||
/* Perform a CHECKPIN operation. SERIALNO should be the serial
|
/* Perform a CHECKPIN operation. SERIALNO should be the serial
|
||||||
number of the card - optionally followed by the fingerprint;
|
* number of the card - optionally followed by the fingerprint;
|
||||||
however the fingerprint is ignored here. */
|
* however the fingerprint is ignored here.
|
||||||
|
* Used by:
|
||||||
|
* card-util.c
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
agent_scd_checkpin (const char *serialno)
|
agent_scd_checkpin (const char *serialno)
|
||||||
{
|
{
|
||||||
@ -1299,15 +1298,6 @@ agent_scd_checkpin (const char *serialno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Dummy function, only used by the gpg 1.4 implementation. */
|
|
||||||
void
|
|
||||||
agent_clear_pin_cache (const char *sn)
|
|
||||||
{
|
|
||||||
(void)sn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Note: All strings shall be UTF-8. On success the caller needs to
|
/* Note: All strings shall be UTF-8. On success the caller needs to
|
||||||
free the string stored at R_PASSPHRASE. On error NULL will be
|
free the string stored at R_PASSPHRASE. On error NULL will be
|
||||||
|
@ -106,10 +106,6 @@ gpg_error_t agent_scd_setattr (const char *name,
|
|||||||
int agent_scd_writecert (const char *certidstr,
|
int agent_scd_writecert (const char *certidstr,
|
||||||
const unsigned char *certdata, size_t certdatalen);
|
const unsigned char *certdata, size_t certdatalen);
|
||||||
|
|
||||||
/* Send a WRITEKEY command to the SCdaemon. */
|
|
||||||
int agent_scd_writekey (int keyno, const char *serialno,
|
|
||||||
const unsigned char *keydata, size_t keydatalen);
|
|
||||||
|
|
||||||
/* Send a GENKEY command to the SCdaemon. */
|
/* Send a GENKEY command to the SCdaemon. */
|
||||||
int agent_scd_genkey (int keyno, int force, u32 *createtime);
|
int agent_scd_genkey (int keyno, int force, u32 *createtime);
|
||||||
|
|
||||||
@ -123,10 +119,6 @@ int agent_scd_change_pin (int chvno, const char *serialno);
|
|||||||
/* Send the CHECKPIN command to the SCdaemon. */
|
/* Send the CHECKPIN command to the SCdaemon. */
|
||||||
int agent_scd_checkpin (const char *serialno);
|
int agent_scd_checkpin (const char *serialno);
|
||||||
|
|
||||||
/* Dummy function, only implemented by gpg 1.4. */
|
|
||||||
void agent_clear_pin_cache (const char *sn);
|
|
||||||
|
|
||||||
|
|
||||||
/* Send the GET_PASSPHRASE command to the agent. */
|
/* Send the GET_PASSPHRASE command to the agent. */
|
||||||
gpg_error_t agent_get_passphrase (const char *cache_id,
|
gpg_error_t agent_get_passphrase (const char *cache_id,
|
||||||
const char *err_msg,
|
const char *err_msg,
|
||||||
|
@ -91,8 +91,6 @@ change_pin (int unblock_v2, int allow_admin)
|
|||||||
log_info (_("OpenPGP card no. %s detected\n"),
|
log_info (_("OpenPGP card no. %s detected\n"),
|
||||||
info.serialno? info.serialno : "[none]");
|
info.serialno? info.serialno : "[none]");
|
||||||
|
|
||||||
agent_clear_pin_cache (info.serialno);
|
|
||||||
|
|
||||||
if (opt.batch)
|
if (opt.batch)
|
||||||
{
|
{
|
||||||
agent_release_card_info (&info);
|
agent_release_card_info (&info);
|
||||||
@ -1279,8 +1277,6 @@ check_pin_for_key_operation (struct agent_card_info_s *info, int *forced_chv1)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
agent_clear_pin_cache (info->serialno);
|
|
||||||
|
|
||||||
*forced_chv1 = !info->chv1_cached;
|
*forced_chv1 = !info->chv1_cached;
|
||||||
if (*forced_chv1)
|
if (*forced_chv1)
|
||||||
{ /* Switch off the forced mode so that during key generation we
|
{ /* Switch off the forced mode so that during key generation we
|
||||||
|
Loading…
x
Reference in New Issue
Block a user