Import libgcrypt 1.5.3.
This commit is contained in:
parent
c12936c5d1
commit
d1307d873a
72 changed files with 11732 additions and 2916 deletions
|
@ -1,72 +1,13 @@
|
|||
2011-12-01 Werner Koch <wk@g10code.com>
|
||||
|
||||
NB: ChangeLog files are no longer manually maintained. Starting
|
||||
on December 1st, 2011 we put change information only in the GIT
|
||||
commit log, and generate a top-level ChangeLog file from logs at
|
||||
"make dist". See doc/HACKING for details.
|
||||
NB: ChangeLog files are no longer manually maintained. Starting
|
||||
on December 1st, 2011 we put change information only in the GIT
|
||||
commit log, and generate a top-level ChangeLog file from logs at
|
||||
"make dist". See doc/HACKING for details.
|
||||
|
||||
2011-09-16 Werner Koch <wk@g10code.com>
|
||||
2011-09-08 Werner Koch <wk@g10code.com>
|
||||
|
||||
Change ATH code and turn the thread initialization callbacks in
|
||||
the API into dummy functions.
|
||||
|
||||
* global.c (global_init): Call _gcry_pimegen_init.
|
||||
|
||||
* gcrypt.h.in (GCRY_THREAD_OPTI ON_VERSION): Bump to 1.
|
||||
(GCRY_THREAD_OPTION_PTH_IMPL): Simplify.
|
||||
(GCRY_THREAD_OPTION_PTHREAD_IMPL): Simplify.
|
||||
|
||||
* ath.c (ath_read, ath_write): Remove. They are only used in the
|
||||
optional random-daemon.
|
||||
(ath_select, ath_waitpid, ath_accept, ath_connect, ath_sendmsg)
|
||||
(ath_recvmsg): Remove. They are not used.
|
||||
* ath.h: Remove prototypes and corresponding structure fields.
|
||||
|
||||
2011-03-11 Werner Koch <wk@g10code.com>
|
||||
|
||||
* ath.c (mutex_init): Rename second arg to FORCE and invert
|
||||
logic. Change all callers.
|
||||
|
||||
2011-09-15 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gcrypt.h.in (enum gcry_thread_option): Remove deprecated enum.
|
||||
(gcry_md_start_debug, gcry_md_stop_debug): Remove deprecated these
|
||||
macros.
|
||||
|
||||
2011-09-15 Werner Koch <wk@g10code.com>
|
||||
|
||||
Removal of the gcry_ac and the module register interfaces.
|
||||
|
||||
* Makefile.am (include_HEADERS): Remove gcrypt-module.h.
|
||||
(libgcrypt_la_SOURCES): Add gcrypt-module.h which is now internal
|
||||
header.
|
||||
* gcrypt-module.h (gcry_md_register, gcry_md_unregister): Remove.
|
||||
(gcry_pk_register, gcry_pk_unregister): Remove.
|
||||
(gcry_cipher_register, gcry_cipher_unregister): Remove.
|
||||
* visibility.h: Include gcrypt-module.h.
|
||||
* gcrypt.h.in: Do not include gcrypt-module.h.
|
||||
* gcrypt.h.in: Remove all gcry_ac symbols.
|
||||
(gcry_pk_list, gcry_md_list, gcry_cipher_list): Remove.
|
||||
* visibility.h: Remove all gcry_ac symbols.
|
||||
(gcry_pk_list, gcry_md_list, gcry_cipher_list): Remove.
|
||||
(gcry_cipher_register, gcry_cipher_unregister, gcry_pk_register)
|
||||
(gcry_pk_unregister, gcry_md_register, gcry_md_unregister): Remove.
|
||||
* visibility.c: Remove all gcry_ac wrappers.
|
||||
(gcry_pk_list, gcry_cipher_list, gcry_md_list): Remove.
|
||||
(gcry_cipher_register, gcry_cipher_unregister, gcry_pk_register)
|
||||
(gcry_pk_unregister, gcry_md_register, gcry_md_unregister): Remove.
|
||||
* libgcrypt.vers: Remove all gcry_ac symbols.
|
||||
(GCRYPT_1.2): Rename to GCRYPT_1.6.
|
||||
(gcry_pk_list, gcry_md_list, gcry_cipher_list): Remove.
|
||||
* libgcrypt.def: Remove all gcry_ac symbols.
|
||||
(gcry_pk_list, gcry_md_list, gcry_cipher_list): Remove.
|
||||
* global.c (global_init): Remove comment code with a call to
|
||||
_gcry_ac_init.
|
||||
|
||||
2011-09-15 Werner Koch <wk@g10code.com>
|
||||
|
||||
* hmac256.c (main): Fix endless loop when using pipe input and
|
||||
option --binary.
|
||||
* gcrypt.h.in [GCRYPT_NO_DEPRECATED]: Exclude gcry_ac structures.
|
||||
|
||||
2011-06-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
|
@ -2392,7 +2333,3 @@ Tue Dec 8 13:15:16 CET 1998 Werner Koch <wk@isil.d.shuttle.de>
|
|||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Local Variables:
|
||||
buffer-read-only: t
|
||||
End:
|
||||
|
|
|
@ -26,7 +26,7 @@ EXTRA_DIST = Manifest libgcrypt-config.in libgcrypt.m4 libgcrypt.vers \
|
|||
bin_SCRIPTS = libgcrypt-config
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = libgcrypt.m4
|
||||
include_HEADERS = gcrypt.h
|
||||
include_HEADERS = gcrypt.h gcrypt-module.h
|
||||
|
||||
lib_LTLIBRARIES = libgcrypt.la
|
||||
bin_PROGRAMS = dumpsexp hmac256
|
||||
|
@ -53,7 +53,7 @@ endif
|
|||
|
||||
libgcrypt_la_CFLAGS = $(GPG_ERROR_CFLAGS)
|
||||
libgcrypt_la_SOURCES = g10lib.h visibility.c visibility.h types.h \
|
||||
cipher.h cipher-proto.h gcrypt-module.h \
|
||||
cipher.h cipher-proto.h \
|
||||
misc.c global.c sexp.c hwfeatures.c \
|
||||
stdmem.c stdmem.h secmem.c secmem.h \
|
||||
mpi.h missing-string.c module.c fips.c \
|
||||
|
|
|
@ -1,323 +1,344 @@
|
|||
/* ath.c - A Thread-safeness library.
|
||||
* Copyright (C) 2002, 2003, 2004, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Libgcrypt.
|
||||
*
|
||||
* Libgcrypt is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser general Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Libgcrypt 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 Lesser General Public License for more details.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
/* ath.c - Thread-safeness library.
|
||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Libgcrypt.
|
||||
|
||||
Libgcrypt is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Libgcrypt 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 Lesser General Public
|
||||
License along with Libgcrypt; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h> /* Right: We need to use assert and not gcry_assert. */
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#if USE_POSIX_THREADS_WEAK
|
||||
# include <pthread.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifndef _WIN32
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include "ath.h"
|
||||
|
||||
|
||||
|
||||
/* On an ELF system it is easy to use pthreads using weak references.
|
||||
Take care not to test the address of a weak referenced function we
|
||||
actually use; some GCC versions have a bug were &foo != NULL is
|
||||
always evaluated to true in PIC mode. USING_PTHREAD_AS_DEFAULT is
|
||||
used by ath_install to detect the default usage of pthread. */
|
||||
#if USE_POSIX_THREADS_WEAK
|
||||
# pragma weak pthread_cancel
|
||||
# pragma weak pthread_mutex_init
|
||||
# pragma weak pthread_mutex_lock
|
||||
# pragma weak pthread_mutex_unlock
|
||||
# pragma weak pthread_mutex_destroy
|
||||
#endif
|
||||
/* The interface table. */
|
||||
static struct ath_ops ops;
|
||||
|
||||
/* For the dummy interface. The MUTEX_NOTINIT value is used to check
|
||||
that a mutex has been initialized. Because its value is there is
|
||||
no need to explicit initialized a mutex variable because it is
|
||||
anyway static and we store a pointer to allocated memory there
|
||||
after initialization. The same thing works with other thread
|
||||
models. */
|
||||
#define MUTEX_NOTINIT ((ath_mutex_t) 0)
|
||||
#define MUTEX_UNLOCKED ((ath_mutex_t) 1)
|
||||
#define MUTEX_LOCKED ((ath_mutex_t) 2)
|
||||
#define MUTEX_DESTROYED ((ath_mutex_t) 3)
|
||||
/* True if we should use the external callbacks. */
|
||||
static int ops_set;
|
||||
|
||||
|
||||
/* For the dummy interface. */
|
||||
#define MUTEX_UNLOCKED ((ath_mutex_t) 0)
|
||||
#define MUTEX_LOCKED ((ath_mutex_t) 1)
|
||||
#define MUTEX_DESTROYED ((ath_mutex_t) 2)
|
||||
|
||||
|
||||
/* Return the thread type from the option field. */
|
||||
#define GET_OPTION(a) ((a) & 0xff)
|
||||
/* Return the version number from the option field. */
|
||||
#define GET_VERSION(a) (((a) >> 8)& 0xff)
|
||||
|
||||
|
||||
|
||||
enum ath_thread_model {
|
||||
ath_model_undefined = 0,
|
||||
ath_model_none, /* No thread support. */
|
||||
ath_model_pthreads_weak, /* POSIX threads using weak symbols. */
|
||||
ath_model_pthreads, /* POSIX threads directly linked. */
|
||||
ath_model_w32 /* Microsoft Windows threads. */
|
||||
};
|
||||
/* The lock we take while checking for lazy lock initialization. */
|
||||
static ath_mutex_t check_init_lock = ATH_MUTEX_INITIALIZER;
|
||||
|
||||
|
||||
/* The thread model in use. */
|
||||
static enum ath_thread_model thread_model;
|
||||
|
||||
|
||||
/* Initialize the ath subsystem. This is called as part of the
|
||||
Libgcrypt initialization. It's purpose is to initialize the
|
||||
locking system. It returns 0 on sucess or an ERRNO value on error.
|
||||
In the latter case it is not defined whether ERRNO was changed.
|
||||
|
||||
Note: This should be called as early as possible because it is not
|
||||
always possible to detect the thread model to use while already
|
||||
running multi threaded. */
|
||||
int
|
||||
ath_init (void)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (thread_model)
|
||||
return 0; /* Already initialized - no error. */
|
||||
|
||||
if (0)
|
||||
;
|
||||
#if USE_POSIX_THREADS_WEAK
|
||||
else if (pthread_cancel)
|
||||
if (ops_set)
|
||||
{
|
||||
thread_model = ath_model_pthreads_weak;
|
||||
if (ops.init)
|
||||
err = (*ops.init) ();
|
||||
if (err)
|
||||
return err;
|
||||
err = (*ops.mutex_init) (&check_init_lock);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
/* Assume a single threaded application. */
|
||||
thread_model = ath_model_none;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/* Return the used thread model as string for display purposes an if
|
||||
R_MODEL is not null store its internal number at R_MODEL. */
|
||||
const char *
|
||||
ath_get_model (int *r_model)
|
||||
{
|
||||
if (r_model)
|
||||
*r_model = thread_model;
|
||||
switch (thread_model)
|
||||
{
|
||||
case ath_model_undefined: return "undefined";
|
||||
case ath_model_none: return "none";
|
||||
case ath_model_pthreads_weak: return "pthread(weak)";
|
||||
case ath_model_pthreads: return "pthread";
|
||||
case ath_model_w32: return "w32";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This function was used in old Libgcrypt versions (via
|
||||
GCRYCTL_SET_THREAD_CBS) to register the thread callback functions.
|
||||
It is not anymore required. However to allow existing code to
|
||||
continue to work, we keep this function and check that no user
|
||||
defined callbacks are used and that the requested thread system
|
||||
matches the one Libgcrypt is using. */
|
||||
/* Initialize the locking library. Returns 0 if the operation was
|
||||
successful, EINVAL if the operation table was invalid and EBUSY if
|
||||
we already were initialized. */
|
||||
gpg_err_code_t
|
||||
ath_install (struct ath_ops *ath_ops)
|
||||
ath_install (struct ath_ops *ath_ops, int check_only)
|
||||
{
|
||||
unsigned int thread_option;
|
||||
|
||||
/* Check if the requested thread option is compatible to the
|
||||
thread option we are already committed to. */
|
||||
thread_option = ath_ops? GET_OPTION (ath_ops->option) : 0;
|
||||
|
||||
/* Return an error if the requested thread model does not match the
|
||||
configured one. */
|
||||
if (0)
|
||||
;
|
||||
#if USE_POSIX_THREADS_WEAK
|
||||
else if (thread_model == ath_model_pthreads_weak)
|
||||
if (check_only)
|
||||
{
|
||||
if (thread_option == ATH_THREAD_OPTION_PTHREAD)
|
||||
return 0; /* Okay - compatible. */
|
||||
}
|
||||
#endif /*USE_POSIX_THREADS_WEAK*/
|
||||
else if (thread_option == ATH_THREAD_OPTION_DEFAULT)
|
||||
return 0; /* No thread support requested. */
|
||||
unsigned int option = 0;
|
||||
|
||||
return GPG_ERR_NOT_SUPPORTED;
|
||||
/* Check if the requested thread option is compatible to the
|
||||
thread option we are already committed to. */
|
||||
if (ath_ops)
|
||||
option = ath_ops->option;
|
||||
|
||||
if (!ops_set && GET_OPTION (option))
|
||||
return GPG_ERR_NOT_SUPPORTED;
|
||||
|
||||
if (GET_OPTION (ops.option) == ATH_THREAD_OPTION_USER
|
||||
|| GET_OPTION (option) == ATH_THREAD_OPTION_USER
|
||||
|| GET_OPTION (ops.option) != GET_OPTION (option)
|
||||
|| GET_VERSION (ops.option) != GET_VERSION (option))
|
||||
return GPG_ERR_NOT_SUPPORTED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ath_ops)
|
||||
{
|
||||
/* It is convenient to not require DESTROY. */
|
||||
if (!ath_ops->mutex_init || !ath_ops->mutex_lock
|
||||
|| !ath_ops->mutex_unlock)
|
||||
return GPG_ERR_INV_ARG;
|
||||
|
||||
ops = *ath_ops;
|
||||
ops_set = 1;
|
||||
}
|
||||
else
|
||||
ops_set = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mutex_init (ath_mutex_t *lock, int just_check)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (just_check)
|
||||
(*ops.mutex_lock) (&check_init_lock);
|
||||
if (*lock == ATH_MUTEX_INITIALIZER || !just_check)
|
||||
err = (*ops.mutex_init) (lock);
|
||||
if (just_check)
|
||||
(*ops.mutex_unlock) (&check_init_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize a new mutex. This function returns 0 on success or an
|
||||
system error code (i.e. an ERRNO value). ERRNO may or may not be
|
||||
changed on error. */
|
||||
int
|
||||
ath_mutex_init (ath_mutex_t *lock)
|
||||
{
|
||||
int err;
|
||||
if (ops_set)
|
||||
return mutex_init (lock, 0);
|
||||
|
||||
switch (thread_model)
|
||||
{
|
||||
case ath_model_none:
|
||||
*lock = MUTEX_UNLOCKED;
|
||||
err = 0;
|
||||
break;
|
||||
|
||||
#if USE_POSIX_THREADS_WEAK
|
||||
case ath_model_pthreads_weak:
|
||||
{
|
||||
pthread_mutex_t *plck;
|
||||
|
||||
plck = malloc (sizeof *plck);
|
||||
if (!plck)
|
||||
err = errno? errno : ENOMEM;
|
||||
else
|
||||
{
|
||||
err = pthread_mutex_init (plck, NULL);
|
||||
if (err)
|
||||
free (plck);
|
||||
else
|
||||
*lock = (void*)plck;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /*USE_POSIX_THREADS_WEAK*/
|
||||
|
||||
default:
|
||||
err = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return err;
|
||||
#ifndef NDEBUG
|
||||
*lock = MUTEX_UNLOCKED;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Destroy a mutex. This function is a NOP if LOCK is NULL. If the
|
||||
mutex is still locked it can't be destroyed and the function
|
||||
returns EBUSY. ERRNO may or may not be changed on error. */
|
||||
int
|
||||
ath_mutex_destroy (ath_mutex_t *lock)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (!*lock)
|
||||
return 0;
|
||||
|
||||
switch (thread_model)
|
||||
if (ops_set)
|
||||
{
|
||||
case ath_model_none:
|
||||
if (*lock != MUTEX_UNLOCKED)
|
||||
err = EBUSY;
|
||||
else
|
||||
{
|
||||
*lock = MUTEX_DESTROYED;
|
||||
err = 0;
|
||||
}
|
||||
break;
|
||||
if (!ops.mutex_destroy)
|
||||
return 0;
|
||||
|
||||
#if USE_POSIX_THREADS_WEAK
|
||||
case ath_model_pthreads_weak:
|
||||
{
|
||||
pthread_mutex_t *plck = (pthread_mutex_t*)lock;
|
||||
|
||||
err = pthread_mutex_destroy (plck);
|
||||
if (!err)
|
||||
{
|
||||
free (plck);
|
||||
lock = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /*USE_POSIX_THREADS_WEAK*/
|
||||
|
||||
default:
|
||||
err = EINVAL;
|
||||
break;
|
||||
(*ops.mutex_lock) (&check_init_lock);
|
||||
if (*lock == ATH_MUTEX_INITIALIZER)
|
||||
{
|
||||
(*ops.mutex_unlock) (&check_init_lock);
|
||||
return 0;
|
||||
}
|
||||
(*ops.mutex_unlock) (&check_init_lock);
|
||||
return (*ops.mutex_destroy) (lock);
|
||||
}
|
||||
|
||||
return err;
|
||||
#ifndef NDEBUG
|
||||
assert (*lock == MUTEX_UNLOCKED);
|
||||
|
||||
*lock = MUTEX_DESTROYED;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Lock the mutex LOCK. On success the function returns 0; on error
|
||||
an error code. ERRNO may or may not be changed on error. */
|
||||
int
|
||||
ath_mutex_lock (ath_mutex_t *lock)
|
||||
{
|
||||
int err;
|
||||
|
||||
switch (thread_model)
|
||||
if (ops_set)
|
||||
{
|
||||
case ath_model_none:
|
||||
if (*lock == MUTEX_NOTINIT)
|
||||
err = EINVAL;
|
||||
else if (*lock == MUTEX_UNLOCKED)
|
||||
{
|
||||
*lock = MUTEX_LOCKED;
|
||||
err = 0;
|
||||
}
|
||||
else
|
||||
err = EDEADLK;
|
||||
break;
|
||||
|
||||
#if USE_POSIX_THREADS_WEAK
|
||||
case ath_model_pthreads_weak:
|
||||
err = pthread_mutex_lock ((pthread_mutex_t*)lock);
|
||||
break;
|
||||
#endif /*USE_POSIX_THREADS_WEAK*/
|
||||
|
||||
default:
|
||||
err = EINVAL;
|
||||
break;
|
||||
int ret = mutex_init (lock, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
return (*ops.mutex_lock) (lock);
|
||||
}
|
||||
|
||||
return err;
|
||||
#ifndef NDEBUG
|
||||
assert (*lock == MUTEX_UNLOCKED);
|
||||
|
||||
*lock = MUTEX_LOCKED;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Unlock the mutex LOCK. On success the function returns 0; on error
|
||||
an error code. ERRNO may or may not be changed on error. */
|
||||
|
||||
int
|
||||
ath_mutex_unlock (ath_mutex_t *lock)
|
||||
{
|
||||
int err;
|
||||
|
||||
switch (thread_model)
|
||||
if (ops_set)
|
||||
{
|
||||
case ath_model_none:
|
||||
if (*lock == MUTEX_NOTINIT)
|
||||
err = EINVAL;
|
||||
else if (*lock == MUTEX_LOCKED)
|
||||
{
|
||||
*lock = MUTEX_UNLOCKED;
|
||||
err = 0;
|
||||
}
|
||||
else
|
||||
err = EPERM;
|
||||
break;
|
||||
|
||||
#if USE_POSIX_THREADS_WEAK
|
||||
case ath_model_pthreads_weak:
|
||||
err = pthread_mutex_unlock ((pthread_mutex_t*)lock);
|
||||
break;
|
||||
#endif /*USE_POSIX_THREADS_WEAK*/
|
||||
|
||||
default:
|
||||
err = EINVAL;
|
||||
break;
|
||||
int ret = mutex_init (lock, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
return (*ops.mutex_unlock) (lock);
|
||||
}
|
||||
|
||||
return err;
|
||||
#ifndef NDEBUG
|
||||
assert (*lock == MUTEX_LOCKED);
|
||||
|
||||
*lock = MUTEX_UNLOCKED;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_read (int fd, void *buf, size_t nbytes)
|
||||
{
|
||||
if (ops_set && ops.read)
|
||||
return (*ops.read) (fd, buf, nbytes);
|
||||
else
|
||||
return read (fd, buf, nbytes);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_write (int fd, const void *buf, size_t nbytes)
|
||||
{
|
||||
if (ops_set && ops.write)
|
||||
return (*ops.write) (fd, buf, nbytes);
|
||||
else
|
||||
return write (fd, buf, nbytes);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
#ifdef _WIN32
|
||||
ath_select (int nfd, void *rset, void *wset, void *eset,
|
||||
struct timeval *timeout)
|
||||
#else
|
||||
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
|
||||
struct timeval *timeout)
|
||||
#endif
|
||||
{
|
||||
if (ops_set && ops.select)
|
||||
return (*ops.select) (nfd, rset, wset, eset, timeout);
|
||||
else
|
||||
#ifdef _WIN32
|
||||
return -1;
|
||||
#else
|
||||
return select (nfd, rset, wset, eset, timeout);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_waitpid (pid_t pid, int *status, int options)
|
||||
{
|
||||
if (ops_set && ops.waitpid)
|
||||
return (*ops.waitpid) (pid, status, options);
|
||||
else
|
||||
#ifdef _WIN32
|
||||
return -1;
|
||||
#else
|
||||
return waitpid (pid, status, options);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
#ifdef _WIN32
|
||||
ath_accept (int s, void *addr, int *length_ptr)
|
||||
#else
|
||||
ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr)
|
||||
#endif
|
||||
{
|
||||
if (ops_set && ops.accept)
|
||||
return (*ops.accept) (s, addr, length_ptr);
|
||||
else
|
||||
#ifdef _WIN32
|
||||
return -1;
|
||||
#else
|
||||
return accept (s, addr, length_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
#ifdef _WIN32
|
||||
ath_connect (int s, void *addr, int length)
|
||||
#else
|
||||
ath_connect (int s, struct sockaddr *addr, socklen_t length)
|
||||
#endif
|
||||
{
|
||||
if (ops_set && ops.connect)
|
||||
return (*ops.connect) (s, addr, length);
|
||||
else
|
||||
#ifdef _WIN32
|
||||
return -1;
|
||||
#else
|
||||
return connect (s, addr, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
#ifdef _WIN32
|
||||
ath_sendmsg (int s, const void *msg, int flags)
|
||||
#else
|
||||
ath_sendmsg (int s, const struct msghdr *msg, int flags)
|
||||
#endif
|
||||
{
|
||||
if (ops_set && ops.sendmsg)
|
||||
return (*ops.sendmsg) (s, msg, flags);
|
||||
else
|
||||
#ifdef _WIN32
|
||||
return -1;
|
||||
#else
|
||||
return sendmsg (s, msg, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
#ifdef _WIN32
|
||||
ath_recvmsg (int s, void *msg, int flags)
|
||||
#else
|
||||
ath_recvmsg (int s, struct msghdr *msg, int flags)
|
||||
#endif
|
||||
{
|
||||
if (ops_set && ops.recvmsg)
|
||||
return (*ops.recvmsg) (s, msg, flags);
|
||||
else
|
||||
#ifdef _WIN32
|
||||
return -1;
|
||||
#else
|
||||
return recvmsg (s, msg, flags);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* ath.h - Thread-safeness library.
|
||||
* Copyright (C) 2002, 2003, 2004, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Libgcrypt.
|
||||
*
|
||||
* Libgcrypt is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser general Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Libgcrypt 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 Lesser General Public License for more details.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Libgcrypt.
|
||||
|
||||
Libgcrypt is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Libgcrypt 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 Lesser General Public
|
||||
License along with Libgcrypt; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef ATH_H
|
||||
#define ATH_H
|
||||
|
@ -50,11 +51,18 @@
|
|||
#define _ATH_PREFIX(x) _ATH_PREFIX2(_ATH_EXT_SYM_PREFIX,x)
|
||||
#define ath_install _ATH_PREFIX(ath_install)
|
||||
#define ath_init _ATH_PREFIX(ath_init)
|
||||
#define ath_get_model _ATH_PREFIX(ath_get_model)
|
||||
#define ath_mutex_init _ATH_PREFIX(ath_mutex_init)
|
||||
#define ath_mutex_destroy _ATH_PREFIX(ath_mutex_destroy)
|
||||
#define ath_mutex_lock _ATH_PREFIX(ath_mutex_lock)
|
||||
#define ath_mutex_unlock _ATH_PREFIX(ath_mutex_unlock)
|
||||
#define ath_read _ATH_PREFIX(ath_read)
|
||||
#define ath_write _ATH_PREFIX(ath_write)
|
||||
#define ath_select _ATH_PREFIX(ath_select)
|
||||
#define ath_waitpid _ATH_PREFIX(ath_waitpid)
|
||||
#define ath_connect _ATH_PREFIX(ath_connect)
|
||||
#define ath_accept _ATH_PREFIX(ath_accept)
|
||||
#define ath_sendmsg _ATH_PREFIX(ath_sendmsg)
|
||||
#define ath_recvmsg _ATH_PREFIX(ath_recvmsg)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -75,18 +83,65 @@ struct ath_ops
|
|||
*/
|
||||
unsigned int option;
|
||||
|
||||
int (*init) (void);
|
||||
int (*mutex_init) (void **priv);
|
||||
int (*mutex_destroy) (void *priv);
|
||||
int (*mutex_lock) (void *priv);
|
||||
int (*mutex_unlock) (void *priv);
|
||||
ssize_t (*read) (int fd, void *buf, size_t nbytes);
|
||||
ssize_t (*write) (int fd, const void *buf, size_t nbytes);
|
||||
#ifdef _WIN32
|
||||
ssize_t (*select) (int nfd, void *rset, void *wset, void *eset,
|
||||
struct timeval *timeout);
|
||||
ssize_t (*waitpid) (pid_t pid, int *status, int options);
|
||||
int (*accept) (int s, void *addr, int *length_ptr);
|
||||
int (*connect) (int s, void *addr, int length);
|
||||
int (*sendmsg) (int s, const void *msg, int flags);
|
||||
int (*recvmsg) (int s, void *msg, int flags);
|
||||
#else
|
||||
ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
|
||||
struct timeval *timeout);
|
||||
ssize_t (*waitpid) (pid_t pid, int *status, int options);
|
||||
int (*accept) (int s, struct sockaddr *addr, socklen_t *length_ptr);
|
||||
int (*connect) (int s, struct sockaddr *addr, socklen_t length);
|
||||
int (*sendmsg) (int s, const struct msghdr *msg, int flags);
|
||||
int (*recvmsg) (int s, struct msghdr *msg, int flags);
|
||||
#endif
|
||||
};
|
||||
|
||||
gpg_err_code_t ath_install (struct ath_ops *ath_ops);
|
||||
gpg_err_code_t ath_install (struct ath_ops *ath_ops, int check_only);
|
||||
int ath_init (void);
|
||||
const char *ath_get_model (int *r_model);
|
||||
|
||||
|
||||
/* Functions for mutual exclusion. */
|
||||
typedef void *ath_mutex_t;
|
||||
#define ATH_MUTEX_INITIALIZER 0
|
||||
|
||||
int ath_mutex_init (ath_mutex_t *mutex);
|
||||
int ath_mutex_destroy (ath_mutex_t *mutex);
|
||||
int ath_mutex_lock (ath_mutex_t *mutex);
|
||||
int ath_mutex_unlock (ath_mutex_t *mutex);
|
||||
|
||||
/* Replacement for the POSIX functions, which can be used to allow
|
||||
other (user-level) threads to run. */
|
||||
ssize_t ath_read (int fd, void *buf, size_t nbytes);
|
||||
ssize_t ath_write (int fd, const void *buf, size_t nbytes);
|
||||
#ifdef _WIN32
|
||||
ssize_t ath_select (int nfd, void *rset, void *wset, void *eset,
|
||||
struct timeval *timeout);
|
||||
ssize_t ath_waitpid (pid_t pid, int *status, int options);
|
||||
int ath_accept (int s, void *addr, int *length_ptr);
|
||||
int ath_connect (int s, void *addr, int length);
|
||||
int ath_sendmsg (int s, const void *msg, int flags);
|
||||
int ath_recvmsg (int s, void *msg, int flags);
|
||||
#else
|
||||
ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
|
||||
struct timeval *timeout);
|
||||
ssize_t ath_waitpid (pid_t pid, int *status, int options);
|
||||
int ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr);
|
||||
int ath_connect (int s, struct sockaddr *addr, socklen_t length);
|
||||
int ath_sendmsg (int s, const struct msghdr *msg, int flags);
|
||||
int ath_recvmsg (int s, struct msghdr *msg, int flags);
|
||||
#endif
|
||||
|
||||
#endif /* ATH_H */
|
||||
|
|
|
@ -135,6 +135,7 @@ extern gcry_cipher_spec_t _gcry_cipher_spec_seed;
|
|||
extern gcry_cipher_spec_t _gcry_cipher_spec_camellia128;
|
||||
extern gcry_cipher_spec_t _gcry_cipher_spec_camellia192;
|
||||
extern gcry_cipher_spec_t _gcry_cipher_spec_camellia256;
|
||||
extern gcry_cipher_spec_t _gcry_cipher_spec_idea;
|
||||
|
||||
extern cipher_extra_spec_t _gcry_cipher_extraspec_tripledes;
|
||||
extern cipher_extra_spec_t _gcry_cipher_extraspec_aes;
|
||||
|
|
|
@ -69,7 +69,7 @@ static int enforced_fips_mode;
|
|||
static int inactive_fips_mode;
|
||||
|
||||
/* This is the lock we use to protect the FSM. */
|
||||
static ath_mutex_t fsm_lock;
|
||||
static ath_mutex_t fsm_lock = ATH_MUTEX_INITIALIZER;
|
||||
|
||||
/* The current state of the FSM. The whole state machinery is only
|
||||
used while in fips mode. Change this only while holding fsm_lock. */
|
||||
|
@ -274,9 +274,17 @@ _gcry_fips_mode (void)
|
|||
int
|
||||
_gcry_enforced_fips_mode (void)
|
||||
{
|
||||
if (!_gcry_fips_mode ())
|
||||
return 0;
|
||||
return enforced_fips_mode;
|
||||
}
|
||||
|
||||
/* Set a flag telling whether we are in the enforced fips mode. */
|
||||
void
|
||||
_gcry_set_enforced_fips_mode (void)
|
||||
{
|
||||
enforced_fips_mode = 1;
|
||||
}
|
||||
|
||||
/* If we do not want to enforce the fips mode, we can set a flag so
|
||||
that the application may check whether it is still in fips mode.
|
||||
|
|
|
@ -69,8 +69,6 @@
|
|||
|
||||
/* Gettext macros. */
|
||||
|
||||
#define _(a) _gcry_gettext(a)
|
||||
|
||||
/* Some handy macros */
|
||||
#ifndef STR
|
||||
#define STR(v) #v
|
||||
|
@ -116,9 +114,20 @@ void _gcry_log_printhex (const char *text, const void *buffer, size_t length);
|
|||
void _gcry_set_log_verbosity( int level );
|
||||
int _gcry_log_verbosity( int level );
|
||||
|
||||
#ifdef JNLIB_GCC_M_FUNCTION
|
||||
#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
|
||||
#define gcry_assert(expr) ((expr)? (void)0 \
|
||||
: _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
#define BUG() _gcry_bug( __FILE__ , __LINE__, __func__ )
|
||||
#define gcry_assert(expr) ((expr)? (void)0 \
|
||||
: _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __func__))
|
||||
#else
|
||||
#define BUG() _gcry_bug( __FILE__ , __LINE__ )
|
||||
#define gcry_assert(expr) ((expr)? (void)0 \
|
||||
: _gcry_assert_failed (STR(expr), __FILE__, __LINE__))
|
||||
#endif
|
||||
|
||||
|
||||
#define log_bug _gcry_log_bug
|
||||
#define log_fatal _gcry_log_fatal
|
||||
|
@ -155,7 +164,6 @@ const char *_gcry_mpi_get_hw_config (void);
|
|||
#endif
|
||||
|
||||
/*-- primegen.c --*/
|
||||
gcry_err_code_t _gcry_primegen_init (void);
|
||||
gcry_mpi_t _gcry_generate_secret_prime (unsigned int nbits,
|
||||
gcry_random_level_t random_level,
|
||||
int (*extra_check)(void*, gcry_mpi_t),
|
||||
|
@ -238,66 +246,6 @@ void _gcry_burn_stack (int bytes);
|
|||
|| (*(a) >= 'A' && *(a) <= 'F') \
|
||||
|| (*(a) >= 'a' && *(a) <= 'f'))
|
||||
|
||||
/* Management for ciphers/digests/pubkey-ciphers. */
|
||||
|
||||
/* Structure for each registered `module'. */
|
||||
struct gcry_module
|
||||
{
|
||||
struct gcry_module *next; /* List pointers. */
|
||||
struct gcry_module **prevp;
|
||||
void *spec; /* Pointer to the subsystem-specific
|
||||
specification structure. */
|
||||
void *extraspec; /* Pointer to the subsystem-specific
|
||||
extra specification structure. */
|
||||
int flags; /* Associated flags. */
|
||||
int counter; /* Use counter. */
|
||||
unsigned int mod_id; /* ID of this module. */
|
||||
};
|
||||
|
||||
typedef struct gcry_module gcry_module_t;
|
||||
|
||||
/* Flags for the `flags' member of gcry_module_t. */
|
||||
#define FLAG_MODULE_DISABLED (1 << 0)
|
||||
|
||||
gcry_err_code_t _gcry_module_add (gcry_module_t *entries,
|
||||
unsigned int id,
|
||||
void *spec,
|
||||
void *extraspec,
|
||||
gcry_module_t *module);
|
||||
|
||||
typedef int (*gcry_module_lookup_t) (void *spec, void *data);
|
||||
|
||||
/* Lookup a module specification by it's ID. After a successful
|
||||
lookup, the module has it's resource counter incremented. */
|
||||
gcry_module_t _gcry_module_lookup_id (gcry_module_t entries,
|
||||
unsigned int id);
|
||||
|
||||
/* Internal function. Lookup a module specification. */
|
||||
gcry_module_t _gcry_module_lookup (gcry_module_t entries, void *data,
|
||||
gcry_module_lookup_t func);
|
||||
|
||||
/* Release a module. In case the use-counter reaches zero, destroy
|
||||
the module. */
|
||||
void _gcry_module_release (gcry_module_t entry);
|
||||
|
||||
/* Add a reference to a module. */
|
||||
void _gcry_module_use (gcry_module_t module);
|
||||
|
||||
/* Return a list of module IDs. */
|
||||
gcry_err_code_t _gcry_module_list (gcry_module_t modules,
|
||||
int *list, int *list_length);
|
||||
|
||||
gcry_err_code_t _gcry_cipher_init (void);
|
||||
gcry_err_code_t _gcry_md_init (void);
|
||||
gcry_err_code_t _gcry_pk_init (void);
|
||||
|
||||
gcry_err_code_t _gcry_pk_module_lookup (int id, gcry_module_t *module);
|
||||
void _gcry_pk_module_release (gcry_module_t module);
|
||||
gcry_err_code_t _gcry_pk_get_elements (int algo, char **enc, char **sig);
|
||||
|
||||
/* Memory management. */
|
||||
#define GCRY_ALLOC_FLAG_SECURE (1 << 0)
|
||||
|
||||
|
||||
/*-- sexp.c --*/
|
||||
gcry_error_t _gcry_sexp_vbuild (gcry_sexp_t *retsexp, size_t *erroff,
|
||||
|
@ -309,8 +257,13 @@ char *_gcry_sexp_nth_string (const gcry_sexp_t list, int number);
|
|||
|
||||
void _gcry_initialize_fips_mode (int force);
|
||||
|
||||
int _gcry_fips_mode (void);
|
||||
#define fips_mode() _gcry_fips_mode ()
|
||||
|
||||
int _gcry_enforced_fips_mode (void);
|
||||
|
||||
void _gcry_set_enforced_fips_mode (void);
|
||||
|
||||
void _gcry_inactivate_fips_mode (const char *text);
|
||||
int _gcry_is_fips_mode_inactive (void);
|
||||
|
||||
|
|
|
@ -19,13 +19,11 @@
|
|||
|
||||
/*
|
||||
This file contains the necessary declarations/definitions for
|
||||
working with Libgcrypt modules. Since 1.6 this is an internal
|
||||
interface and will eventually be merged into another header or
|
||||
entirely removed.
|
||||
working with Libgcrypt modules.
|
||||
*/
|
||||
|
||||
#ifndef GCRYPT_MODULE_H
|
||||
#define GCRYPT_MODULE_H
|
||||
#ifndef _GCRYPT_MODULE_H
|
||||
#define _GCRYPT_MODULE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -95,6 +93,19 @@ typedef struct gcry_cipher_spec
|
|||
gcry_cipher_stdecrypt_t stdecrypt;
|
||||
} gcry_cipher_spec_t;
|
||||
|
||||
/* Register a new cipher module whose specification can be found in
|
||||
CIPHER. On success, a new algorithm ID is stored in ALGORITHM_ID
|
||||
and a pointer representing this module is stored in MODULE. */
|
||||
gcry_error_t gcry_cipher_register (gcry_cipher_spec_t *cipher,
|
||||
int *algorithm_id,
|
||||
gcry_module_t *module)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
|
||||
/* Unregister the cipher identified by MODULE, which must have been
|
||||
registered with gcry_cipher_register. */
|
||||
void gcry_cipher_unregister (gcry_module_t module)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* ********************** */
|
||||
|
||||
|
@ -160,6 +171,18 @@ typedef struct gcry_pk_spec
|
|||
gcry_pk_get_nbits_t get_nbits;
|
||||
} gcry_pk_spec_t;
|
||||
|
||||
/* Register a new pubkey module whose specification can be found in
|
||||
PUBKEY. On success, a new algorithm ID is stored in ALGORITHM_ID
|
||||
and a pointer representhing this module is stored in MODULE. */
|
||||
gcry_error_t gcry_pk_register (gcry_pk_spec_t *pubkey,
|
||||
unsigned int *algorithm_id,
|
||||
gcry_module_t *module)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Unregister the pubkey identified by ID, which must have been
|
||||
registered with gcry_pk_register. */
|
||||
void gcry_pk_unregister (gcry_module_t module)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* ********************** */
|
||||
|
||||
|
@ -195,10 +218,23 @@ typedef struct gcry_md_spec
|
|||
size_t contextsize; /* allocate this amount of context */
|
||||
} gcry_md_spec_t;
|
||||
|
||||
/* Register a new digest module whose specification can be found in
|
||||
DIGEST. On success, a new algorithm ID is stored in ALGORITHM_ID
|
||||
and a pointer representhing this module is stored in MODULE. */
|
||||
gcry_error_t gcry_md_register (gcry_md_spec_t *digest,
|
||||
unsigned int *algorithm_id,
|
||||
gcry_module_t *module)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Unregister the digest identified by ID, which must have been
|
||||
registered with gcry_digest_register. */
|
||||
void gcry_md_unregister (gcry_module_t module)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
#if 0 /* keep Emacsens's auto-indent happy */
|
||||
{
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*GCRYPT_MODULE_H*/
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* gcrypt.h - GNU Cryptographic Library Interface -*- c -*-
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
|
||||
2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
2007, 2008, 2009, 2010, 2011,
|
||||
2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2012, 2013 g10 Code GmbH
|
||||
|
||||
This file is part of Libgcrypt.
|
||||
|
||||
|
@ -63,6 +65,11 @@ extern "C" {
|
|||
matches the installed library. */
|
||||
#define GCRYPT_VERSION "@VERSION@"
|
||||
|
||||
/* The version number of this header. It may be used to handle minor
|
||||
API incompatibilities. */
|
||||
#define GCRYPT_VERSION_NUMBER @VERSION_NUMBER@
|
||||
|
||||
|
||||
/* Internal: We can't use the convenience macros for the multi
|
||||
precision integer functions when building this library. */
|
||||
#ifdef _GCRYPT_IN_LIBGCRYPT
|
||||
|
@ -173,41 +180,6 @@ gcry_error_t gcry_err_make_from_errno (gcry_err_source_t source, int err);
|
|||
/* Return an error value with the system error ERR. */
|
||||
gcry_err_code_t gcry_error_from_errno (int err);
|
||||
|
||||
|
||||
/* NOTE: Since Libgcrypt 1.6 the thread callbacks are not anymore
|
||||
used. However we keep it to allow for some source code
|
||||
compatibility if used in the standard way. */
|
||||
|
||||
/* Constants defining the thread model to use. Used with the OPTION
|
||||
field of the struct gcry_thread_cbs. */
|
||||
#define GCRY_THREAD_OPTION_DEFAULT 0
|
||||
#define GCRY_THREAD_OPTION_USER 1
|
||||
#define GCRY_THREAD_OPTION_PTH 2
|
||||
#define GCRY_THREAD_OPTION_PTHREAD 3
|
||||
|
||||
/* The version number encoded in the OPTION field of the struct
|
||||
gcry_thread_cbs. */
|
||||
#define GCRY_THREAD_OPTION_VERSION 1
|
||||
|
||||
/* Wrapper for struct ath_ops. */
|
||||
struct gcry_thread_cbs
|
||||
{
|
||||
/* The OPTION field encodes the thread model and the version number
|
||||
of this structure.
|
||||
Bits 7 - 0 are used for the thread model
|
||||
Bits 15 - 8 are used for the version number. */
|
||||
unsigned int option;
|
||||
} _GCRY_ATTR_INTERNAL;
|
||||
|
||||
#define GCRY_THREAD_OPTION_PTH_IMPL \
|
||||
static struct gcry_thread_cbs gcry_threads_pth = { \
|
||||
(GCRY_THREAD_OPTION_PTH | (GCRY_THREAD_OPTION_VERSION << 8))}
|
||||
|
||||
#define GCRY_THREAD_OPTION_PTHREAD_IMPL \
|
||||
static struct gcry_thread_cbs gcry_threads_pthread = { \
|
||||
(GCRY_THREAD_OPTION_PTHREAD | (GCRY_THREAD_OPTION_VERSION << 8))}
|
||||
|
||||
|
||||
|
||||
/* The data object used to hold a multi precision integer. */
|
||||
struct gcry_mpi;
|
||||
|
@ -285,7 +257,8 @@ enum gcry_ctl_cmds
|
|||
GCRYCTL_FORCE_FIPS_MODE = 56,
|
||||
GCRYCTL_SELFTEST = 57,
|
||||
/* Note: 58 .. 62 are used internally. */
|
||||
GCRYCTL_DISABLE_HWF = 63
|
||||
GCRYCTL_DISABLE_HWF = 63,
|
||||
GCRYCTL_SET_ENFORCED_FIPS_FLAG = 64
|
||||
};
|
||||
|
||||
/* Perform various operations defined by CMD. */
|
||||
|
@ -821,6 +794,14 @@ 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 )
|
||||
|
||||
/* Get a list consisting of the IDs of the loaded cipher modules. If
|
||||
LIST is zero, write the number of loaded cipher modules to
|
||||
LIST_LENGTH and return. If LIST is non-zero, the first
|
||||
*LIST_LENGTH algorithm IDs are stored in LIST, which must be of
|
||||
according size. In case there are less cipher modules than
|
||||
*LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
|
||||
gcry_error_t gcry_cipher_list (int *list, int *list_length);
|
||||
|
||||
|
||||
/************************************
|
||||
* *
|
||||
|
@ -911,6 +892,13 @@ gcry_sexp_t gcry_pk_get_param (int algo, const char *name);
|
|||
#define gcry_pk_test_algo(a) \
|
||||
gcry_pk_algo_info( (a), GCRYCTL_TEST_ALGO, NULL, NULL )
|
||||
|
||||
/* Get a list consisting of the IDs of the loaded pubkey modules. If
|
||||
LIST is zero, write the number of loaded pubkey modules to
|
||||
LIST_LENGTH and return. If LIST is non-zero, the first
|
||||
*LIST_LENGTH algorithm IDs are stored in LIST, which must be of
|
||||
according size. In case there are less pubkey modules than
|
||||
*LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */
|
||||
gcry_error_t gcry_pk_list (int *list, int *list_length);
|
||||
|
||||
|
||||
|
||||
|
@ -1081,6 +1069,438 @@ void gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
|
|||
#define gcry_md_get_asnoid(a,b,n) \
|
||||
gcry_md_algo_info((a), GCRYCTL_GET_ASNOID, (b), (n))
|
||||
|
||||
/* Enable debugging for digest object A; i.e. create files named
|
||||
dbgmd-<n>.<string> while hashing. B is a string used as the suffix
|
||||
for the filename. This macro is deprecated, use gcry_md_debug. */
|
||||
#ifndef GCRYPT_NO_DEPRECATED
|
||||
#define gcry_md_start_debug(a,b) \
|
||||
gcry_md_ctl( (a), GCRYCTL_START_DUMP, (b), 0 )
|
||||
|
||||
/* Disable the debugging of A. This macro is deprecated, use
|
||||
gcry_md_debug. */
|
||||
#define gcry_md_stop_debug(a,b) \
|
||||
gcry_md_ctl( (a), GCRYCTL_STOP_DUMP, (b), 0 )
|
||||
#endif
|
||||
|
||||
/* Get a list consisting of the IDs of the loaded message digest
|
||||
modules. If LIST is zero, write the number of loaded message
|
||||
digest modules to LIST_LENGTH and return. If LIST is non-zero, the
|
||||
first *LIST_LENGTH algorithm IDs are stored in LIST, which must be
|
||||
of according size. In case there are less message digest modules
|
||||
than *LIST_LENGTH, *LIST_LENGTH is updated to the correct
|
||||
number. */
|
||||
gcry_error_t gcry_md_list (int *list, int *list_length);
|
||||
|
||||
|
||||
#if !defined(GCRYPT_NO_DEPRECATED) || defined(_GCRYPT_IN_LIBGCRYPT)
|
||||
/* Alternative interface for asymmetric cryptography. This interface
|
||||
is deprecated. */
|
||||
|
||||
/* The algorithm IDs. */
|
||||
typedef enum gcry_ac_id
|
||||
{
|
||||
GCRY_AC_RSA = 1,
|
||||
GCRY_AC_DSA = 17,
|
||||
GCRY_AC_ELG = 20,
|
||||
GCRY_AC_ELG_E = 16
|
||||
}
|
||||
gcry_ac_id_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Key types. */
|
||||
typedef enum gcry_ac_key_type
|
||||
{
|
||||
GCRY_AC_KEY_SECRET,
|
||||
GCRY_AC_KEY_PUBLIC
|
||||
}
|
||||
gcry_ac_key_type_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Encoding methods. */
|
||||
typedef enum gcry_ac_em
|
||||
{
|
||||
GCRY_AC_EME_PKCS_V1_5,
|
||||
GCRY_AC_EMSA_PKCS_V1_5
|
||||
}
|
||||
gcry_ac_em_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Encryption and Signature schemes. */
|
||||
typedef enum gcry_ac_scheme
|
||||
{
|
||||
GCRY_AC_ES_PKCS_V1_5,
|
||||
GCRY_AC_SSA_PKCS_V1_5
|
||||
}
|
||||
gcry_ac_scheme_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* AC data. */
|
||||
#define GCRY_AC_FLAG_DEALLOC (1 << 0)
|
||||
#define GCRY_AC_FLAG_COPY (1 << 1)
|
||||
#define GCRY_AC_FLAG_NO_BLINDING (1 << 2)
|
||||
|
||||
/* This type represents a `data set'. */
|
||||
typedef struct gcry_ac_data *gcry_ac_data_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* This type represents a single `key', either a secret one or a
|
||||
public one. */
|
||||
typedef struct gcry_ac_key *gcry_ac_key_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* This type represents a `key pair' containing a secret and a public
|
||||
key. */
|
||||
typedef struct gcry_ac_key_pair *gcry_ac_key_pair_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* This type represents a `handle' that is needed by functions
|
||||
performing cryptographic operations. */
|
||||
typedef struct gcry_ac_handle *gcry_ac_handle_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
typedef gpg_error_t (*gcry_ac_data_read_cb_t) (void *opaque,
|
||||
unsigned char *buffer,
|
||||
size_t *buffer_n)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
typedef gpg_error_t (*gcry_ac_data_write_cb_t) (void *opaque,
|
||||
unsigned char *buffer,
|
||||
size_t buffer_n)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GCRY_AC_IO_READABLE,
|
||||
GCRY_AC_IO_WRITABLE
|
||||
}
|
||||
gcry_ac_io_mode_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GCRY_AC_IO_STRING,
|
||||
GCRY_AC_IO_CALLBACK
|
||||
}
|
||||
gcry_ac_io_type_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
typedef struct gcry_ac_io
|
||||
{
|
||||
/* This is an INTERNAL structure, do NOT use manually. */
|
||||
gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL;
|
||||
gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL;
|
||||
union
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
gcry_ac_data_read_cb_t cb;
|
||||
void *opaque;
|
||||
} callback;
|
||||
struct
|
||||
{
|
||||
unsigned char *data;
|
||||
size_t data_n;
|
||||
} string;
|
||||
void *opaque;
|
||||
} readable;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
gcry_ac_data_write_cb_t cb;
|
||||
void *opaque;
|
||||
} callback;
|
||||
struct
|
||||
{
|
||||
unsigned char **data;
|
||||
size_t *data_n;
|
||||
} string;
|
||||
void *opaque;
|
||||
} writable;
|
||||
} io _GCRY_ATTR_INTERNAL;
|
||||
}
|
||||
gcry_ac_io_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* The caller of gcry_ac_key_pair_generate can provide one of these
|
||||
structures in order to influence the key generation process in an
|
||||
algorithm-specific way. */
|
||||
typedef struct gcry_ac_key_spec_rsa
|
||||
{
|
||||
gcry_mpi_t e; /* E to use. */
|
||||
} gcry_ac_key_spec_rsa_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Structure used for passing data to the implementation of the
|
||||
`EME-PKCS-V1_5' encoding method. */
|
||||
typedef struct gcry_ac_eme_pkcs_v1_5
|
||||
{
|
||||
size_t key_size;
|
||||
} gcry_ac_eme_pkcs_v1_5_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
typedef enum gcry_md_algos gcry_md_algo_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Structure used for passing data to the implementation of the
|
||||
`EMSA-PKCS-V1_5' encoding method. */
|
||||
typedef struct gcry_ac_emsa_pkcs_v1_5
|
||||
{
|
||||
gcry_md_algo_t md;
|
||||
size_t em_n;
|
||||
} gcry_ac_emsa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Structure used for passing data to the implementation of the
|
||||
`SSA-PKCS-V1_5' signature scheme. */
|
||||
typedef struct gcry_ac_ssa_pkcs_v1_5
|
||||
{
|
||||
gcry_md_algo_t md;
|
||||
} gcry_ac_ssa_pkcs_v1_5_t _GCRY_ATTR_INTERNAL;
|
||||
#endif /* !GCRYPT_NO_DEPRECATED || !_GCRYPT_IN_LIBGCRYPT */
|
||||
|
||||
|
||||
#ifndef GCRYPT_NO_DEPRECATED
|
||||
/* Returns a new, empty data set in DATA. */
|
||||
gcry_error_t gcry_ac_data_new (gcry_ac_data_t *data)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Destroy the data set DATA. */
|
||||
void gcry_ac_data_destroy (gcry_ac_data_t data)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Create a copy of the data set DATA and store it in DATA_CP. */
|
||||
gcry_error_t gcry_ac_data_copy (gcry_ac_data_t *data_cp,
|
||||
gcry_ac_data_t data)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Return the number of named MPI values inside of the data set
|
||||
DATA. */
|
||||
unsigned int gcry_ac_data_length (gcry_ac_data_t data)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Destroy any values contained in the data set DATA. */
|
||||
void gcry_ac_data_clear (gcry_ac_data_t data)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Add the value MPI to DATA with the label NAME. If FLAGS contains
|
||||
GCRY_AC_FLAG_DATA_COPY, the data set will contain copies of NAME
|
||||
and MPI. If FLAGS contains GCRY_AC_FLAG_DATA_DEALLOC or
|
||||
GCRY_AC_FLAG_DATA_COPY, the values contained in the data set will
|
||||
be deallocated when they are to be removed from the data set. */
|
||||
gcry_error_t gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags,
|
||||
const char *name, gcry_mpi_t mpi)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Store the value labelled with NAME found in DATA in MPI. If FLAGS
|
||||
contains GCRY_AC_FLAG_COPY, store a copy of the MPI value contained
|
||||
in the data set. MPI may be NULL. */
|
||||
gcry_error_t gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags,
|
||||
const char *name, gcry_mpi_t *mpi)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Stores in NAME and MPI the named MPI value contained in the data
|
||||
set DATA with the index IDX. If FLAGS contains GCRY_AC_FLAG_COPY,
|
||||
store copies of the values contained in the data set. NAME or MPI
|
||||
may be NULL. */
|
||||
gcry_error_t gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags,
|
||||
unsigned int idx,
|
||||
const char **name, gcry_mpi_t *mpi)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Convert the data set DATA into a new S-Expression, which is to be
|
||||
stored in SEXP, according to the identifiers contained in
|
||||
IDENTIFIERS. */
|
||||
gcry_error_t gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp,
|
||||
const char **identifiers)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Create a new data set, which is to be stored in DATA_SET, from the
|
||||
S-Expression SEXP, according to the identifiers contained in
|
||||
IDENTIFIERS. */
|
||||
gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp,
|
||||
const char **identifiers)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Initialize AC_IO according to MODE, TYPE and the variable list of
|
||||
arguments. The list of variable arguments to specify depends on
|
||||
the given TYPE. */
|
||||
void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
|
||||
gcry_ac_io_type_t type, ...)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Initialize AC_IO according to MODE, TYPE and the variable list of
|
||||
arguments AP. The list of variable arguments to specify depends on
|
||||
the given TYPE. */
|
||||
void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
|
||||
gcry_ac_io_type_t type, va_list ap)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Create a new ac handle. */
|
||||
gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle,
|
||||
gcry_ac_id_t algorithm, unsigned int flags)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Destroy an ac handle. */
|
||||
void gcry_ac_close (gcry_ac_handle_t handle)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Initialize a key from a given data set. */
|
||||
gcry_error_t gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle,
|
||||
gcry_ac_key_type_t type, gcry_ac_data_t data)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Generates a new key pair via the handle HANDLE of NBITS bits and
|
||||
stores it in KEY_PAIR. In case non-standard settings are wanted, a
|
||||
pointer to a structure of type gcry_ac_key_spec_<algorithm>_t,
|
||||
matching the selected algorithm, can be given as KEY_SPEC.
|
||||
MISC_DATA is not used yet. */
|
||||
gcry_error_t gcry_ac_key_pair_generate (gcry_ac_handle_t handle,
|
||||
unsigned int nbits, void *spec,
|
||||
gcry_ac_key_pair_t *key_pair,
|
||||
gcry_mpi_t **misc_data)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Returns the key of type WHICH out of the key pair KEY_PAIR. */
|
||||
gcry_ac_key_t gcry_ac_key_pair_extract (gcry_ac_key_pair_t key_pair,
|
||||
gcry_ac_key_type_t which)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Returns the data set contained in the key KEY. */
|
||||
gcry_ac_data_t gcry_ac_key_data_get (gcry_ac_key_t key)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Verifies that the key KEY is sane via HANDLE. */
|
||||
gcry_error_t gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Stores the number of bits of the key KEY in NBITS via HANDLE. */
|
||||
gcry_error_t gcry_ac_key_get_nbits (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key, unsigned int *nbits)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Writes the 20 byte long key grip of the key KEY to KEY_GRIP via
|
||||
HANDLE. */
|
||||
gcry_error_t gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key,
|
||||
unsigned char *key_grip)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Destroy a key. */
|
||||
void gcry_ac_key_destroy (gcry_ac_key_t key)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Destroy a key pair. */
|
||||
void gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Encodes a message according to the encoding method METHOD. OPTIONS
|
||||
must be a pointer to a method-specific structure
|
||||
(gcry_ac_em*_t). */
|
||||
gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method,
|
||||
unsigned int flags, void *options,
|
||||
gcry_ac_io_t *io_read,
|
||||
gcry_ac_io_t *io_write)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Decodes a message according to the encoding method METHOD. OPTIONS
|
||||
must be a pointer to a method-specific structure
|
||||
(gcry_ac_em*_t). */
|
||||
gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method,
|
||||
unsigned int flags, void *options,
|
||||
gcry_ac_io_t *io_read,
|
||||
gcry_ac_io_t *io_write)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Encrypt the plain text MPI value DATA_PLAIN with the key KEY under
|
||||
the control of the flags FLAGS and store the resulting data set
|
||||
into DATA_ENCRYPTED. */
|
||||
gcry_error_t gcry_ac_data_encrypt (gcry_ac_handle_t handle,
|
||||
unsigned int flags,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data_plain,
|
||||
gcry_ac_data_t *data_encrypted)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Decrypt the decrypted data contained in the data set DATA_ENCRYPTED
|
||||
with the key KEY under the control of the flags FLAGS and store the
|
||||
resulting plain text MPI value in DATA_PLAIN. */
|
||||
gcry_error_t gcry_ac_data_decrypt (gcry_ac_handle_t handle,
|
||||
unsigned int flags,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t *data_plain,
|
||||
gcry_ac_data_t data_encrypted)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Sign the data contained in DATA with the key KEY and store the
|
||||
resulting signature in the data set DATA_SIGNATURE. */
|
||||
gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data,
|
||||
gcry_ac_data_t *data_signature)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Verify that the signature contained in the data set DATA_SIGNATURE
|
||||
is indeed the result of signing the data contained in DATA with the
|
||||
secret key belonging to the public key KEY. */
|
||||
gcry_error_t gcry_ac_data_verify (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data,
|
||||
gcry_ac_data_t data_signature)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Encrypts the plain text readable from IO_MESSAGE through HANDLE
|
||||
with the public key KEY according to SCHEME, FLAGS and OPTS. If
|
||||
OPTS is not NULL, it has to be a pointer to a structure specific to
|
||||
the chosen scheme (gcry_ac_es_*_t). The encrypted message is
|
||||
written to IO_CIPHER. */
|
||||
gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_cipher)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Decrypts the cipher text readable from IO_CIPHER through HANDLE
|
||||
with the secret key KEY according to SCHEME, @var{flags} and OPTS.
|
||||
If OPTS is not NULL, it has to be a pointer to a structure specific
|
||||
to the chosen scheme (gcry_ac_es_*_t). The decrypted message is
|
||||
written to IO_MESSAGE. */
|
||||
gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_cipher,
|
||||
gcry_ac_io_t *io_message)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Signs the message readable from IO_MESSAGE through HANDLE with the
|
||||
secret key KEY according to SCHEME, FLAGS and OPTS. If OPTS is not
|
||||
NULL, it has to be a pointer to a structure specific to the chosen
|
||||
scheme (gcry_ac_ssa_*_t). The signature is written to
|
||||
IO_SIGNATURE. */
|
||||
gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_signature)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Verifies through HANDLE that the signature readable from
|
||||
IO_SIGNATURE is indeed the result of signing the message readable
|
||||
from IO_MESSAGE with the secret key belonging to the public key KEY
|
||||
according to SCHEME and OPTS. If OPTS is not NULL, it has to be an
|
||||
anonymous structure (gcry_ac_ssa_*_t) specific to the chosen
|
||||
scheme. */
|
||||
gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_signature)
|
||||
/* */ _GCRY_ATTR_INTERNAL;
|
||||
|
||||
/* Store the textual representation of the algorithm whose id is given
|
||||
in ALGORITHM in NAME. This function is deprecated; use
|
||||
gcry_pk_algo_name. */
|
||||
gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm,
|
||||
const char **name)
|
||||
/* */ _GCRY_GCC_ATTR_DEPRECATED;
|
||||
/* Store the numeric ID of the algorithm whose textual representation
|
||||
is contained in NAME in ALGORITHM. This function is deprecated;
|
||||
use gcry_pk_map_name. */
|
||||
gcry_error_t gcry_ac_name_to_id (const char *name,
|
||||
gcry_ac_id_t *algorithm)
|
||||
/* */ _GCRY_GCC_ATTR_DEPRECATED;
|
||||
#endif /*GCRYPT_NO_DEPRECATED*/
|
||||
|
||||
|
||||
/******************************
|
||||
|
@ -1323,6 +1743,9 @@ int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE;
|
|||
#define gcry_fips_mode_active() !!gcry_control (GCRYCTL_FIPS_MODE_P, 0)
|
||||
|
||||
|
||||
/* Include support for Libgcrypt modules. */
|
||||
#include <gcrypt-module.h>
|
||||
|
||||
#if 0 /* (Keep Emacsens' auto-indent happy.) */
|
||||
{
|
||||
#endif
|
||||
|
|
|
@ -104,21 +104,16 @@ global_init (void)
|
|||
/* Initialize our portable thread/mutex wrapper. */
|
||||
err = ath_init ();
|
||||
if (err)
|
||||
{
|
||||
err = gpg_error_from_errno (err);
|
||||
goto fail;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
/* See whether the system is in FIPS mode. This needs to come as
|
||||
early as possible but after ATH has been initialized. */
|
||||
early as possible put after the ATH has been initialized. */
|
||||
_gcry_initialize_fips_mode (force_fips_mode);
|
||||
|
||||
/* Before we do any other initialization we need to test available
|
||||
hardware features. */
|
||||
_gcry_detect_hw_features (disabled_hw_features);
|
||||
|
||||
/* Initialize the modules - this is mainly allocating some memory and
|
||||
creating mutexes. */
|
||||
err = _gcry_cipher_init ();
|
||||
if (err)
|
||||
goto fail;
|
||||
|
@ -128,9 +123,15 @@ global_init (void)
|
|||
err = _gcry_pk_init ();
|
||||
if (err)
|
||||
goto fail;
|
||||
err = _gcry_primegen_init ();
|
||||
if (err)
|
||||
goto fail;
|
||||
#if 0
|
||||
/* Hmmm, as of now ac_init does nothing. */
|
||||
if ( !fips_mode () )
|
||||
{
|
||||
err = _gcry_ac_init ();
|
||||
if (err)
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
||||
|
@ -235,6 +236,9 @@ gcry_check_version( const char *req_version )
|
|||
int rq_major, rq_minor, rq_micro;
|
||||
const char *my_plvl;
|
||||
|
||||
if (req_version && req_version[0] == 1 && req_version[1] == 1)
|
||||
return _gcry_compat_identification ();
|
||||
|
||||
/* Initialize library. */
|
||||
global_init ();
|
||||
|
||||
|
@ -292,7 +296,6 @@ print_config ( int (*fnc)(FILE *fp, const char *format, ...), FILE *fp)
|
|||
#endif
|
||||
"\n");
|
||||
fnc (fp, "mpi-asm:%s:\n", _gcry_mpi_get_hw_config ());
|
||||
fnc (fp, "threads:%s:\n", ath_get_model (NULL));
|
||||
hwf = _gcry_get_hw_features ();
|
||||
fnc (fp, "hwflist:");
|
||||
for (i=0; hwflist[i].desc; i++)
|
||||
|
@ -444,8 +447,8 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr)
|
|||
break;
|
||||
|
||||
case GCRYCTL_SET_THREAD_CBS:
|
||||
err = ath_install (va_arg (arg_ptr, void *));
|
||||
if (!err)
|
||||
err = ath_install (va_arg (arg_ptr, void *), any_init_done);
|
||||
if (! err)
|
||||
global_init ();
|
||||
break;
|
||||
|
||||
|
@ -596,9 +599,17 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr)
|
|||
}
|
||||
break;
|
||||
|
||||
case GCRYCTL_SET_ENFORCED_FIPS_FLAG:
|
||||
if (!any_init_done)
|
||||
{
|
||||
/* Not yet intialized at all. Set the enforced fips mode flag */
|
||||
_gcry_set_enforced_fips_mode ();
|
||||
}
|
||||
else
|
||||
err = GPG_ERR_GENERAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* A call to make sure that the dummy code is linked in. */
|
||||
_gcry_compat_identification ();
|
||||
err = GPG_ERR_INV_OP;
|
||||
}
|
||||
|
||||
|
|
|
@ -766,8 +766,6 @@ main (int argc, char **argv)
|
|||
pgm, strerror (errno));
|
||||
exit (1);
|
||||
}
|
||||
if (use_stdin)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -132,8 +132,7 @@ EXPORTS
|
|||
gcry_cipher_decrypt @101
|
||||
gcry_cipher_get_algo_keylen @102
|
||||
gcry_cipher_get_algo_blklen @103
|
||||
|
||||
;; @104 used to be part of the module register interface
|
||||
gcry_cipher_list @104
|
||||
|
||||
gcry_pk_encrypt @105
|
||||
gcry_pk_decrypt @106
|
||||
|
@ -147,13 +146,33 @@ EXPORTS
|
|||
gcry_pk_map_name @114
|
||||
gcry_pk_get_nbits @115
|
||||
gcry_pk_get_keygrip @116
|
||||
gcry_pk_list @117
|
||||
|
||||
;; @117 used to be part of the module register interface
|
||||
|
||||
;;
|
||||
;; 118 to 142 were used in previous Libgcrypt versions for the gcry_ac
|
||||
;; interface
|
||||
;;
|
||||
gcry_ac_data_new @118
|
||||
gcry_ac_data_destroy @119
|
||||
gcry_ac_data_set @120
|
||||
gcry_ac_data_copy @121
|
||||
gcry_ac_data_length @122
|
||||
gcry_ac_data_get_name @123
|
||||
gcry_ac_data_get_index @124
|
||||
gcry_ac_data_clear @125
|
||||
gcry_ac_open @126
|
||||
gcry_ac_close @127
|
||||
gcry_ac_key_init @128
|
||||
gcry_ac_key_pair_generate @129
|
||||
gcry_ac_key_pair_extract @130
|
||||
gcry_ac_key_data_get @131
|
||||
gcry_ac_key_test @132
|
||||
gcry_ac_key_get_nbits @133
|
||||
gcry_ac_key_get_grip @134
|
||||
gcry_ac_key_destroy @135
|
||||
gcry_ac_key_pair_destroy @136
|
||||
gcry_ac_data_encrypt @137
|
||||
gcry_ac_data_decrypt @138
|
||||
gcry_ac_data_sign @139
|
||||
gcry_ac_data_verify @140
|
||||
gcry_ac_id_to_name @141
|
||||
gcry_ac_name_to_id @142
|
||||
|
||||
gcry_md_open @143
|
||||
gcry_md_close @144
|
||||
|
@ -173,7 +192,8 @@ EXPORTS
|
|||
gcry_md_algo_name @158
|
||||
gcry_md_map_name @159
|
||||
gcry_md_setkey @160
|
||||
;; @161 used to be part of the module register interface
|
||||
gcry_md_list @161
|
||||
|
||||
gcry_randomize @162
|
||||
gcry_random_add_bytes @163
|
||||
gcry_random_bytes @164
|
||||
|
@ -189,15 +209,21 @@ EXPORTS
|
|||
|
||||
gcry_md_debug @172
|
||||
|
||||
;; @173 used to be part of the module register interface
|
||||
;; @174 used to be part of the module register interface
|
||||
;; @175 used to be part of the module register interface
|
||||
;; @176 used to be part of the module register interface
|
||||
;; @177 used to be part of the module register interface
|
||||
;; @178 used to be part of the module register interface
|
||||
;;
|
||||
;; @179 to @186 used to be part of the removed gcry_ac interface
|
||||
;;
|
||||
gcry_cipher_register @173
|
||||
gcry_cipher_unregister @174
|
||||
gcry_md_register @175
|
||||
gcry_md_unregister @176
|
||||
gcry_pk_register @177
|
||||
gcry_pk_unregister @178
|
||||
|
||||
gcry_ac_data_from_sexp @179
|
||||
gcry_ac_data_to_sexp @180
|
||||
gcry_ac_io_init @181
|
||||
gcry_ac_io_init_va @182
|
||||
gcry_ac_data_encrypt_scheme @183
|
||||
gcry_ac_data_decrypt_scheme @184
|
||||
gcry_ac_data_sign_scheme @185
|
||||
gcry_ac_data_verify_scheme @186
|
||||
|
||||
gcry_sexp_nth_string @187
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
dnl Autoconf macros for libgcrypt
|
||||
dnl Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is free software; as a special exception the author gives
|
||||
dnl unlimited permission to copy and/or distribute it, with or without
|
||||
|
@ -21,8 +21,7 @@ dnl this features allows to prevent build against newer versions of libgcrypt
|
|||
dnl with a changed API.
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_LIBGCRYPT],
|
||||
[ AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_ARG_WITH(libgcrypt-prefix,
|
||||
[ AC_ARG_WITH(libgcrypt-prefix,
|
||||
AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
|
||||
[prefix where LIBGCRYPT is installed (optional)]),
|
||||
libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
|
||||
|
@ -99,9 +98,10 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
|
|||
LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
|
||||
LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
|
||||
ifelse([$2], , :, [$2])
|
||||
libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
|
||||
if test x"$libgcrypt_config_host" != xnone ; then
|
||||
if test x"$libgcrypt_config_host" != x"$host" ; then
|
||||
if test x"$host" != x ; then
|
||||
libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
|
||||
if test x"$libgcrypt_config_host" != xnone ; then
|
||||
if test x"$libgcrypt_config_host" != x"$host" ; then
|
||||
AC_MSG_WARN([[
|
||||
***
|
||||
*** The config script $LIBGCRYPT_CONFIG was
|
||||
|
@ -110,6 +110,7 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
|
|||
*** You may want to use the configure option --with-libgcrypt-prefix
|
||||
*** to specify a matching config script.
|
||||
***]])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# libgcrypt.vers - What symbols to export -*- std -*-
|
||||
# Copyright (C) 2002, 2004, 2008, 2011 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002, 2004, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of Libgcrypt.
|
||||
#
|
||||
|
@ -20,7 +20,7 @@
|
|||
# NOTE: When adding new functions, please make sure to add them to
|
||||
# visibility.h and libgcrypt.def as well.
|
||||
|
||||
GCRYPT_1.6 {
|
||||
GCRYPT_1.2 {
|
||||
global:
|
||||
gcry_check_version; gcry_control;
|
||||
gcry_set_allocation_handler; gcry_set_fatalerror_handler;
|
||||
|
@ -40,24 +40,41 @@ GCRYPT_1.6 {
|
|||
gcry_md_copy; gcry_md_ctl; gcry_md_enable; gcry_md_get;
|
||||
gcry_md_get_algo; gcry_md_get_algo_dlen; gcry_md_hash_buffer;
|
||||
gcry_md_info; gcry_md_is_enabled; gcry_md_is_secure;
|
||||
gcry_md_map_name; gcry_md_open; gcry_md_read;
|
||||
gcry_md_reset; gcry_md_setkey;
|
||||
gcry_md_write; gcry_md_debug;
|
||||
gcry_md_list; gcry_md_map_name; gcry_md_open; gcry_md_read;
|
||||
gcry_md_register; gcry_md_reset; gcry_md_setkey;
|
||||
gcry_md_unregister; gcry_md_write; gcry_md_debug;
|
||||
|
||||
gcry_cipher_algo_info; gcry_cipher_algo_name; gcry_cipher_close;
|
||||
gcry_cipher_ctl; gcry_cipher_decrypt; gcry_cipher_encrypt;
|
||||
gcry_cipher_get_algo_blklen; gcry_cipher_get_algo_keylen;
|
||||
gcry_cipher_info; gcry_cipher_map_name;
|
||||
gcry_cipher_info; gcry_cipher_list; gcry_cipher_map_name;
|
||||
gcry_cipher_mode_from_oid; gcry_cipher_open;
|
||||
gcry_cipher_register; gcry_cipher_unregister;
|
||||
gcry_cipher_setkey; gcry_cipher_setiv; gcry_cipher_setctr;
|
||||
|
||||
gcry_pk_algo_info; gcry_pk_algo_name; gcry_pk_ctl;
|
||||
gcry_pk_decrypt; gcry_pk_encrypt; gcry_pk_genkey;
|
||||
gcry_pk_get_keygrip; gcry_pk_get_nbits;
|
||||
gcry_pk_get_keygrip; gcry_pk_get_nbits; gcry_pk_list;
|
||||
gcry_pk_map_name; gcry_pk_register; gcry_pk_sign;
|
||||
gcry_pk_testkey; gcry_pk_verify;
|
||||
gcry_pk_testkey; gcry_pk_unregister; gcry_pk_verify;
|
||||
gcry_pk_get_curve; gcry_pk_get_param;
|
||||
|
||||
gcry_ac_data_new; gcry_ac_data_destroy; gcry_ac_data_copy;
|
||||
gcry_ac_data_length; gcry_ac_data_clear; gcry_ac_data_set;
|
||||
gcry_ac_data_get_name; gcry_ac_data_get_index; gcry_ac_open;
|
||||
gcry_ac_close; gcry_ac_key_init; gcry_ac_key_pair_generate;
|
||||
gcry_ac_key_pair_extract; gcry_ac_key_data_get; gcry_ac_key_test;
|
||||
gcry_ac_key_get_nbits; gcry_ac_key_get_grip; gcry_ac_key_destroy;
|
||||
gcry_ac_key_pair_destroy; gcry_ac_data_encrypt; gcry_ac_data_decrypt;
|
||||
gcry_ac_data_sign; gcry_ac_data_verify; gcry_ac_id_to_name;
|
||||
gcry_ac_name_to_id; gcry_ac_list; gcry_ac_data_encode;
|
||||
gcry_ac_data_decode; gcry_ac_mpi_to_os; gcry_ac_mpi_to_os_alloc;
|
||||
gcry_ac_os_to_mpi; gcry_ac_data_encrypt_scheme;
|
||||
gcry_ac_data_decrypt_scheme;
|
||||
gcry_ac_data_sign_scheme; gcry_ac_data_verify_scheme;
|
||||
gcry_ac_data_to_sexp; gcry_ac_data_from_sexp;
|
||||
gcry_ac_io_init; gcry_ac_io_init_va;
|
||||
|
||||
gcry_kdf_derive;
|
||||
|
||||
gcry_prime_check; gcry_prime_generate;
|
||||
|
|
|
@ -96,7 +96,7 @@ struct gcry_mpi
|
|||
# define mpi_alloc_secure(n) _gcry_mpi_alloc_secure((n) )
|
||||
# define mpi_free(a) _gcry_mpi_free((a) )
|
||||
# define mpi_resize(a,b) _gcry_mpi_resize((a),(b))
|
||||
# define mpi_copy(a) gcry_mpi_copy((a))
|
||||
# define mpi_copy(a) _gcry_mpi_copy((a))
|
||||
gcry_mpi_t _gcry_mpi_alloc( unsigned nlimbs );
|
||||
gcry_mpi_t _gcry_mpi_alloc_secure( unsigned nlimbs );
|
||||
void _gcry_mpi_free( gcry_mpi_t a );
|
||||
|
@ -104,6 +104,8 @@ struct gcry_mpi
|
|||
gcry_mpi_t _gcry_mpi_copy( gcry_mpi_t a );
|
||||
#endif
|
||||
|
||||
#define gcry_mpi_copy _gcry_mpi_copy
|
||||
|
||||
#define mpi_is_opaque(a) ((a) && ((a)->flags&4))
|
||||
#define mpi_is_secure(a) ((a) && ((a)->flags&1))
|
||||
#define mpi_clear(a) _gcry_mpi_clear ((a))
|
||||
|
@ -114,13 +116,14 @@ struct gcry_mpi
|
|||
#define mpi_alloc_set_ui(a) _gcry_mpi_alloc_set_ui ((a))
|
||||
#define mpi_m_check(a) _gcry_mpi_m_check ((a))
|
||||
#define mpi_swap(a,b) _gcry_mpi_swap ((a),(b))
|
||||
#define mpi_new(n) gcry_mpi_new ((n))
|
||||
#define mpi_new(n) _gcry_mpi_new ((n))
|
||||
#define mpi_snew(n) _gcry_mpi_snew ((n))
|
||||
|
||||
void _gcry_mpi_clear( gcry_mpi_t a );
|
||||
gcry_mpi_t _gcry_mpi_alloc_like( gcry_mpi_t a );
|
||||
gcry_mpi_t _gcry_mpi_alloc_set_ui( unsigned long u);
|
||||
gcry_err_code_t _gcry_mpi_get_ui (gcry_mpi_t w, ulong *u);
|
||||
gcry_err_code_t gcry_mpi_get_ui (gcry_mpi_t w, ulong *u);
|
||||
void _gcry_mpi_m_check( gcry_mpi_t a );
|
||||
void _gcry_mpi_swap( gcry_mpi_t a, gcry_mpi_t b);
|
||||
gcry_mpi_t _gcry_mpi_new (unsigned int nbits);
|
||||
|
|
|
@ -576,13 +576,25 @@ gcry_sexp_nth( const gcry_sexp_t list, int number )
|
|||
p++;
|
||||
|
||||
if ( *p == ST_DATA ) {
|
||||
memcpy ( &n, p, sizeof n ); p += sizeof n;
|
||||
newlist = gcry_malloc ( sizeof *newlist + n + 1 );
|
||||
memcpy ( &n, p, sizeof n );
|
||||
/* Allocate 1 (=sizeof *newlist) byte for ST_OPEN
|
||||
1 byte for ST_DATA
|
||||
sizeof n byte for n
|
||||
n byte for the data
|
||||
1 byte for ST_CLOSE
|
||||
1 byte for ST_STOP */
|
||||
newlist = gcry_malloc ( sizeof *newlist + 1 + sizeof n + n + 2 );
|
||||
if (!newlist)
|
||||
return NULL;
|
||||
d = newlist->d;
|
||||
memcpy ( d, p, n ); d += n;
|
||||
*d++ = ST_STOP;
|
||||
return NULL;
|
||||
d = newlist->d;
|
||||
*d = ST_OPEN; /* Put the ST_OPEN flag */
|
||||
d++; /* Move forward */
|
||||
/* Copy ST_DATA, n and the data from p to d */
|
||||
memcpy ( d, p, 1 + sizeof n + n );
|
||||
d += 1 + sizeof n + n; /* Move after the data copied */
|
||||
*d = ST_CLOSE; /* Put the ST_CLOSE flag */
|
||||
d++; /* Move forward */
|
||||
*d = ST_STOP; /* Put the ST_STOP flag */
|
||||
}
|
||||
else if ( *p == ST_OPEN ) {
|
||||
const byte *head = p;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @LIBGCRYPT_LT_CURRENT@,@LIBGCRYPT_LT_AGE@,@LIBGCRYPT_LT_REVISION@,@BUILD_REVISION@
|
||||
FILEVERSION @BUILD_FILEVERSION@
|
||||
PRODUCTVERSION @BUILD_FILEVERSION@
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
|
@ -39,7 +39,7 @@ BEGIN
|
|||
VALUE "FileDescription", "Libgcrypt - The GNU Crypto Library\0"
|
||||
VALUE "FileVersion", "@LIBGCRYPT_LT_CURRENT@.@LIBGCRYPT_LT_AGE@.@LIBGCRYPT_LT_REVISION@.@BUILD_REVISION@\0"
|
||||
VALUE "InternalName", "libgcrypt\0"
|
||||
VALUE "LegalCopyright", "Copyright © 2011 Free Software Foundation, Inc.\0"
|
||||
VALUE "LegalCopyright", "Copyright © 2012 Free Software Foundation, Inc.\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "libgcrypt.dll\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
|
|
|
@ -621,6 +621,12 @@ gcry_cipher_get_algo_blklen (int algo)
|
|||
return _gcry_cipher_get_algo_blklen (algo);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_cipher_list (int *list, int *list_length)
|
||||
{
|
||||
return _gcry_cipher_list (list, list_length);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_pk_encrypt (gcry_sexp_t *result, gcry_sexp_t data, gcry_sexp_t pkey)
|
||||
{
|
||||
|
@ -753,6 +759,12 @@ gcry_pk_get_param (int algo, const char *name)
|
|||
return _gcry_pk_get_param (algo, name);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_pk_list (int *list, int *list_length)
|
||||
{
|
||||
return _gcry_pk_list (list, list_length);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags)
|
||||
{
|
||||
|
@ -910,6 +922,294 @@ gcry_md_debug (gcry_md_hd_t hd, const char *suffix)
|
|||
_gcry_md_debug (hd, suffix);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_md_list (int *list, int *list_length)
|
||||
{
|
||||
return _gcry_md_list (list, list_length);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_new (gcry_ac_data_t *data)
|
||||
{
|
||||
return _gcry_ac_data_new (data);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_ac_data_destroy (gcry_ac_data_t data)
|
||||
{
|
||||
_gcry_ac_data_destroy (data);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_copy (gcry_ac_data_t *data_cp, gcry_ac_data_t data)
|
||||
{
|
||||
return _gcry_ac_data_copy (data_cp, data);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
gcry_ac_data_length (gcry_ac_data_t data)
|
||||
{
|
||||
return _gcry_ac_data_length (data);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_ac_data_clear (gcry_ac_data_t data)
|
||||
{
|
||||
_gcry_ac_data_clear (data);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags,
|
||||
const char *name, gcry_mpi_t mpi)
|
||||
{
|
||||
return _gcry_ac_data_set (data, flags, name, mpi);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags,
|
||||
const char *name, gcry_mpi_t *mpi)
|
||||
{
|
||||
return _gcry_ac_data_get_name (data, flags, name, mpi);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags,
|
||||
unsigned int idx, const char **name, gcry_mpi_t *mpi)
|
||||
{
|
||||
return _gcry_ac_data_get_index (data, flags, idx, name, mpi);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp,
|
||||
const char **identifiers)
|
||||
{
|
||||
return _gcry_ac_data_to_sexp (data, sexp, identifiers);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp,
|
||||
const char **identifiers)
|
||||
{
|
||||
return _gcry_ac_data_from_sexp (data, sexp, identifiers);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
|
||||
gcry_ac_io_type_t type, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
|
||||
va_start (arg_ptr, type);
|
||||
_gcry_ac_io_init_va (ac_io, mode, type, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
|
||||
gcry_ac_io_type_t type, va_list ap)
|
||||
{
|
||||
_gcry_ac_io_init_va (ac_io, mode, type, ap);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_open (gcry_ac_handle_t *handle,
|
||||
gcry_ac_id_t algorithm, unsigned int flags)
|
||||
{
|
||||
return _gcry_ac_open (handle, algorithm, flags);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_ac_close (gcry_ac_handle_t handle)
|
||||
{
|
||||
_gcry_ac_close (handle);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle,
|
||||
gcry_ac_key_type_t type, gcry_ac_data_t data)
|
||||
{
|
||||
return _gcry_ac_key_init (key, handle, type, data);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_key_pair_generate (gcry_ac_handle_t handle,
|
||||
unsigned int nbits, void *spec,
|
||||
gcry_ac_key_pair_t *key_pair,
|
||||
gcry_mpi_t **miscdata)
|
||||
{
|
||||
return _gcry_ac_key_pair_generate ( handle, nbits, spec, key_pair, miscdata);
|
||||
}
|
||||
|
||||
gcry_ac_key_t
|
||||
gcry_ac_key_pair_extract (gcry_ac_key_pair_t keypair, gcry_ac_key_type_t which)
|
||||
{
|
||||
return _gcry_ac_key_pair_extract (keypair, which);
|
||||
}
|
||||
|
||||
gcry_ac_data_t
|
||||
gcry_ac_key_data_get (gcry_ac_key_t key)
|
||||
{
|
||||
return _gcry_ac_key_data_get (key);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key)
|
||||
{
|
||||
return _gcry_ac_key_test (handle, key);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_key_get_nbits (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key, unsigned int *nbits)
|
||||
{
|
||||
return _gcry_ac_key_get_nbits (handle, key, nbits);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key,
|
||||
unsigned char *key_grip)
|
||||
{
|
||||
return _gcry_ac_key_get_grip (handle, key, key_grip);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_ac_key_destroy (gcry_ac_key_t key)
|
||||
{
|
||||
_gcry_ac_key_destroy (key);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair)
|
||||
{
|
||||
_gcry_ac_key_pair_destroy (key_pair);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_encode (gcry_ac_em_t method, unsigned int flags, void *options,
|
||||
gcry_ac_io_t *io_read, gcry_ac_io_t *io_write)
|
||||
{
|
||||
return _gcry_ac_data_encode (method, flags, options, io_read, io_write);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_decode (gcry_ac_em_t method, unsigned int flags, void *options,
|
||||
gcry_ac_io_t *io_read, gcry_ac_io_t *io_write)
|
||||
{
|
||||
return _gcry_ac_data_decode (method, flags, options, io_read, io_write);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_encrypt (gcry_ac_handle_t handle,
|
||||
unsigned int flags,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data_plain,
|
||||
gcry_ac_data_t *data_encrypted)
|
||||
{
|
||||
return _gcry_ac_data_encrypt (handle, flags, key,
|
||||
data_plain, data_encrypted);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_decrypt (gcry_ac_handle_t handle,
|
||||
unsigned int flags,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t *data_plain,
|
||||
gcry_ac_data_t data_encrypted)
|
||||
{
|
||||
return _gcry_ac_data_decrypt (handle, flags, key,
|
||||
data_plain, data_encrypted);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_sign (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data,
|
||||
gcry_ac_data_t *data_signature)
|
||||
{
|
||||
return _gcry_ac_data_sign (handle, key, data, data_signature);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_verify (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data,
|
||||
gcry_ac_data_t data_signature)
|
||||
{
|
||||
return _gcry_ac_data_verify (handle, key, data, data_signature);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_cipher)
|
||||
{
|
||||
return _gcry_ac_data_encrypt_scheme (handle, scheme, flags, opts, key,
|
||||
io_message, io_cipher);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_cipher,
|
||||
gcry_ac_io_t *io_message)
|
||||
{
|
||||
return _gcry_ac_data_decrypt_scheme (handle, scheme, flags, opts, key,
|
||||
io_cipher, io_message);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_sign_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_signature)
|
||||
{
|
||||
return _gcry_ac_data_sign_scheme (handle, scheme, flags, opts, key,
|
||||
io_message, io_signature);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_data_verify_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_signature)
|
||||
{
|
||||
return _gcry_ac_data_verify_scheme (handle, scheme, flags, opts, key,
|
||||
io_message, io_signature);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_id_to_name (gcry_ac_id_t algorithm, const char **name)
|
||||
{
|
||||
/* This function is deprecated. We implement it in terms of the
|
||||
suggested replacement. */
|
||||
const char *tmp = _gcry_pk_algo_name (algorithm);
|
||||
if (!*tmp)
|
||||
return gcry_error (GPG_ERR_PUBKEY_ALGO);
|
||||
*name = tmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_ac_name_to_id (const char *name, gcry_ac_id_t *algorithm)
|
||||
{
|
||||
/* This function is deprecated. We implement it in terms of the
|
||||
suggested replacement. */
|
||||
int algo = _gcry_pk_map_name (name);
|
||||
if (!algo)
|
||||
return gcry_error (GPG_ERR_PUBKEY_ALGO);
|
||||
*algorithm = algo;
|
||||
return 0;
|
||||
}
|
||||
|
||||
gpg_error_t
|
||||
gcry_kdf_derive (const void *passphrase, size_t passphraselen,
|
||||
int algo, int hashalgo,
|
||||
|
@ -1144,3 +1444,43 @@ gcry_is_secure (const void *a)
|
|||
{
|
||||
return _gcry_is_secure (a);
|
||||
}
|
||||
|
||||
|
||||
gcry_error_t
|
||||
gcry_cipher_register (gcry_cipher_spec_t *cipher, int *algorithm_id,
|
||||
gcry_module_t *module)
|
||||
{
|
||||
return _gcry_cipher_register (cipher, NULL, algorithm_id, module);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_cipher_unregister (gcry_module_t module)
|
||||
{
|
||||
_gcry_cipher_unregister (module);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_pk_register (gcry_pk_spec_t *pubkey, unsigned int *algorithm_id,
|
||||
gcry_module_t *module)
|
||||
{
|
||||
return _gcry_pk_register (pubkey, NULL, algorithm_id, module);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_pk_unregister (gcry_module_t module)
|
||||
{
|
||||
_gcry_pk_unregister (module);
|
||||
}
|
||||
|
||||
gcry_error_t
|
||||
gcry_md_register (gcry_md_spec_t *digest, unsigned int *algorithm_id,
|
||||
gcry_module_t *module)
|
||||
{
|
||||
return _gcry_md_register (digest, NULL, algorithm_id, module);
|
||||
}
|
||||
|
||||
void
|
||||
gcry_md_unregister (gcry_module_t module)
|
||||
{
|
||||
_gcry_md_unregister (module);
|
||||
}
|
||||
|
|
|
@ -66,9 +66,12 @@
|
|||
#define gcry_md_info _gcry_md_info
|
||||
#define gcry_md_is_enabled _gcry_md_is_enabled
|
||||
#define gcry_md_is_secure _gcry_md_is_secure
|
||||
#define gcry_md_list _gcry_md_list
|
||||
#define gcry_md_map_name _gcry_md_map_name
|
||||
#define gcry_md_open _gcry_md_open
|
||||
#define gcry_md_read _gcry_md_read
|
||||
/* gcry_md_register and _gcry_md_register differ. */
|
||||
#define gcry_md_unregister _gcry_md_unregister
|
||||
#define gcry_md_reset _gcry_md_reset
|
||||
#define gcry_md_setkey _gcry_md_setkey
|
||||
#define gcry_md_write _gcry_md_write
|
||||
|
@ -86,9 +89,12 @@
|
|||
#define gcry_cipher_get_algo_blklen _gcry_cipher_get_algo_blklen
|
||||
#define gcry_cipher_get_algo_keylen _gcry_cipher_get_algo_keylen
|
||||
#define gcry_cipher_info _gcry_cipher_info
|
||||
#define gcry_cipher_list _gcry_cipher_list
|
||||
#define gcry_cipher_map_name _gcry_cipher_map_name
|
||||
#define gcry_cipher_mode_from_oid _gcry_cipher_mode_from_oid
|
||||
#define gcry_cipher_open _gcry_cipher_open
|
||||
/* gcry_cipher_register and _gcry_cipher_register differ. */
|
||||
#define gcry_cipher_unregister _gcry_cipher_unregister
|
||||
|
||||
#define gcry_pk_algo_info _gcry_pk_algo_info
|
||||
#define gcry_pk_algo_name _gcry_pk_algo_name
|
||||
|
@ -100,11 +106,53 @@
|
|||
#define gcry_pk_get_curve _gcry_pk_get_curve
|
||||
#define gcry_pk_get_param _gcry_pk_get_param
|
||||
#define gcry_pk_get_nbits _gcry_pk_get_nbits
|
||||
#define gcry_pk_list _gcry_pk_list
|
||||
#define gcry_pk_map_name _gcry_pk_map_name
|
||||
/* gcry_pk_register and _gcry_pk_register differ. */
|
||||
#define gcry_pk_unregister _gcry_pk_unregister
|
||||
#define gcry_pk_sign _gcry_pk_sign
|
||||
#define gcry_pk_testkey _gcry_pk_testkey
|
||||
#define gcry_pk_verify _gcry_pk_verify
|
||||
|
||||
#define gcry_ac_data_new _gcry_ac_data_new
|
||||
#define gcry_ac_data_destroy _gcry_ac_data_destroy
|
||||
#define gcry_ac_data_copy _gcry_ac_data_copy
|
||||
#define gcry_ac_data_length _gcry_ac_data_length
|
||||
#define gcry_ac_data_clear _gcry_ac_data_clear
|
||||
#define gcry_ac_data_set _gcry_ac_data_set
|
||||
#define gcry_ac_data_get_name _gcry_ac_data_get_name
|
||||
#define gcry_ac_data_get_index _gcry_ac_data_get_index
|
||||
#define gcry_ac_open _gcry_ac_open
|
||||
#define gcry_ac_close _gcry_ac_close
|
||||
#define gcry_ac_key_init _gcry_ac_key_init
|
||||
#define gcry_ac_key_pair_generate _gcry_ac_key_pair_generate
|
||||
#define gcry_ac_key_pair_extract _gcry_ac_key_pair_extract
|
||||
#define gcry_ac_key_data_get _gcry_ac_key_data_get
|
||||
#define gcry_ac_key_test _gcry_ac_key_test
|
||||
#define gcry_ac_key_get_nbits _gcry_ac_key_get_nbits
|
||||
#define gcry_ac_key_get_grip _gcry_ac_key_get_grip
|
||||
#define gcry_ac_key_destroy _gcry_ac_key_destroy
|
||||
#define gcry_ac_key_pair_destroy _gcry_ac_key_pair_destroy
|
||||
#define gcry_ac_data_encrypt _gcry_ac_data_encrypt
|
||||
#define gcry_ac_data_decrypt _gcry_ac_data_decrypt
|
||||
#define gcry_ac_data_sign _gcry_ac_data_sign
|
||||
#define gcry_ac_data_verify _gcry_ac_data_verify
|
||||
#define gcry_ac_id_to_name _gcry_ac_id_to_name
|
||||
#define gcry_ac_name_to_id _gcry_ac_name_to_id
|
||||
#define gcry_ac_data_encode _gcry_ac_data_encode
|
||||
#define gcry_ac_data_decode _gcry_ac_data_decode
|
||||
#define gcry_ac_mpi_to_os _gcry_ac_mpi_to_os
|
||||
#define gcry_ac_mpi_to_os_alloc _gcry_ac_mpi_to_os_alloc
|
||||
#define gcry_ac_os_to_mpi _gcry_ac_os_to_mpi
|
||||
#define gcry_ac_data_encrypt_scheme _gcry_ac_data_encrypt_scheme
|
||||
#define gcry_ac_data_decrypt_scheme _gcry_ac_data_decrypt_scheme
|
||||
#define gcry_ac_data_sign_scheme _gcry_ac_data_sign_scheme
|
||||
#define gcry_ac_data_verify_scheme _gcry_ac_data_verify_scheme
|
||||
#define gcry_ac_data_to_sexp _gcry_ac_data_to_sexp
|
||||
#define gcry_ac_data_from_sexp _gcry_ac_data_from_sexp
|
||||
#define gcry_ac_io_init _gcry_ac_io_init
|
||||
#define gcry_ac_io_init_va _gcry_ac_io_init_va
|
||||
|
||||
#define gcry_kdf_derive _gcry_kdf_derive
|
||||
|
||||
#define gcry_prime_check _gcry_prime_check
|
||||
|
@ -193,15 +241,111 @@
|
|||
deprecated attribute. */
|
||||
# define GCRYPT_NO_DEPRECATED
|
||||
# include "gcrypt.h"
|
||||
/* None in this version. */
|
||||
/* The algorithm IDs. */
|
||||
gcry_error_t gcry_ac_data_new (gcry_ac_data_t *data);
|
||||
void gcry_ac_data_destroy (gcry_ac_data_t data);
|
||||
gcry_error_t gcry_ac_data_copy (gcry_ac_data_t *data_cp,
|
||||
gcry_ac_data_t data);
|
||||
unsigned int gcry_ac_data_length (gcry_ac_data_t data);
|
||||
void gcry_ac_data_clear (gcry_ac_data_t data);
|
||||
gcry_error_t gcry_ac_data_set (gcry_ac_data_t data, unsigned int flags,
|
||||
const char *name, gcry_mpi_t mpi);
|
||||
gcry_error_t gcry_ac_data_get_name (gcry_ac_data_t data, unsigned int flags,
|
||||
const char *name, gcry_mpi_t *mpi);
|
||||
gcry_error_t gcry_ac_data_get_index (gcry_ac_data_t data, unsigned int flags,
|
||||
unsigned int idx,
|
||||
const char **name, gcry_mpi_t *mpi);
|
||||
gcry_error_t gcry_ac_data_to_sexp (gcry_ac_data_t data, gcry_sexp_t *sexp,
|
||||
const char **identifiers);
|
||||
gcry_error_t gcry_ac_data_from_sexp (gcry_ac_data_t *data, gcry_sexp_t sexp,
|
||||
const char **identifiers);
|
||||
void gcry_ac_io_init (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
|
||||
gcry_ac_io_type_t type, ...);
|
||||
void gcry_ac_io_init_va (gcry_ac_io_t *ac_io, gcry_ac_io_mode_t mode,
|
||||
gcry_ac_io_type_t type, va_list ap);
|
||||
gcry_error_t gcry_ac_open (gcry_ac_handle_t *handle,
|
||||
gcry_ac_id_t algorithm, unsigned int flags);
|
||||
void gcry_ac_close (gcry_ac_handle_t handle);
|
||||
gcry_error_t gcry_ac_key_init (gcry_ac_key_t *key, gcry_ac_handle_t handle,
|
||||
gcry_ac_key_type_t type, gcry_ac_data_t data);
|
||||
gcry_error_t gcry_ac_key_pair_generate (gcry_ac_handle_t handle,
|
||||
unsigned int nbits, void *spec,
|
||||
gcry_ac_key_pair_t *key_pair,
|
||||
gcry_mpi_t **misc_data);
|
||||
gcry_ac_key_t gcry_ac_key_pair_extract (gcry_ac_key_pair_t key_pair,
|
||||
gcry_ac_key_type_t which);
|
||||
gcry_ac_data_t gcry_ac_key_data_get (gcry_ac_key_t key);
|
||||
gcry_error_t gcry_ac_key_test (gcry_ac_handle_t handle, gcry_ac_key_t key);
|
||||
gcry_error_t gcry_ac_key_get_nbits (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key, unsigned int *nbits);
|
||||
gcry_error_t gcry_ac_key_get_grip (gcry_ac_handle_t handle, gcry_ac_key_t key,
|
||||
unsigned char *key_grip);
|
||||
void gcry_ac_key_destroy (gcry_ac_key_t key);
|
||||
void gcry_ac_key_pair_destroy (gcry_ac_key_pair_t key_pair);
|
||||
gcry_error_t gcry_ac_data_encode (gcry_ac_em_t method,
|
||||
unsigned int flags, void *options,
|
||||
gcry_ac_io_t *io_read,
|
||||
gcry_ac_io_t *io_write);
|
||||
gcry_error_t gcry_ac_data_decode (gcry_ac_em_t method,
|
||||
unsigned int flags, void *options,
|
||||
gcry_ac_io_t *io_read,
|
||||
gcry_ac_io_t *io_write);
|
||||
gcry_error_t gcry_ac_data_encrypt (gcry_ac_handle_t handle,
|
||||
unsigned int flags,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data_plain,
|
||||
gcry_ac_data_t *data_encrypted);
|
||||
gcry_error_t gcry_ac_data_decrypt (gcry_ac_handle_t handle,
|
||||
unsigned int flags,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t *data_plain,
|
||||
gcry_ac_data_t data_encrypted);
|
||||
gcry_error_t gcry_ac_data_sign (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data,
|
||||
gcry_ac_data_t *data_signature);
|
||||
gcry_error_t gcry_ac_data_verify (gcry_ac_handle_t handle,
|
||||
gcry_ac_key_t key,
|
||||
gcry_mpi_t data,
|
||||
gcry_ac_data_t data_signature);
|
||||
gcry_error_t gcry_ac_data_encrypt_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_cipher);
|
||||
gcry_error_t gcry_ac_data_decrypt_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_cipher,
|
||||
gcry_ac_io_t *io_message);
|
||||
gcry_error_t gcry_ac_data_sign_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_signature);
|
||||
gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle,
|
||||
gcry_ac_scheme_t scheme,
|
||||
unsigned int flags, void *opts,
|
||||
gcry_ac_key_t key,
|
||||
gcry_ac_io_t *io_message,
|
||||
gcry_ac_io_t *io_signature);
|
||||
gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm, const char **name);
|
||||
gcry_error_t gcry_ac_name_to_id (const char *name, gcry_ac_id_t *algorithm);
|
||||
#else
|
||||
# include "gcrypt.h"
|
||||
#endif
|
||||
#include "gcrypt-module.h"
|
||||
|
||||
/* Prototypes of functions exported but not ready for use. */
|
||||
gcry_err_code_t gcry_md_get (gcry_md_hd_t hd, int algo,
|
||||
unsigned char *buffer, int buflen);
|
||||
void gcry_ac_mpi_to_os (gcry_mpi_t mpi, unsigned char *os, size_t os_n);
|
||||
gcry_error_t gcry_ac_mpi_to_os_alloc (gcry_mpi_t mpi, unsigned char **os,
|
||||
size_t *os_n);
|
||||
void gcry_ac_os_to_mpi (gcry_mpi_t mpi, unsigned char *os, size_t os_n);
|
||||
|
||||
|
||||
|
||||
/* Our use of the ELF visibility feature works by passing
|
||||
|
@ -272,9 +416,12 @@ gcry_err_code_t gcry_md_get (gcry_md_hd_t hd, int algo,
|
|||
#undef gcry_md_info
|
||||
#undef gcry_md_is_enabled
|
||||
#undef gcry_md_is_secure
|
||||
#undef gcry_md_list
|
||||
#undef gcry_md_map_name
|
||||
#undef gcry_md_open
|
||||
#undef gcry_md_read
|
||||
/* gcry_md_register is not anymore a macro. */
|
||||
#undef gcry_md_unregister
|
||||
#undef gcry_md_reset
|
||||
#undef gcry_md_setkey
|
||||
#undef gcry_md_write
|
||||
|
@ -292,9 +439,12 @@ gcry_err_code_t gcry_md_get (gcry_md_hd_t hd, int algo,
|
|||
#undef gcry_cipher_get_algo_blklen
|
||||
#undef gcry_cipher_get_algo_keylen
|
||||
#undef gcry_cipher_info
|
||||
#undef gcry_cipher_list
|
||||
#undef gcry_cipher_map_name
|
||||
#undef gcry_cipher_mode_from_oid
|
||||
#undef gcry_cipher_open
|
||||
/* gcry_cipher_register is not anymore a macro. */
|
||||
#undef gcry_cipher_unregister
|
||||
|
||||
#undef gcry_pk_algo_info
|
||||
#undef gcry_pk_algo_name
|
||||
|
@ -306,11 +456,53 @@ gcry_err_code_t gcry_md_get (gcry_md_hd_t hd, int algo,
|
|||
#undef gcry_pk_get_curve
|
||||
#undef gcry_pk_get_param
|
||||
#undef gcry_pk_get_nbits
|
||||
#undef gcry_pk_list
|
||||
#undef gcry_pk_map_name
|
||||
/* gcry_pk_register is not anymore a macro. */
|
||||
#undef gcry_pk_unregister
|
||||
#undef gcry_pk_sign
|
||||
#undef gcry_pk_testkey
|
||||
#undef gcry_pk_verify
|
||||
|
||||
#undef gcry_ac_data_new
|
||||
#undef gcry_ac_data_destroy
|
||||
#undef gcry_ac_data_copy
|
||||
#undef gcry_ac_data_length
|
||||
#undef gcry_ac_data_clear
|
||||
#undef gcry_ac_data_set
|
||||
#undef gcry_ac_data_get_name
|
||||
#undef gcry_ac_data_get_index
|
||||
#undef gcry_ac_open
|
||||
#undef gcry_ac_close
|
||||
#undef gcry_ac_key_init
|
||||
#undef gcry_ac_key_pair_generate
|
||||
#undef gcry_ac_key_pair_extract
|
||||
#undef gcry_ac_key_data_get
|
||||
#undef gcry_ac_key_test
|
||||
#undef gcry_ac_key_get_nbits
|
||||
#undef gcry_ac_key_get_grip
|
||||
#undef gcry_ac_key_destroy
|
||||
#undef gcry_ac_key_pair_destroy
|
||||
#undef gcry_ac_data_encrypt
|
||||
#undef gcry_ac_data_decrypt
|
||||
#undef gcry_ac_data_sign
|
||||
#undef gcry_ac_data_verify
|
||||
#undef gcry_ac_id_to_name
|
||||
#undef gcry_ac_name_to_id
|
||||
#undef gcry_ac_data_encode
|
||||
#undef gcry_ac_data_decode
|
||||
#undef gcry_ac_mpi_to_os
|
||||
#undef gcry_ac_mpi_to_os_alloc
|
||||
#undef gcry_ac_os_to_mpi
|
||||
#undef gcry_ac_data_encrypt_scheme
|
||||
#undef gcry_ac_data_decrypt_scheme
|
||||
#undef gcry_ac_data_sign_scheme
|
||||
#undef gcry_ac_data_verify_scheme
|
||||
#undef gcry_ac_data_to_sexp
|
||||
#undef gcry_ac_data_from_sexp
|
||||
#undef gcry_ac_io_init
|
||||
#undef gcry_ac_io_init_va
|
||||
|
||||
#undef gcry_kdf_derive
|
||||
|
||||
#undef gcry_prime_check
|
||||
|
@ -438,11 +630,14 @@ MARK_VISIBLE (gcry_md_hash_buffer)
|
|||
MARK_VISIBLE (gcry_md_info)
|
||||
MARK_VISIBLE (gcry_md_is_enabled)
|
||||
MARK_VISIBLE (gcry_md_is_secure)
|
||||
MARK_VISIBLE (gcry_md_list)
|
||||
MARK_VISIBLE (gcry_md_map_name)
|
||||
MARK_VISIBLE (gcry_md_open)
|
||||
MARK_VISIBLE (gcry_md_read)
|
||||
MARK_VISIBLEX(gcry_md_register)
|
||||
MARK_VISIBLE (gcry_md_reset)
|
||||
MARK_VISIBLE (gcry_md_setkey)
|
||||
MARK_VISIBLE (gcry_md_unregister)
|
||||
MARK_VISIBLE (gcry_md_write)
|
||||
MARK_VISIBLE (gcry_md_debug)
|
||||
|
||||
|
@ -458,9 +653,12 @@ MARK_VISIBLE (gcry_cipher_encrypt)
|
|||
MARK_VISIBLE (gcry_cipher_get_algo_blklen)
|
||||
MARK_VISIBLE (gcry_cipher_get_algo_keylen)
|
||||
MARK_VISIBLE (gcry_cipher_info)
|
||||
MARK_VISIBLE (gcry_cipher_list)
|
||||
MARK_VISIBLE (gcry_cipher_map_name)
|
||||
MARK_VISIBLE (gcry_cipher_mode_from_oid)
|
||||
MARK_VISIBLE (gcry_cipher_open)
|
||||
MARK_VISIBLEX(gcry_cipher_register)
|
||||
MARK_VISIBLE (gcry_cipher_unregister)
|
||||
|
||||
MARK_VISIBLE (gcry_pk_algo_info)
|
||||
MARK_VISIBLE (gcry_pk_algo_name)
|
||||
|
@ -472,11 +670,55 @@ MARK_VISIBLE (gcry_pk_get_keygrip)
|
|||
MARK_VISIBLE (gcry_pk_get_curve)
|
||||
MARK_VISIBLE (gcry_pk_get_param)
|
||||
MARK_VISIBLE (gcry_pk_get_nbits)
|
||||
MARK_VISIBLE (gcry_pk_list)
|
||||
MARK_VISIBLE (gcry_pk_map_name)
|
||||
MARK_VISIBLEX(gcry_pk_register)
|
||||
MARK_VISIBLE (gcry_pk_sign)
|
||||
MARK_VISIBLE (gcry_pk_testkey)
|
||||
MARK_VISIBLE (gcry_pk_unregister)
|
||||
MARK_VISIBLE (gcry_pk_verify)
|
||||
|
||||
MARK_VISIBLE (gcry_ac_data_new)
|
||||
MARK_VISIBLE (gcry_ac_data_destroy)
|
||||
MARK_VISIBLE (gcry_ac_data_copy)
|
||||
MARK_VISIBLE (gcry_ac_data_length)
|
||||
MARK_VISIBLE (gcry_ac_data_clear)
|
||||
MARK_VISIBLE (gcry_ac_data_set)
|
||||
MARK_VISIBLE (gcry_ac_data_get_name)
|
||||
MARK_VISIBLE (gcry_ac_data_get_index)
|
||||
MARK_VISIBLE (gcry_ac_open)
|
||||
MARK_VISIBLE (gcry_ac_close)
|
||||
MARK_VISIBLE (gcry_ac_key_init)
|
||||
MARK_VISIBLE (gcry_ac_key_pair_generate)
|
||||
MARK_VISIBLE (gcry_ac_key_pair_extract)
|
||||
MARK_VISIBLE (gcry_ac_key_data_get)
|
||||
MARK_VISIBLE (gcry_ac_key_test)
|
||||
MARK_VISIBLE (gcry_ac_key_get_nbits)
|
||||
MARK_VISIBLE (gcry_ac_key_get_grip)
|
||||
MARK_VISIBLE (gcry_ac_key_destroy)
|
||||
MARK_VISIBLE (gcry_ac_key_pair_destroy)
|
||||
MARK_VISIBLE (gcry_ac_data_encrypt)
|
||||
MARK_VISIBLE (gcry_ac_data_decrypt)
|
||||
MARK_VISIBLE (gcry_ac_data_sign)
|
||||
MARK_VISIBLE (gcry_ac_data_verify)
|
||||
MARK_VISIBLE (gcry_ac_id_to_name)
|
||||
MARK_VISIBLE (gcry_ac_name_to_id)
|
||||
/* MARK_VISIBLE (gcry_ac_list) Not defined although it is in
|
||||
libgcrypt.vers. */
|
||||
MARK_VISIBLE (gcry_ac_data_encode)
|
||||
MARK_VISIBLE (gcry_ac_data_decode)
|
||||
MARK_VISIBLE (gcry_ac_mpi_to_os)
|
||||
MARK_VISIBLE (gcry_ac_mpi_to_os_alloc)
|
||||
MARK_VISIBLE (gcry_ac_os_to_mpi)
|
||||
MARK_VISIBLE (gcry_ac_data_encrypt_scheme)
|
||||
MARK_VISIBLE (gcry_ac_data_decrypt_scheme)
|
||||
MARK_VISIBLE (gcry_ac_data_sign_scheme)
|
||||
MARK_VISIBLE (gcry_ac_data_verify_scheme)
|
||||
MARK_VISIBLE (gcry_ac_data_to_sexp)
|
||||
MARK_VISIBLE (gcry_ac_data_from_sexp)
|
||||
MARK_VISIBLE (gcry_ac_io_init)
|
||||
MARK_VISIBLE (gcry_ac_io_init_va)
|
||||
|
||||
MARK_VISIBLE (gcry_kdf_derive)
|
||||
|
||||
MARK_VISIBLE (gcry_prime_check)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue