PQLR
Postquantum Crypto Library by QAPP
PQLR common algorithm interface

Macros

#define PQLR_ALG_OPTION_ENABLE_HW_ACC   0x00000001u
 
#define PQLR_ALG_OPTION_ENABLE_PROXY   0x00000002u
 

Typedefs

typedef struct pqlr_alg_st * pqlr_alg
 PQLR algorithm instance handle. More...
 

Functions

PQLR_API pqlr_alg pqlr_alg_new (const char *alg_str)
 Creates pqlr_alg instance. More...
 
PQLR_API void pqlr_alg_free (pqlr_alg alg)
 Frees pqlr_alg instance and all corresponding resources. More...
 
PQLR_API const char * pqlr_alg_get_str (const pqlr_alg alg)
 Gets a string with the name of PQLR algorithm. More...
 
PQLR_API int pqlr_alg_num_paramsets (const pqlr_alg alg)
 Gets available parameter sets for this algorithm. If the return value is n then all parameter sets from range [0; n) can be used. More...
 
PQLR_API int pqlr_alg_get_paramset (const pqlr_alg alg)
 Gets parameter set configured for given algorithm instance. More...
 
PQLR_API int pqlr_alg_set_paramset (pqlr_alg alg, int paramset)
 Enables selected parameter set. More...
 
PQLR_API int pqlr_alg_set_options (pqlr_alg alg, uint32_t options)
 Enables selected option. More...
 
PQLR_API void pqlr_alg_set_defaults (pqlr_alg alg)
 Configures the PQLR algorithm with default parameter and options set. More...
 

Detailed Description

Macro Definition Documentation

◆ PQLR_ALG_OPTION_ENABLE_HW_ACC

#define PQLR_ALG_OPTION_ENABLE_HW_ACC   0x00000001u

◆ PQLR_ALG_OPTION_ENABLE_PROXY

#define PQLR_ALG_OPTION_ENABLE_PROXY   0x00000002u

Typedef Documentation

◆ pqlr_alg

typedef struct pqlr_alg_st* pqlr_alg

Function Documentation

◆ pqlr_alg_free()

PQLR_API void pqlr_alg_free ( pqlr_alg  alg)

Frees pqlr_alg instance and all corresponding resources.

Parameters
[in]algPQLR algorithm instance
See also
pqlr_alg
pqlr_alg_new

◆ pqlr_alg_get_paramset()

PQLR_API int pqlr_alg_get_paramset ( const pqlr_alg  alg)

Gets parameter set configured for given algorithm instance.

Parameters
[in]algPQLR algorithm instance
See also
pqlr_alg
pqlr_alg_num_paramsets
pqlr_alg_set_paramset
Returns
non-negative value on success or PQLR_ALG_ERROR on failure

◆ pqlr_alg_get_str()

PQLR_API const char* pqlr_alg_get_str ( const pqlr_alg  alg)

Gets a string with the name of PQLR algorithm.

Note
String memory does not need to be freed by user.
Parameters
[in]algPQLR algorithm instance
See also
pqlr_alg
Returns
Null terminated string, PQLR_ALG_UNKNOWN in case of error.

◆ pqlr_alg_new()

PQLR_API pqlr_alg pqlr_alg_new ( const char *  alg_str)

Creates pqlr_alg instance.

Note
Instance is initialized with default settings for specified algorithm
Parameters
[in]alg_strPQLR algorithm name
See also
pqlr_alg
pqlr_alg_free
pqlr_alg_set_defaults
Returns
new pqlr_alg instance or NULL in case of error

◆ pqlr_alg_num_paramsets()

PQLR_API int pqlr_alg_num_paramsets ( const pqlr_alg  alg)

Gets available parameter sets for this algorithm. If the return value is n then all parameter sets from range [0; n) can be used.

Parameters
[in]algPQLR algorithm instance
See also
pqlr_alg
Returns
Non-negative value or PQLR_ALG_ERROR in case of error

◆ pqlr_alg_set_defaults()

PQLR_API void pqlr_alg_set_defaults ( pqlr_alg  alg)

Configures the PQLR algorithm with default parameter and options set.

Parameters
[in]algPQLR algorithm instance
See also
pqlr_alg
pqlr_alg_new
pqlr_alg_set_paramset
pqlr_alg_set_options

◆ pqlr_alg_set_options()

PQLR_API int pqlr_alg_set_options ( pqlr_alg  alg,
uint32_t  options 
)

Enables selected option.

Note
Options, unlike parameter sets, refer to algorithm implementation features such as use of hardware acceleration.
Parameters
[in]algPQLR algorithm instance
[in]optionsAlgorithm option to be enabled
See also
pqlr_alg
pqlr_alg_set_paramset
Returns
0 on success or non-zero value on failure

◆ pqlr_alg_set_paramset()

PQLR_API int pqlr_alg_set_paramset ( pqlr_alg  alg,
int  paramset 
)

Enables selected parameter set.

Note
For given algorithm, the possible parameter set values are defined in enum <algorithm>_parameterset_t.
Parameters
[in]algPQLR algorithm instance
[in]paramsetAlgorithm paramset to be enabled
See also
pqlr_alg
pqlr_alg_num_paramsets
pqlr_alg_get_paramset
Returns
0 on success or non-zero value on failure