1 FreeBSD maintainer's guide to OpenSSL
2 =====================================
4 These instructions assume you have a clone of the FreeBSD git repo
5 main branch in src/freebsd/main, and will store vendor trees under
6 src/freebsd/vendor/. In addition, this assumes there is a "freebsd"
7 origin pointing to git(repo).freebsd.org/src.git.
9 01) Switch to the vendor branch:
12 $ git worktree add ../vendor/openssl-X.Y freebsd/vendor/openssl-X.Y
13 $ cd ../vendor/openssl-X.Y
15 02) Download the latest OpenSSL tarball and signature from the official
16 website (https://www.openssl.org/source/).
18 $ (cd .. && fetch https://openssl.org/source/openssl-X.Y.Z.tar.gz)
19 $ (cd .. && fetch https://openssl.org/source/openssl-X.Y.Z.tar.gz.asc)
21 03) Verify the signature:
23 $ gpg --verify ../openssl-X.Y.Z.tar.gz.asc ../openssl-X.Y.Z.tar.gz
25 04) Unpack the OpenSSL tarball to the parent directory:
27 $ tar -x -X FREEBSD-Xlist -f ../openssl-X.Y.Z.tar.gz -C ..
29 05) Copy to the vendor branch:
31 $ rsync --exclude FREEBSD.* --delete -av ../openssl-X.Y.Z/* .
33 06) Take care of added / deleted files:
39 $ git commit -m "openssl: Vendor import of OpenSSL X.Y.Z"
43 $ git tag -a -m "Tag OpenSSL X.Y.Z" vendor/openssl/X.Y.Z
45 At this point the vendor branch can be pushed to the FreeBSD repo via:
47 $ git push freebsd vendor/openssl-X.Y
48 $ git push freebsd vendor/openssl/X.Y.Z
50 Note the second "git push" command is used to push the tag, which is
51 not pushed by default.
53 It is also possible to push the branch and tag together, but use
54 --dry-run first to ensure that no undesired tags will be pushed:
56 $ git push --dry-run --follow-tags freebsd vendor/openssl-X.Y
57 $ git push --follow-tags freebsd vendor/openssl-X.Y
59 The update and tag could instead be pushed later, along with the merge
60 to main, but pushing now allows others to collaborate.
62 09) Merge from the vendor branch:
64 $ git subtree merge -P crypto/openssl vendor/openssl-X.Y
66 A number of files have been deleted from FreeBSD's copy of OpenSSL.
67 If git prompts for these deleted files during the merge, choose 'd'
68 (leaving them deleted).
70 10) Resolve conflicts. Remember to bump the version and date in
71 secure/lib/libcrypto/Makefile.inc and
72 crypto/openssl/include/openssl/opensslv.h.
74 11) Diff against the vendor branch:
76 $ git diff --diff-filter=M vendor/openssl/X.Y.Z HEAD:crypto/openssl
78 Review the diff for any unexpected changes.
80 12) Re-generate the assembly files:
82 $ cd secure/lib/libcrypto
83 $ make cleanasm buildasm
85 13) Update the appropriate makefiles to reflect changes in the vendor's
86 build.info files. This is especially important if source files have
87 been added or removed. Keep in mind that the assembly files generated
88 belong to sys/crypto/openssl, and will therefore affect the kernel as
91 14) If symbols have been added or removed, update the appropriate
92 Version.map to reflect these changes.
94 15) Compare compilation flags, the list of files built and included, the
95 list of symbols generated with the corresponding port if available.
97 16) Re-generate the manual files:
99 $ tar xzf openssl-X.Y.Z.tar.gz
100 $ (cd openssl-X.Y.Z && ./Configure --prefix=/usr --openssldir=/etc/ssl &&
103 $ find openssl-X.Y.Z/doc/man/man1 -name '*.1' -exec cp {} secure/usr.bin/openssl/man/ \;
104 $ find openssl-X.Y.Z/doc/man/man3 -name '*.3' -exec cp {} secure/lib/libcrypto/man/man3/ \;
105 $ find openssl-X.Y.Z/doc/man/man5 -name '*.5' -exec cp {} secure/lib/libcrypto/man/man5/ \;
106 $ find openssl-X.Y.Z/doc/man/man7 -name '*.7' -exec cp {} secure/lib/libcrypto/man/man7/ \;
107 $ grep -nrF usr/local secure/lib/libcrypto/man secure/usr.bin/openssl/man
108 [correct the references to the prefix and OpenSSL directories]
109 $ git commit --amend secure/lib/libcrypto/man secure/usr.bin/openssl/man
111 Review the diff and tree status for anything requiring attention.
113 16) Build and install world, reboot, test.
115 17) Test the legacy and fips providers as well: (here with "test" as the password)
117 $ echo test | openssl rc4 -provider legacy -e -a -pbkdf2
118 enter RC4 encryption password:
119 Verifying - enter RC4 encryption password:
120 U2FsdGVkX1+JvhqxLMOvlxvTi1/h
122 # openssl fipsinstall -out /etc/ssl/fipsmodule.cnf -module /usr/lib/ossl-modules/fips.so
124 # vi /etc/ssl/openssl.cnf
125 [enable the FIPS module]
126 # echo test | openssl aes-256-cbc -provider fips -e -a -pbkdf2
127 U2FsdGVkX19lTexiYsnMX83ZLSojBOFwv7GB0Plhgmw=
129 18) Commit and hope you did not miss anything.