3 * $Id: rsa.h,v 1.1 1999/12/22 15:50:45 mdw Exp $
5 * The RSA public-key cryptosystem
7 * (c) 1999 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Revision history --------------------------------------------------*
33 * Revision 1.1 1999/12/22 15:50:45 mdw
34 * Initial RSA support.
38 #ifndef CATACOMB_RSA_H
39 #define CATACOMB_RSA_H
45 /*----- Header files ------------------------------------------------------*/
47 #ifndef CATACOMB_GRAND_H
55 #ifndef CATACOMB_PGEN_H
59 /*----- Data structures ---------------------------------------------------*/
61 typedef struct rsa_param
{
68 /*----- Functions provided ------------------------------------------------*/
70 /* --- @rsa_gen@ --- *
72 * Arguments: @rsa_param *rp@ = pointer to block to be filled in
73 * @unsigned nbits@ = required modulus size in bits
74 * @grand *r@ = random number source
75 * @unsigned n@ = number of attempts to make
76 * @pgen_proc *event@ = event handler function
77 * @void *ectx@ = argument for the event handler
79 * Returns: Zero if all went well, nonzero otherwise.
81 * Use: Constructs a pair of strong RSA primes and other useful RSA
82 * parameters. A small encryption exponent is chosen if
86 extern int rsa_gen(rsa_param */
*rp*/
, unsigned /*nbits*/,
87 grand */
*r*/
, unsigned /*n*/,
88 pgen_proc */
*event*/
, void */
*ectx*/
);
90 /* --- @rsa_decrypt@ --- *
92 * Arguments: @rsa_param *rp@ = pointer to RSA parameters
93 * @mp *d@ = destination
94 * @mp *c@ = ciphertext message
95 * @grand *r@ = pointer to random number source for blinding
97 * Returns: Correctly decrypted message.
99 * Use: Performs RSA decryption, very carefully.
102 extern mp
*rsa_decrypt(rsa_param */
*rp*/
, mp */
*d*/
, mp */
*c*/
,
105 /* --- @rsa_recover@ --- *
107 * Arguments: @rsa_param *rp@ = pointer to parameter block
109 * Returns: Zero if all went well, nonzero if the parameters make no
112 * Use: Derives the full set of RSA parameters given a minimal set.
115 extern int rsa_recover(rsa_param */
*rp*/
);
117 /*----- That's all, folks -------------------------------------------------*/