Skip to content

Commit

Permalink
Add library version retrieval function (#1273)
Browse files Browse the repository at this point in the history
  • Loading branch information
baentsch authored Aug 3, 2022
1 parent 33738d9 commit 91bfca9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ OQS_API void OQS_init(void) {
return;
}

OQS_API const char *OQS_version(void) {
return OQS_VERSION_TEXT;
}

OQS_API int OQS_MEM_secure_bcmp(const void *a, const void *b, size_t len) {
/* Assume CHAR_BIT = 8 */
uint8_t r = 0;
Expand Down
5 changes: 5 additions & 0 deletions src/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ OQS_API int OQS_CPU_has_extension(OQS_CPU_EXT ext);
*/
OQS_API void OQS_init(void);

/**
* Return library version string.
*/
OQS_API const char *OQS_version(void);

/**
* Constant time comparison of byte sequences `a` and `b` of length `len`.
* Returns 0 if the byte sequences are equal or if `len`=0.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ void *test_wrapper(void *arg) {

int main(int argc, char **argv) {

printf("Testing KEM algorithms using liboqs version %s\n", OQS_version());

if (argc != 2) {
fprintf(stderr, "Usage: test_kem algname\n");
fprintf(stderr, " algname: ");
Expand Down
2 changes: 2 additions & 0 deletions tests/test_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ void *test_wrapper(void *arg) {

int main(int argc, char **argv) {

printf("Testing signature algorithms using liboqs version %s\n", OQS_version());

if (argc != 2) {
fprintf(stderr, "Usage: test_sig algname\n");
fprintf(stderr, " algname: ");
Expand Down

0 comments on commit 91bfca9

Please sign in to comment.