OpenSSL moving to clang-format
OpenSSL would like to modernise and streamline development processes, mainly to ensure effective code review and make the project easier for contributors to contribute to.
As part of this effort, we will be making some changes to our coding style guidelines and adopting clang-format using the WebKit C coding style as enforced by clang-format. We will transition to using clang-format to check pre-submissions and ensure code follows the format portions of the style guide before PRs are reviewed.
The benefits of OpenSSL adopting clang-format on PR submission include:
Modernised and streamlined development processes: ensure effective code review.
Easier contributions: It makes the project more accessible for contributors.
Ensured compliance: Contributors can use standard tools to ensure their changes adhere to the coding style guidelines.
Reduced review time: Reviewers will not need to spend time checking for style compliance, allowing them to focus on other aspects of the code.
To ensure effectiveness and continue merging fixes into the active branches, we will reformat the code base with clang-format on the master branch and the 3.X branches.
We will be reformatting the master, as well as the 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, and 3.6 branches.
On each affected branch, a .clang-format file will be committed to the repository first. Several preparatory commits will follow to prepare for the reformatting.
Immediately before the reformatting commit, the branch will be tagged with the tag X.Y-PRE-CLANG-FORMAT-WEBKIT. (Where X.Y is the version)
Clang-format will be run on all the .c, .h, .c.in, and .h.in files in the repository, and the result will be committed.
Immediately after the re-formatting commit, the branch will be tagged with the tag X.Y-POST-CLANG-FORMAT-WEBKIT
The reformatting commit hash will be added to the .git-blame-ignore-revs file at the repository root.
OpenSSL’s GitHub pre-commit processes will require PR’s to conform to the clang-format style on submission.
We are planning to reformat the branches during the week of December 8 2025. We will post here that week when the reformatting operation is completed in the tree. In the unlikely event that there are issues preventing this from happening the week of December 8, we will target doing this on the week of December 15.
If you maintain patches on top of OpenSSL, you will need to transition them through this event to ensure they continue to apply. There are a number of ways to do this, but the most basic process will look like (for a patch applying to version X.Y):
Check out two copies of the OpenSSL source tree at X.Y-PRE-CLANG-FORMAT-WEBKIT.
Apply your patch to one copy, ensure that it still applies, builds, and functions as you expect.
Run clang-format on the changed files in both copies of the source tree.
Re-generate your patches.
Check out a copy of the OpenSSL source tree at X.Y-POST-CLANG-FORMAT-WEBKIT.
Apply your patch to this copy of the source tree, ensure that it still applies, builds, and functions as you expect.