Jacob Appelbaum | adaa788 | 2012-07-31 00:19:22 -0700 | [diff] [blame] | 1 | Please feel free to contribute patches; here are the basic guidelines to hack |
| 2 | along with us! |
| 3 | |
| 4 | Please work from a git tree by cloning the repo: |
| 5 | |
| 6 | git clone https://github.com/ioerror/tlsdate.git |
| 7 | |
| 8 | Please file bugs on the tlsdate issue tracker: |
| 9 | |
| 10 | https://github.com/ioerror/tlsdate/issues |
| 11 | |
| 12 | Please use the github pull request feature when possible. |
| 13 | |
| 14 | White Space: |
| 15 | |
| 16 | Spaces only, no tabs; all tabs must die |
| 17 | No stray spaces at the end of lines |
| 18 | Generally try not to add excessive empty white space |
| 19 | |
| 20 | Documentation: |
| 21 | |
| 22 | Document all functions with doxygen style comments |
| 23 | |
| 24 | Ensuring Correctness: |
| 25 | |
| 26 | Test your patches and ensure: |
| 27 | |
| 28 | No compiler warnings or errors |
| 29 | No linker warnings or errors |
| 30 | |
| 31 | Test your improved copy of tlsdate extensively |
| 32 | |
Jacob Appelbaum | 0bd77a0 | 2012-07-31 00:55:37 -0700 | [diff] [blame] | 33 | Security: |
| 34 | |
| 35 | tlsdate is security sensitive - please consider where you add code and in |
| 36 | what context it will run. When possible, run with the least privilege as is |
| 37 | possible. |
| 38 | |
Jacob Appelbaum | adaa788 | 2012-07-31 00:19:22 -0700 | [diff] [blame] | 39 | Proactively find bugs: |
| 40 | |
| 41 | Run your copy of tlsdate under valgrind |
| 42 | |
| 43 | Weird but meaningful conventions are prefered in tlsdate. We prefer attention |
| 44 | to detail: |
| 45 | |
| 46 | if ( NULL == foo (void) ) |
| 47 | { |
| 48 | bar (void); |
| 49 | } |
| 50 | |
| 51 | Over quick, hard to read and potentilly incorrect: |
| 52 | |
| 53 | if (foo(void)==NULL)) |
| 54 | bar(); |
| 55 | |
Jacob Appelbaum | 0bd77a0 | 2012-07-31 00:55:37 -0700 | [diff] [blame] | 56 | Define magic numbers and explain their origin: |
| 57 | |
| 58 | // As taken from RFC 3.14 |
| 59 | #define MAGIC_NUMBER 23 // This goes in foo.h |
| 60 | ptr = malloc (MAGIC_NUMBER); |
| 61 | |
| 62 | Rather than just throwing them about in code: |
| 63 | |
| 64 | ptr = malloc (23); |
| 65 | |
| 66 | It is almost always prefered to use dynamically allocated memory: |
| 67 | |
| 68 | widget_ptr = malloc (WIDGET_SIZE); |
| 69 | |
| 70 | Try to avoid static allocations like the following: |
| 71 | |
| 72 | char widget[WIDGET_SIZE]; |
| 73 | |
Jacob Appelbaum | 1c064ab | 2012-11-05 17:40:31 -0500 | [diff] [blame] | 74 | Try to use unsigned values unless an API requires signed values: |
| 75 | |
| 76 | uint32_t server_time_s; |
| 77 | |
Jacob Appelbaum | adaa788 | 2012-07-31 00:19:22 -0700 | [diff] [blame] | 78 | Please provide relevant CHANGELOG entries for all changes. |
Jacob Appelbaum | 0bd77a0 | 2012-07-31 00:55:37 -0700 | [diff] [blame] | 79 | Please remove items from the TODO file as they are completed. |
Jacob Appelbaum | 6cb4b8b | 2012-07-31 00:43:20 -0700 | [diff] [blame] | 80 | Please provide unittest cases. |
Jacob Appelbaum | adaa788 | 2012-07-31 00:19:22 -0700 | [diff] [blame] | 81 | |
| 82 | When submitting patches via email, please use `git format-patch` to format |
| 83 | patches: |
| 84 | |
| 85 | git format-patch 9a61fcba9bebc3fa2d91c9f79306bf316c59cbcc |
| 86 | |
| 87 | Email patches with a GnuPG signature whenever possible. |
| 88 | |
| 89 | When applying patches, please use `git am` to apply patches: |
| 90 | |
| 91 | git am -i 0001-add-TODO-item.patch |
| 92 | |
| 93 | If `git format-patch` is not possible, please send a unified diff. |
| 94 | |
| 95 | When in doubt, please consult the Tor HACKING guide: |
| 96 | |
| 97 | https://gitweb.torproject.org/tor.git/blob/HEAD:/doc/HACKING |
| 98 | |