-
Notifications
You must be signed in to change notification settings - Fork 479
Coding conventions
Subdirectories of src
contain modules. The first component of a module name is the type of module it is, either rand
for a pseudorandom number generator, or kex
for a key exchange method.
- For pseudorandom number generators, every module has a name of the form
rand_<algid>
, where<algid>
describes the generator in an appropriate way. - For key exchange methods, every module has a name of the form
kex_<problem>_<algid>
, where<problem>
denotes the mathematical problem the algorithm is based on (e.g., rlwe, lwe, sidh, ntru, mceliece, ...) and<algid>
denotes a specific algorithm identifier (e.g., bcns15, frodo, newhope, ...).
Public functions are functions which are intended to be used by calling applications/libraries, and which are exported in .h
files. Public functions start with upper-case letters and are of the form OQS_RAND_<algid>_<name>
or OQS_KEX_<problem>_<algid>_<name>
. For example, OQS_KEX_rlwe_bcns15_alice_0
or OQS_RAND_urandom_chacha20_32
.
Private functions that still have global scope are functions which might be meaningful on their own, and could be useful to another research, but are not generally intended to be used by calling applications/libraries. They might be tested independently by a test hardness. Private functions with global scope start with lower-case letters and are of the form oqs_rand_<algid>_<name>
or oqs_kex_<problem>_<algid>_<name>
. For example, oqs_kex_rlwe_bcns15_crossround2
.
Private functions that do not have global scope can be named in any way. However, they must be declared static
to avoid polluting the global namespace. You can check to make sure you haven't missed any such functions by ensuring the following command gives empty output:
nm -g liboqs.a | grep ' T ' | grep -v -i ' T _OQS'
Code will be compiled using -std=gnu11
. The code should compile cleanly—without warnings—with the following compiler flags:
-Wpedantic -Wall -Wextra
Source code should be formatted using the make prettyprint
target before committing.
Inline documentation in .c
and .h
files is done using Doxygen.