Mercurial > dropbear
comparison libtomcrypt/src/pk/dh/dh.c @ 1511:5916af64acd4 fuzz
merge from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 17 Feb 2018 19:29:51 +0800 |
parents | 6dba84798cd5 |
children |
comparison
equal
deleted
inserted
replaced
1457:32f990cc96b1 | 1511:5916af64acd4 |
---|---|
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
2 * | |
3 * LibTomCrypt is a library that provides various cryptographic | |
4 * algorithms in a highly modular and flexible manner. | |
5 * | |
6 * The library is free for all purposes without any express | |
7 * guarantee it works. | |
8 */ | |
9 | |
10 #include "tomcrypt.h" | |
11 | |
12 #ifdef LTC_MDH | |
13 | |
14 /* This holds the key settings. ***MUST*** be organized by size from smallest to largest. */ | |
15 const ltc_dh_set_type ltc_dh_sets[] = { | |
16 #ifdef LTC_DH768 | |
17 { /* 768-bit MODP Group 1 - https://tools.ietf.org/html/rfc7296#appendix-B.1 */ | |
18 96, | |
19 "DH-768", | |
20 "2", | |
21 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" | |
22 "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" | |
23 "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" | |
24 "E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF" | |
25 }, | |
26 #endif | |
27 #ifdef LTC_DH1024 | |
28 { /* 1024-bit MODP Group 2 - https://tools.ietf.org/html/rfc7296#appendix-B.2 */ | |
29 128, | |
30 "DH-1024", | |
31 "2", | |
32 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" | |
33 "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" | |
34 "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" | |
35 "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" | |
36 "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" | |
37 "FFFFFFFFFFFFFFFF" | |
38 }, | |
39 #endif | |
40 #ifdef LTC_DH1536 | |
41 { /* 1536-bit MODP Group 5 - https://tools.ietf.org/html/rfc3526#section-2 */ | |
42 192, | |
43 "DH-1536", | |
44 "2", | |
45 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" | |
46 "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" | |
47 "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" | |
48 "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" | |
49 "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" | |
50 "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" | |
51 "83655D23DCA3AD961C62F356208552BB9ED529077096966D" | |
52 "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF" | |
53 }, | |
54 #endif | |
55 #ifdef LTC_DH2048 | |
56 { /* 2048-bit MODP Group 14 - https://tools.ietf.org/html/rfc3526#section-3 */ | |
57 256, | |
58 "DH-2048", | |
59 "2", | |
60 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" | |
61 "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" | |
62 "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" | |
63 "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" | |
64 "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" | |
65 "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" | |
66 "83655D23DCA3AD961C62F356208552BB9ED529077096966D" | |
67 "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" | |
68 "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" | |
69 "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" | |
70 "15728E5A8AACAA68FFFFFFFFFFFFFFFF" | |
71 }, | |
72 #endif | |
73 #ifdef LTC_DH3072 | |
74 { /* 3072-bit MODP Group 15 - https://tools.ietf.org/html/rfc3526#section-4 */ | |
75 384, | |
76 "DH-3072", | |
77 "2", | |
78 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" | |
79 "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" | |
80 "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" | |
81 "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" | |
82 "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" | |
83 "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" | |
84 "83655D23DCA3AD961C62F356208552BB9ED529077096966D" | |
85 "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" | |
86 "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" | |
87 "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" | |
88 "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" | |
89 "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" | |
90 "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" | |
91 "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" | |
92 "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" | |
93 "43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF" | |
94 }, | |
95 #endif | |
96 #ifdef LTC_DH4096 | |
97 { /* 4096-bit MODP Group 16 - https://tools.ietf.org/html/rfc3526#section-5 */ | |
98 512, | |
99 "DH-4096", | |
100 "2", | |
101 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" | |
102 "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" | |
103 "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" | |
104 "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" | |
105 "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" | |
106 "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" | |
107 "83655D23DCA3AD961C62F356208552BB9ED529077096966D" | |
108 "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" | |
109 "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" | |
110 "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" | |
111 "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" | |
112 "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" | |
113 "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" | |
114 "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" | |
115 "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" | |
116 "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" | |
117 "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" | |
118 "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" | |
119 "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" | |
120 "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" | |
121 "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199" | |
122 "FFFFFFFFFFFFFFFF" | |
123 }, | |
124 #endif | |
125 #ifdef LTC_DH6144 | |
126 { /* 6144-bit MODP Group 17 - https://tools.ietf.org/html/rfc3526#section-6 */ | |
127 768, | |
128 "DH-6144", | |
129 "2", | |
130 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" | |
131 "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" | |
132 "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" | |
133 "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" | |
134 "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" | |
135 "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" | |
136 "83655D23DCA3AD961C62F356208552BB9ED529077096966D" | |
137 "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" | |
138 "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" | |
139 "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" | |
140 "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" | |
141 "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" | |
142 "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" | |
143 "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" | |
144 "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" | |
145 "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" | |
146 "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" | |
147 "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" | |
148 "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" | |
149 "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" | |
150 "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934028492" | |
151 "36C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BD" | |
152 "F8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831" | |
153 "179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1B" | |
154 "DB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF" | |
155 "5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6" | |
156 "D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F3" | |
157 "23A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA" | |
158 "CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE328" | |
159 "06A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55C" | |
160 "DA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE" | |
161 "12BF2D5B0B7474D6E694F91E6DCC4024FFFFFFFFFFFFFFFF" | |
162 }, | |
163 #endif | |
164 #ifdef LTC_DH8192 | |
165 { /* 8192-bit MODP Group 18 - https://tools.ietf.org/html/rfc3526#section-7 */ | |
166 1024, | |
167 "DH-8192", | |
168 "2", | |
169 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" | |
170 "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" | |
171 "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" | |
172 "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" | |
173 "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" | |
174 "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" | |
175 "83655D23DCA3AD961C62F356208552BB9ED529077096966D" | |
176 "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" | |
177 "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" | |
178 "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" | |
179 "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" | |
180 "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" | |
181 "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" | |
182 "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" | |
183 "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" | |
184 "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" | |
185 "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" | |
186 "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" | |
187 "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" | |
188 "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" | |
189 "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934028492" | |
190 "36C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BD" | |
191 "F8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831" | |
192 "179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1B" | |
193 "DB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF" | |
194 "5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6" | |
195 "D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F3" | |
196 "23A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA" | |
197 "CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE328" | |
198 "06A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55C" | |
199 "DA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE" | |
200 "12BF2D5B0B7474D6E694F91E6DBE115974A3926F12FEE5E4" | |
201 "38777CB6A932DF8CD8BEC4D073B931BA3BC832B68D9DD300" | |
202 "741FA7BF8AFC47ED2576F6936BA424663AAB639C5AE4F568" | |
203 "3423B4742BF1C978238F16CBE39D652DE3FDB8BEFC848AD9" | |
204 "22222E04A4037C0713EB57A81A23F0C73473FC646CEA306B" | |
205 "4BCBC8862F8385DDFA9D4B7FA2C087E879683303ED5BDD3A" | |
206 "062B3CF5B3A278A66D2A13F83F44F82DDF310EE074AB6A36" | |
207 "4597E899A0255DC164F31CC50846851DF9AB48195DED7EA1" | |
208 "B1D510BD7EE74D73FAF36BC31ECFA268359046F4EB879F92" | |
209 "4009438B481C6CD7889A002ED5EE382BC9190DA6FC026E47" | |
210 "9558E4475677E9AA9E3050E2765694DFC81F56E880B96E71" | |
211 "60C980DD98EDD3DFFFFFFFFFFFFFFFFF" | |
212 }, | |
213 #endif | |
214 { | |
215 0, | |
216 NULL, | |
217 NULL, | |
218 NULL | |
219 } | |
220 }; | |
221 | |
222 /** | |
223 Returns the DH group size (octets) for given key | |
224 @param key The DH key to get the size of | |
225 @return The group size in octets (0 on error) | |
226 */ | |
227 int dh_get_groupsize(dh_key *key) | |
228 { | |
229 if (key == NULL) return 0; | |
230 return mp_unsigned_bin_size(key->prime); | |
231 } | |
232 | |
233 #endif /* LTC_MDH */ | |
234 | |
235 /* ref: $Format:%D$ */ | |
236 /* git commit: $Format:%H$ */ | |
237 /* commit time: $Format:%ai$ */ |