mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
scd: Use a macro for the flag parameter of learn_status.
* scd/app-common.h (APP_LEARN_FLAG_KEYPAIRINFO): New flag macro.. * scd/command.c (cmd_learn): Pass that flag instead of a plain number. * scd/app-nks.c (do_learn_status_core): Use new flag. * scd/app-p15.c (do_learn_status): Ditto. * scd/app-piv.c (do_learn_status): Ditto. * scd/app-sc-hsm.c (do_learn_status): Ditto. * scd/app.c (app_write_learn_status): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
1d277c9670
commit
2cdea776cd
@ -39,9 +39,11 @@
|
||||
/* Flags used with app_readkey. */
|
||||
#define APP_READKEY_FLAG_INFO 1 /* Send also a KEYPAIRINFO line. */
|
||||
|
||||
/* Bit flags set by the decipher function into R_INFO. */
|
||||
/* Flags set by the decipher function into R_INFO. */
|
||||
#define APP_DECIPHER_INFO_NOPAD 1 /* Padding has been removed. */
|
||||
|
||||
/* Flags used by the app_write_learn_status. */
|
||||
#define APP_LEARN_FLAG_KEYPAIRINFO 1 /* Return only keypair infos. */
|
||||
|
||||
/* List of supported card types. Generic is the usual ISO7817-4
|
||||
* compliant card. More specific card or token versions can be given
|
||||
|
@ -420,7 +420,7 @@ do_learn_status_core (app_t app, ctrl_t ctrl, unsigned int flags, int is_sigg)
|
||||
if (!!filelist[i].is_sigg != !!is_sigg)
|
||||
continue;
|
||||
|
||||
if (filelist[i].certtype && !(flags &1))
|
||||
if (filelist[i].certtype && !(flags & APP_LEARN_FLAG_KEYPAIRINFO))
|
||||
{
|
||||
size_t len;
|
||||
|
||||
|
@ -2500,7 +2500,7 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
|
||||
{
|
||||
gpg_error_t err;
|
||||
|
||||
if ((flags & 1))
|
||||
if ((flags & APP_LEARN_FLAG_KEYPAIRINFO))
|
||||
err = 0;
|
||||
else
|
||||
{
|
||||
|
@ -1176,7 +1176,8 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
|
||||
|
||||
for (i=0; data_objects[i].tag; i++)
|
||||
if (data_objects[i].keypair)
|
||||
send_keypair_and_cert_info (app, ctrl, data_objects + i, !!(flags & 1));
|
||||
send_keypair_and_cert_info (app, ctrl, data_objects + i,
|
||||
!!(flags & APP_LEARN_FLAG_KEYPAIRINFO));
|
||||
|
||||
|
||||
return 0;
|
||||
|
@ -1407,7 +1407,7 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
|
||||
{
|
||||
gpg_error_t err;
|
||||
|
||||
if ((flags & 1))
|
||||
if ((flags & APP_LEARN_FLAG_KEYPAIRINFO))
|
||||
err = 0;
|
||||
else
|
||||
{
|
||||
|
@ -1054,7 +1054,7 @@ app_write_learn_status (card_t card, ctrl_t ctrl, unsigned int flags)
|
||||
app = card->app;
|
||||
|
||||
/* We do not send CARD and APPTYPE if only keypairinfo is requested. */
|
||||
if (!(flags &1))
|
||||
if (!(flags & APP_LEARN_FLAG_KEYPAIRINFO))
|
||||
{
|
||||
if (card->cardtype)
|
||||
send_status_direct (ctrl, "CARDTYPE", strcardtype (card->cardtype));
|
||||
|
@ -475,7 +475,9 @@ cmd_learn (assuan_context_t ctx, char *line)
|
||||
/* Let the application print out its collection of useful status
|
||||
information. */
|
||||
if (!rc)
|
||||
rc = app_write_learn_status (ctrl->card_ctx, ctrl, only_keypairinfo);
|
||||
rc = app_write_learn_status
|
||||
(ctrl->card_ctx, ctrl,
|
||||
(only_keypairinfo? APP_LEARN_FLAG_KEYPAIRINFO : 0));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user