+typedef struct pgen_event {
+ const char *name; /* Which quantity is being found */
+ mp *m; /* Current value under test */
+ unsigned steps; /* Number of candidates left */
+ unsigned tests; /* Tests left before passing */
+ grand *r; /* Source of random numbers */
+} pgen_event;
+
+/*----- Prime search parameters -------------------------------------------*
+ *
+ * The prime search is parameterized in a large number of ways, although this
+ * isn't so much of a surprise given the different sorts of properties
+ * required from prime numbers in cryptographic applications.
+ *
+ * There are two main things which need to be configured: stepping, and
+ * testing. (Filtering is done as part of stepping.)
+ *
+ * The functions here provide a toolkit for constructing stepping and testing
+ * routines. In a lot of cases, the functions can be used directly; in
+ * others, simple bits of glue need be written.
+ *
+ * Two types of functions are defined: steppers and testers, but their
+ * interfaces are substantially similar. Each is given a request code, a
+ * context block and an event block. It is meant to update its context and
+ * the event block and return an event code.