re_check_t) (const void *);

/* Type for memory reallocation handlers.  */
typedef void *(*gcry_handler_realloc_t) (void *p, size_t n);

/* Type for memory free handlers.  */
typedef void (*gcry_handler_free_t) (void *);

/* Type for out-of-memory handlers.  */
typedef int (*gcry_handler_no_mem_t) (void *, size_t, unsigned int);

/* Type for fatal error handlers.  */
typedef void (*gcry_handler_error_t) (void *, int, const char *);

/* Type for the deprecated log handler.  */
typedef void (*gcry_handler_log_t) (void *, int, const char *, va_list);

/* Certain operations can provide progress information.  This function
   is used to register a handler for retrieving these information. */
void gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data);


/* Register a custom memory allocation functions. */
void gcry_set_allocation_handler (
                             gcry_handler_alloc_t func_alloc,
                             gcry_handler_alloc_t func_alloc_secure,
                             gcry_handler_secure_check_t func_secure_check,
                             gcry_handler_realloc_t func_realloc,
                             gcry_handler_free_t func_free);

/* Register a function used instead of the internal out of memory
   handler. */
void gcry_set_outofcore_handler (gcry_handler_no_mem_t h, void *opaque);

/* Register a function used instead of the internal fatal error
   handler. */
void gcry_set_fatalerror_handler (gcry_handler_error_t fnc, void *opaque);

/* This function has no more effect.  */
void gcry_set_log_handler (gcry_handler_log_t f,
                           void *opaque) _GCRY_ATTR_INTERNAL;

/* Reserved for future use. */
void gcry_set_gettext_handler (const char *(*f)(const char*));

/* Libgcrypt uses its own memory allocation.  It is important to use
   gcry_free () to release memory allocated by libgcrypt. */
void *gcry_malloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
void *gcry_calloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
void *gcry_malloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
void *gcry_calloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
void *gcry_realloc (void *a, size_t n);
char *gcry_strdup (const char *string) _GCRY_GCC_ATTR_MALLOC;
void *gcry_xmalloc (size_t n) _GCRY_GCC_ATTR_MALLOC;
void *gcry_xcalloc (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
void *gcry_xmalloc_secure (size_t n) _GCRY_GCC_ATTR_MALLOC;
void *gcry_xcalloc_secure (size_t n, size_t m) _GCRY_GCC_ATTR_MALLOC;
void *gcry_xrealloc (void *a, size_t n);
char *gcry_xstrdup (const char * a) _GCRY_GCC_ATTR_MALLOC;
void  gcry_free (void *a);

/* Return true if A is allocated in "secure" memory. */
int gcry_is_secure (const void *a) _GCRY_GCC_ATTR_PURE;

/* Return true if Libgcrypt is in FIPS mode.  */
#define gcry_fips_mode_active()  !!gcry_control (GCRYCTL_FIPS_MODE_P, 0)

/* Variant of gcry_pk_sign which takes as additional parameter a HD
 * handle for hash and an optional context.  The hash algorithm used by the
 * handle needs to be enabled and input needs to be supplied beforehand.
 * DATA-TMPL specifies a template to compose an S-expression to be signed.
 * A template should include '(hash %s %b)' or '(hash ALGONAME %b)'.
 * For the former case, '%s' is substituted by the string of algorithm
 * of gcry_md_get_algo (HD) and when gcry_md_read is called, ALGO=0 is
 * used internally.  For the latter case, hash algorithm by ALGONAME
 * is used when gcry_md_read is called internally.
 * The hash handle must not yet been finalized; the function
 * takes a copy of the state and does a finalize on the copy.  This
 * function shall be used if a policy requires that hashing and signing
 * is done by the same function.  CTX is currently not used and should
 * be passed as NULL.  */
gcry_error_t gcry_pk_hash_sign (gcry_sexp_t *result,
                                const char *data_tmpl, gcry_sexp_t skey,
                                gcry_md_hd_t hd, gcry_ctx_t ctx);

/* Variant of gcry_pk_verify which takes as additional parameter a HD
 * handle for hash and an optional context.  Similar to gcry_pk_hash_sign.  */
gcry_error_t gcry_pk_hash_verify (gcry_sexp_t sigval,
                                  const char *data_tmpl, gcry_sexp_t pkey,
                                  gcry_md_hd_t hd, gcry_ctx_t ctx);

gcry_error_t gcry_pk_random_override_new (gcry_ctx_t *r_ctx,
                                          const unsigned char *p, size_t len);
#define gcry_pk_input_data_push gcry_pk_random_override_new

#if 0 /* (Keep Emacsens' auto-indent happy.) */
{
#endif
#ifdef __cplusplus
}
#endif
#endif /* _GCRYPT_H */
/*
Local Variables:
buffer-read-only: t
End:
*/
