Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Add libfuzzer integration for libsignal-protocol-c #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ddworken
Copy link

👋 I saw #136 and was wondering whether y'all would be interested in adding support for continuous fuzzing for this library. I went ahead and made a quick prototype of how it would look just as a jumping off point to start the discussion.

Now building and running the tests will create a new fuzzer target that fuzzes deserialization and decryption with libfuzzer. As part of ctest this will automatically run for 2048 iterations (takes 3 seconds on my computer) in order to ensure that the fuzzer stays up to date. The fuzzer can also be run manually in order to fuzz for more iterations.

I've run this fuzzer for ~10 million iterations on my own computer and have not found anything yet. But, my ultimate goal would be to integrate this repository with OSSFuzz per #136.

Note that tests/fuzzing_corpus/ includes an initial corpus for fuzzing so that the fuzzer has somewhere to start. This was seeded with a couple of valid serialized ciphertexts but the majority of it was synthesized by the fuzzer over time.

Now building and running the tests will create a new `fuzzer` target that
fuzzes deserialization and decryption with libfuzzer. As part of ctest
this will automatically run for 2048 iterations (takes 3 seconds on my
computer) in order to ensure that the fuzzer stays up to date. The fuzzer
can be run manually in order to fuzz for more iterations.

I've run this fuzzer for ~10 million iterations on my own computer and have
not found anything yet. But, my ultimate goal with this PR is to integrate
this repository with OSSFuzz per signalapp#136.

Note that tests/fuzzing_corpus/ includes an initial corpus for fuzzing so
that the fuzzer has somewhere to start. This was seeded with a couple of
valid serialized ciphertexts but the majority of it was synthesized by the
fuzzer over time.
@ddworken
Copy link
Author

@dkonigsberg for thoughts?

@@ -169,7 +170,7 @@ void setup_test_store_context(signal_protocol_store_context **context, signal_co

signal_protocol_store_context *store_context = 0;
result = signal_protocol_store_context_create(&store_context, global_context);
ck_assert_int_eq(result, 0);
assert(result == 0);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapped to assert in this one case so that this setup function can be used by the fuzzer which is not running as part of a check test suite.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant