mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-09 00:04:26 -04:00
* refactoring - Introduced typedef int OQS_status; in src/common/common.h and refactored the code accordingly. Now it's easy to figure out whether the function returns an error status or an int. - Refactored hard-coded returns so now we return the OQS_status as either OQS_SUCCESS or OQS_ERROR. OQS_RAND_get_system_entropy() and all other KEX/SIG API functions now return OQS_STATUS instead of int. - Introduced src/common/oqs.h, which include all other necessary liboqs headers. All standalone programs now only #include <oqs/oqs.h> - src/kex.c:23, the UNUSED macro was re-defined differently from oqs/common.h:25, so re-defined kex.c's UNUSED to UNUSED_KEX - Got rid of PRINT_(PART)_HEX macros and introduced stand-alone functions in src/common.h (with definitions in src/common.c) void OQS_print_hex_string(const char *label, uint8_t *str, size_t len); void OQS_print_part_hex_string(const char *label, uint8_t *str, size_t len, size_t sub_len); * commit fixed stdint.h missing #include * commit * commit * commit * These files are part of the patch * Modified patch * added oqs.h in the Windows build * VS build * Fixed VS build * fixed VS build * Fixed test_rand VS project added WINDOWS macro in the VS configuration for test_rand
35 lines
775 B
C
35 lines
775 B
C
#ifndef __OQS_COMMON_H
|
|
#define __OQS_COMMON_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
typedef int OQS_STATUS;
|
|
#define OQS_SUCCESS 0
|
|
#define OQS_ERROR -1
|
|
|
|
/* Displays hexadecimal strings */
|
|
void OQS_print_hex_string(const char *label, uint8_t *str, size_t len);
|
|
|
|
/* Partially displays hexadecimal strings */
|
|
void OQS_print_part_hex_string(const char *label, uint8_t *str, size_t len, size_t sub_len);
|
|
|
|
void OQS_MEM_cleanse(void *ptr, size_t len);
|
|
void OQS_MEM_secure_free(void *ptr, size_t len);
|
|
|
|
#if __ANDROID__
|
|
//android workaround
|
|
#define eprintf(...) printf(__VA_ARGS__);
|
|
#else
|
|
#define eprintf(...) fprintf(stderr, __VA_ARGS__);
|
|
#endif
|
|
|
|
#if defined(WINDOWS)
|
|
#define UNUSED
|
|
// __attribute__ not supported in VS
|
|
#else
|
|
#define UNUSED __attribute__((unused))
|
|
#endif
|
|
|
|
#endif
|