+extern int rsa_decrypt(rsa_privctx */*rp*/, mp */*m*/,
+ dstr */*d*/, rsa_decunpad */*e*/, void */*earg*/);
+
+/*----- RSA public key operations -----------------------------------------*/
+
+/* --- @rsa_pubcreate@ --- *
+ *
+ * Arguments: @rsa_pubctx *rd@ = pointer to an RSA public key context
+ * @rsa_pub *rp@ = pointer to RSA public key
+ *
+ * Returns: ---
+ *
+ * Use: Initializes an RSA public-key context.
+ */
+
+extern void rsa_pubcreate(rsa_pubctx */*rd*/, rsa_pub */*rp*/);
+
+/* --- @rsa_pubdestroy@ --- *
+ *
+ * Arguments: @rsa_pubctx *rd@ = pointer to an RSA public key context
+ *
+ * Returns: ---
+ *
+ * Use: Destroys an RSA public-key context.
+ */
+
+extern void rsa_pubdestroy(rsa_pubctx */*rd*/);
+
+/* --- @rsa_pubop@ --- *
+ *
+ * Arguments: @rsa_pubctx *rd@ = pointer to an RSA public key context
+ * @mp *d@ = destination
+ * @mp *p@ = input message
+ *
+ * Returns: The transformed output message.
+ *
+ * Use: Performs an RSA public key operation.
+ */
+
+extern mp *rsa_pubop(rsa_pubctx */*rd*/, mp */*d*/, mp */*p*/);
+
+/* --- @rsa_qpubop@ --- *
+ *
+ * Arguments: @rsa_pub *rp@ = pointer to RSA parameters
+ * @mp *d@ = destination
+ * @mp *p@ = input message
+ *
+ * Returns: Correctly transformed output message.
+ *
+ * Use: Performs an RSA public key operation.
+ */
+
+extern mp *rsa_qpubop(rsa_pub */*rp*/, mp */*d*/, mp */*c*/);
+
+/* --- @rsa_encrypt@ --- *
+ *
+ * Arguments: @rsa_pubctx *rp@ = pointer to an RSA public key context
+ * @mp *d@ = proposed destination integer
+ * @const void *m@ = pointer to input message
+ * @size_t msz@ = size of input message
+ * @rsa_pad *e@ = encoding procedure
+ * @void *earg@ = argument pointer for encoding procedure
+ *
+ * Returns: The encrypted message, as a multiprecision integer, or null
+ * on failure.
+ *
+ * Use: Does RSA encryption.
+ */
+
+extern mp *rsa_encrypt(rsa_pubctx */*rp*/, mp */*d*/,
+ const void */*m*/, size_t /*msz*/,
+ rsa_pad */*e*/, void */*earg*/);
+
+/* --- @rsa_verify@ --- *
+ *
+ * Arguments: @rsa_pubctx *rp@ = pointer to an RSA public key contxt
+ * @mp *s@ = the signature, as a multiprecision integer
+ * @const void *m@ = pointer to message to verify, or null
+ * @size_t sz@ = size of input message
+ * @dstr *d@ = pointer to output string, or null
+ * @rsa_vfrunpad *e@ = decoding procedure
+ * @void *earg@ = argument pointer for decoding procedure
+ *
+ * Returns: The length of the output string if successful (0 if no output
+ * was wanted); negative on failure.
+ *
+ * Use: Does RSA signature verification. To use a signature scheme
+ * with recovery, pass in @m == 0@ and @d != 0@: the recovered
+ * message should appear in @d@. To use a signature scheme with
+ * appendix, provide @m != 0@ and @d == 0@; the result should be
+ * zero for success.
+ */
+
+extern int rsa_verify(rsa_pubctx */*rp*/, mp */*s*/,
+ const void */*m*/, size_t /*sz*/, dstr */*d*/,
+ rsa_vrfunpad */*e*/, void */*earg*/);
+
+/*----- Miscellaneous operations ------------------------------------------*/
+
+/* --- @rsa_gen@ --- *
+ *
+ * Arguments: @rsa_priv *rp@ = pointer to block to be filled in
+ * @unsigned nbits@ = required modulus size in bits
+ * @grand *r@ = random number source
+ * @unsigned n@ = number of attempts to make
+ * @pgen_proc *event@ = event handler function
+ * @void *ectx@ = argument for the event handler
+ *
+ * Returns: Zero if all went well, nonzero otherwise.
+ *
+ * Use: Constructs a pair of strong RSA primes and other useful RSA
+ * parameters. A small encryption exponent is chosen if
+ * possible.
+ */
+
+extern int rsa_gen(rsa_priv */*rp*/, unsigned /*nbits*/,
+ grand */*r*/, unsigned /*n*/,
+ pgen_proc */*event*/, void */*ectx*/);