1
0
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:
NIIBE Yutaka 2023-02-27 18:41:31 +09:00
parent d30ce02dd6
commit 5055718fec
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
4 changed files with 23 additions and 30 deletions

View File

@ -35,8 +35,3 @@ tkdaemon_LDADD = $(libcommonpth) \
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \
$(GPG_ERROR_LIBS) \
$(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV)
pksign_LDADD = $(libcommonpth) \
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \
$(GPG_ERROR_LIBS) \
$(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV)

View File

@ -189,11 +189,12 @@ static gpg_error_t
cmd_slotlist (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
gpg_error_t err = 0;
gpg_error_t err;
line = skip_options (line);
(void)line;
(void)ctrl;
err = token_slotlist (ctrl);
return err;
}
@ -216,7 +217,6 @@ cmd_readkey (assuan_context_t ctx, char *line)
int opt_nokey = 0;
unsigned char *pk = NULL;
size_t pklen;
token_t token;
const char *keygrip;
if (has_option (line, "--format=advanced"))
@ -232,15 +232,7 @@ cmd_readkey (assuan_context_t ctx, char *line)
if (strlen (keygrip) != 40)
err = gpg_error (GPG_ERR_INV_ID);
token = token_get (ctrl, keygrip);
if (token)
{
err = token_readkey (token, opt_info, &pk, &pklen);
token_put (token);
}
else
err = gpg_error (GPG_ERR_NO_SECKEY);
err = token_readkey (ctrl, keygrip, opt_info, &pk, &pklen);
if (err)
goto leave;
@ -325,7 +317,6 @@ cmd_pksign (assuan_context_t ctx, char *line)
gpg_error_t err;
int hash_algo;
const char *keygrip;
token_t token;
unsigned char *outdata;
size_t outdatalen;
@ -347,15 +338,7 @@ cmd_pksign (assuan_context_t ctx, char *line)
if (strlen (keygrip) != 40)
err = gpg_error (GPG_ERR_INV_ID);
token = token_get (ctrl, keygrip);
if (token)
{
err = token_sign (token, keygrip, hash_algo, &outdata, &outdatalen);
token_put (token);
}
else
err = gpg_error (GPG_ERR_NO_SECKEY);
err = token_sign (ctrl, keygrip, hash_algo, &outdata, &outdatalen);
if (err)
{
log_error ("token_sign failed: %s\n", gpg_strerror (err));
@ -415,6 +398,7 @@ static const char hlp_keyinfo[] =
static gpg_error_t
cmd_keyinfo (assuan_context_t ctx, char *line)
{
gpg_error_t err;
int cap;
int opt_data;
const char *keygrip = NULL;
@ -434,9 +418,9 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
else
keygrip = skip_options (line);
token_keyinfo (ctrl, keygrip, opt_data, cap);
err = token_keyinfo (ctrl, keygrip, opt_data, cap);
return 0;
return err;
}

View File

@ -41,8 +41,8 @@
#define INCLUDED_BY_MAIN_MODULE 1
#define GNUPG_COMMON_NEED_AFLOCAL
#include "tkdaemon.h"
#include <gcrypt.h>
#include <gcrypt.h>
#include <assuan.h> /* malloc hooks */
#include "../common/i18n.h"

View File

@ -107,4 +107,18 @@ void send_keyinfo (ctrl_t ctrl, int data, const char *keygrip_str,
const char *serialno, const char *idstr,
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*/