/src/cryptofuzz/entry.cpp
Line | Count | Source |
1 | | #include <cstddef> |
2 | | #include <cstdint> |
3 | | #include <memory> |
4 | | #include <set> |
5 | | #include <vector> |
6 | | #include <string> |
7 | | #include <cryptofuzz/options.h> |
8 | | #include <fuzzing/datasource/id.hpp> |
9 | | #include "repository_tbl.h" |
10 | | #include "driver.h" |
11 | | #include "numbers.h" |
12 | | |
13 | | #if defined(CRYPTOFUZZ_LIBTOMMATH) && defined(CRYPTOFUZZ_NSS) |
14 | | #error "libtommath and NSS cannot be used together due to symbol collisions" |
15 | | #endif |
16 | | |
17 | | #if defined(CRYPTOFUZZ_TREZOR_FIRMWARE) && defined(CRYPTOFUZZ_RELIC) |
18 | | #error "trezor-firmware and relic cannot be used together due to symbol collisions" |
19 | | #endif |
20 | | |
21 | | #if !defined(CRYPTOFUZZ_NO_OPENSSL) |
22 | | #include <modules/openssl/module.h> |
23 | | #ifdef SHA1 |
24 | | #undef SHA1 |
25 | | #endif |
26 | | #ifdef SHA224 |
27 | | #undef SHA224 |
28 | | #endif |
29 | | #ifdef SHA256 |
30 | | #undef SHA256 |
31 | | #endif |
32 | | #ifdef SHA384 |
33 | | #undef SHA384 |
34 | | #endif |
35 | | #ifdef SHA512 |
36 | | #undef SHA512 |
37 | | #endif |
38 | | #endif |
39 | | |
40 | | #if defined(CRYPTOFUZZ_BITCOIN) |
41 | | #include <modules/bitcoin/module.h> |
42 | | #endif |
43 | | |
44 | | #if defined(CRYPTOFUZZ_REFERENCE) |
45 | | #include <modules/reference/module.h> |
46 | | #endif |
47 | | |
48 | | #if defined(CRYPTOFUZZ_CPPCRYPTO) |
49 | | #include <modules/cppcrypto/module.h> |
50 | | #endif |
51 | | |
52 | | #if defined(CRYPTOFUZZ_MBEDTLS) |
53 | | #include <modules/mbedtls/module.h> |
54 | | #endif |
55 | | |
56 | | #if defined(CRYPTOFUZZ_BOOST) |
57 | | #include <modules/boost/module.h> |
58 | | #endif |
59 | | |
60 | | #if defined(CRYPTOFUZZ_MONERO) |
61 | | #include <modules/monero/module.h> |
62 | | #endif |
63 | | |
64 | | #if defined(CRYPTOFUZZ_VERACRYPT) |
65 | | #include <modules/veracrypt/module.h> |
66 | | #endif |
67 | | |
68 | | #if defined(CRYPTOFUZZ_LIBSODIUM) |
69 | | #include <modules/libsodium/module.h> |
70 | | #endif |
71 | | |
72 | | #if defined(CRYPTOFUZZ_LIBTOMCRYPT) |
73 | | #include <modules/libtomcrypt/module.h> |
74 | | #endif |
75 | | |
76 | | #if defined(CRYPTOFUZZ_CRYPTOPP) |
77 | | #include <modules/cryptopp/module.h> |
78 | | #endif |
79 | | |
80 | | #if defined(CRYPTOFUZZ_LIBGCRYPT) |
81 | | #include <modules/libgcrypt/module.h> |
82 | | #endif |
83 | | |
84 | | #if defined(CRYPTOFUZZ_EVERCRYPT) |
85 | | #include <modules/evercrypt/module.h> |
86 | | #endif |
87 | | |
88 | | #if defined(CRYPTOFUZZ_GOLANG) |
89 | | #include <modules/golang/module.h> |
90 | | #endif |
91 | | |
92 | | #if defined(CRYPTOFUZZ_RING) |
93 | | #include <modules/ring/module.h> |
94 | | #endif |
95 | | |
96 | | #if defined(CRYPTOFUZZ_NSS) |
97 | | #include <modules/nss/module.h> |
98 | | #endif |
99 | | |
100 | | #if defined(CRYPTOFUZZ_BOTAN) |
101 | | #include <modules/botan/module.h> |
102 | | #endif |
103 | | |
104 | | #if defined(CRYPTOFUZZ_NETTLE) |
105 | | #include <modules/nettle/module.h> |
106 | | #endif |
107 | | |
108 | | #if defined(CRYPTOFUZZ_WOLFCRYPT) |
109 | | #include <modules/wolfcrypt/module.h> |
110 | | #endif |
111 | | |
112 | | #if defined(CRYPTOFUZZ_LIBGMP) |
113 | | #include <modules/libgmp/module.h> |
114 | | #endif |
115 | | |
116 | | #if defined(CRYPTOFUZZ_BN_JS) |
117 | | #include <modules/bn.js/module.h> |
118 | | #endif |
119 | | |
120 | | #if defined(CRYPTOFUZZ_CRYPTO_JS) |
121 | | #include <modules/crypto-js/module.h> |
122 | | #endif |
123 | | |
124 | | #if defined(CRYPTOFUZZ_BIGNUMBER_JS) |
125 | | #include <modules/bignumber.js/module.h> |
126 | | #endif |
127 | | |
128 | | #if defined(CRYPTOFUZZ_MPDECIMAL) |
129 | | #include <modules/mpdecimal/module.h> |
130 | | #endif |
131 | | |
132 | | #if defined(CRYPTOFUZZ_LINUX) |
133 | | #include <modules/linux/module.h> |
134 | | #endif |
135 | | |
136 | | #if defined(CRYPTOFUZZ_SYMCRYPT) |
137 | | #include <modules/symcrypt/module.h> |
138 | | #endif |
139 | | |
140 | | #if defined(CRYPTOFUZZ_LIBTOMMATH) |
141 | | #include <modules/libtommath/module.h> |
142 | | #endif |
143 | | |
144 | | #if defined(CRYPTOFUZZ_SJCL) |
145 | | #include <modules/sjcl/module.h> |
146 | | #endif |
147 | | |
148 | | #if defined(CRYPTOFUZZ_WOLFCRYPT_OPENSSL) |
149 | | #include <modules/wolfcrypt-openssl/module.h> |
150 | | #endif |
151 | | |
152 | | #if defined(CRYPTOFUZZ_MONOCYPHER) |
153 | | #include <modules/monocypher/module.h> |
154 | | #endif |
155 | | |
156 | | #if defined(CRYPTOFUZZ_SECP256K1) |
157 | | #include <modules/secp256k1/module.h> |
158 | | #endif |
159 | | |
160 | | #if defined(CRYPTOFUZZ_RUST_LIBSECP256K1) |
161 | | #include <modules/rust-libsecp256k1/module.h> |
162 | | #endif |
163 | | |
164 | | #if defined(CRYPTOFUZZ_TREZOR_FIRMWARE) |
165 | | #include <modules/trezor/module.h> |
166 | | #endif |
167 | | |
168 | | #if defined(CRYPTOFUZZ_ELLIPTIC) |
169 | | #include <modules/elliptic/module.h> |
170 | | #endif |
171 | | |
172 | | #if defined(CRYPTOFUZZ_DECRED) |
173 | | #include <modules/decred/module.h> |
174 | | #endif |
175 | | |
176 | | #if defined(CRYPTOFUZZ_BEARSSL) |
177 | | #include <modules/bearssl/module.h> |
178 | | #endif |
179 | | |
180 | | #if defined(CRYPTOFUZZ_MICRO_ECC) |
181 | | #include <modules/micro-ecc/module.h> |
182 | | #endif |
183 | | |
184 | | #if defined(CRYPTOFUZZ_CIFRA) |
185 | | #include <modules/cifra/module.h> |
186 | | #endif |
187 | | |
188 | | #if defined(CRYPTOFUZZ_RELIC) |
189 | | #include <modules/relic/module.h> |
190 | | #endif |
191 | | |
192 | | #if defined(CRYPTOFUZZ_LIBECC) |
193 | | #include <modules/libecc/module.h> |
194 | | #endif |
195 | | |
196 | | #if defined(CRYPTOFUZZ_CHIA_BLS) |
197 | | #include <modules/chia_bls/module.h> |
198 | | #endif |
199 | | |
200 | | #if defined(CRYPTOFUZZ_K256) |
201 | | #include <modules/k256/module.h> |
202 | | #endif |
203 | | |
204 | | #if defined(CRYPTOFUZZ_SCHNORRKEL) |
205 | | #include <modules/schnorrkel/module.h> |
206 | | #endif |
207 | | |
208 | | #if defined(CRYPTOFUZZ_NOBLE_SECP256K1) |
209 | | #include <modules/noble-secp256k1/module.h> |
210 | | #endif |
211 | | |
212 | | #if defined(CRYPTOFUZZ_BLST) |
213 | | #include <modules/blst/module.h> |
214 | | #endif |
215 | | |
216 | | #if defined(CRYPTOFUZZ_MCL) |
217 | | #include <modules/mcl/module.h> |
218 | | #endif |
219 | | |
220 | | #if defined(CRYPTOFUZZ_PY_ECC) |
221 | | #include <modules/py_ecc/module.h> |
222 | | #endif |
223 | | |
224 | | #if defined(CRYPTOFUZZ_KILIC_BLS12_381) |
225 | | #include <modules/kilic-bls12-381/module.h> |
226 | | #endif |
227 | | |
228 | | #if defined(CRYPTOFUZZ_NOBLE_ED25519) |
229 | | #include <modules/noble-ed25519/module.h> |
230 | | #endif |
231 | | |
232 | | #if defined(CRYPTOFUZZ_NOBLE_BLS12_381) |
233 | | #include <modules/noble-bls12-381/module.h> |
234 | | #endif |
235 | | |
236 | | #if defined(CRYPTOFUZZ_SCHNORR_FUN) |
237 | | #include <modules/schnorr_fun/module.h> |
238 | | #endif |
239 | | |
240 | | #if defined(CRYPTOFUZZ_QUICKJS) |
241 | | #include <modules/quickjs/module.h> |
242 | | #endif |
243 | | |
244 | | #if defined(CRYPTOFUZZ_UINT128_T) |
245 | | #include <modules/uint128_t/module.h> |
246 | | #endif |
247 | | |
248 | | #if defined(CRYPTOFUZZ_LIBFF) |
249 | | #include <modules/libff/module.h> |
250 | | #endif |
251 | | |
252 | | #if defined(CRYPTOFUZZ_GNARK_BN254) |
253 | | #include <modules/gnark-bn254/module.h> |
254 | | #endif |
255 | | |
256 | | #if defined(CRYPTOFUZZ_GOOGLE_BN256) |
257 | | #include <modules/google-bn256/module.h> |
258 | | #endif |
259 | | |
260 | | #if defined(CRYPTOFUZZ_CLOUDFLARE_BN256) |
261 | | #include <modules/cloudflare-bn256/module.h> |
262 | | #endif |
263 | | |
264 | | #if defined(CRYPTOFUZZ_NOBLE_HASHES) |
265 | | #include <modules/noble-hashes/module.h> |
266 | | #endif |
267 | | |
268 | | #if defined(CRYPTOFUZZ_SKALE_SOLIDITY) |
269 | | #include <modules/skalesolidity/module.h> |
270 | | #endif |
271 | | |
272 | | #if defined(CRYPTOFUZZ_GOOGLE_INTEGERS) |
273 | | #include <modules/google-integers/module.h> |
274 | | #endif |
275 | | |
276 | | #if defined(CRYPTOFUZZ_NIMCRYPTO) |
277 | | #include <modules/nimcrypto/module.h> |
278 | | #endif |
279 | | |
280 | | #if defined(CRYPTOFUZZ_RUSTCRYPTO) |
281 | | #include <modules/rustcrypto/module.h> |
282 | | #endif |
283 | | |
284 | | #if defined(CRYPTOFUZZ_NUM_BIGINT) |
285 | | #include <modules/num-bigint/module.h> |
286 | | #endif |
287 | | |
288 | | #if defined(CRYPTOFUZZ_INTX) |
289 | | #include <modules/intx/module.h> |
290 | | #endif |
291 | | |
292 | | #if defined(CRYPTOFUZZ_DECRED_UINT256) |
293 | | #include <modules/decred-uint256/module.h> |
294 | | #endif |
295 | | |
296 | | #if defined(CRYPTOFUZZ_LIBDIVIDE) |
297 | | #include <modules/libdivide/module.h> |
298 | | #endif |
299 | | |
300 | | #if defined(CRYPTOFUZZ_RUST_UINT) |
301 | | #include <modules/rust-uint/module.h> |
302 | | #endif |
303 | | |
304 | | #if defined(CRYPTOFUZZ_BC) |
305 | | #include <modules/bc/module.h> |
306 | | #endif |
307 | | |
308 | | #if defined(CRYPTOFUZZ_JAVA) |
309 | | #include <modules/java/module.h> |
310 | | #endif |
311 | | |
312 | | #if defined(CRYPTOFUZZ_SOLIDITY_MATH) |
313 | | #include <modules/soliditymath/module.h> |
314 | | #endif |
315 | | |
316 | | #if defined(CRYPTOFUZZ_V8) |
317 | | #include <modules/v8/module.h> |
318 | | #endif |
319 | | |
320 | | #if defined(CRYPTOFUZZ_CIRCL) |
321 | | #include <modules/circl/module.h> |
322 | | #endif |
323 | | |
324 | | #if defined(CRYPTOFUZZ_SPL_MATH) |
325 | | #include <modules/spl_math/module.h> |
326 | | #endif |
327 | | |
328 | | #if defined(CRYPTOFUZZ_ZIG) |
329 | | #include <modules/zig/module.h> |
330 | | #endif |
331 | | |
332 | | #if defined(CRYPTOFUZZ_PRYSMATICLABS_HASHTREE) |
333 | | #include <modules/prysmaticlabs-hashtree/module.h> |
334 | | #endif |
335 | | |
336 | | #if defined(CRYPTOFUZZ_STARKWARE) |
337 | | #include <modules/starkware/module.h> |
338 | | #endif |
339 | | |
340 | | #if defined(CRYPTOFUZZ_PORNIN_BINGCD) |
341 | | #include <modules/pornin-bingcd/module.h> |
342 | | #endif |
343 | | |
344 | | #if defined(CRYPTOFUZZ_STINT) |
345 | | #include <modules/stint/module.h> |
346 | | #endif |
347 | | |
348 | | #if defined(CRYPTOFUZZ_KRYPTOLOGY) |
349 | | #include <modules/kryptology/module.h> |
350 | | #endif |
351 | | |
352 | | #if defined(CRYPTOFUZZ_NIM_BIGINTS) |
353 | | #include <modules/nim-bigints/module.h> |
354 | | #endif |
355 | | |
356 | | #if defined(CRYPTOFUZZ_HOLIMAN_UINT256) |
357 | | #include <modules/holiman-uint256/module.h> |
358 | | #endif |
359 | | |
360 | | #if defined(CRYPTOFUZZ_CPU) |
361 | | #include <modules/cpu/module.h> |
362 | | #endif |
363 | | |
364 | | #if defined(CRYPTOFUZZ_GETH) |
365 | | #include <modules/geth/module.h> |
366 | | #endif |
367 | | |
368 | | #if defined(CRYPTOFUZZ_JSBN) |
369 | | #include <modules/jsbn/module.h> |
370 | | #endif |
371 | | |
372 | | #if defined(CRYPTOFUZZ_WIDE_INTEGER) |
373 | | #include <modules/wide-integer/module.h> |
374 | | #endif |
375 | | |
376 | | #if defined(CRYPTOFUZZ_TINY_KECCAK) |
377 | | #include <modules/tiny-keccak/module.h> |
378 | | #endif |
379 | | |
380 | | std::shared_ptr<cryptofuzz::Driver> driver = nullptr; |
381 | | |
382 | | const cryptofuzz::Options* cryptofuzz_options = nullptr; |
383 | | |
384 | 2 | static void setOptions(int argc, char** argv) { |
385 | 2 | std::vector<std::string> extraArguments; |
386 | | |
387 | 2 | const std::string cmdline( |
388 | 2 | #include "extra_options.h" |
389 | 2 | ); |
390 | 2 | boost::split(extraArguments, cmdline, boost::is_any_of(" ")); |
391 | | |
392 | 2 | const cryptofuzz::Options options(argc, argv, extraArguments); |
393 | | |
394 | 2 | driver = std::make_shared<cryptofuzz::Driver>(options); |
395 | 2 | cryptofuzz_options = driver->GetOptionsPtr(); |
396 | 2 | } |
397 | | |
398 | 2 | static void addNumbers(void) { |
399 | 2 | std::set<std::string> curveNumbers; |
400 | | |
401 | 228 | for (size_t i = 0; i < (sizeof(ECC_CurveLUT) / sizeof(ECC_CurveLUT[0])); i++) { |
402 | 226 | if ( ECC_CurveLUT[i].prime ) curveNumbers.insert(*ECC_CurveLUT[i].prime); |
403 | 226 | if ( ECC_CurveLUT[i].a ) curveNumbers.insert(*ECC_CurveLUT[i].a); |
404 | 226 | if ( ECC_CurveLUT[i].b ) curveNumbers.insert(*ECC_CurveLUT[i].b); |
405 | 226 | if ( ECC_CurveLUT[i].x ) curveNumbers.insert(*ECC_CurveLUT[i].x); |
406 | 226 | if ( ECC_CurveLUT[i].y ) curveNumbers.insert(*ECC_CurveLUT[i].y); |
407 | 226 | if ( ECC_CurveLUT[i].order_min_1 ) curveNumbers.insert(*ECC_CurveLUT[i].order_min_1); |
408 | 226 | if ( ECC_CurveLUT[i].order ) curveNumbers.insert(*ECC_CurveLUT[i].order); |
409 | 226 | } |
410 | | |
411 | 694 | for (const auto& s : curveNumbers) { |
412 | 694 | cryptofuzz::numbers.push_back(s); |
413 | 694 | } |
414 | 2 | } |
415 | | |
416 | 22 | extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { |
417 | 22 | setOptions(*argc, *argv); |
418 | 22 | addNumbers(); |
419 | | |
420 | 22 | #if !defined(CRYPTOFUZZ_NO_OPENSSL) |
421 | 22 | driver->LoadModule( std::make_shared<cryptofuzz::module::OpenSSL>() ); |
422 | 22 | #endif |
423 | | |
424 | | #if defined(CRYPTOFUZZ_BITCOIN) |
425 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Bitcoin>() ); |
426 | | #endif |
427 | | |
428 | | #if defined(CRYPTOFUZZ_REFERENCE) |
429 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Reference>() ); |
430 | | #endif |
431 | | |
432 | | #if defined(CRYPTOFUZZ_CPPCRYPTO) |
433 | | driver->LoadModule( std::make_shared<cryptofuzz::module::CPPCrypto>() ); |
434 | | #endif |
435 | | |
436 | | #if defined(CRYPTOFUZZ_MBEDTLS) |
437 | | driver->LoadModule( std::make_shared<cryptofuzz::module::mbedTLS>() ); |
438 | | #endif |
439 | | |
440 | | #if defined(CRYPTOFUZZ_BOOST) |
441 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Boost>() ); |
442 | | #endif |
443 | | |
444 | | #if defined(CRYPTOFUZZ_MONERO) |
445 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Monero>() ); |
446 | | #endif |
447 | | |
448 | | #if defined(CRYPTOFUZZ_VERACRYPT) |
449 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Veracrypt>() ); |
450 | | #endif |
451 | | |
452 | | #if defined(CRYPTOFUZZ_LIBSODIUM) |
453 | | driver->LoadModule( std::make_shared<cryptofuzz::module::libsodium>() ); |
454 | | #endif |
455 | | |
456 | | #if defined(CRYPTOFUZZ_LIBTOMCRYPT) |
457 | | driver->LoadModule( std::make_shared<cryptofuzz::module::libtomcrypt>() ); |
458 | | #endif |
459 | | |
460 | | #if defined(CRYPTOFUZZ_CRYPTOPP) |
461 | | driver->LoadModule( std::make_shared<cryptofuzz::module::CryptoPP>() ); |
462 | | #endif |
463 | | |
464 | | #if defined(CRYPTOFUZZ_LIBGCRYPT) |
465 | | driver->LoadModule( std::make_shared<cryptofuzz::module::libgcrypt>() ); |
466 | | #endif |
467 | | |
468 | | #if defined(CRYPTOFUZZ_EVERCRYPT) |
469 | | driver->LoadModule( std::make_shared<cryptofuzz::module::EverCrypt>() ); |
470 | | #endif |
471 | | |
472 | | #if defined(CRYPTOFUZZ_GOLANG) |
473 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Golang>() ); |
474 | | #endif |
475 | | |
476 | | #if defined(CRYPTOFUZZ_RING) |
477 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Ring>() ); |
478 | | #endif |
479 | | |
480 | | #if defined(CRYPTOFUZZ_NSS) |
481 | | driver->LoadModule( std::make_shared<cryptofuzz::module::NSS>() ); |
482 | | #endif |
483 | | |
484 | | #if defined(CRYPTOFUZZ_BOTAN) |
485 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Botan>() ); |
486 | | #endif |
487 | | |
488 | | #if defined(CRYPTOFUZZ_NETTLE) |
489 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Nettle>() ); |
490 | | #endif |
491 | | |
492 | | #if defined(CRYPTOFUZZ_WOLFCRYPT) |
493 | | driver->LoadModule( std::make_shared<cryptofuzz::module::wolfCrypt>() ); |
494 | | #endif |
495 | | |
496 | | #if defined(CRYPTOFUZZ_LIBGMP) |
497 | | driver->LoadModule( std::make_shared<cryptofuzz::module::libgmp>() ); |
498 | | #endif |
499 | | |
500 | | #if defined(CRYPTOFUZZ_BN_JS) |
501 | | driver->LoadModule( std::make_shared<cryptofuzz::module::bn_js>() ); |
502 | | #endif |
503 | | |
504 | | #if defined(CRYPTOFUZZ_CRYPTO_JS) |
505 | | driver->LoadModule( std::make_shared<cryptofuzz::module::crypto_js>() ); |
506 | | #endif |
507 | | |
508 | | #if defined(CRYPTOFUZZ_BIGNUMBER_JS) |
509 | | driver->LoadModule( std::make_shared<cryptofuzz::module::bignumber_js>() ); |
510 | | #endif |
511 | | |
512 | | #if defined(CRYPTOFUZZ_MPDECIMAL) |
513 | | driver->LoadModule( std::make_shared<cryptofuzz::module::mpdecimal>() ); |
514 | | #endif |
515 | | |
516 | | #if defined(CRYPTOFUZZ_LINUX) |
517 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Linux>() ); |
518 | | #endif |
519 | | |
520 | | #if defined(CRYPTOFUZZ_SYMCRYPT) |
521 | | driver->LoadModule( std::make_shared<cryptofuzz::module::SymCrypt>() ); |
522 | | #endif |
523 | | |
524 | | #if defined(CRYPTOFUZZ_LIBTOMMATH) |
525 | | driver->LoadModule( std::make_shared<cryptofuzz::module::libtommath>() ); |
526 | | #endif |
527 | | |
528 | | #if defined(CRYPTOFUZZ_SJCL) |
529 | | driver->LoadModule( std::make_shared<cryptofuzz::module::sjcl>() ); |
530 | | #endif |
531 | | |
532 | | #if defined(CRYPTOFUZZ_WOLFCRYPT_OPENSSL) |
533 | | driver->LoadModule( std::make_shared<cryptofuzz::module::wolfCrypt_OpenSSL>() ); |
534 | | #endif |
535 | | |
536 | | #if defined(CRYPTOFUZZ_MONOCYPHER) |
537 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Monocypher>() ); |
538 | | #endif |
539 | | |
540 | | #if defined(CRYPTOFUZZ_SECP256K1) |
541 | | driver->LoadModule( std::make_shared<cryptofuzz::module::secp256k1>() ); |
542 | | #endif |
543 | | |
544 | | #if defined(CRYPTOFUZZ_RUST_LIBSECP256K1) |
545 | | driver->LoadModule( std::make_shared<cryptofuzz::module::rust_libsecp256k1>() ); |
546 | | #endif |
547 | | |
548 | | #if defined(CRYPTOFUZZ_TREZOR_FIRMWARE) |
549 | | driver->LoadModule( std::make_shared<cryptofuzz::module::trezor_firmware>() ); |
550 | | #endif |
551 | | |
552 | | #if defined(CRYPTOFUZZ_ELLIPTIC) |
553 | | driver->LoadModule( std::make_shared<cryptofuzz::module::elliptic>() ); |
554 | | #endif |
555 | | |
556 | | #if defined(CRYPTOFUZZ_DECRED) |
557 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Decred>() ); |
558 | | #endif |
559 | | |
560 | | #if defined(CRYPTOFUZZ_BEARSSL) |
561 | | driver->LoadModule( std::make_shared<cryptofuzz::module::BearSSL>() ); |
562 | | #endif |
563 | | |
564 | | #if defined(CRYPTOFUZZ_MICRO_ECC) |
565 | | driver->LoadModule( std::make_shared<cryptofuzz::module::micro_ecc>() ); |
566 | | #endif |
567 | | |
568 | | #if defined(CRYPTOFUZZ_CIFRA) |
569 | | driver->LoadModule( std::make_shared<cryptofuzz::module::cifra>() ); |
570 | | #endif |
571 | | |
572 | | #if defined(CRYPTOFUZZ_RELIC) |
573 | | driver->LoadModule( std::make_shared<cryptofuzz::module::relic>() ); |
574 | | #endif |
575 | | |
576 | | #if defined(CRYPTOFUZZ_LIBECC) |
577 | | driver->LoadModule( std::make_shared<cryptofuzz::module::libecc>() ); |
578 | | #endif |
579 | | |
580 | | #if defined(CRYPTOFUZZ_CHIA_BLS) |
581 | | driver->LoadModule( std::make_shared<cryptofuzz::module::chia_bls>() ); |
582 | | #endif |
583 | | |
584 | | #if defined(CRYPTOFUZZ_K256) |
585 | | driver->LoadModule( std::make_shared<cryptofuzz::module::k256>() ); |
586 | | #endif |
587 | | |
588 | | #if defined(CRYPTOFUZZ_SCHNORRKEL) |
589 | | driver->LoadModule( std::make_shared<cryptofuzz::module::schnorrkel>() ); |
590 | | #endif |
591 | | |
592 | | #if defined(CRYPTOFUZZ_NOBLE_SECP256K1) |
593 | | driver->LoadModule( std::make_shared<cryptofuzz::module::noble_secp256k1>() ); |
594 | | #endif |
595 | | |
596 | | #if defined(CRYPTOFUZZ_BLST) |
597 | | driver->LoadModule( std::make_shared<cryptofuzz::module::blst>() ); |
598 | | #endif |
599 | | |
600 | | #if defined(CRYPTOFUZZ_MCL) |
601 | | driver->LoadModule( std::make_shared<cryptofuzz::module::mcl>() ); |
602 | | #endif |
603 | | |
604 | | #if defined(CRYPTOFUZZ_PY_ECC) |
605 | | driver->LoadModule( std::make_shared<cryptofuzz::module::py_ecc>() ); |
606 | | #endif |
607 | | |
608 | | #if defined(CRYPTOFUZZ_KILIC_BLS12_381) |
609 | | driver->LoadModule( std::make_shared<cryptofuzz::module::kilic_bls12_381>() ); |
610 | | #endif |
611 | | |
612 | | #if defined(CRYPTOFUZZ_NOBLE_ED25519) |
613 | | driver->LoadModule( std::make_shared<cryptofuzz::module::noble_ed25519>() ); |
614 | | #endif |
615 | | |
616 | | #if defined(CRYPTOFUZZ_NOBLE_BLS12_381) |
617 | | driver->LoadModule( std::make_shared<cryptofuzz::module::noble_bls12_381>() ); |
618 | | #endif |
619 | | |
620 | | #if defined(CRYPTOFUZZ_SCHNORR_FUN) |
621 | | driver->LoadModule( std::make_shared<cryptofuzz::module::schnorr_fun>() ); |
622 | | #endif |
623 | | |
624 | | #if defined(CRYPTOFUZZ_QUICKJS) |
625 | | driver->LoadModule( std::make_shared<cryptofuzz::module::quickjs>() ); |
626 | | #endif |
627 | | |
628 | | #if defined(CRYPTOFUZZ_UINT128_T) |
629 | | driver->LoadModule( std::make_shared<cryptofuzz::module::uint128_t>() ); |
630 | | #endif |
631 | | |
632 | | #if defined(CRYPTOFUZZ_LIBFF) |
633 | | driver->LoadModule( std::make_shared<cryptofuzz::module::_libff>() ); |
634 | | #endif |
635 | | |
636 | | #if defined(CRYPTOFUZZ_GNARK_BN254) |
637 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Gnark_bn254>() ); |
638 | | #endif |
639 | | |
640 | | #if defined(CRYPTOFUZZ_GOOGLE_BN256) |
641 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Google_bn256>() ); |
642 | | #endif |
643 | | |
644 | | #if defined(CRYPTOFUZZ_CLOUDFLARE_BN256) |
645 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Cloudflare_bn256>() ); |
646 | | #endif |
647 | | |
648 | | #if defined(CRYPTOFUZZ_NOBLE_HASHES) |
649 | | driver->LoadModule( std::make_shared<cryptofuzz::module::noble_hashes>() ); |
650 | | #endif |
651 | | |
652 | | #if defined(CRYPTOFUZZ_SKALE_SOLIDITY) |
653 | | driver->LoadModule( std::make_shared<cryptofuzz::module::SkaleSolidity>() ); |
654 | | #endif |
655 | | |
656 | | #if defined(CRYPTOFUZZ_GOOGLE_INTEGERS) |
657 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Google_Integers>() ); |
658 | | #endif |
659 | | |
660 | | #if defined(CRYPTOFUZZ_NIMCRYPTO) |
661 | | driver->LoadModule( std::make_shared<cryptofuzz::module::nimcrypto>() ); |
662 | | #endif |
663 | | |
664 | | #if defined(CRYPTOFUZZ_RUSTCRYPTO) |
665 | | driver->LoadModule( std::make_shared<cryptofuzz::module::rustcrypto>() ); |
666 | | #endif |
667 | | |
668 | | #if defined(CRYPTOFUZZ_NUM_BIGINT) |
669 | | driver->LoadModule( std::make_shared<cryptofuzz::module::num_bigint>() ); |
670 | | #endif |
671 | | |
672 | | #if defined(CRYPTOFUZZ_INTX) |
673 | | driver->LoadModule( std::make_shared<cryptofuzz::module::intx>() ); |
674 | | #endif |
675 | | |
676 | | #if defined(CRYPTOFUZZ_DECRED_UINT256) |
677 | | driver->LoadModule( std::make_shared<cryptofuzz::module::decred_uint256>() ); |
678 | | #endif |
679 | | |
680 | | #if defined(CRYPTOFUZZ_LIBDIVIDE) |
681 | | driver->LoadModule( std::make_shared<cryptofuzz::module::libdivide>() ); |
682 | | #endif |
683 | | |
684 | | #if defined(CRYPTOFUZZ_RUST_UINT) |
685 | | driver->LoadModule( std::make_shared<cryptofuzz::module::rust_uint>() ); |
686 | | #endif |
687 | | |
688 | | #if defined(CRYPTOFUZZ_BC) |
689 | | driver->LoadModule( std::make_shared<cryptofuzz::module::bc>() ); |
690 | | #endif |
691 | | |
692 | | #if defined(CRYPTOFUZZ_JAVA) |
693 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Java>() ); |
694 | | #endif |
695 | | |
696 | | #if defined(CRYPTOFUZZ_SOLIDITY_MATH) |
697 | | driver->LoadModule( std::make_shared<cryptofuzz::module::SolidityMath>() ); |
698 | | #endif |
699 | | |
700 | | #if defined(CRYPTOFUZZ_V8) |
701 | | driver->LoadModule( std::make_shared<cryptofuzz::module::V8>() ); |
702 | | #endif |
703 | | |
704 | | #if defined(CRYPTOFUZZ_CIRCL) |
705 | | driver->LoadModule( std::make_shared<cryptofuzz::module::circl>() ); |
706 | | #endif |
707 | | |
708 | | #if defined(CRYPTOFUZZ_SPL_MATH) |
709 | | driver->LoadModule( std::make_shared<cryptofuzz::module::spl_math>() ); |
710 | | #endif |
711 | | |
712 | | #if defined(CRYPTOFUZZ_ZIG) |
713 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Zig>() ); |
714 | | #endif |
715 | | |
716 | | #if defined(CRYPTOFUZZ_PRYSMATICLABS_HASHTREE) |
717 | | driver->LoadModule( std::make_shared<cryptofuzz::module::prysmaticlabs_hashtree>() ); |
718 | | #endif |
719 | | |
720 | | #if defined(CRYPTOFUZZ_STARKWARE) |
721 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Starkware>() ); |
722 | | #endif |
723 | | |
724 | | #if defined(CRYPTOFUZZ_PORNIN_BINGCD) |
725 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Pornin_BinGCD>() ); |
726 | | #endif |
727 | | |
728 | | #if defined(CRYPTOFUZZ_STINT) |
729 | | driver->LoadModule( std::make_shared<cryptofuzz::module::stint>() ); |
730 | | #endif |
731 | | |
732 | | #if defined(CRYPTOFUZZ_KRYPTOLOGY) |
733 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Kryptology>() ); |
734 | | #endif |
735 | | |
736 | | #if defined(CRYPTOFUZZ_NIM_BIGINTS) |
737 | | driver->LoadModule( std::make_shared<cryptofuzz::module::nim_bigints>() ); |
738 | | #endif |
739 | | |
740 | | #if defined(CRYPTOFUZZ_HOLIMAN_UINT256) |
741 | | driver->LoadModule( std::make_shared<cryptofuzz::module::holiman_uint256>() ); |
742 | | #endif |
743 | | |
744 | | #if defined(CRYPTOFUZZ_CPU) |
745 | | driver->LoadModule( std::make_shared<cryptofuzz::module::CPU>() ); |
746 | | #endif |
747 | | |
748 | | #if defined(CRYPTOFUZZ_GETH) |
749 | | driver->LoadModule( std::make_shared<cryptofuzz::module::Geth>() ); |
750 | | #endif |
751 | | |
752 | | #if defined(CRYPTOFUZZ_JSBN) |
753 | | driver->LoadModule( std::make_shared<cryptofuzz::module::jsbn>() ); |
754 | | #endif |
755 | | |
756 | | #if defined(CRYPTOFUZZ_WIDE_INTEGER) |
757 | | driver->LoadModule( std::make_shared<cryptofuzz::module::wide_integer>() ); |
758 | | #endif |
759 | | |
760 | | #if defined(CRYPTOFUZZ_TINY_KECCAK) |
761 | | driver->LoadModule( std::make_shared<cryptofuzz::module::tiny_keccak>() ); |
762 | | #endif |
763 | | |
764 | | /* TODO check if options.forceModule (if set) refers to a module that is |
765 | | * actually loaded, warn otherwise. |
766 | | */ |
767 | 22 | return 0; |
768 | 22 | } |
769 | | |
770 | 81.3k | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
771 | 81.3k | driver->Run(data, size); |
772 | | |
773 | 81.3k | return 0; |
774 | 81.3k | } |