PQLR
Postquantum Crypto Library by QAPP
|
Data Structures | |
struct | pqlr_error_handler_callback |
Pqlr user's error handler callback interface. More... | |
Typedefs | |
typedef void(* | pqlr_error_handler_fnc) (int err_no, const char *msg, void *ctx) |
Type definition for error handling function. Place to free user defined resources before termination. More... | |
typedef struct pqlr_error_handler_callback | pqlr_error_handler_callback_t |
Pqlr user's error handler callback interface. More... | |
typedef struct pqlr_st * | pqlr_t |
Pqlr instance handle. Pqlr represents basic library and it's algorithms configuration. There are singleton instance which could be obtained by pqlr_singleton_instance and local instances which could be obtained from concrete algorithms instances. At the initialization point all the algorithms inherit pqlr's singleton instance state. Any change in the global configuration does not affect previously created algorithms. More... | |
Enumerations | |
enum | algorithm_id_t { pqlr_algorithm_general = 0xb01a41e3820cfefd , pqlr_algorithm_newhope , pqlr_algorithm_saber = 0xc83c3990d6c012b3 , pqlr_algorithm_sphincs_plus , pqlr_algorithm_sphinxp_gost , pqlr_algorithm_hypericum , pqlr_algorithm_falcon , pqlr_algorithm_dilithium , pqlr_algorithm_shipovnik , pqlr_algorithm_kryzhovnik , pqlr_algorithm_rainbow , pqlr_algorithm_polynomial_hash , pqlr_algorithm_xmss = 0x8f4ffb1fc25105ca , pqlr_algorithm_mceliece , pqlr_algorithm_kyber = 0xdbd34adf68c5f0eb , pqlr_algorithm_drbg = 0xcb86e336a7c49070 , pqlr_algorithm_xmssmt } |
Pqlr instance type id. More... | |
Functions | |
PQLR_API void | pqlr_set_error_handler (pqlr_t pqlr, pqlr_error_handler_callback_t *error_handler) |
Allows to specify custom fatal error handler for pqlr instance. Please, note that any change in the global PQLR configuration does not affect previously created algorithms. More... | |
PQLR_API void | pqlr_get_error_handler (const pqlr_t pqlr, pqlr_error_handler_callback_t *error_handler) |
Obtains custom error handler specified by pqlr_set_error_handler(). More... | |
PQLR_API void | pqlr_default_error_handler (int err_no, const char *msg, void *ctx) |
Default pqlr fatal error handler. Prints error string to stderr. More... | |
PQLR_API pqlr_t | pqlr_singleton_instance (void) |
Pqlr singleton instance accessor Please, note that any change in the global PQLR configuration does not affect previously created algorithms. More... | |
PQLR_API algorithm_id_t | pqlr_get_algorithm_id (pqlr_t) |
Detects algorithm type id. More... | |
PQLR_API void | pqlr_proxy_set_context (pqlr_t pqlr, const void *proxy_context) |
set context for proxy backend More... | |
void | pqlr_proxy_context_free (pqlr_t pqlr) |
free proxy backend context More... | |
PQLR_API int | pqlr_proxy_connect_to_server (const char *host, int port) |
Connect to server on port. More... | |
PQLR_API int | pqlr_proxy_send_and_rcv (pqlr_t pqlr, int sockfd, const msgpack_sbuffer *msg, msgpack_unpacker *unp, msgpack_unpacked *und) |
Sends a packed message and blocks till gets a packed message in response, then unpacks it. More... | |
PQLR_API void | pqlr_get_entropy (const pqlr_t pqlr, void *data, size_t size) |
Gets entropy via default entropy source. More... | |
PQLR_API const char * | pqlr_get_version (void) |
Returns null terminated string containing library version. Usage example: More... | |
Shared common functions and definitions for different PQLR algorithms
typedef struct pqlr_error_handler_callback pqlr_error_handler_callback_t |
Pqlr user's error handler callback interface.
In case of fatal error in any pqlr algorithm abort() will be called. If set this callback would be called just before the abort.
typedef void(* pqlr_error_handler_fnc) (int err_no, const char *msg, void *ctx) |
Type definition for error handling function. Place to free user defined resources before termination.
err_no | Error code. |
msg | Text message. |
ctx | Pointer to user defined data. Could be used as link to resources which are should be made free. |
typedef struct pqlr_st* pqlr_t |
Pqlr instance handle. Pqlr represents basic library and it's algorithms configuration. There are singleton instance which could be obtained by pqlr_singleton_instance and local instances which could be obtained from concrete algorithms instances. At the initialization point all the algorithms inherit pqlr's singleton instance state. Any change in the global configuration does not affect previously created algorithms.
enum algorithm_id_t |
Pqlr instance type id.
PQLR_API void pqlr_default_error_handler | ( | int | err_no, |
const char * | msg, | ||
void * | ctx | ||
) |
Default pqlr fatal error handler. Prints error string to stderr.
err_no | Error code. |
msg | Text message. |
ctx | Unused, could be NULL |
PQLR_API algorithm_id_t pqlr_get_algorithm_id | ( | pqlr_t | ) |
Gets entropy via default entropy source.
Usage example:
pqlr | Initialized pqlr instance | |
[out] | data | pointer to buffer where entropy will be written |
size | requested entropy size |
PQLR_API void pqlr_get_error_handler | ( | const pqlr_t | pqlr, |
pqlr_error_handler_callback_t * | error_handler | ||
) |
Obtains custom error handler specified by pqlr_set_error_handler().
Usage:
pqlr | Pqlr instance. | |
[out] | error_handler | Pointer to error handling callback. |
PQLR_API const char* pqlr_get_version | ( | void | ) |
Returns null terminated string containing library version. Usage example:
PQLR_API int pqlr_proxy_connect_to_server | ( | const char * | host, |
int | port | ||
) |
Connect to server on port.
host | host address |
port | host port |
void pqlr_proxy_context_free | ( | pqlr_t | pqlr | ) |
free proxy backend context
pqlr | instance of pqlr |
PQLR_API int pqlr_proxy_send_and_rcv | ( | pqlr_t | pqlr, |
int | sockfd, | ||
const msgpack_sbuffer * | msg, | ||
msgpack_unpacker * | unp, | ||
msgpack_unpacked * | und | ||
) |
Sends a packed message and blocks till gets a packed message in response, then unpacks it.
sockfd | socket file descriptor with connected host |
msg | message to send to a server |
unp | unpacker, keeps data buffer for reading |
und | unpacked message to return |
set context for proxy backend
pqlr | instance of pqlr |
proxy_context | context to pass to proxy backend |
PQLR_API void pqlr_set_error_handler | ( | pqlr_t | pqlr, |
pqlr_error_handler_callback_t * | error_handler | ||
) |
Allows to specify custom fatal error handler for pqlr instance. Please, note that any change in the global PQLR configuration does not affect previously created algorithms.
Usage example:
pqlr | Pqlr instance. |
error_handler | Pointer to error handler callback struct. If NULL, program will exit immediately on fatal error. |