mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Define routines for pkcs11.c in the header.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
d30ce02dd6
commit
5055718fec
@ -35,8 +35,3 @@ tkdaemon_LDADD = $(libcommonpth) \
|
|||||||
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \
|
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \
|
||||||
$(GPG_ERROR_LIBS) \
|
$(GPG_ERROR_LIBS) \
|
||||||
$(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV)
|
$(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV)
|
||||||
|
|
||||||
pksign_LDADD = $(libcommonpth) \
|
|
||||||
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \
|
|
||||||
$(GPG_ERROR_LIBS) \
|
|
||||||
$(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV)
|
|
||||||
|
@ -189,11 +189,12 @@ static gpg_error_t
|
|||||||
cmd_slotlist (assuan_context_t ctx, char *line)
|
cmd_slotlist (assuan_context_t ctx, char *line)
|
||||||
{
|
{
|
||||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||||
gpg_error_t err = 0;
|
gpg_error_t err;
|
||||||
|
|
||||||
line = skip_options (line);
|
line = skip_options (line);
|
||||||
|
(void)line;
|
||||||
|
|
||||||
(void)ctrl;
|
err = token_slotlist (ctrl);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +217,6 @@ cmd_readkey (assuan_context_t ctx, char *line)
|
|||||||
int opt_nokey = 0;
|
int opt_nokey = 0;
|
||||||
unsigned char *pk = NULL;
|
unsigned char *pk = NULL;
|
||||||
size_t pklen;
|
size_t pklen;
|
||||||
token_t token;
|
|
||||||
const char *keygrip;
|
const char *keygrip;
|
||||||
|
|
||||||
if (has_option (line, "--format=advanced"))
|
if (has_option (line, "--format=advanced"))
|
||||||
@ -232,15 +232,7 @@ cmd_readkey (assuan_context_t ctx, char *line)
|
|||||||
if (strlen (keygrip) != 40)
|
if (strlen (keygrip) != 40)
|
||||||
err = gpg_error (GPG_ERR_INV_ID);
|
err = gpg_error (GPG_ERR_INV_ID);
|
||||||
|
|
||||||
token = token_get (ctrl, keygrip);
|
err = token_readkey (ctrl, keygrip, opt_info, &pk, &pklen);
|
||||||
if (token)
|
|
||||||
{
|
|
||||||
err = token_readkey (token, opt_info, &pk, &pklen);
|
|
||||||
token_put (token);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
err = gpg_error (GPG_ERR_NO_SECKEY);
|
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
@ -325,7 +317,6 @@ cmd_pksign (assuan_context_t ctx, char *line)
|
|||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
int hash_algo;
|
int hash_algo;
|
||||||
const char *keygrip;
|
const char *keygrip;
|
||||||
token_t token;
|
|
||||||
unsigned char *outdata;
|
unsigned char *outdata;
|
||||||
size_t outdatalen;
|
size_t outdatalen;
|
||||||
|
|
||||||
@ -347,15 +338,7 @@ cmd_pksign (assuan_context_t ctx, char *line)
|
|||||||
if (strlen (keygrip) != 40)
|
if (strlen (keygrip) != 40)
|
||||||
err = gpg_error (GPG_ERR_INV_ID);
|
err = gpg_error (GPG_ERR_INV_ID);
|
||||||
|
|
||||||
token = token_get (ctrl, keygrip);
|
err = token_sign (ctrl, keygrip, hash_algo, &outdata, &outdatalen);
|
||||||
if (token)
|
|
||||||
{
|
|
||||||
err = token_sign (token, keygrip, hash_algo, &outdata, &outdatalen);
|
|
||||||
token_put (token);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
err = gpg_error (GPG_ERR_NO_SECKEY);
|
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
log_error ("token_sign failed: %s\n", gpg_strerror (err));
|
log_error ("token_sign failed: %s\n", gpg_strerror (err));
|
||||||
@ -415,6 +398,7 @@ static const char hlp_keyinfo[] =
|
|||||||
static gpg_error_t
|
static gpg_error_t
|
||||||
cmd_keyinfo (assuan_context_t ctx, char *line)
|
cmd_keyinfo (assuan_context_t ctx, char *line)
|
||||||
{
|
{
|
||||||
|
gpg_error_t err;
|
||||||
int cap;
|
int cap;
|
||||||
int opt_data;
|
int opt_data;
|
||||||
const char *keygrip = NULL;
|
const char *keygrip = NULL;
|
||||||
@ -434,9 +418,9 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
|
|||||||
else
|
else
|
||||||
keygrip = skip_options (line);
|
keygrip = skip_options (line);
|
||||||
|
|
||||||
token_keyinfo (ctrl, keygrip, opt_data, cap);
|
err = token_keyinfo (ctrl, keygrip, opt_data, cap);
|
||||||
|
|
||||||
return 0;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
#define INCLUDED_BY_MAIN_MODULE 1
|
#define INCLUDED_BY_MAIN_MODULE 1
|
||||||
#define GNUPG_COMMON_NEED_AFLOCAL
|
#define GNUPG_COMMON_NEED_AFLOCAL
|
||||||
#include "tkdaemon.h"
|
#include "tkdaemon.h"
|
||||||
#include <gcrypt.h>
|
|
||||||
|
|
||||||
|
#include <gcrypt.h>
|
||||||
#include <assuan.h> /* malloc hooks */
|
#include <assuan.h> /* malloc hooks */
|
||||||
|
|
||||||
#include "../common/i18n.h"
|
#include "../common/i18n.h"
|
||||||
|
@ -107,4 +107,18 @@ void send_keyinfo (ctrl_t ctrl, int data, const char *keygrip_str,
|
|||||||
const char *serialno, const char *idstr,
|
const char *serialno, const char *idstr,
|
||||||
const char *usage);
|
const char *usage);
|
||||||
|
|
||||||
|
/*-- pkcs11.c --*/
|
||||||
|
gpg_error_t token_slotlist (ctrl_t ctrl);
|
||||||
|
gpg_error_t token_sign (ctrl_t ctrl,
|
||||||
|
const char *keygrip, int hash_algo,
|
||||||
|
unsigned char **r_outdata,
|
||||||
|
size_t *r_outdatalen);
|
||||||
|
gpg_error_t token_readkey (ctrl_t ctrl,
|
||||||
|
const char *keygrip, int opt_info,
|
||||||
|
unsigned char **r_pk,
|
||||||
|
size_t *r_pklen);
|
||||||
|
gpg_error_t token_keyinfo (ctrl_t ctrl, const char *keygrip,
|
||||||
|
int opt_data, int cap);
|
||||||
|
|
||||||
|
|
||||||
#endif /*TKDAEMON_H*/
|
#endif /*TKDAEMON_H*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user