1 /* test-stubs.c - The GnuPG signature verify utility
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2006,
3 * 2008, 2009, 2012 Free Software Foundation, Inc.
5 * This file is part of GnuPG.
7 * GnuPG is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * GnuPG is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <https://www.gnu.org/licenses/>.
29 #define INCLUDED_BY_MAIN_MODULE 1
43 #include "call-agent.h"
51 rc = rc? rc : log_get_errorcount(0)? 2 : g10_errors_seen? 1 : 0;
57 * We have to override the trustcheck from pkclist.c because
58 * this utility assumes that all keys in the keyring are trustworthy
61 check_signatures_trust (ctrl_t ctrl, PKT_signature *sig)
69 read_trust_options(byte *trust_model, ulong *created, ulong *nextcheck,
70 byte *marginals, byte *completes, byte *cert_depth,
83 * We don't have the trustdb , so we have to provide some stub functions
88 cache_disabled_value(PKT_public_key *pk)
95 check_trustdb_stale (ctrl_t ctrl)
101 get_validity_info (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk,
112 get_validity (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, PKT_user_id *uid,
113 PKT_signature *sig, int may_ask)
125 trust_value_to_string (unsigned int value)
132 uid_trust_string_fixed (ctrl_t ctrl, PKT_public_key *key, PKT_user_id *uid)
141 get_ownertrust_info (PKT_public_key *pk)
148 get_ownertrust (PKT_public_key *pk)
151 return TRUST_UNKNOWN;
156 * Because we only work with trusted keys, it does not make sense to
157 * get them from a keyserver
160 struct keyserver_spec *
161 keyserver_match (struct keyserver_spec *spec)
168 keyserver_any_configured (ctrl_t ctrl)
175 keyserver_import_keyid (u32 *keyid, void *dummy, int quick)
184 keyserver_import_fprint (ctrl_t ctrl, const byte *fprint,size_t fprint_len,
185 struct keyserver_spec *keyserver, int quick)
196 keyserver_import_cert (const char *name)
203 keyserver_import_pka (const char *name,unsigned char *fpr)
211 keyserver_import_wkd (ctrl_t ctrl, const char *name, int quick,
212 unsigned char **fpr, size_t *fpr_len)
223 keyserver_import_name (const char *name,struct keyserver_spec *spec)
231 keyserver_import_ldap (const char *name)
238 read_key_from_file (ctrl_t ctrl, const char *fname, kbnode_t *r_keyblock)
247 * No encryption here but mainproc links to these functions.
250 get_session_key (ctrl_t ctrl, PKT_pubkey_enc *k, DEK *dek)
255 return GPG_ERR_GENERAL;
260 get_override_session_key (DEK *dek, const char *string)
264 return GPG_ERR_GENERAL;
269 decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
275 return GPG_ERR_GENERAL;
280 * No interactive commands, so we don't need the helptexts
283 display_online_help (const char *keyword)
289 * We don't use secret keys, but getkey.c links to this
292 check_secret_key (PKT_public_key *pk, int n)
296 return GPG_ERR_GENERAL;
300 * No secret key, so no passphrase needed
303 passphrase_to_dek (int cipher_algo, STRING2KEY *s2k, int create, int nocache,
304 const char *tmp, int *canceled)
318 passphrase_clear_cache (const char *cacheid)
323 struct keyserver_spec *
324 parse_preferred_keyserver(PKT_signature *sig)
330 struct keyserver_spec *
331 parse_keyserver_uri (const char *uri, int require_scheme,
332 const char *configname, unsigned int configlineno)
335 (void)require_scheme;
342 free_keyserver_spec (struct keyserver_spec *keyserver)
347 /* Stubs to avoid linking to photoid.c */
349 show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
357 parse_image_header (const struct user_attribute *attr, byte *type, u32 *len)
366 image_type_to_string (byte type, int string)
373 #ifdef ENABLE_CARD_SUPPORT
375 agent_scd_getattr (const char *name, struct agent_card_info_s *info)
381 #endif /* ENABLE_CARD_SUPPORT */
383 /* We do not do any locking, so use these stubs here */
385 dotlock_disable (void)
390 dotlock_create (const char *file_to_lock, unsigned int flags)
398 dotlock_destroy (dotlock_t h)
404 dotlock_take (dotlock_t h, long timeout)
412 dotlock_release (dotlock_t h)
419 dotlock_remove_lockfiles (void)
424 agent_probe_secret_key (ctrl_t ctrl, PKT_public_key *pk)
428 return gpg_error (GPG_ERR_NO_SECKEY);
432 agent_probe_any_secret_key (ctrl_t ctrl, kbnode_t keyblock)
436 return gpg_error (GPG_ERR_NO_SECKEY);
440 agent_get_keyinfo (ctrl_t ctrl, const char *hexkeygrip,
441 char **r_serialno, int *r_cleartext)
447 return gpg_error (GPG_ERR_NO_SECKEY);
451 gpg_dirmngr_get_pka (ctrl_t ctrl, const char *userid,
452 unsigned char **r_fpr, size_t *r_fprlen,
463 return gpg_error (GPG_ERR_NOT_FOUND);
467 export_pubkey_buffer (ctrl_t ctrl, const char *keyspec, unsigned int options,
468 export_stats_t stats,
469 kbnode_t *r_keyblock, void **r_data, size_t *r_datalen)
479 return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
483 tofu_write_tfs_record (ctrl_t ctrl, estream_t fp,
484 PKT_public_key *pk, const char *user_id)
490 return gpg_error (GPG_ERR_GENERAL);
494 tofu_get_policy (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *user_id,
495 enum tofu_policy *policy)
501 return gpg_error (GPG_ERR_GENERAL);
505 tofu_policy_str (enum tofu_policy policy)
513 tofu_begin_batch_update (ctrl_t ctrl)
519 tofu_end_batch_update (ctrl_t ctrl)
525 tofu_notice_key_changed (ctrl_t ctrl, kbnode_t kb)