From 98b8e35a7cf71df4de100a14e30a85b9d7515a23 Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Fri, 19 Nov 2021 15:27:59 -0500 Subject: [PATCH] fix symbol exporting again --- CMakeLists.txt | 1 + include/olm/megolm.h | 16 ++++++++++------ include/olm/pickle_encoding.h | 12 ++++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1fe2e6..0c53d22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() +set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) diff --git a/include/olm/megolm.h b/include/olm/megolm.h index e4e5d0b..338ab21 100644 --- a/include/olm/megolm.h +++ b/include/olm/megolm.h @@ -23,6 +23,10 @@ #include #include +// Note: exports in this file are only for unit tests. Nobody else should be +// using this externally +#include "olm/olm_export.h" + #ifdef __cplusplus extern "C" { #endif @@ -59,25 +63,25 @@ extern const struct _olm_cipher *megolm_cipher; * initialize the megolm ratchet. random_data should be at least * MEGOLM_RATCHET_LENGTH bytes of randomness. */ -void megolm_init(Megolm *megolm, uint8_t const *random_data, uint32_t counter); +OLM_EXPORT void megolm_init(Megolm *megolm, uint8_t const *random_data, uint32_t counter); /** Returns the number of bytes needed to store a megolm */ -size_t megolm_pickle_length(const Megolm *megolm); +OLM_EXPORT size_t megolm_pickle_length(const Megolm *megolm); /** * Pickle the megolm. Returns a pointer to the next free space in the buffer. */ -uint8_t * megolm_pickle(const Megolm *megolm, uint8_t *pos); +OLM_EXPORT uint8_t * megolm_pickle(const Megolm *megolm, uint8_t *pos); /** * Unpickle the megolm. Returns a pointer to the next item in the buffer. */ -const uint8_t * megolm_unpickle(Megolm *megolm, const uint8_t *pos, +OLM_EXPORT const uint8_t * megolm_unpickle(Megolm *megolm, const uint8_t *pos, const uint8_t *end); /** advance the ratchet by one step */ -void megolm_advance(Megolm *megolm); +OLM_EXPORT void megolm_advance(Megolm *megolm); /** * get the key data in the ratchet. The returned data is @@ -86,7 +90,7 @@ void megolm_advance(Megolm *megolm); #define megolm_get_data(megolm) ((const uint8_t *)((megolm)->data)) /** advance the ratchet to a given count */ -void megolm_advance_to(Megolm *megolm, uint32_t advance_to); +OLM_EXPORT void megolm_advance_to(Megolm *megolm, uint32_t advance_to); #ifdef __cplusplus } // extern "C" diff --git a/include/olm/pickle_encoding.h b/include/olm/pickle_encoding.h index 03611df..ec2a2d6 100644 --- a/include/olm/pickle_encoding.h +++ b/include/olm/pickle_encoding.h @@ -23,6 +23,10 @@ #include "olm/error.h" +// Note: exports in this file are only for unit tests. Nobody else should be +// using this externally +#include "olm/olm_export.h" + #ifdef __cplusplus extern "C" { #endif @@ -31,7 +35,7 @@ extern "C" { /** * Get the number of bytes needed to encode a pickle of the length given */ -size_t _olm_enc_output_length(size_t raw_length); +OLM_EXPORT size_t _olm_enc_output_length(size_t raw_length); /** * Get the point in the output buffer that the raw pickle should be written to. @@ -41,7 +45,7 @@ size_t _olm_enc_output_length(size_t raw_length); * base-64 encoding would otherwise overwrite the end of the input before it * was encoded.) */ - uint8_t *_olm_enc_output_pos(uint8_t * output, size_t raw_length); +OLM_EXPORT uint8_t *_olm_enc_output_pos(uint8_t * output, size_t raw_length); /** * Encrypt and encode the given pickle in-situ. @@ -51,7 +55,7 @@ size_t _olm_enc_output_length(size_t raw_length); * * Returns the number of bytes in the encoded pickle. */ -size_t _olm_enc_output( +OLM_EXPORT size_t _olm_enc_output( uint8_t const * key, size_t key_length, uint8_t *pickle, size_t raw_length ); @@ -62,7 +66,7 @@ size_t _olm_enc_output( * Returns the number of bytes in the decoded pickle, or olm_error() on error, * in which case *last_error will be updated, if last_error is non-NULL. */ -size_t _olm_enc_input( +OLM_EXPORT size_t _olm_enc_input( uint8_t const * key, size_t key_length, uint8_t * input, size_t b64_length, enum OlmErrorCode * last_error