xref: /freebsd/crypto/openssl/HACKING.md (revision 4b15965daa99044daf184221b7c283bf7f2d7e66)
1MODIFYING OPENSSL SOURCE
2========================
3
4This document describes the way to add custom modifications to OpenSSL
5sources.
6
7If you are adding new C source files
8------------------------------------
9
10Please update the `build.info` files in the directories where you placed the
11C source files, to include a line like this for each new C source file:
12
13-   In `crypto/` or any of its subdirectories (intended for `libcrypto`):
14
15        SOURCE[../libcrypto]={name-of-C-source-file}
16
17-   In `ssl/` or any of its subdirectories (intended for `libssl`):
18
19        SOURCE[../libssl]={name-of-C-source-file}
20
21Do note that the path given as the `SOURCE` attribute must be adapted
22appropriately for the location of the `build.info` file, as it's a relative
23path to where the library itself is built, for example:
24
25-   For `crypto/build.info`, the library path should be `../libcrypto`
26-   For `crypto/evp/build.info`, the library path should be
27    `../../libcrypto`
28-   For `ssl/build.info`, the library path should be `../libssl`
29-   For `ssl/quic/build.info`, the library path should be `../../libssl`
30
31To know more about `build.info` files, please read [doc/internal/man7/build.info.pod].
32For better viewing, consider converting it to HTML or PDF using `pod2html`
33or `pod2pdf`.
34
35Adding new public functions
36---------------------------
37
38If you are adding new public functions to the custom library build, you need to
39either add a prototype in one of the existing OpenSSL header files, or
40provide a new header file and edit.
41
42Only headers in the `include/openssl` subdirectory are considered for public
43functions.  If you're creating a new header file, it must be located in that
44directory.
45
46Functions declared in `include/openssl` header files are assumed to be part
47of the `libcrypto` library unless specified otherwise.  *If your new
48functions are meant for the `libssl` library*, you will need to edit
49[Configurations/unix-Makefile.tmpl] and add the header file name in the
50array `my @sslheaders_tmpl`.
51
52Updating OpenSSL's bookkeeping files
53------------------------------------
54
55OpenSSL has a few bookkeeping files to keep track of exposed functions, most
56importantly `util/libcrypto.num` and `util/libssl.num`.  Any time a new
57public function - as defined above - is added, these files must be updated.
58
59To make such an update, please do the following:
60
61    ./Configure -Werror --strict-warnings [your-options]
62    make update
63
64If you plan to submit the changes you made to OpenSSL (see
65[CONTRIBUTING.md]), it's also worth running the following after running
66`make update`, to ensure that documentation has correct format.
67
68    make doc-nits
69
70Do note that `make update` also generates files related to OIDs (in the
71`crypto/objects/`  folder) and errors messages.
72
73If a git merge error occurs in one of these generated files, then the
74generated files need to be removed and regenerated using `make update`.
75To aid in this process, the generated files can be committed separately
76so they can be removed easily by reverting that commit.
77
78[doc/internal/man7/build.info.pod]: ./doc/internal/man7/build.info.pod
79[Configurations/unix-Makefile.tmpl]: ./Configurations/unix-Makefile.tmpl
80[CONTRIBUTING.md]: ./CONTRIBUTING.md
81