mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* gpgv.c (agent_scd_getattr): Stub.
* misc.c (get_signature_count): New. Get the signature count from a smartcard. (pct_expando): Call it here so the %c expando becomes the number of signatures issued. This allows for notations or the like with an automatic signature count. * ccid-driver.c (usb_get_string_simple): Replacement function to work with older libusb.
This commit is contained in:
parent
e991fb59d1
commit
a46e83b8e3
4 changed files with 98 additions and 0 deletions
26
g10/misc.c
26
g10/misc.c
|
@ -39,6 +39,7 @@
|
|||
#include "photoid.h"
|
||||
#include "options.h"
|
||||
#include "i18n.h"
|
||||
#include "cardglue.h"
|
||||
|
||||
#if defined(__linux__) && defined(__alpha__) && __GLIBC__ < 2
|
||||
static int
|
||||
|
@ -287,6 +288,22 @@ idea_cipher_warn(int show)
|
|||
}
|
||||
#endif
|
||||
|
||||
static unsigned long get_signature_count(PKT_secret_key *sk)
|
||||
{
|
||||
#ifdef ENABLE_CARD_SUPPORT
|
||||
if(sk && sk->is_protected && sk->protect.s2k.mode==1002)
|
||||
{
|
||||
struct agent_card_info_s info;
|
||||
if(agent_scd_getattr("SIG-COUNTER",&info)==0)
|
||||
return info.sig_counter;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* How to do this without a card? */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Expand %-strings. Returns a string which must be m_freed. Returns
|
||||
NULL if the string cannot be expanded (too large). */
|
||||
char *
|
||||
|
@ -366,6 +383,15 @@ pct_expando(const char *string,struct expando_args *args)
|
|||
}
|
||||
break;
|
||||
|
||||
case 'c': /* signature count from card, if any. */
|
||||
if(idx+10<maxlen)
|
||||
{
|
||||
sprintf(&ret[idx],"%lu",get_signature_count(args->sk));
|
||||
idx+=strlen(&ret[idx]);
|
||||
done=1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p': /* primary pk fingerprint of a sk */
|
||||
case 'f': /* pk fingerprint */
|
||||
case 'g': /* sk fingerprint */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue