ROOT
v6-20
Reference Guide
rsadef.h
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
* Header used by internal rsa functions *
31
* *
32
*******************************************************************************/
33
34
#ifndef _RSADEF_H
35
#define _RSADEF_H
36
37
typedef
unsigned
short
rsa_INT
;
/* muss MAXINT fassen */
38
typedef
unsigned
long
rsa_LONG
;
/* muss (MAXINT+1)^2 -1 fassen */
39
40
/*
41
* (MAXINT+1)-adic Zahlen
42
*/
43
44
/*
45
* MAXINT Maximale Zahl pro Element (muss int sein)
46
* MAXBIT Maximales Bit von MAXINT
47
* LOWBITS Anzahl der consekutiven low Bits von MAXINT
48
* HIGHBIT Hoechsten Bit von MAXINT
49
* TOINT muss (INT)( (x) % MAXINT) ergeben
50
* MAXLEN Laenge der INT Array in jeder NUMBER
51
*/
52
53
#define rsa_MAXINT 0xFFFF
54
55
#if rsa_MAXINT == 99
56
#define rsa_MAXBIT 7
57
#define rsa_LOWBITS 2
58
#endif
59
#if rsa_MAXINT == 9
60
#define rsa_MAXBIT 4
61
#define rsa_LOWBITS 1
62
#endif
63
#if rsa_MAXINT == 1
64
#define rsa_MAXBIT 1
65
#endif
66
#if rsa_MAXINT == 0xFF
67
#define rsa_MAXBIT 8
68
#define rsa_TOINT(x) ((rsa_INT)(x))
/* ACHTUNG !!!!! */
69
#endif
70
#if rsa_MAXINT == 0xFFFF
71
#define rsa_MAXBIT 16
72
#define rsa_TOINT(x) ((rsa_INT)(x))
/* ACHTUNG !!!!! */
73
#endif
74
75
#ifndef rsa_MAXBIT
76
#include "<< ERROR: rsa_MAXBIT must be defined >
>
"
77
#endif
78
#ifndef rsa_LOWBITS
79
#if rsa_MAXINT == (1 << rsa_MAXBIT) - 1
80
#define rsa_LOWBITS rsa_MAXBIT
81
#else
82
#include "
<<
ERROR
:
rsa_LOWBITS
must be defined >>
"
83
#endif
84
#endif
85
86
#define rsa_MAXLEN (300*8/(rsa_MAXBIT + 1))
87
#define rsa_STRLEN (rsa_MAXLEN*rsa_MAXBIT/4)
88
#define rsa_HIGHBIT (1 << (rsa_MAXBIT-1) )
89
90
#if rsa_LOWBITS == rsa_MAXBIT
91
#define rsa_DIVMAX1(x) ((x) >> rsa_MAXBIT)
92
#define rsa_MODMAX1(x) ((x) & rsa_MAXINT)
93
#define rsa_MULMAX1(x) ((x) << rsa_MAXBIT)
94
#else
95
#define rsa_DIVMAX1(x) ((x) / (rsa_MAXINT+1))
96
#define rsa_MODMAX1(x) ((x) % (rsa_MAXINT+1))
97
#define rsa_MULMAX1(x) ((x) * (unsigned)(rsa_MAXINT+1))
98
#endif
99
100
#ifndef rsa_TOINT
101
#define rsa_TOINT(x) ((rsa_INT)rsa_MODMAX1(x))
102
#endif
103
104
typedef struct {
105
int n_len; /* Hoechster benutzter Index */
106
rsa_INT n_part[rsa_MAXLEN];
107
} rsa_NUMBER;
108
109
#define rsa_NUM0P ((rsa_NUMBER *)0) /* Abkuerzung */
110
111
/* Key structures */
112
typedef struct {
113
rsa_NUMBER n; /* modulus */
114
rsa_NUMBER e; /* private or public exponent */
115
} rsa_KEY;
116
typedef struct {
117
int len; /* length of 'data' in bytes */
118
char *keys; /* 'HEX[n]#HEX[d]\0' */
119
} rsa_KEY_export;
120
121
122
#endif
RooFit::ERROR
@ ERROR
Definition:
RooGlobalFunc.h:65
rsa_LOWBITS
#define rsa_LOWBITS
Definition:
rsadef.h:80
rsa_INT
unsigned short rsa_INT
Definition:
rsadef.h:37
rsa_LONG
unsigned long rsa_LONG
Definition:
rsadef.h:38
net
auth
res
rsadef.h
ROOT v6-20 - Reference Guide Generated on Fri Apr 1 2022 00:22:29 (GVA Time) using Doxygen 1.9.4