Bundle Protocol Security (RFC 9172) - authentication and encryption for DTN
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): add gen_corpus.ml to all fuzz directories for E718

Add seed corpus generators with representative test data for:
ocaml-aos, ocaml-block, ocaml-bloom, ocaml-bpsec, ocaml-bundle,
ocaml-cfdp, ocaml-cgr, ocaml-clcw, ocaml-cookeio, ocaml-cpio

+37
+5
fuzz/dune
··· 14 14 (deps fuzz_bpsec.exe) 15 15 (action 16 16 (echo "AFL fuzzer built: %{exe:fuzz_bpsec.exe}\n"))) 17 + 18 + (executable 19 + (name gen_corpus) 20 + (modules gen_corpus) 21 + (libraries unix))
+32
fuzz/gen_corpus.ml
··· 1 + (** Generate seed corpus for fuzz testing. *) 2 + 3 + let () = 4 + (try Unix.mkdir "corpus" 0o755 5 + with Unix.Unix_error (Unix.EEXIST, _, _) -> ()); 6 + let write name data = 7 + let oc = open_out_bin (Filename.concat "corpus" name) in 8 + output_string oc data; 9 + close_out oc 10 + in 11 + (* CBOR-encoded security block samples. 12 + BPSec security blocks are CBOR arrays per RFC 9172. *) 13 + (* Empty CBOR array: 0x80 *) 14 + write "seed_000" "\x80"; 15 + (* CBOR array with 5 elements (typical security block structure): 16 + [targets, context_id, context_flags, source, parameters, results] 17 + Minimal: [[1], 1, 0, [1,0], [[]], [[]]] *) 18 + (* targets=[1], context_id=1 (BIB-HMAC-SHA2), flags=0, source=dtn:none=[1,0] *) 19 + write "seed_001" "\x86\x81\x01\x01\x00\x82\x01\x00\x80\x81\x80"; 20 + (* targets=[1], context_id=2 (BCB-AES-GCM), flags=1, source=dtn:none *) 21 + write "seed_002" "\x86\x81\x01\x02\x01\x82\x01\x00\x80\x81\x80"; 22 + (* Truncated CBOR - exercises error paths *) 23 + write "seed_003" "\x86\x81"; 24 + (* Invalid CBOR *) 25 + write "seed_004" "\xFF"; 26 + (* CBOR unsigned integer 0 *) 27 + write "seed_005" "\x00"; 28 + (* Nested CBOR array *) 29 + write "seed_006" "\x82\x81\x01\x82\x02\x03"; 30 + (* CBOR indefinite-length array *) 31 + write "seed_007" "\x9F\x01\x02\x03\xFF"; 32 + print_endline "gen_corpus: wrote 8 bpsec seed files"