Skip to content

Commit

Permalink
CONTRIBUTING: add some coding and style conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasnick committed Oct 18, 2023
1 parent f0a8402 commit afd9e4a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ Chat history logs can be found at https://gnusha.org/secp256k1/.

The Contributor Workflow & Peer Review in libsecp256k1 are similar to Bitcoin Core's workflow and review processes described in Core's [CONTRIBUTING.md](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md).

### Coding Conventions

In addition, libsecp256 tries to maintain the following coding conventions:

- No runtime heap allocation (e.g., no `malloc`).
- The tests should cover all lines and branches of the library (see [Test coverage](#test-coverage)).
- Operations involving secret data should be tested for being constant time with respect to the secrets (see [src/ctime_tests.c](src/ctime_tests.c)).
- Local variables containing secret data should be cleared explicitly to try to delete secrets from memory.
- Use `secp256k1_memcmp_var` instead of `memcmp` (see [#823](https://github.com/bitcoin-core/secp256k1/issues/823)).

#### Style Conventions

- Commits should be atomic and diffs should be easy to read. For this reason, do not mix any formatting fixes or code moves with actual code changes. Make sure each individual commit is hygienic: that it builds successfully on its own without warnings, errors, regressions, or test failures.
- Use `void *ptr` instead of `void* ptr`.
- Avoid trailing whitespaces.

### Test coverage

This library aims to have full coverage of the reachable lines and branches.
Expand Down

0 comments on commit afd9e4a

Please sign in to comment.