diff --git a/Makefile b/Makefile
index 90179de..6d53816 100644
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,3 @@ all:
bundle exec jekyll build
#bash deploy_benchmarking.sh
-doxyjinj:
- cd _doxygen_pretty && python3 doxyjinj.py struct_file.html ../_includes/liboqs/build/docs/xml/struct_o_q_s___k_e_m.xml 'https://github.com/open-quantum-safe/liboqs/tree/main/' > ../liboqs/api/oqskem.html
- cd _doxygen_pretty && python3 doxyjinj.py struct_file.html ../_includes/liboqs/build/docs/xml/struct_o_q_s___s_i_g.xml 'https://github.com/open-quantum-safe/liboqs/tree/main/' > ../liboqs/api/oqssig.html
- cd _doxygen_pretty && python3 doxyjinj.py struct_file.html ../_includes/liboqs/build/docs/xml/struct_o_q_s___s_i_g___s_t_f_l___s_e_c_r_e_t___k_e_y.xml 'https://github.com/open-quantum-safe/liboqs/tree/main/' > ../liboqs/api/oqssig_stfl_secret_key.html
- cd _doxygen_pretty && python3 doxyjinj.py header_file.html ../_includes/liboqs/build/docs/xml/common_8h.xml 'https://github.com/open-quantum-safe/liboqs/tree/main/' > ../liboqs/api/common.html
- cd _doxygen_pretty && python3 doxyjinj.py header_file.html ../_includes/liboqs/build/docs/xml/kem_8h.xml 'https://github.com/open-quantum-safe/liboqs/tree/main/' > ../liboqs/api/kem.html
- cd _doxygen_pretty && python3 doxyjinj.py header_file.html ../_includes/liboqs/build/docs/xml/rand_8h.xml 'https://github.com/open-quantum-safe/liboqs/tree/main/' > ../liboqs/api/rand.html
- cd _doxygen_pretty && python3 doxyjinj.py header_file.html ../_includes/liboqs/build/docs/xml/sig_8h.xml 'https://github.com/open-quantum-safe/liboqs/tree/main/' > ../liboqs/api/sig.html
- cd _doxygen_pretty && python3 doxyjinj.py header_file.html ../_includes/liboqs/build/docs/xml/sig__stfl_8h.xml 'https://github.com/open-quantum-safe/liboqs/tree/main/' > ../liboqs/api/sig_stfl.html
diff --git a/README.md b/README.md
index dfbae47..44314c5 100644
--- a/README.md
+++ b/README.md
@@ -36,9 +36,6 @@ git commit
```
## Rebuilding API documentation
-
-```bash
-make doxyjinj
-```
-
-Then clean up the diffs so that they have the YML header and don't have their own HTML header / footer.
+API documentation is generated by Doxygen and served under the path `/liboqs/api/doxygen`.
+A simple page is served at `/liboqs/api` to provide an explicit link to the documentation.
+See [`gen-c-api-docs.sh`](./gen-c-api-docs.sh) for details.
diff --git a/_doxygen_pretty/doxyjinj.py b/_doxygen_pretty/doxyjinj.py
deleted file mode 100644
index b7566c8..0000000
--- a/_doxygen_pretty/doxyjinj.py
+++ /dev/null
@@ -1,194 +0,0 @@
-import jinja2
-from lxml import etree
-import os
-import sys
-
-def render_text_and_children(element):
- global env
- s = ''
- if element.text: s += element.text
- for child in element:
- if child.tag == 'ndash': s += '–'
- elif child.tag == 'ref': s += child.text
- elif child.tag == 'computeroutput': s += env.get_template('base/computeroutput').render(t = child.text)
- elif child.tag == 'para': s += env.get_template('base/para').render(t = render_text_and_children(child))
- elif child.tag == 'verbatim': s += env.get_template('base/verbatim').render(t = render_text_and_children(child))
- elif child.tag == 'parameterlist': pass
- elif child.tag == 'simplesect': pass
- else: raise NotImplementedError("Unknown node type: " + child.tag)
- if child.tail: s += child.tail
- return s
-
-def render_text_and_children_or_empty(element, path):
- a = element.xpath(path)
- if len(a) > 0: return render_text_and_children(a[0])
- return ''
-
-def element_text_or_empty(element, path):
- a = element.xpath(path)
- if len(a) > 0: return a[0].text
- return ''
-
-def attribute_or_empty(element, path):
- a = element.xpath(path)
- if len(a) > 0: return a[0]
- return ''
-
-def object_or_empty(element, path):
- a = element.xpath(path)
- if len(a) > 0: return a[0]
- return ''
-
-class DXFunctionDescriptionParam(object):
- def __init__(self, element, function):
- self.element = element
- self.function = function
- def name(self):
- return render_text_and_children_or_empty(self.element, 'parameternamelist/parametername')
- def description(self):
- return render_text_and_children_or_empty(self.element, 'parameterdescription')
- def type(self):
- for p in self.function.args():
- if self.name() == p.declname(): return p.type()
- return ''
-
-class DXFunctionParam(object):
- def __init__(self, element):
- self.element = element
- def type(self):
- return render_text_and_children_or_empty(self.element, 'type')
- def declname(self):
- return render_text_and_children_or_empty(self.element, 'declname')
- def defname(self):
- return render_text_and_children_or_empty(self.element, 'defname')
- def tostring(self):
- return (self.type() + ' ' + self.declname() + ' ' + self.defname()).strip()
-
-class DXMember(object):
- def name(self):
- return element_text_or_empty(self.element, 'name')
- def uniqid(self):
- return attribute_or_empty(self.element, '@id')
- def src_filename(self):
- return attribute_or_empty(self.element, 'location/@file')
- def src_linenumber(self):
- return attribute_or_empty(self.element, 'location/@line')
- def type(self):
- return render_text_and_children_or_empty(self.element, 'type')
- def definition(self):
- return render_text_and_children_or_empty(self.element, 'definition')
- def args(self):
- return [DXFunctionParam(p) for p in self.element.xpath('param')]
- def argsstring(self):
- return render_text_and_children_or_empty(self.element, 'argsstring')
- def description_brief(self):
- return render_text_and_children_or_empty(self.element, 'briefdescription')
- def description_detailed(self):
- return render_text_and_children_or_empty(self.element, 'detaileddescription')
- def description_parameter_list(self):
- a = self.element.xpath('detaileddescription//parameterlist')
- if len(a) == 0: return []
- else: return [DXFunctionDescriptionParam(p, self) for p in a[0]]
- def return_description(self):
- return render_text_and_children_or_empty(self.element, 'detaileddescription//simplesect[@kind="return"]')
- def initializer(self):
- return render_text_and_children_or_empty(self.element, 'initializer')
-
-class DXDefine(DXMember):
- def __init__(self, element):
- self.element = element
-
-class DXEnumValue(DXMember):
- def __init__(self, element):
- self.element = element
-
-class DXEnum(DXMember):
- def __init__(self, element):
- self.element = element
- def values(self):
- return [DXEnumValue(v) for v in self.element.xpath('enumvalue')]
-
-class DXFunction(DXMember):
- def __init__(self, element):
- self.element = element
-
-class DXIncludes(object):
- def __init__(self, element):
- self.element = element
- def local(self):
- a = attribute_or_empty(self.element, '@local')
- return not(a == '' or a == 'no')
- def filename(self):
- return self.element.text
-
-class DXTypedef(DXMember):
- def __init__(self, element):
- self.element = element
-
-class DXVariable(DXMember):
- def __init__(self, element):
- self.element = element
- def definition(self):
- return render_text_and_children_or_empty(self.element, 'definition')
-
-class DXCompound(object):
- @staticmethod
- def factory(element):
- kind = attribute_or_empty(element, 'compounddef/@kind')
- if kind == 'file': return DXFile(element)
- elif kind == 'struct': return DXStruct(element)
- raise TypeError('Unknown kind: ' + kind)
- def name(self):
- return element_text_or_empty(self.element, 'compounddef/compoundname')
- def path(self):
- a = attribute_or_empty(self.element, 'compounddef/location/@file')
- if len(a) > 0:
- if len(os.path.dirname(a)) > 0: return os.path.dirname(a) + '/'
- return ''
- def src_filename(self):
- return attribute_or_empty(self.element, 'location/@file')
- def description_brief(self):
- return render_text_and_children_or_empty(self.element, 'compounddef/briefdescription')
- def description_detailed(self):
- return render_text_and_children_or_empty(self.element, 'compounddef/detaileddescription')
- def includes(self):
- return [DXIncludes(f) for f in self.element.xpath('compounddef/includes')]
-
-class DXFile(DXCompound):
- def __init__(self, element):
- self.element = element
- def defines(self):
- return [DXDefine(f) for f in self.element.xpath('//memberdef[@kind="define"]')]
- def enums(self):
- return [DXEnum(f) for f in self.element.xpath('//memberdef[@kind="enum"]')]
- def functions(self):
- return [DXFunction(f) for f in self.element.xpath('//memberdef[@kind="function"]')]
- def typedefs(self):
- return [DXTypedef(f) for f in self.element.xpath('//memberdef[@kind="typedef"]')]
-
-class DXStruct(DXCompound):
- def __init__(self, element):
- self.element = element
- def src_linenumber(self):
- return attribute_or_empty(self.element, 'location/@line')
- def variables(self):
- return [DXVariable(f) for f in self.element.xpath('//memberdef[@kind="variable"]')]
-
-def render(templatefilename, xmlfilename, srcbaseurl=''):
- global env
- env = jinja2.Environment(
- loader = jinja2.FileSystemLoader('templates')
- )
- template = env.get_template(templatefilename)
- tree = etree.parse(xmlfilename)
- return template.render(file = DXCompound.factory(tree), srcbaseurl=srcbaseurl)
-
-if __name__ == "__main__":
- if len(sys.argv) < 3 or len(sys.argv) > 4:
- print("Usage: python3 jinja_doxygen_xml.py template xmlfile [srcbaseurl]")
- exit(1)
-
- templatefilename = sys.argv[1]
- xmlfilename = sys.argv[2]
- srcbaseurl = '' if len(sys.argv) < 4 else sys.argv[3]
- print(render(templatefilename, xmlfilename, srcbaseurl))
diff --git a/_doxygen_pretty/templates/base/computeroutput b/_doxygen_pretty/templates/base/computeroutput
deleted file mode 100644
index b5fe204..0000000
--- a/_doxygen_pretty/templates/base/computeroutput
+++ /dev/null
@@ -1 +0,0 @@
-{{ t }}
\ No newline at end of file
diff --git a/_doxygen_pretty/templates/base/para b/_doxygen_pretty/templates/base/para
deleted file mode 100644
index 48e72ef..0000000
--- a/_doxygen_pretty/templates/base/para
+++ /dev/null
@@ -1 +0,0 @@
-
{{ t }}
\ No newline at end of file diff --git a/_doxygen_pretty/templates/base/verbatim b/_doxygen_pretty/templates/base/verbatim deleted file mode 100644 index 4fbe53c..0000000 --- a/_doxygen_pretty/templates/base/verbatim +++ /dev/null @@ -1,3 +0,0 @@ -{{ t }}
-enum {{ e.name() }}{{ v.name() }} {{ v.initializer() }} |
- {{ v.description_detailed() }} | -
- enum {{ e.name() }}
-
- {% if not(loop.last) %}{{ f.type() }} {{ f.name() }}{{ f.argsstring() }}{{ p.type() }} |
- {{ p.name() }} |
- {{ p.description() }} | -
{{ f.type() }} |
- {{ f.name() }}{{ f.argsstring() }} |
-
- #include {{ '"' if i.local() else '<' }}{{ i.filename() }}{{ '"' if i.local() else '>' }}
-
- {% if not(loop.last) %}|
-
-
|
|
-
-
|
{{ v.type() }} |
- {{ v.name() }}{{ v.argsstring() }} |
-
Utility functions for use in liboqs.
- -SPDX-License-Identifier: MIT
- - - -
- #include <limits.h>
-
-
- #include <stdint.h>
-
-
- #include <stdio.h>
-
-
- #include <stdlib.h>
-
-
- #include <oqs/oqsconfig.h>
-
-
-
-
-
-
-
-
- enum OQS_STATUS
-
-
- enum OQS_CPU_EXT
-
-
-
- enum OQS_STATUSRepresents return values from functions.
-Callers should compare with the symbol rather than the individual value. For example,
ret = OQS_KEM_encaps(...);
-if (ret == OQS_SUCCESS) { ... }
-
-rather than
if (!OQS_KEM_encaps(...) { ... }
-
-OQS_ERROR = -1 |
-
- Used to indicate that some undefined error occurred. - |
-
OQS_SUCCESS = 0 |
-
- Used to indicate successful return from function. - |
-
OQS_EXTERNAL_LIB_ERROR_OPENSSL = 50 |
-
- Used to indicate failures in external libraries (e.g., OpenSSL). - |
-
enum OQS_CPU_EXTCPU runtime detection flags
- -OQS_CPU_EXT_INIT |
- - | -
OQS_CPU_EXT_ADX |
- - | -
OQS_CPU_EXT_AES |
- - | -
OQS_CPU_EXT_AVX |
- - | -
OQS_CPU_EXT_AVX2 |
- - | -
OQS_CPU_EXT_AVX512 |
- - | -
OQS_CPU_EXT_BMI1 |
- - | -
OQS_CPU_EXT_BMI2 |
- - | -
OQS_CPU_EXT_PCLMULQDQ |
- - | -
OQS_CPU_EXT_VPCLMULQDQ |
- - | -
OQS_CPU_EXT_POPCNT |
- - | -
OQS_CPU_EXT_SSE |
- - | -
OQS_CPU_EXT_SSE2 |
- - | -
OQS_CPU_EXT_SSE3 |
- - | -
OQS_CPU_EXT_ARM_AES |
- - | -
OQS_CPU_EXT_ARM_SHA2 |
- - | -
OQS_CPU_EXT_ARM_SHA3 |
- - | -
OQS_CPU_EXT_ARM_NEON |
- - | -
OQS_CPU_EXT_COUNT |
- - | -
OQS_API int |
- OQS_CPU_has_extension(OQS_CPU_EXT ext) |
-
OQS_API void |
- OQS_init(void) |
-
OQS_API void |
- OQS_thread_stop(void) |
-
OQS_API void |
- OQS_destroy(void) |
-
OQS_API const char * |
- OQS_version(void) |
-
OQS_API void * |
- OQS_MEM_malloc(size_t size) |
-
OQS_API void * |
- OQS_MEM_calloc(size_t num_elements, size_t element_size) |
-
OQS_API char * |
- OQS_MEM_strdup(const char *str) |
-
OQS_API int |
- OQS_MEM_secure_bcmp(const void *a, const void *b, size_t len) |
-
OQS_API void |
- OQS_MEM_cleanse(void *ptr, size_t len) |
-
OQS_API void |
- OQS_MEM_secure_free(void *ptr, size_t len) |
-
OQS_API void |
- OQS_MEM_insecure_free(void *ptr) |
-
void * |
- OQS_MEM_aligned_alloc(size_t alignment, size_t size) |
-
void |
- OQS_MEM_aligned_free(void *ptr) |
-
OQS_API int OQS_CPU_has_extension(OQS_CPU_EXT ext)Checks if the CPU supports a given extension
--
- -1 if the given CPU extension is available, 0 otherwise.
-OQS_API void OQS_init(void)This currently sets the values in the OQS_CPU_EXTENSIONS and prefetches the OpenSSL objects if necessary.
- -OQS_API void OQS_thread_stop(void)This function stops OpenSSL threads, which allows resources to be cleaned up in the correct order. -
- -OQS_API void OQS_destroy(void)This function frees prefetched OpenSSL objects
- -OQS_API const char * OQS_version(void)Return library version string.
- -OQS_API void * OQS_MEM_malloc(size_t size)These functions provide a unified interface for memory operations, using OpenSSL functions when OQS_USE_OPENSSL is defined, and standard C library functions otherwise. Allocates memory of a given size. - -
- -size_t |
- size |
-
- The size of the memory to be allocated in bytes. - |
-
A pointer to the allocated memory.
-OQS_API void * OQS_MEM_calloc(size_t num_elements, size_t element_size)Allocates memory for an array of elements of a given size. - -
- -size_t |
- num_elements |
-
- The number of elements to allocate. - |
-
size_t |
- element_size |
-
- The size of each element in bytes. - |
-
A pointer to the allocated memory.
-OQS_API char * OQS_MEM_strdup(const char *str)Duplicates a string. - -
- -const char * |
- str |
-
- The string to be duplicated. - |
-
A pointer to the newly allocated string.
-OQS_API int OQS_MEM_secure_bcmp(const void *a, const void *b, size_t len)Constant time comparison of byte sequences a and b of length len. Returns 0 if the byte sequences are equal or if len=0. Returns 1 otherwise.
-
- -const void * |
- a |
-
- A byte sequence of length at least |
-
const void * |
- b |
-
- A byte sequence of length at least |
-
size_t |
- len |
-
- The number of bytes to compare. - |
-
OQS_API void OQS_MEM_cleanse(void *ptr, size_t len)Zeros out len bytes of memory starting at ptr.
Designed to be protected against optimizing compilers which try to remove "unnecessary" operations. Should be used for all buffers containing secret data.
--
- -void * |
- ptr |
-
- The start of the memory to zero out. - |
-
size_t |
- len |
-
- The number of bytes to zero out. - |
-
OQS_API void OQS_MEM_secure_free(void *ptr, size_t len)Zeros out len bytes of memory starting at ptr, then frees ptr.
Can be called with ptr = NULL, in which case no operation is performed.
Designed to be protected against optimizing compilers which try to remove "unnecessary" operations. Should be used for all buffers containing secret data.
--
- -void * |
- ptr |
-
- The start of the memory to zero out and free. - |
-
size_t |
- len |
-
- The number of bytes to zero out. - |
-
OQS_API void OQS_MEM_insecure_free(void *ptr)Frees ptr.
Can be called with ptr = NULL, in which case no operation is performed.
Should only be used on non-secret data.
--
- -void * |
- ptr |
-
- The start of the memory to free. - |
-
void * OQS_MEM_aligned_alloc(size_t alignment, size_t size)Internal implementation of C11 aligned_alloc to work around compiler quirks.
-Allocates size bytes of uninitialized memory with a base pointer that is a multiple of alignment. Alignment must be a power of two and a multiple of sizeof(void *). Size must be a multiple of alignment. -
- -void OQS_MEM_aligned_free(void *ptr)Free memory allocated with OQS_MEM_aligned_alloc.
- -|
-
-
Macro for terminating the program if x is a null pointer. - - - -
-
-
- do { \
- if ((x) == (void *)0) { \
- fprintf(stderr, "Unexpected NULL returned from %s API. Exiting.\n", \
- loc); \
- exit(EXIT_FAILURE); \
- } \
- } while (0)
- |
|
-
-
This macro is intended to replace those assert()s involving side-effecting statements in aes/aes_ossl.c. -assert() becomes a no-op when -DNDEBUG is defined, which causes compilation failures when the statement being checked also results in side-effects. -This is a temporary workaround until a better error handling strategy is developed. Certain functions (such as OQS_randombytes_openssl in src/rand/rand.c) take in a size_t parameter, but can only handle values up to INT_MAX for those parameters. This macro is a temporary workaround for such functions. - - - -
-
-
- int int_var_name = 0; \
- if (size_t_var_name <= INT_MAX) { \
- int_var_name = (int)size_t_var_name; \
- } else { \
- exit(EXIT_FAILURE); \
- }
- |
|
-
-
Defines which functions should be exposed outside the LibOQS library -By default the visibility of all the symbols is defined to "hidden" Only the library API should be marked as default -Example: OQS_API return_value function_name(void); - - - |