]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - README.rsa
Flatten the dist and various 4.n.n trees in preparation of future ntp imports.
[FreeBSD/FreeBSD.git] / README.rsa
1 If you want to use the RSA stuff for crypto keys:
2
3 - Get RSAREF or RSAEURO.
4 - - Unpack it in the top-level source directory of the NTP distribution
5     in a directory named rsaref2 or rsaeuro1, respectively
6     (You should see directories like ports, rsaref2, scripts)
7
8 Make sure rsa.c has the security patch applied - a copy of it is at the
9 end of this file.
10
11 When you run configure, the Right Thing will happen.
12
13 Be advised that the RSA DES code is not quite as portable is one might
14 wish for.  In particular, DES under NTP will only work between machines
15 of the same "endianness".
16
17 Note that the next release of NTP uses OpenSSL instead of RSAREF.
18
19 --- rsa.c.orig  Fri Mar 25 14:01:48 1994
20 +++ rsaref2/source/rsa.c        Mon Dec 13 13:10:28 1999
21 @@ -33,6 +33,9 @@
22    unsigned char byte, pkcsBlock[MAX_RSA_MODULUS_LEN];
23    unsigned int i, modulusLen;
24    
25 +  if (publicKey->bits > MAX_RSA_MODULUS_BITS)
26 +    return (RE_LEN);
27 +
28    modulusLen = (publicKey->bits + 7) / 8;
29    if (inputLen + 11 > modulusLen)
30      return (RE_LEN);
31 @@ -78,6 +81,9 @@
32    unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
33    unsigned int i, modulusLen, pkcsBlockLen;
34    
35 +  if (publicKey->bits > MAX_RSA_MODULUS_BITS)
36 +    return (RE_LEN);
37 +
38    modulusLen = (publicKey->bits + 7) / 8;
39    if (inputLen > modulusLen)
40      return (RE_LEN);
41 @@ -128,6 +134,9 @@
42    int status;
43    unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
44    unsigned int i, modulusLen;
45 +
46 +  if (privateKey->bits > MAX_RSA_MODULUS_BITS)
47 +    return (RE_LEN);
48    
49    modulusLen = (privateKey->bits + 7) / 8;
50    if (inputLen + 11 > modulusLen)
51 @@ -168,6 +177,9 @@
52    unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
53    unsigned int i, modulusLen, pkcsBlockLen;
54    
55 +  if (privateKey->bits > MAX_RSA_MODULUS_BITS)
56 +    return (RE_LEN);
57 +
58    modulusLen = (privateKey->bits + 7) / 8;
59    if (inputLen > modulusLen)
60      return (RE_LEN);
61
62 --- rsa.c.orig  Sat Sep 28 22:59:40 1996
63 +++ rsaeuro1/source/rsa.c       Sat Jul  8 00:33:13 2000
64 @@ -51,6 +51,9 @@ R_RANDOM_STRUCT *randomStruct;  /* rando
65         unsigned char byte, pkcsBlock[MAX_RSA_MODULUS_LEN];
66         unsigned int i, modulusLen;
67  
68 +       if (publicKey->bits > MAX_RSA_MODULUS_BITS)
69 +       return (RE_LEN);
70 +
71         modulusLen = (publicKey->bits + 7) / 8;
72  
73         if(inputLen + 11 > modulusLen)
74 @@ -101,6 +104,9 @@ R_RSA_PUBLIC_KEY *publicKey;    /* RSA p
75         unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
76         unsigned int i, modulusLen, pkcsBlockLen;
77  
78 +       if (publicKey->bits > MAX_RSA_MODULUS_BITS)
79 +       return (RE_LEN);
80 +
81         modulusLen = (publicKey->bits + 7) / 8;
82  
83         if(inputLen > modulusLen)
84 @@ -154,6 +160,9 @@ R_RSA_PRIVATE_KEY *privateKey;  /* RSA p
85         unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
86         unsigned int i, modulusLen;
87  
88 +       if (privateKey->bits > MAX_RSA_MODULUS_BITS)
89 +       return (RE_LEN);
90 +
91         modulusLen = (privateKey->bits + 7) / 8;
92  
93         if(inputLen + 11 > modulusLen)
94 @@ -193,6 +202,9 @@ R_RSA_PRIVATE_KEY *privateKey;  /* RSA p
95         unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
96         unsigned int i, modulusLen, pkcsBlockLen;
97  
98 +       if (privateKey->bits > MAX_RSA_MODULUS_BITS)
99 +       return (RE_LEN);
100 +
101         modulusLen = (privateKey->bits + 7) / 8;
102  
103         if(inputLen > modulusLen)