1 /* gpgv.c - The GnuPG signature verify utility
2 * Copyright (C) 1998-2020 Free Software Foundation, Inc.
3 * Copyright (C) 1997-2019 Werner Koch
4 * Copyright (C) 2015-2020 g10 Code GmbH
5 *
6 * This file is part of GnuPG.
7 *
8 * GnuPG is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * GnuPG is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <https://www.gnu.org/licenses/>.
20 * SPDX-License-Identifier: GPL-3.0-or-later
21 */
22
23 #include <config.h>
24 #include <errno.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <ctype.h>
29 #include <unistd.h>
30 #ifdef HAVE_DOSISH_SYSTEM
31 #include <fcntl.h> /* for setmode() */
32 #endif
33 #ifdef HAVE_LIBREADLINE
34 #define GNUPG_LIBREADLINE_H_INCLUDED
35 #include <readline/readline.h>
36 #endif
37
38 #define INCLUDED_BY_MAIN_MODULE 1
39 #include "gpg.h"
40 #include "../common/util.h"
41 #include "packet.h"
42 #include "../common/iobuf.h"
43 #include "main.h"
44 #include "options.h"
45 #include "keydb.h"
46 #include "trustdb.h"
47 #include "filter.h"
48 #include "../common/ttyio.h"
49 #include "../common/i18n.h"
50 #include "../common/sysutils.h"
51 #include "../common/status.h"
52 #include "call-agent.h"
53 #include "../common/init.h"
54
55
56 enum cmd_and_opt_values {
57 aNull = 0,
58 oQuiet = 'q',
59 oVerbose = 'v',
60 oOutput = 'o',
61 oBatch = 500,
62 oKeyring,
63 oIgnoreTimeConflict,
64 oStatusFD,
65 oLoggerFD,
66 oLoggerFile,
67 oHomedir,
68 oWeakDigest,
69 oEnableSpecialFilenames,
70 oDebug,
71 aTest
72 };
73
74
75 static gpgrt_opt_t opts[] = {
76 ARGPARSE_group (300, N_("@\nOptions:\n ")),
77
78 ARGPARSE_s_n (oVerbose, "verbose", N_("verbose")),
79 ARGPARSE_s_n (oQuiet, "quiet", N_("be somewhat more quiet")),
80 ARGPARSE_s_s (oKeyring, "keyring",
81 N_("|FILE|take the keys from the keyring FILE")),
82 ARGPARSE_s_s (oOutput, "output", N_("|FILE|write output to FILE")),
83 ARGPARSE_s_n (oIgnoreTimeConflict, "ignore-time-conflict",
84 N_("make timestamp conflicts only a warning")),
85 ARGPARSE_s_i (oStatusFD, "status-fd",
86 N_("|FD|write status info to this FD")),
87 ARGPARSE_s_i (oLoggerFD, "logger-fd", "@"),
88 ARGPARSE_s_s (oLoggerFile, "log-file", "@"),
89 ARGPARSE_s_s (oHomedir, "homedir", "@"),
90 ARGPARSE_s_s (oWeakDigest, "weak-digest",
91 N_("|ALGO|reject signatures made with ALGO")),
92 ARGPARSE_s_n (oEnableSpecialFilenames, "enable-special-filenames", "@"),
93 ARGPARSE_s_s (oDebug, "debug", "@"),
94
95 ARGPARSE_end ()
96 };
97
98
99 /* The list of supported debug flags. */
100 static struct debug_flags_s debug_flags [] =
101 {
102 { DBG_PACKET_VALUE , "packet" },
103 { DBG_MPI_VALUE , "mpi" },
104 { DBG_CRYPTO_VALUE , "crypto" },
105 { DBG_FILTER_VALUE , "filter" },
106 { DBG_IOBUF_VALUE , "iobuf" },
107 { DBG_MEMORY_VALUE , "memory" },
108 { DBG_CACHE_VALUE , "cache" },
109 { DBG_MEMSTAT_VALUE, "memstat" },
110 { DBG_TRUST_VALUE , "trust" },
111 { DBG_HASHING_VALUE, "hashing" },
112 { DBG_IPC_VALUE , "ipc" },
113 { DBG_CLOCK_VALUE , "clock" },
114 { DBG_LOOKUP_VALUE , "lookup" },
115 { DBG_EXTPROG_VALUE, "extprog" },
116 { 0, NULL }
117 };
118
119
120 int g10_errors_seen = 0;
121
122
123 static char *
make_libversion(const char * libname,const char * (* getfnc)(const char *))124 make_libversion (const char *libname, const char *(*getfnc)(const char*))
125 {
126 const char *s;
127 char *result;
128
129 s = getfnc (NULL);
130 result = xmalloc (strlen (libname) + 1 + strlen (s) + 1);
131 strcpy (stpcpy (stpcpy (result, libname), " "), s);
132 return result;
133 }
134
135 static const char *
my_strusage(int level)136 my_strusage( int level )
137 {
138 static char *ver_gcry;
139 const char *p;
140
141 switch (level)
142 {
143 case 9: p = "GPL-3.0-or-later"; break;
144 case 11: p = "@GPG@v (GnuPG)";
145 break;
146 case 13: p = VERSION; break;
147 case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break;
148 case 17: p = PRINTABLE_OS_NAME; break;
149 case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break;
150
151 case 1:
152 case 40: p = _("Usage: gpgv [options] [files] (-h for help)");
153 break;
154 case 41: p = _("Syntax: gpgv [options] [files]\n"
155 "Check signatures against known trusted keys\n");
156 break;
157
158 case 20:
159 if (!ver_gcry)
160 ver_gcry = make_libversion ("libgcrypt", gcry_check_version);
161 p = ver_gcry;
162 break;
163
164
165 default: p = NULL;
166 }
167 return p;
168 }
169
170
171
172 int
main(int argc,char ** argv)173 main( int argc, char **argv )
174 {
175 gpgrt_argparse_t pargs;
176 int rc=0;
177 strlist_t sl;
178 strlist_t nrings = NULL;
179 ctrl_t ctrl;
180
181 early_system_init ();
182 gpgrt_set_strusage (my_strusage);
183 log_set_prefix ("gpgv", GPGRT_LOG_WITH_PREFIX);
184
185 /* Make sure that our subsystems are ready. */
186 i18n_init();
187 init_common_subsystems (&argc, &argv);
188
189 gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
190
191 gnupg_init_signals (0, NULL);
192
193 opt.command_fd = -1; /* no command fd */
194 opt.keyserver_options.options |= KEYSERVER_AUTO_KEY_RETRIEVE;
195 opt.trust_model = TM_ALWAYS;
196 opt.no_sig_cache = 1;
197 opt.flags.require_cross_cert = 1;
198 opt.batch = 1;
199 opt.answer_yes = 1;
200
201 opt.weak_digests = NULL;
202
203 tty_no_terminal(1);
204 tty_batchmode(1);
205 dotlock_disable ();
206 gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
207 additional_weak_digest("MD5");
208 gnupg_initialize_compliance (GNUPG_MODULE_NAME_GPG);
209
210 pargs.argc = &argc;
211 pargs.argv = &argv;
212 pargs.flags= ARGPARSE_FLAG_KEEP;
213 while (gpgrt_argparser (&pargs, opts, NULL))
214 {
215 switch (pargs.r_opt)
216 {
217 case ARGPARSE_CONFFILE: break;
218
219 case oQuiet: opt.quiet = 1; break;
220 case oVerbose:
221 opt.verbose++;
222 opt.list_sigs=1;
223 gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
224 break;
225 case oDebug:
226 if (parse_debug_flag (pargs.r.ret_str, &opt.debug, debug_flags))
227 {
228 pargs.r_opt = ARGPARSE_INVALID_ARG;
229 pargs.err = ARGPARSE_PRINT_ERROR;
230 }
231 break;
232 case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
233 case oOutput: opt.outfile = pargs.r.ret_str; break;
234 case oStatusFD:
235 set_status_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
236 break;
237 case oLoggerFD:
238 log_set_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
239 break;
240 case oLoggerFile:
241 log_set_file (pargs.r.ret_str);
242 log_set_prefix (NULL, (GPGRT_LOG_WITH_PREFIX
243 | GPGRT_LOG_WITH_TIME
244 | GPGRT_LOG_WITH_PID) );
245 break;
246 case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break;
247 case oWeakDigest:
248 additional_weak_digest(pargs.r.ret_str);
249 break;
250 case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break;
251 case oEnableSpecialFilenames:
252 enable_special_filenames ();
253 break;
254 default : pargs.err = ARGPARSE_PRINT_ERROR; break;
255 }
256 }
257
258 gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
259
260 if (log_get_errorcount (0))
261 g10_exit(2);
262
263 if (opt.verbose > 1)
264 set_packet_list_mode(1);
265
266 /* Note: We open all keyrings in read-only mode. */
267 if (!nrings) /* No keyring given: use default one. */
268 keydb_add_resource ("trustedkeys" EXTSEP_S "kbx",
269 (KEYDB_RESOURCE_FLAG_READONLY
270 |KEYDB_RESOURCE_FLAG_GPGVDEF));
271 for (sl = nrings; sl; sl = sl->next)
272 keydb_add_resource (sl->d, KEYDB_RESOURCE_FLAG_READONLY);
273
274 FREE_STRLIST (nrings);
275
276 ctrl = xcalloc (1, sizeof *ctrl);
277
278 if ((rc = verify_signatures (ctrl, argc, argv)))
279 log_error("verify signatures failed: %s\n", gpg_strerror (rc) );
280
281 keydb_release (ctrl->cached_getkey_kdb);
282 xfree (ctrl);
283
284 /* cleanup */
285 g10_exit (0);
286 return 8; /*NOTREACHED*/
287 }
288
289
290 void
g10_exit(int rc)291 g10_exit( int rc )
292 {
293 rc = rc? rc : log_get_errorcount(0)? 2 : g10_errors_seen? 1 : 0;
294 exit(rc );
295 }
296
297
298 /* Stub:
299 * We have to override the trustcheck from pkclist.c because
300 * this utility assumes that all keys in the keyring are trustworthy
301 */
302 gpg_error_t
check_signatures_trust(ctrl_t ctrl,kbnode_t kblock,PKT_public_key * pk,PKT_signature * sig)303 check_signatures_trust (ctrl_t ctrl, kbnode_t kblock,
304 PKT_public_key *pk, PKT_signature *sig)
305 {
306 (void)ctrl;
307 (void)kblock;
308 (void)pk;
309 (void)sig;
310 return 0;
311 }
312
313 void
read_trust_options(ctrl_t ctrl,byte * trust_model,ulong * created,ulong * nextcheck,byte * marginals,byte * completes,byte * cert_depth,byte * min_cert_level)314 read_trust_options (ctrl_t ctrl,
315 byte *trust_model, ulong *created, ulong *nextcheck,
316 byte *marginals, byte *completes, byte *cert_depth,
317 byte *min_cert_level)
318 {
319 (void)ctrl;
320 (void)trust_model;
321 (void)created;
322 (void)nextcheck;
323 (void)marginals;
324 (void)completes;
325 (void)cert_depth;
326 (void)min_cert_level;
327 }
328
329 /* Stub:
330 * We don't have the trustdb , so we have to provide some stub functions
331 * instead
332 */
333
334 int
cache_disabled_value(ctrl_t ctrl,PKT_public_key * pk)335 cache_disabled_value (ctrl_t ctrl, PKT_public_key *pk)
336 {
337 (void)ctrl;
338 (void)pk;
339 return 0;
340 }
341
342 void
check_trustdb_stale(ctrl_t ctrl)343 check_trustdb_stale (ctrl_t ctrl)
344 {
345 (void)ctrl;
346 }
347
348 int
get_validity_info(ctrl_t ctrl,kbnode_t kb,PKT_public_key * pk,PKT_user_id * uid)349 get_validity_info (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk,
350 PKT_user_id *uid)
351 {
352 (void)ctrl;
353 (void)kb;
354 (void)pk;
355 (void)uid;
356 return '?';
357 }
358
359 unsigned int
get_validity(ctrl_t ctrl,kbnode_t kb,PKT_public_key * pk,PKT_user_id * uid,PKT_signature * sig,int may_ask)360 get_validity (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, PKT_user_id *uid,
361 PKT_signature *sig, int may_ask)
362 {
363 (void)ctrl;
364 (void)kb;
365 (void)pk;
366 (void)uid;
367 (void)sig;
368 (void)may_ask;
369 return 0;
370 }
371
372 const char *
trust_value_to_string(unsigned int value)373 trust_value_to_string (unsigned int value)
374 {
375 (void)value;
376 return "err";
377 }
378
379 const char *
uid_trust_string_fixed(ctrl_t ctrl,PKT_public_key * key,PKT_user_id * uid)380 uid_trust_string_fixed (ctrl_t ctrl, PKT_public_key *key, PKT_user_id *uid)
381 {
382 (void)ctrl;
383 (void)key;
384 (void)uid;
385 return "err";
386 }
387
388 int
get_ownertrust_info(ctrl_t ctrl,PKT_public_key * pk,int no_create)389 get_ownertrust_info (ctrl_t ctrl, PKT_public_key *pk, int no_create)
390 {
391 (void)ctrl;
392 (void)pk;
393 (void)no_create;
394 return '?';
395 }
396
397 unsigned int
get_ownertrust(ctrl_t ctrl,PKT_public_key * pk)398 get_ownertrust (ctrl_t ctrl, PKT_public_key *pk)
399 {
400 (void)ctrl;
401 (void)pk;
402 return TRUST_UNKNOWN;
403 }
404
405
406 /* Stubs:
407 * Because we only work with trusted keys, it does not make sense to
408 * get them from a keyserver
409 */
410
411 struct keyserver_spec *
keyserver_match(struct keyserver_spec * spec)412 keyserver_match (struct keyserver_spec *spec)
413 {
414 (void)spec;
415 return NULL;
416 }
417
418 int
keyserver_any_configured(ctrl_t ctrl)419 keyserver_any_configured (ctrl_t ctrl)
420 {
421 (void)ctrl;
422 return 0;
423 }
424
425 int
keyserver_import_keyid(u32 * keyid,void * dummy,unsigned int flags)426 keyserver_import_keyid (u32 *keyid, void *dummy, unsigned int flags)
427 {
428 (void)keyid;
429 (void)dummy;
430 (void)flags;
431 return -1;
432 }
433
434 int
keyserver_import_fprint(ctrl_t ctrl,const byte * fprint,size_t fprint_len,struct keyserver_spec * keyserver,unsigned int flags)435 keyserver_import_fprint (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
436 struct keyserver_spec *keyserver, unsigned int flags)
437 {
438 (void)ctrl;
439 (void)fprint;
440 (void)fprint_len;
441 (void)keyserver;
442 (void)flags;
443 return -1;
444 }
445
446 int
keyserver_import_fprint_ntds(ctrl_t ctrl,const byte * fprint,size_t fprint_len)447 keyserver_import_fprint_ntds (ctrl_t ctrl,
448 const byte *fprint, size_t fprint_len)
449 {
450 (void)ctrl;
451 (void)fprint;
452 (void)fprint_len;
453 return -1;
454 }
455
456 int
keyserver_import_cert(const char * name)457 keyserver_import_cert (const char *name)
458 {
459 (void)name;
460 return -1;
461 }
462
463 gpg_error_t
keyserver_import_wkd(ctrl_t ctrl,const char * name,unsigned int flags,unsigned char ** fpr,size_t * fpr_len)464 keyserver_import_wkd (ctrl_t ctrl, const char *name, unsigned int flags,
465 unsigned char **fpr, size_t *fpr_len)
466 {
467 (void)ctrl;
468 (void)name;
469 (void)flags;
470 (void)fpr;
471 (void)fpr_len;
472 return GPG_ERR_BUG;
473 }
474
475 int
keyserver_import_mbox(const char * name,struct keyserver_spec * spec)476 keyserver_import_mbox (const char *name,struct keyserver_spec *spec)
477 {
478 (void)name;
479 (void)spec;
480 return -1;
481 }
482
483 int
keyserver_import_ntds(ctrl_t ctrl,const char * mbox,unsigned char ** fpr,size_t * fprlen)484 keyserver_import_ntds (ctrl_t ctrl, const char *mbox,
485 unsigned char **fpr, size_t *fprlen)
486 {
487 (void)ctrl;
488 (void)mbox;
489 (void)fpr;
490 (void)fprlen;
491 return -1;
492 }
493
494 int
keyserver_import_ldap(const char * name)495 keyserver_import_ldap (const char *name)
496 {
497 (void)name;
498 return -1;
499 }
500
501
502 gpg_error_t
read_key_from_file_or_buffer(ctrl_t ctrl,const char * fname,const void * buffer,size_t buflen,kbnode_t * r_keyblock)503 read_key_from_file_or_buffer (ctrl_t ctrl, const char *fname,
504 const void *buffer, size_t buflen,
505 kbnode_t *r_keyblock)
506 {
507 (void)ctrl;
508 (void)fname;
509 (void)buffer;
510 (void)buflen;
511 (void)r_keyblock;
512 return -1;
513 }
514
515 gpg_error_t
import_included_key_block(ctrl_t ctrl,kbnode_t keyblock)516 import_included_key_block (ctrl_t ctrl, kbnode_t keyblock)
517 {
518 (void)ctrl;
519 (void)keyblock;
520 return -1;
521 }
522
523
524 /* Stub:
525 * No encryption here but mainproc links to these functions.
526 */
527 gpg_error_t
get_session_key(ctrl_t ctrl,struct pubkey_enc_list * k,DEK * dek)528 get_session_key (ctrl_t ctrl, struct pubkey_enc_list *k, DEK *dek)
529 {
530 (void)ctrl;
531 (void)k;
532 (void)dek;
533 return GPG_ERR_GENERAL;
534 }
535
536 /* Stub: */
537 gpg_error_t
get_override_session_key(DEK * dek,const char * string)538 get_override_session_key (DEK *dek, const char *string)
539 {
540 (void)dek;
541 (void)string;
542 return GPG_ERR_GENERAL;
543 }
544
545 /* Stub: */
546 int
decrypt_data(ctrl_t ctrl,void * procctx,PKT_encrypted * ed,DEK * dek)547 decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
548 {
549 (void)ctrl;
550 (void)procctx;
551 (void)ed;
552 (void)dek;
553 return GPG_ERR_GENERAL;
554 }
555
556
557 /* Stub:
558 * No interactive commands, so we don't need the helptexts
559 */
560 void
display_online_help(const char * keyword)561 display_online_help (const char *keyword)
562 {
563 (void)keyword;
564 }
565
566 /* Stub:
567 * We don't use secret keys, but getkey.c links to this
568 */
569 int
check_secret_key(PKT_public_key * pk,int n)570 check_secret_key (PKT_public_key *pk, int n)
571 {
572 (void)pk;
573 (void)n;
574 return GPG_ERR_GENERAL;
575 }
576
577 /* Stub:
578 * No secret key, so no passphrase needed
579 */
580 DEK *
passphrase_to_dek(int cipher_algo,STRING2KEY * s2k,int create,int nocache,const char * tmp,unsigned int flags,int * canceled)581 passphrase_to_dek (int cipher_algo, STRING2KEY *s2k, int create, int nocache,
582 const char *tmp, unsigned int flags, int *canceled)
583 {
584 (void)cipher_algo;
585 (void)s2k;
586 (void)create;
587 (void)nocache;
588 (void)tmp;
589 (void)flags;
590
591 if (canceled)
592 *canceled = 0;
593 return NULL;
594 }
595
596 void
passphrase_clear_cache(const char * cacheid)597 passphrase_clear_cache (const char *cacheid)
598 {
599 (void)cacheid;
600 }
601
602 struct keyserver_spec *
parse_preferred_keyserver(PKT_signature * sig)603 parse_preferred_keyserver(PKT_signature *sig)
604 {
605 (void)sig;
606 return NULL;
607 }
608
609 struct keyserver_spec *
parse_keyserver_uri(const char * uri,int require_scheme,const char * configname,unsigned int configlineno)610 parse_keyserver_uri (const char *uri, int require_scheme,
611 const char *configname, unsigned int configlineno)
612 {
613 (void)uri;
614 (void)require_scheme;
615 (void)configname;
616 (void)configlineno;
617 return NULL;
618 }
619
620 void
free_keyserver_spec(struct keyserver_spec * keyserver)621 free_keyserver_spec (struct keyserver_spec *keyserver)
622 {
623 (void)keyserver;
624 }
625
626 /* Stubs to avoid linking to photoid.c */
627 void
show_photos(const struct user_attribute * attrs,int count,PKT_public_key * pk)628 show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
629 {
630 (void)attrs;
631 (void)count;
632 (void)pk;
633 }
634
635 int
parse_image_header(const struct user_attribute * attr,byte * type,u32 * len)636 parse_image_header (const struct user_attribute *attr, byte *type, u32 *len)
637 {
638 (void)attr;
639 (void)type;
640 (void)len;
641 return 0;
642 }
643
644 char *
image_type_to_string(byte type,int string)645 image_type_to_string (byte type, int string)
646 {
647 (void)type;
648 (void)string;
649 return NULL;
650 }
651
652 #ifdef ENABLE_CARD_SUPPORT
653 int
agent_scd_getattr(const char * name,struct agent_card_info_s * info)654 agent_scd_getattr (const char *name, struct agent_card_info_s *info)
655 {
656 (void)name;
657 (void)info;
658 return 0;
659 }
660 #endif /* ENABLE_CARD_SUPPORT */
661
662 /* We do not do any locking, so use these stubs here */
663 void
dotlock_disable(void)664 dotlock_disable (void)
665 {
666 }
667
668 dotlock_t
dotlock_create(const char * file_to_lock,unsigned int flags)669 dotlock_create (const char *file_to_lock, unsigned int flags)
670 {
671 (void)file_to_lock;
672 (void)flags;
673 return NULL;
674 }
675
676 void
dotlock_destroy(dotlock_t h)677 dotlock_destroy (dotlock_t h)
678 {
679 (void)h;
680 }
681
682 int
dotlock_take(dotlock_t h,long timeout)683 dotlock_take (dotlock_t h, long timeout)
684 {
685 (void)h;
686 (void)timeout;
687 return 0;
688 }
689
690 int
dotlock_release(dotlock_t h)691 dotlock_release (dotlock_t h)
692 {
693 (void)h;
694 return 0;
695 }
696
697 void
dotlock_remove_lockfiles(void)698 dotlock_remove_lockfiles (void)
699 {
700 }
701
702 int
agent_probe_secret_key(ctrl_t ctrl,PKT_public_key * pk)703 agent_probe_secret_key (ctrl_t ctrl, PKT_public_key *pk)
704 {
705 (void)ctrl;
706 (void)pk;
707 return 0;
708 }
709
710 gpg_error_t
agent_probe_any_secret_key(ctrl_t ctrl,kbnode_t keyblock)711 agent_probe_any_secret_key (ctrl_t ctrl, kbnode_t keyblock)
712 {
713 (void)ctrl;
714 (void)keyblock;
715 return gpg_error (GPG_ERR_NO_SECKEY);
716 }
717
718 gpg_error_t
agent_get_keyinfo(ctrl_t ctrl,const char * hexkeygrip,char ** r_serialno,int * r_cleartext)719 agent_get_keyinfo (ctrl_t ctrl, const char *hexkeygrip,
720 char **r_serialno, int *r_cleartext)
721 {
722 (void)ctrl;
723 (void)hexkeygrip;
724 (void)r_cleartext;
725 *r_serialno = NULL;
726 return gpg_error (GPG_ERR_NO_SECKEY);
727 }
728
729 gpg_error_t
export_pubkey_buffer(ctrl_t ctrl,const char * keyspec,unsigned int options,const void * prefix,size_t prefixlen,export_stats_t stats,kbnode_t * r_keyblock,void ** r_data,size_t * r_datalen)730 export_pubkey_buffer (ctrl_t ctrl, const char *keyspec, unsigned int options,
731 const void *prefix, size_t prefixlen,
732 export_stats_t stats,
733 kbnode_t *r_keyblock, void **r_data, size_t *r_datalen)
734 {
735 (void)ctrl;
736 (void)keyspec;
737 (void)options;
738 (void)prefix;
739 (void)prefixlen;
740 (void)stats;
741
742 *r_keyblock = NULL;
743 *r_data = NULL;
744 *r_datalen = 0;
745 return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
746 }
747
748 gpg_error_t
tofu_write_tfs_record(ctrl_t ctrl,estream_t fp,PKT_public_key * pk,const char * user_id)749 tofu_write_tfs_record (ctrl_t ctrl, estream_t fp,
750 PKT_public_key *pk, const char *user_id)
751 {
752 (void)ctrl;
753 (void)fp;
754 (void)pk;
755 (void)user_id;
756 return gpg_error (GPG_ERR_GENERAL);
757 }
758
759 gpg_error_t
tofu_get_policy(ctrl_t ctrl,PKT_public_key * pk,PKT_user_id * user_id,enum tofu_policy * policy)760 tofu_get_policy (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *user_id,
761 enum tofu_policy *policy)
762 {
763 (void)ctrl;
764 (void)pk;
765 (void)user_id;
766 (void)policy;
767 return gpg_error (GPG_ERR_GENERAL);
768 }
769
770 const char *
tofu_policy_str(enum tofu_policy policy)771 tofu_policy_str (enum tofu_policy policy)
772 {
773 (void)policy;
774
775 return "unknown";
776 }
777
778 void
tofu_begin_batch_update(ctrl_t ctrl)779 tofu_begin_batch_update (ctrl_t ctrl)
780 {
781 (void)ctrl;
782 }
783
784 void
tofu_end_batch_update(ctrl_t ctrl)785 tofu_end_batch_update (ctrl_t ctrl)
786 {
787 (void)ctrl;
788 }
789
790 gpg_error_t
tofu_notice_key_changed(ctrl_t ctrl,kbnode_t kb)791 tofu_notice_key_changed (ctrl_t ctrl, kbnode_t kb)
792 {
793 (void) ctrl;
794 (void) kb;
795
796 return 0;
797 }
798
799
800 int
get_revocation_reason(PKT_signature * sig,char ** r_reason,char ** r_comment,size_t * r_commentlen)801 get_revocation_reason (PKT_signature *sig, char **r_reason,
802 char **r_comment, size_t *r_commentlen)
803 {
804 (void)sig;
805 (void)r_commentlen;
806
807 if (r_reason)
808 *r_reason = NULL;
809 if (r_comment)
810 *r_comment = NULL;
811 return 0;
812 }
813