fix symbol exporting again

This commit is contained in:
Hubert Chathi 2021-11-19 15:27:59 -05:00
parent 2430e9bb9a
commit 98b8e35a7c
3 changed files with 19 additions and 10 deletions

View file

@ -21,6 +21,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
endif() endif()
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

View file

@ -23,6 +23,10 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -59,25 +63,25 @@ extern const struct _olm_cipher *megolm_cipher;
* initialize the megolm ratchet. random_data should be at least * initialize the megolm ratchet. random_data should be at least
* MEGOLM_RATCHET_LENGTH bytes of randomness. * 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 */ /** 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. * 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. * 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); const uint8_t *end);
/** advance the ratchet by one step */ /** 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 * 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)) #define megolm_get_data(megolm) ((const uint8_t *)((megolm)->data))
/** advance the ratchet to a given count */ /** 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 #ifdef __cplusplus
} // extern "C" } // extern "C"

View file

@ -23,6 +23,10 @@
#include "olm/error.h" #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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -31,7 +35,7 @@ extern "C" {
/** /**
* Get the number of bytes needed to encode a pickle of the length given * 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. * 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 * base-64 encoding would otherwise overwrite the end of the input before it
* was encoded.) * 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. * 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. * 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 const * key, size_t key_length,
uint8_t *pickle, size_t raw_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, * 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. * 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 const * key, size_t key_length,
uint8_t * input, size_t b64_length, uint8_t * input, size_t b64_length,
enum OlmErrorCode * last_error enum OlmErrorCode * last_error