Page MenuHomeFreeBSD
Paste P675

FreeBSD-upgrade.md.html
ActivePublic

Authored by ngie on Sun, Oct 19, 7:51 AM.
Tags
None
Referenced Files
F132718395: Command-Line Input
Sun, Oct 19, 7:51 AM
Subscribers
None
<h1>FreeBSD maintainer's guide to OpenSSL</h1>
<h2>Assumptions</h2>
<p>These instructions assume the following:
- A git clone of FreeBSD will be available at <code>$GIT_ROOT/src/freebsd/main</code> with
an origin named <code>freebsd</code>. Example:
<code>
git clone -o freebsd git@gitrepo.freebsd.org:src.git "$GIT_ROOT/src/freebsd/main"
</code>
- The vendor trees will be stored under <code>$GIT_ROOT/src/freebsd/vendor/</code>.</p>
<h2>Software requirements</h2>
<p>The following additional software must be installed from ports:</p>
<ul>
<li>lang/perl5</li>
<li>lang/python</li>
<li>net/rsync</li>
<li>security/gnupg</li>
</ul>
<h2>Warning</h2>
<p>This is a long and complicated process, in part because OpenSSL is a large,
complex, and foundational software component in the FreeBSD distribution. A
lot of the overall process has been automated to reduce potential human error,
but some rough edges still exist. These rough edges have been highlighted in
the directions.</p>
<h2>Process</h2>
<h3>Notes</h3>
<p>The following directions use X.Y.Z to describe the major, minor, subminor
versions, respectively for the OpenSSL release. Please substitute the values as
appropriate in the directions below.</p>
<p>All single commands are prefixed with <code>%</code>.</p>
<h3>Variables</h3>
<p><code>
% OPENSSL_VER_MAJOR_MINOR=X.Y
% OPENSSL_VER_FULL=X.Y.Z
% RELEASE_TARFILE="openssl-${OPENSSL_VER_FULL}.tar.gz"
% BASE_URL="https://github.com/openssl/openssl/releases/download/openssl-${OPENSSL_VER_FULL}/${RELEASE_TARFILE}"
</code></p>
<h3>Switch to the vendor branch</h3>
<p><code>
% cd "$GIT_ROOT/src/freebsd/main"
% git worktree add -b vendor/openssl-${OPENSSL_VER_MAJOR_MINOR} \
../vendor/openssl-${OPENSSL_VER_MAJOR_MINOR} \
freebsd/vendor/openssl-${OPENSSL_VER_MAJOR_MINOR}
% cd "$GIT_ROOT/src/freebsd/vendor/openssl-${OPENSSL_VER_MAJOR_MINOR}
</code></p>
<h3>Download the latest OpenSSL release</h3>
<p>The following instructions demonstrate how to fetch a recent OpenSSL release
and its corresponding artifacts (release SHA256 checksum; release PGP
signature) from the <a href="https://www.openssl.org/source/">official website</a>.</p>
<p><code>
% (cd .. &amp;&amp; fetch ${BASE_URL} ${BASE_URL}.asc ${BASE_URL}.sha256)
</code></p>
<h3>Verify the release authenticity and integrity</h3>
<p><strong>NOTE</strong>: this step requires importing the project author's PGP keys beforehand.
See the <a href="https://openssl-library.org/source/">sources webpage</a> for more
details.</p>
<p>This step uses the PGP signature and SHA256 checksum files to verify the release
authenticity and integrity, respectively.</p>
<p><code>
% (cd .. &amp;&amp; sha256sum -c ${RELEASE_TARFILE}.sha256)
% (cd .. &amp;&amp; gpg --verify ${RELEASE_TARFILE}.asc)
</code></p>
<h3>Unpack the OpenSSL tarball to the parent directory</h3>
<p><code>
% (cd .. &amp;&amp; tar xf ../${RELEASE_TARFILE})
</code></p>
<h3>Update the sources in the vendor branch</h3>
<p><strong>IMPORTANT</strong>: the trailing slash in the source directory is required!</p>
<p><code>
% rsync --exclude .git --delete -av ../openssl-${OPENSSL_VER_FULL}/ .
</code></p>
<h3>Take care of added / deleted files</h3>
<p><code>
% git add -A
</code></p>
<h3>Commit, tag, and push</h3>
<p><code>
% git commit -m "openssl: Vendor import of OpenSSL ${OPENSSL_VER_FULL}"
% git tag -a -m "Tag OpenSSL ${OPENSSL_VER_FULL}" vendor/openssl/${OPENSSL_VER_FULL}
</code></p>
<p>The update and tag could instead be pushed later, along with the merge
to main, but pushing now allows others to collaborate.</p>
<h4>Push branch update and tag separately</h4>
<p>At this point the vendor branch can be pushed to the FreeBSD repo via:
<code>
% git push freebsd vendor/openssl-${OPENSSL_VER_MAJOR_MINOR}
% git push freebsd vendor/openssl/${OPENSSL_VER_FULL}
</code></p>
<p><strong>NOTE</strong>: the second "git push" command is used to push the tag, which is not
pushed by default.</p>
<h4>Push branch update and tag simultaneously</h4>
<p>It is also possible to push the branch and tag together, but use
<code>--dry-run</code> first to ensure that no undesired tags will be pushed:</p>
<p><code>
% git push --dry-run --follow-tags freebsd vendor/openssl-${OPENSSL_VER_MAJOR_MINOR}
% git push --follow-tags freebsd vendor/openssl-${OPENSSL_VER_MAJOR_MINOR}
</code></p>
<h3>Remove any existing patches and generated files.</h3>
<p><code>
% make clean
</code></p>
<p>Please note that this step does not remove any generated manpages: this happens
in a later step.</p>
<h3>Merge from the vendor branch and resolve conflicts</h3>
<p><code>
% git subtree merge -P crypto/openssl vendor/openssl-${OPENSSL_VER_MAJOR_MINOR}
</code></p>
<p><strong>NOTE</strong>: Some files may have been deleted from FreeBSD's copy of OpenSSL.
If git prompts for these deleted files during the merge, choose 'd'
(leaving them deleted).</p>
<h3>Patch, configure, and regenerate all files</h3>
<p>The following commands turn the crank associated with the vendor release
update:</p>
<p><code>
% make patch
% make configure
% make all
</code></p>
<p>This process updates all generated files, syncs the manpages with the new release,
regenerates assembly files, etc.</p>
<p>For now, any build-related changes, e.g., a assembly source was removed, a manpage
was added, etc, will require makefile updates.</p>
<h3>Diff against the vendor branch</h3>
<p>Review the diff for any unexpected changes:</p>
<p><code>
% git diff --diff-filter=M vendor/openssl/${OPENSSL_VER_FULL} HEAD:crypto/openssl
</code></p>
<p>The net-result should be just the applied patches from the freebsd/ directory.</p>
<h3>Make build-related changes</h3>
<p><strong>IMPORTANT</strong>: manual adjustments/care needed here.</p>
<p>Update the appropriate makefiles to reflect changes in the vendor's
<code>build.info</code> metadata file. This is especially important if source files have
been added or removed. Keep in mind that the assembly files generated belong in
<code>sys/crypto/openssl</code>, and will therefore affect the kernel as well.</p>
<p>If symbols have been added or removed, update the appropriate <code>Version.map</code> to
reflect these changes. Please try to stick to the new versioning scheme in the
target OpenSSL release to improve interoperability with binaries compiled
dynamically against the ports version of OpenSSL, for instance.</p>
<p>Compare compilation flags, the list of files built and included, the list of
symbols generated with the corresponding port if available.</p>
<h3>Build, install, and test</h3>
<p>Build and install a new version of world and the kernel with the newer release
of OpenSSL. Reboot the test host and run any appropriate tests using kyua,
<code>make checkworld</code>, etc.</p>
<h3>Commit and push</h3>

Event Timeline

ngie changed the title of this paste from Command-Line Input to FreeBSD-upgrade.md.html.Sun, Oct 19, 7:52 AM
ngie updated the paste's language from autodetect to html.