2003-06-05 07:14:21 +00:00
|
|
|
/* gpg.h - top level include file for gpg etc.
|
2010-02-02 14:06:19 +00:00
|
|
|
* Copyright (C) 2003, 2006, 2010 Free Software Foundation, Inc.
|
2003-06-05 07:14:21 +00:00
|
|
|
*
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
*
|
|
|
|
* GnuPG is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-04 19:49:40 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-06-05 07:14:21 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GnuPG is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2016-11-05 12:02:19 +01:00
|
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
2003-06-05 07:14:21 +00:00
|
|
|
*/
|
|
|
|
#ifndef GNUPG_G10_GPG_H
|
2011-02-04 12:57:53 +01:00
|
|
|
#define GNUPG_G10_GPG_H
|
2003-06-05 07:14:21 +00:00
|
|
|
|
2003-06-18 19:56:13 +00:00
|
|
|
/* Note, that this file should be the first one after the system
|
|
|
|
header files. This is required to set the error source to the
|
|
|
|
correct value and may be of advantage if we ever have to do
|
|
|
|
special things. */
|
|
|
|
|
2018-03-08 14:08:51 +09:00
|
|
|
#ifdef HAVE_W32_SYSTEM
|
|
|
|
# define WIN32_LEAN_AND_MEAN 1
|
|
|
|
#endif
|
|
|
|
|
2003-06-05 07:14:21 +00:00
|
|
|
#ifdef GPG_ERR_SOURCE_DEFAULT
|
|
|
|
#error GPG_ERR_SOURCE_DEFAULT already defined
|
|
|
|
#endif
|
|
|
|
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPG
|
2004-12-18 10:22:10 +00:00
|
|
|
#define map_assuan_err(a) \
|
|
|
|
map_assuan_err_with_source (GPG_ERR_SOURCE_DEFAULT, (a))
|
2003-06-05 07:14:21 +00:00
|
|
|
#include <gpg-error.h>
|
2006-04-19 11:26:11 +00:00
|
|
|
#include <gcrypt.h>
|
2003-06-05 07:14:21 +00:00
|
|
|
|
|
|
|
|
2006-04-19 11:26:11 +00:00
|
|
|
/* Number of bits we accept when reading or writing MPIs. */
|
|
|
|
#define MAX_EXTERN_MPI_BITS 16384
|
|
|
|
|
2024-04-03 18:00:44 +02:00
|
|
|
/* Number of bytes we accept when reading four-octet count prefixed
|
|
|
|
* key parameters. Needs to fit as a positive number into an int. */
|
|
|
|
#define MAX_EXTERN_KEYPARM_BITS (32768*8)
|
|
|
|
|
2015-11-13 16:42:59 +01:00
|
|
|
/* The maximum length of a binary fingerprints. This is used to
|
2017-09-27 09:42:13 +02:00
|
|
|
* provide a static buffer and will be increased if we need to support
|
|
|
|
* longer fingerprints. Warning: At some places we have some
|
|
|
|
* assumption on a 20 byte fingerprint.
|
|
|
|
* Watch out for FIXME(fingerprint) */
|
|
|
|
#define MAX_FINGERPRINT_LEN 32
|
2006-04-19 11:26:11 +00:00
|
|
|
|
2015-11-14 09:13:02 +01:00
|
|
|
/* The maximum length of a formatted fingerprint as returned by
|
2017-09-27 09:42:13 +02:00
|
|
|
* format_hexfingerprint(). */
|
2019-11-28 12:02:41 +01:00
|
|
|
#define MAX_FORMATTED_FINGERPRINT_LEN 60
|
2015-11-14 09:13:02 +01:00
|
|
|
|
2006-04-19 11:26:11 +00:00
|
|
|
|
2011-02-04 12:57:53 +01:00
|
|
|
/*
|
|
|
|
Forward declarations.
|
2006-12-21 19:40:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Object used to keep state locally to server.c . */
|
|
|
|
struct server_local_s;
|
|
|
|
|
2019-09-09 14:34:09 +02:00
|
|
|
/* Object used to keep state locally to call-keyboxd.c . */
|
|
|
|
struct keyboxd_local_s;
|
|
|
|
typedef struct keyboxd_local_s *keyboxd_local_t;
|
|
|
|
|
2011-01-10 14:30:17 +01:00
|
|
|
/* Object used to keep state locally to call-dirmngr.c . */
|
|
|
|
struct dirmngr_local_s;
|
|
|
|
typedef struct dirmngr_local_s *dirmngr_local_t;
|
|
|
|
|
2017-03-31 20:44:05 +02:00
|
|
|
/* Object used to describe a keyblock node. */
|
2019-09-09 14:34:09 +02:00
|
|
|
typedef struct kbnode_struct *KBNODE; /* Deprecated use kbnode_t. */typedef struct kbnode_struct *kbnode_t;
|
2006-04-19 11:26:11 +00:00
|
|
|
|
2017-03-31 20:44:05 +02:00
|
|
|
/* The handle for keydb operations. */
|
2019-09-09 14:34:09 +02:00
|
|
|
typedef struct keydb_handle_s *KEYDB_HANDLE;
|
2017-03-31 20:44:05 +02:00
|
|
|
|
2016-05-21 12:26:44 +02:00
|
|
|
/* TOFU database meta object. */
|
|
|
|
struct tofu_dbs_s;
|
|
|
|
typedef struct tofu_dbs_s *tofu_dbs_t;
|
|
|
|
|
2006-04-19 11:26:11 +00:00
|
|
|
|
2017-03-31 20:06:54 +02:00
|
|
|
#if SIZEOF_UNSIGNED_LONG == 8
|
|
|
|
# define SERVER_CONTROL_MAGIC 0x53616c696e676572
|
|
|
|
#else
|
|
|
|
# define SERVER_CONTROL_MAGIC 0x53616c69
|
|
|
|
#endif
|
|
|
|
|
2006-12-21 19:40:00 +00:00
|
|
|
/* Session control object. This object is passed to most functions to
|
|
|
|
convey the status of a session. Note that the defaults are set by
|
|
|
|
gpg_init_default_ctrl(). */
|
|
|
|
struct server_control_s
|
|
|
|
{
|
2017-03-31 20:06:54 +02:00
|
|
|
/* Always has the value SERVER_CONTROL_MAGIC. */
|
|
|
|
unsigned long magic;
|
|
|
|
|
2011-01-10 14:30:17 +01:00
|
|
|
/* Local data for server.c */
|
2006-12-21 19:40:00 +00:00
|
|
|
struct server_local_s *server_local;
|
2011-01-10 14:30:17 +01:00
|
|
|
|
|
|
|
/* Local data for call-dirmngr.c */
|
|
|
|
dirmngr_local_t dirmngr_local;
|
2016-05-21 12:26:44 +02:00
|
|
|
|
2019-09-09 14:34:09 +02:00
|
|
|
/* Local data for call-keyboxd.c */
|
|
|
|
keyboxd_local_t keyboxd_local;
|
|
|
|
|
2016-05-21 12:26:44 +02:00
|
|
|
/* Local data for tofu.c */
|
|
|
|
struct {
|
|
|
|
tofu_dbs_t dbs;
|
2016-08-31 10:47:05 +02:00
|
|
|
int batch_updated_wanted;
|
2016-05-21 12:26:44 +02:00
|
|
|
} tofu;
|
|
|
|
|
2017-03-31 20:44:05 +02:00
|
|
|
/* This is used to cache a key data base handle. */
|
|
|
|
KEYDB_HANDLE cached_getkey_kdb;
|
2021-05-19 02:32:19 +02:00
|
|
|
|
|
|
|
/* Cached results from HAVEKEY --list. They are used if the pointer
|
|
|
|
* is not NULL. The length gives the length in bytes and is a
|
|
|
|
* multiple of 20. If the no_more flag is set the list shall not
|
|
|
|
* anymore be refreshed even if it has been freed and NULLed. */
|
|
|
|
unsigned char *secret_keygrips;
|
|
|
|
size_t secret_keygrips_len;
|
|
|
|
int no_more_secret_keygrips;
|
2024-09-09 16:41:35 +02:00
|
|
|
|
|
|
|
/* This first flag is set to true if we are running a
|
|
|
|
* --add-recipients or --change-recipients command. The second if
|
|
|
|
* it is --change-recipients. */
|
|
|
|
unsigned int modify_recipients:1;
|
|
|
|
unsigned int clear_recipients:1;
|
|
|
|
|
|
|
|
/* Temporary used to pass the last read byte up the call chain. */
|
|
|
|
int last_read_ctb;
|
2006-12-21 19:40:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-06-05 07:14:21 +00:00
|
|
|
#endif /*GNUPG_G10_GPG_H*/
|