| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Libgcrypt makes it possible to install so called `handler functions', which get called by Libgcrypt in case of certain events.
| 4.1 Progress handler | Using a progress handler function. | |
| 4.2 Allocation handler | Using special memory allocation functions. | |
| 4.3 Error handler | Using error handler functions. | |
| 4.4 Logging handler | Using a special logging function. |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is often useful to retrieve some feedback while long running operations are performed.
Progress handler functions have to be of the type
gcry_handler_progress_t, which is defined as:
void (*gcry_handler_progress_t) (void *, const char *, int, int, int)
The following function may be used to register a handler function for this purpose.
This function installs cb as the `Progress handler' function. cb must be defined as follows:
void
my_progress_handler (void *cb_data, const char *what,
int printchar, int current, int total)
{
/* Do something. */
}
|
A description of the arguments of the progress handler function follows.
The argument provided in the call to gcry_set_progress_handler.
A string identifying the type of the progress output. The following values for what are defined:
need_entropyNot enough entropy is available. total holds the number of required bytes.
primegenValues for printchar:
\nPrime generated.
!Need to refresh the pool of prime numbers.
<, >Number of bits adjusted.
^Searching for a generator.
.Fermat test on 10 candidates failed.
:Restart with a new random value.
+Rabin Miller test passed.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is possible to make Libgcrypt use special memory allocation functions instead of the built-in ones.
Memory allocation functions are of the following types:
This type is defined as: void *(*gcry_handler_alloc_t) (size_t n).
This type is defined as: int *(*gcry_handler_secure_check_t) (const void *).
This type is defined as: void *(*gcry_handler_realloc_t) (void *p, size_t n).
This type is defined as: void *(*gcry_handler_free_t) (void *).
Special memory allocation functions can be installed with the following function:
Install the provided functions and use them instead of the built-in functions for doing memory allocation.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following functions may be used to register handler functions that are called by Libgcrypt in case certain error conditions occur.
This type is defined as: void (*gcry_handler_no_mem_t) (void *, size_t, unsigned int)
This function registers func_no_mem as `out-of-core handler', which means that it will be called in the case of not having enough memory available.
This type is defined as: void (*gcry_handler_error_t) (void *, int, const char *)
This function registers func_error as `error handler', which means that it will be called in error conditions.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This type is defined as: void (*gcry_handler_log_t) (void *, int, const char *, va_list)
This function registers func_log as `logging handler', which means that it will be called in case Libgcrypt wants to log a message.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by root on September, 4 2006 using texi2html 1.76.