Next: Allocation handler, Up: Handler Functions [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. It may be used only during initialization. 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_entropy
Not enough entropy is available. total holds the number of required bytes.
wait_dev_random
Waiting to re-open a random device. total gives the number of seconds until the next try.
primegen
Values for printchar:
\n
Prime 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.