Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
rsafun.cxx
Go to the documentation of this file.
1 /* @(#)root/auth:$Id$ */
2 /* Author: Martin Nicolay 22/11/1988 */
3 
4 /******************************************************************************
5 Copyright (C) 2006 Martin Nicolay <m.nicolay@osm-gmbh.de>
6 
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later
11 version.
12 
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free
20 Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
21 MA 02110-1301 USA
22 ******************************************************************************/
23 
24 /*******************************************************************************
25 * *
26 * Simple RSA public key code. *
27 * Adaptation in library for ROOT by G. Ganis, July 2003 *
28 * (gerardo.ganis@cern.ch) *
29 * *
30 *******************************************************************************/
31 
32 #include "rsafun.h"
33 
34 rsa_NUMBER rsa_genprim(int, int);
35 int rsa_genrsa(rsa_NUMBER, rsa_NUMBER, rsa_NUMBER *, rsa_NUMBER *, rsa_NUMBER *);
36 int rsa_encode(char *, int, rsa_NUMBER, rsa_NUMBER);
37 int rsa_decode(char *, int, rsa_NUMBER, rsa_NUMBER);
38 int rsa_num_sput( rsa_NUMBER*, char*, int );
39 int rsa_num_fput( rsa_NUMBER*, FILE* );
40 int rsa_num_sget( rsa_NUMBER*, char* );
41 int rsa_num_fget( rsa_NUMBER*, FILE* );
42 void rsa_assign( rsa_NUMBER*, rsa_NUMBER* );
43 int rsa_cmp( rsa_NUMBER*, rsa_NUMBER* );
44 
45 RSA_genprim_t TRSA_fun::fg_rsa_genprim;
46 RSA_genrsa_t TRSA_fun::fg_rsa_genrsa;
47 RSA_encode_t TRSA_fun::fg_rsa_encode;
48 RSA_decode_t TRSA_fun::fg_rsa_decode;
49 RSA_num_sput_t TRSA_fun::fg_rsa_num_sput;
50 RSA_num_fput_t TRSA_fun::fg_rsa_num_fput;
51 RSA_num_sget_t TRSA_fun::fg_rsa_num_sget;
52 RSA_num_fget_t TRSA_fun::fg_rsa_num_fget;
53 RSA_assign_t TRSA_fun::fg_rsa_assign;
54 RSA_cmp_t TRSA_fun::fg_rsa_cmp;
55 
56 RSA_genprim_t TRSA_fun::RSA_genprim() { return fg_rsa_genprim; }
57 RSA_genrsa_t TRSA_fun::RSA_genrsa() { return fg_rsa_genrsa; }
58 RSA_encode_t TRSA_fun::RSA_encode() { return fg_rsa_encode; }
59 RSA_decode_t TRSA_fun::RSA_decode() { return fg_rsa_decode; }
60 RSA_num_sput_t TRSA_fun::RSA_num_sput() { return fg_rsa_num_sput; }
61 RSA_num_fput_t TRSA_fun::RSA_num_fput() { return fg_rsa_num_fput; }
62 RSA_num_sget_t TRSA_fun::RSA_num_sget() { return fg_rsa_num_sget; }
63 RSA_num_fget_t TRSA_fun::RSA_num_fget() { return fg_rsa_num_fget; }
64 RSA_assign_t TRSA_fun::RSA_assign() { return fg_rsa_assign; }
65 RSA_cmp_t TRSA_fun::RSA_cmp() { return fg_rsa_cmp; }
66 
67 // Static instantiation to load hooks during dynamic load
68 static TRSA_fun g_rsa_init(&rsa_genprim,&rsa_genrsa,&rsa_encode,&rsa_decode,
69  &rsa_num_sput,&rsa_num_fput,&rsa_num_sget,
70  &rsa_num_fget,&rsa_assign,&rsa_cmp);
71 
72 TRSA_fun::TRSA_fun(RSA_genprim_t genprim, RSA_genrsa_t genrsa, RSA_encode_t encode,
73  RSA_decode_t decode, RSA_num_sput_t num_sput, RSA_num_fput_t num_fput,
74  RSA_num_sget_t num_sget, RSA_num_fget_t num_fget,
75  RSA_assign_t assign, RSA_cmp_t cmp)
76 {
77  // constructor
78 
79  fg_rsa_genprim = genprim;
80  fg_rsa_genrsa = genrsa;
81  fg_rsa_encode = encode;
82  fg_rsa_decode = decode;
83  fg_rsa_num_sput = num_sput;
84  fg_rsa_num_fput = num_fput;
85  fg_rsa_num_sget = num_sget;
86  fg_rsa_num_fget = num_fget;
87  fg_rsa_assign = assign;
88  fg_rsa_cmp = cmp;
89 }