updated gpg4win portable to 2.3.6
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/* gcrypt.h - GNU Cryptographic Library Interface -*- c -*-
|
||||
* Copyright (C) 2012-2021 g10 Code GmbH
|
||||
* Copyright (C) 2012-2022 g10 Code GmbH
|
||||
* Copyright (C) 2013-2022 Jussi Kivilinna
|
||||
* Copyright (C) 1998-2018 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Libgcrypt.
|
||||
@@ -16,7 +17,6 @@
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* File: src/gcrypt.h. Generated from gcrypt.h.in by configure.
|
||||
*/
|
||||
@@ -33,20 +33,11 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined _WIN32 || defined __WIN32__
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# include <time.h>
|
||||
# ifndef __GNUC__
|
||||
typedef long ssize_t;
|
||||
typedef int pid_t;
|
||||
# endif /*!__GNUC__*/
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
# include <sys/time.h>
|
||||
#
|
||||
#endif /*!_WIN32*/
|
||||
|
||||
typedef int gcry_socklen_t;
|
||||
#endif /*_WIN32*/
|
||||
|
||||
/* This is required for error code compatibility. */
|
||||
#define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT
|
||||
@@ -63,11 +54,11 @@ extern "C" {
|
||||
return the same version. The purpose of this macro is to let
|
||||
autoconf (using the AM_PATH_GCRYPT macro) check that this header
|
||||
matches the installed library. */
|
||||
#define GCRYPT_VERSION "1.8.8"
|
||||
#define GCRYPT_VERSION "1.10.1"
|
||||
|
||||
/* The version number of this header. It may be used to handle minor
|
||||
API incompatibilities. */
|
||||
#define GCRYPT_VERSION_NUMBER 0x010808
|
||||
#define GCRYPT_VERSION_NUMBER 0x010a01
|
||||
|
||||
|
||||
/* Internal: We can't use the convenience macros for the multi
|
||||
@@ -128,7 +119,7 @@ extern "C" {
|
||||
#ifdef _GCRYPT_IN_LIBGCRYPT
|
||||
#define _GCRY_ATTR_INTERNAL
|
||||
#else
|
||||
#define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED
|
||||
#define _GCRY_ATTR_INTERNAL _GCRY_GCC_ATTR_DEPRECATED
|
||||
#endif
|
||||
|
||||
/* Wrappers for the libgpg-error library. */
|
||||
@@ -333,7 +324,13 @@ enum gcry_ctl_cmds
|
||||
GCRYCTL_DRBG_REINIT = 74,
|
||||
GCRYCTL_SET_TAGLEN = 75,
|
||||
GCRYCTL_GET_TAGLEN = 76,
|
||||
GCRYCTL_REINIT_SYSCALL_CLAMP = 77
|
||||
GCRYCTL_REINIT_SYSCALL_CLAMP = 77,
|
||||
GCRYCTL_AUTO_EXPAND_SECMEM = 78,
|
||||
GCRYCTL_SET_ALLOW_WEAK_KEY = 79,
|
||||
GCRYCTL_SET_DECRYPTION_TAG = 80,
|
||||
GCRYCTL_FIPS_SERVICE_INDICATOR_CIPHER = 81,
|
||||
GCRYCTL_FIPS_SERVICE_INDICATOR_KDF = 82,
|
||||
GCRYCTL_NO_FIPS_MODE = 83
|
||||
};
|
||||
|
||||
/* Perform various operations defined by CMD. */
|
||||
@@ -387,7 +384,7 @@ gcry_error_t gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff,
|
||||
/* Like gcry_sexp_build, but uses an array instead of variable
|
||||
function arguments. */
|
||||
gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff,
|
||||
const char *format, void **arg_list);
|
||||
const char *format, void **arg_list);
|
||||
|
||||
/* Release the S-expression object SEXP */
|
||||
void gcry_sexp_release (gcry_sexp_t sexp);
|
||||
@@ -588,6 +585,9 @@ gcry_mpi_t gcry_mpi_set (gcry_mpi_t w, const gcry_mpi_t u);
|
||||
/* Store the unsigned integer value U in W. */
|
||||
gcry_mpi_t gcry_mpi_set_ui (gcry_mpi_t w, unsigned long u);
|
||||
|
||||
/* Store U as an unsigned int at W or return GPG_ERR_ERANGE. */
|
||||
gpg_error_t gcry_mpi_get_ui (unsigned int *w, gcry_mpi_t u);
|
||||
|
||||
/* Swap the values of A and B. */
|
||||
void gcry_mpi_swap (gcry_mpi_t a, gcry_mpi_t b);
|
||||
|
||||
@@ -841,6 +841,7 @@ gcry_mpi_t _gcry_mpi_get_const (int no);
|
||||
#define mpi_snatch( w, u) gcry_mpi_snatch( (w), (u) )
|
||||
#define mpi_set( w, u) gcry_mpi_set( (w), (u) )
|
||||
#define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) )
|
||||
#define mpi_get_ui( w, u) gcry_mpi_get_ui( (w), (u) )
|
||||
#define mpi_abs( w ) gcry_mpi_abs( (w) )
|
||||
#define mpi_neg( w, u) gcry_mpi_neg( (w), (u) )
|
||||
#define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) )
|
||||
@@ -940,7 +941,9 @@ enum gcry_cipher_algos
|
||||
GCRY_CIPHER_SALSA20 = 313,
|
||||
GCRY_CIPHER_SALSA20R12 = 314,
|
||||
GCRY_CIPHER_GOST28147 = 315,
|
||||
GCRY_CIPHER_CHACHA20 = 316
|
||||
GCRY_CIPHER_CHACHA20 = 316,
|
||||
GCRY_CIPHER_GOST28147_MESH = 317, /* With CryptoPro key meshing. */
|
||||
GCRY_CIPHER_SM4 = 318
|
||||
};
|
||||
|
||||
/* The Rijndael algorithm is basically AES, so provide some macros. */
|
||||
@@ -967,7 +970,10 @@ enum gcry_cipher_modes
|
||||
GCRY_CIPHER_MODE_POLY1305 = 10, /* Poly1305 based AEAD mode. */
|
||||
GCRY_CIPHER_MODE_OCB = 11, /* OCB3 mode. */
|
||||
GCRY_CIPHER_MODE_CFB8 = 12, /* Cipher feedback (8 bit mode). */
|
||||
GCRY_CIPHER_MODE_XTS = 13 /* XTS mode. */
|
||||
GCRY_CIPHER_MODE_XTS = 13, /* XTS mode. */
|
||||
GCRY_CIPHER_MODE_EAX = 14, /* EAX mode. */
|
||||
GCRY_CIPHER_MODE_SIV = 15, /* SIV mode. */
|
||||
GCRY_CIPHER_MODE_GCM_SIV = 16 /* GCM-SIV mode. */
|
||||
};
|
||||
|
||||
/* Flags used with the open function. */
|
||||
@@ -976,7 +982,8 @@ enum gcry_cipher_flags
|
||||
GCRY_CIPHER_SECURE = 1, /* Allocate in secure memory. */
|
||||
GCRY_CIPHER_ENABLE_SYNC = 2, /* Enable CFB sync mode. */
|
||||
GCRY_CIPHER_CBC_CTS = 4, /* Enable CBC cipher text stealing (CTS). */
|
||||
GCRY_CIPHER_CBC_MAC = 8 /* Enable CBC message auth. code (MAC). */
|
||||
GCRY_CIPHER_CBC_MAC = 8, /* Enable CBC message auth. code (MAC). */
|
||||
GCRY_CIPHER_EXTENDED = 16 /* Enable extended AES-WRAP. */
|
||||
};
|
||||
|
||||
/* GCM works only with blocks of 128 bits */
|
||||
@@ -991,6 +998,9 @@ enum gcry_cipher_flags
|
||||
/* XTS works only with blocks of 128 bits. */
|
||||
#define GCRY_XTS_BLOCK_LEN (128 / 8)
|
||||
|
||||
/* SIV and GCM-SIV works only with blocks of 128 bits */
|
||||
#define GCRY_SIV_BLOCK_LEN (128 / 8)
|
||||
|
||||
/* Create a handle for algorithm ALGO to be used in MODE. FLAGS may
|
||||
be given as an bitwise OR of the gcry_cipher_flags values. */
|
||||
gcry_error_t gcry_cipher_open (gcry_cipher_hd_t *handle,
|
||||
@@ -1093,6 +1103,11 @@ size_t gcry_cipher_get_algo_blklen (int algo);
|
||||
#define gcry_cipher_test_algo(a) \
|
||||
gcry_cipher_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
|
||||
|
||||
/* Setup tag for decryption (for SIV and GCM-SIV mode). */
|
||||
#define gcry_cipher_set_decryption_tag(a, tag, taglen) \
|
||||
gcry_cipher_ctl ((a), GCRYCTL_SET_DECRYPTION_TAG, \
|
||||
(void *)(tag), (taglen))
|
||||
|
||||
|
||||
/************************************
|
||||
* *
|
||||
@@ -1192,6 +1207,28 @@ gcry_sexp_t gcry_pk_get_param (int algo, const char *name);
|
||||
/* Return an S-expression representing the context CTX. */
|
||||
gcry_error_t gcry_pubkey_get_sexp (gcry_sexp_t *r_sexp,
|
||||
int mode, gcry_ctx_t ctx);
|
||||
|
||||
/************************************
|
||||
* *
|
||||
* Modern ECC Functions *
|
||||
* *
|
||||
************************************/
|
||||
|
||||
/* The curves we support. */
|
||||
enum gcry_ecc_curves
|
||||
{
|
||||
GCRY_ECC_CURVE25519 = 1,
|
||||
GCRY_ECC_CURVE448 = 2
|
||||
};
|
||||
|
||||
/* Get the length of point to prepare buffer for the result. */
|
||||
unsigned int gcry_ecc_get_algo_keylen (int curveid);
|
||||
|
||||
/* Convenience function to compute scalar multiplication of the
|
||||
* Montgomery form of curve. */
|
||||
gpg_error_t gcry_ecc_mul_point (int curveid, unsigned char *result,
|
||||
const unsigned char *scalar,
|
||||
const unsigned char *point);
|
||||
|
||||
|
||||
|
||||
@@ -1241,7 +1278,10 @@ enum gcry_md_algos
|
||||
GCRY_MD_BLAKE2S_256 = 322,
|
||||
GCRY_MD_BLAKE2S_224 = 323,
|
||||
GCRY_MD_BLAKE2S_160 = 324,
|
||||
GCRY_MD_BLAKE2S_128 = 325
|
||||
GCRY_MD_BLAKE2S_128 = 325,
|
||||
GCRY_MD_SM3 = 326,
|
||||
GCRY_MD_SHA512_256 = 327,
|
||||
GCRY_MD_SHA512_224 = 328
|
||||
};
|
||||
|
||||
/* Flags used with the open function. */
|
||||
@@ -1408,6 +1448,7 @@ typedef struct gcry_mac_handle *gcry_mac_hd_t;
|
||||
enum gcry_mac_algos
|
||||
{
|
||||
GCRY_MAC_NONE = 0,
|
||||
GCRY_MAC_GOST28147_IMIT = 1,
|
||||
|
||||
GCRY_MAC_HMAC_SHA256 = 101,
|
||||
GCRY_MAC_HMAC_SHA224 = 102,
|
||||
@@ -1427,6 +1468,18 @@ enum gcry_mac_algos
|
||||
GCRY_MAC_HMAC_SHA3_256 = 116,
|
||||
GCRY_MAC_HMAC_SHA3_384 = 117,
|
||||
GCRY_MAC_HMAC_SHA3_512 = 118,
|
||||
GCRY_MAC_HMAC_GOSTR3411_CP = 119,
|
||||
GCRY_MAC_HMAC_BLAKE2B_512 = 120,
|
||||
GCRY_MAC_HMAC_BLAKE2B_384 = 121,
|
||||
GCRY_MAC_HMAC_BLAKE2B_256 = 122,
|
||||
GCRY_MAC_HMAC_BLAKE2B_160 = 123,
|
||||
GCRY_MAC_HMAC_BLAKE2S_256 = 124,
|
||||
GCRY_MAC_HMAC_BLAKE2S_224 = 125,
|
||||
GCRY_MAC_HMAC_BLAKE2S_160 = 126,
|
||||
GCRY_MAC_HMAC_BLAKE2S_128 = 127,
|
||||
GCRY_MAC_HMAC_SM3 = 128,
|
||||
GCRY_MAC_HMAC_SHA512_256 = 129,
|
||||
GCRY_MAC_HMAC_SHA512_224 = 130,
|
||||
|
||||
GCRY_MAC_CMAC_AES = 201,
|
||||
GCRY_MAC_CMAC_3DES = 202,
|
||||
@@ -1439,6 +1492,7 @@ enum gcry_mac_algos
|
||||
GCRY_MAC_CMAC_RFC2268 = 209,
|
||||
GCRY_MAC_CMAC_IDEA = 210,
|
||||
GCRY_MAC_CMAC_GOST28147 = 211,
|
||||
GCRY_MAC_CMAC_SM4 = 212,
|
||||
|
||||
GCRY_MAC_GMAC_AES = 401,
|
||||
GCRY_MAC_GMAC_CAMELLIA = 402,
|
||||
@@ -1538,7 +1592,16 @@ enum gcry_kdf_algos
|
||||
GCRY_KDF_ITERSALTED_S2K = 19,
|
||||
GCRY_KDF_PBKDF1 = 33,
|
||||
GCRY_KDF_PBKDF2 = 34,
|
||||
GCRY_KDF_SCRYPT = 48
|
||||
GCRY_KDF_SCRYPT = 48,
|
||||
GCRY_KDF_ARGON2 = 64,
|
||||
GCRY_KDF_BALLOON = 65
|
||||
};
|
||||
|
||||
enum gcry_kdf_subalgo_argon2
|
||||
{
|
||||
GCRY_KDF_ARGON2D = 0,
|
||||
GCRY_KDF_ARGON2I = 1,
|
||||
GCRY_KDF_ARGON2ID = 2
|
||||
};
|
||||
|
||||
/* Derive a key from a passphrase. */
|
||||
@@ -1548,8 +1611,33 @@ gpg_error_t gcry_kdf_derive (const void *passphrase, size_t passphraselen,
|
||||
unsigned long iterations,
|
||||
size_t keysize, void *keybuffer);
|
||||
|
||||
/* Another API to derive a key from a passphrase. */
|
||||
typedef struct gcry_kdf_handle *gcry_kdf_hd_t;
|
||||
|
||||
typedef void (*gcry_kdf_job_fn_t) (void *priv);
|
||||
typedef int (*gcry_kdf_dispatch_job_fn_t) (void *jobs_context,
|
||||
gcry_kdf_job_fn_t job_fn,
|
||||
void *job_priv);
|
||||
typedef int (*gcry_kdf_wait_all_jobs_fn_t) (void *jobs_context);
|
||||
|
||||
/* Exposed structure for KDF computation to decouple thread functionality. */
|
||||
typedef struct gcry_kdf_thread_ops
|
||||
{
|
||||
void *jobs_context;
|
||||
gcry_kdf_dispatch_job_fn_t dispatch_job;
|
||||
gcry_kdf_wait_all_jobs_fn_t wait_all_jobs;
|
||||
} gcry_kdf_thread_ops_t;
|
||||
|
||||
gcry_error_t gcry_kdf_open (gcry_kdf_hd_t *hd, int algo, int subalgo,
|
||||
const unsigned long *param, unsigned int paramlen,
|
||||
const void *passphrase, size_t passphraselen,
|
||||
const void *salt, size_t saltlen,
|
||||
const void *key, size_t keylen,
|
||||
const void *ad, size_t adlen);
|
||||
gcry_error_t gcry_kdf_compute (gcry_kdf_hd_t h,
|
||||
const gcry_kdf_thread_ops_t *ops);
|
||||
gcry_error_t gcry_kdf_final (gcry_kdf_hd_t h, size_t resultlen, void *result);
|
||||
void gcry_kdf_close (gcry_kdf_hd_t h);
|
||||
|
||||
/************************************
|
||||
* *
|
||||
@@ -1600,8 +1688,7 @@ void *gcry_random_bytes (size_t nbytes, enum gcry_random_level level)
|
||||
_GCRY_GCC_ATTR_MALLOC;
|
||||
|
||||
/* Return NBYTES of allocated random using a random numbers of quality
|
||||
LEVEL. The random numbers are created returned in "secure"
|
||||
memory. */
|
||||
LEVEL. The random is returned in "secure" memory. */
|
||||
void *gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level)
|
||||
_GCRY_GCC_ATTR_MALLOC;
|
||||
|
||||
@@ -1784,6 +1871,32 @@ int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE;
|
||||
/* Return true if Libgcrypt is in FIPS mode. */
|
||||
#define gcry_fips_mode_active() !!gcry_control (GCRYCTL_FIPS_MODE_P, 0)
|
||||
|
||||
/* Variant of gcry_pk_sign which takes as additional parameter a HD
|
||||
* handle for hash and an optional context. The hash algorithm used by the
|
||||
* handle needs to be enabled and input needs to be supplied beforehand.
|
||||
* DATA-TMPL specifies a template to compose an S-expression to be signed.
|
||||
* A template should include '(hash %s %b)' or '(hash ALGONAME %b)'.
|
||||
* For the former case, '%s' is substituted by the string of algorithm
|
||||
* of gcry_md_get_algo (HD) and when gcry_md_read is called, ALGO=0 is
|
||||
* used internally. For the latter case, hash algorithm by ALGONAME
|
||||
* is used when gcry_md_read is called internally.
|
||||
* The hash handle must not yet been finalized; the function
|
||||
* takes a copy of the state and does a finalize on the copy. This
|
||||
* function shall be used if a policy requires that hashing and signing
|
||||
* is done by the same function. CTX is currently not used and should
|
||||
* be passed as NULL. */
|
||||
gcry_error_t gcry_pk_hash_sign (gcry_sexp_t *result,
|
||||
const char *data_tmpl, gcry_sexp_t skey,
|
||||
gcry_md_hd_t hd, gcry_ctx_t ctx);
|
||||
|
||||
/* Variant of gcry_pk_verify which takes as additional parameter a HD
|
||||
* handle for hash and an optional context. Similar to gcry_pk_hash_sign. */
|
||||
gcry_error_t gcry_pk_hash_verify (gcry_sexp_t sigval,
|
||||
const char *data_tmpl, gcry_sexp_t pkey,
|
||||
gcry_md_hd_t hd, gcry_ctx_t ctx);
|
||||
|
||||
gcry_error_t gcry_pk_random_override_new (gcry_ctx_t *r_ctx,
|
||||
const unsigned char *p, size_t len);
|
||||
|
||||
#if 0 /* (Keep Emacsens' auto-indent happy.) */
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user