blob: 09754a7846516ba2d411eaac96f3bf5d970f537e [file] [log] [blame]
Jacob Appelbaumadaa7882012-07-31 00:19:22 -07001Please feel free to contribute patches; here are the basic guidelines to hack
2along with us!
3
4Please work from a git tree by cloning the repo:
5
6 git clone https://github.com/ioerror/tlsdate.git
7
8Please file bugs on the tlsdate issue tracker:
9
10 https://github.com/ioerror/tlsdate/issues
11
12Please use the github pull request feature when possible.
13
14White 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
20Documentation:
21
22 Document all functions with doxygen style comments
23
24Ensuring 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 Appelbaum0bd77a02012-07-31 00:55:37 -070033Security:
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 Appelbaumadaa7882012-07-31 00:19:22 -070039Proactively find bugs:
40
41 Run your copy of tlsdate under valgrind
42
43Weird but meaningful conventions are prefered in tlsdate. We prefer attention
44to detail:
45
46 if ( NULL == foo (void) )
47 {
48 bar (void);
49 }
50
51Over quick, hard to read and potentilly incorrect:
52
53 if (foo(void)==NULL))
54 bar();
55
Jacob Appelbaum0bd77a02012-07-31 00:55:37 -070056Define 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
62Rather than just throwing them about in code:
63
64 ptr = malloc (23);
65
66It is almost always prefered to use dynamically allocated memory:
67
68 widget_ptr = malloc (WIDGET_SIZE);
69
70Try to avoid static allocations like the following:
71
72 char widget[WIDGET_SIZE];
73
Jacob Appelbaum1c064ab2012-11-05 17:40:31 -050074Try to use unsigned values unless an API requires signed values:
75
76 uint32_t server_time_s;
77
Jacob Appelbaumadaa7882012-07-31 00:19:22 -070078Please provide relevant CHANGELOG entries for all changes.
Jacob Appelbaum0bd77a02012-07-31 00:55:37 -070079Please remove items from the TODO file as they are completed.
Jacob Appelbaum6cb4b8b2012-07-31 00:43:20 -070080Please provide unittest cases.
Jacob Appelbaumadaa7882012-07-31 00:19:22 -070081
82When submitting patches via email, please use `git format-patch` to format
83patches:
84
85 git format-patch 9a61fcba9bebc3fa2d91c9f79306bf316c59cbcc
86
87Email patches with a GnuPG signature whenever possible.
88
89When applying patches, please use `git am` to apply patches:
90
91 git am -i 0001-add-TODO-item.patch
92
93If `git format-patch` is not possible, please send a unified diff.
94
95When in doubt, please consult the Tor HACKING guide:
96
97 https://gitweb.torproject.org/tor.git/blob/HEAD:/doc/HACKING
98