The GmSSL Coding Style

This coding style has some differences with the current OpenSSL coding style (see [1]). As coding style is very personal and currently I am still the major contributor, the GmSSL coding style is what I prefer to use. The major reason of this coding style is that the maintenance is easier than the OpenSSL coding style.

Basic Rule


Use tabs with 8-character width.

The OpenSSL coding style is derived from the Linux kernel coding style (see [2]) but it changed the indentation from tab to 4-character width spaces. The GmSSL coding style follows the kernel’s style.

Broken lines with one more tab indent.

Because it is easier to type (without help of editors) and with 8-character width ident it is still easy to see.

Always using braces.

Wrapping with barces even for a single statement. This is different with the Linux kernel style and the OpenSSL style.The reason for writing the unnecessary braces is for future debugging and error handling. And it is less error-prone for developers not familar the code.

Push errors when possible.

For debugging reasons.

Wrapping changes with define micros

For future maintenance.


  1. OpenSSL coding style. []
  2. Linux kernel coding style. []

Copyright 2016 The GmSSL Project. All Rights Reserved.