mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02: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 334b16b868
)
This commit is contained in:
parent
d410b5f930
commit
c2f87a936a
3 changed files with 76 additions and 98 deletions
162
g10/call-agent.c
162
g10/call-agent.c
|
@ -352,7 +352,7 @@ start_agent (ctrl_t ctrl, int flag_for_card)
|
|||
break;
|
||||
default:
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -723,7 +723,12 @@ learn_status_cb (void *opaque, const char *line)
|
|||
|
||||
/* Call the scdaemon to learn about a smartcard. Note that in
|
||||
* 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
|
||||
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
|
||||
agent_keytocard (const char *hexgrip, int keyno, int force,
|
||||
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
|
||||
the data in the same structure as used by the learn command. It is
|
||||
allowed to update such a structure using this command. */
|
||||
* the data in the same structure as used by the learn command. It is
|
||||
* 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
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Send an setattr command to the SCdaemon.
|
||||
* 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
|
||||
agent_scd_writecert (const char *certidstr,
|
||||
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. */
|
||||
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,
|
||||
the value will be passed to SCDAEMON with --timestamp option so that
|
||||
the key is created with this. Otherwise, timestamp was generated by
|
||||
SCDEAMON. On success, creation time is stored back to
|
||||
CREATETIME. */
|
||||
* the value will be passed to SCDAEMON with --timestamp option so that
|
||||
* the key is created with this. Otherwise, timestamp was generated by
|
||||
* SCDEAMON. On success, creation time is stored back to
|
||||
* CREATETIME.
|
||||
* Used by:
|
||||
* gen_card_key
|
||||
*/
|
||||
int
|
||||
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);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 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
|
||||
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 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)
|
||||
return err;
|
||||
|
||||
|
@ -1125,8 +1105,13 @@ agent_scd_serialno (char **r_serialno, const char *demand)
|
|||
*r_serialno = serialno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Send a READCERT command to the SCdaemon. */
|
||||
/* Send a READCERT command to the SCdaemon.
|
||||
* Used by:
|
||||
* card-util.c
|
||||
*/
|
||||
int
|
||||
agent_scd_readcert (const char *certidstr,
|
||||
void **r_buf, size_t *r_buflen)
|
||||
|
@ -1164,6 +1149,8 @@ agent_scd_readcert (const char *certidstr,
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct card_cardlist_parm_s {
|
||||
int error;
|
||||
|
@ -1201,7 +1188,12 @@ card_cardlist_cb (void *opaque, const char *line)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Return cardlist. */
|
||||
|
||||
/* Return a list of currently available cards.
|
||||
* Used by:
|
||||
* card-util.c
|
||||
* skclist.c
|
||||
*/
|
||||
int
|
||||
agent_scd_cardlist (strlist_t *result)
|
||||
{
|
||||
|
@ -1230,16 +1222,20 @@ agent_scd_cardlist (strlist_t *result)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Change the PIN of an OpenPGP card or reset the retry counter.
|
||||
CHVNO 1: Change the PIN
|
||||
2: For v1 cards: Same as 1.
|
||||
For v2 cards: Reset the PIN using the Reset Code.
|
||||
3: Change the admin PIN
|
||||
101: Set a new PIN and reset the retry counter
|
||||
102: For v1 cars: Same as 101.
|
||||
For v2 cards: Set a new Reset Code.
|
||||
SERIALNO is not used.
|
||||
* CHVNO 1: Change the PIN
|
||||
* 2: For v1 cards: Same as 1.
|
||||
* For v2 cards: Reset the PIN using the Reset Code.
|
||||
* 3: Change the admin PIN
|
||||
* 101: Set a new PIN and reset the retry counter
|
||||
* 102: For v1 cars: Same as 101.
|
||||
* For v2 cards: Set a new Reset Code.
|
||||
* SERIALNO is not used.
|
||||
* Used by:
|
||||
* card-util.c
|
||||
*/
|
||||
int
|
||||
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
|
||||
number of the card - optionally followed by the fingerprint;
|
||||
however the fingerprint is ignored here. */
|
||||
* number of the card - optionally followed by the fingerprint;
|
||||
* however the fingerprint is ignored here.
|
||||
* Used by:
|
||||
* card-util.c
|
||||
*/
|
||||
int
|
||||
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
|
||||
free the string stored at R_PASSPHRASE. On error NULL will be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue