-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Explicitly mark public API of Themis Introduce a new header <themis/themis_api.h> which defines a function attribute marker THEMIS_API. It is used to explicitly mark API that is considered public. These functions will be exported from the library. Themis does not really provide separate public header files so it's not immediately obvious which functions have to be marked public. We go with functions visible when including <themis/themis.h>. Currently we support only UNIX-like systems so we can limit ourselves to just Clang and GCC. MSVC requires slightly different syntax but we'll get back to that when we start supporting Windows again. * Explicitly mark public API of Soter Just like with Themis, introduce <soter/soter_api.h> with SOTER_API and mark all public declarations as such. Note that Soter also has a... complicated story with header files. It's not apparent which headers are public and which are private. We consider public those ones included from <soter/soter.h>. * Export additional private-use API from Soter Due to historically sloppy export management, many functions in Themis (as well as in unit-tests) rely on not-so-public API to be available. Normally you cannot get access to these functions, but you can if you import <soter/soter_t.h> or some other internal header files. Introduce a new marker SOTER_PRIVATE_API to distinguish such functions from normal exports, and mark all of them exported. There are quite a few of functions, yeah... Note that while public functions are marked in header files, private export functions are marked at definition site. This is required because some of the source files do not actually include corresponding headers. Plus, this way this definitions are ugly to look at and discourage from adding new 'private' exports. * Set default symbol visibility to hidden Finally, compile all source code with default symbol visibility set to "hidden". With this only symbols marked with THEMIS_API, SOTER_API, or SOTER_PRIVATE_API will get exported from libraries. "static" functions will never be exported, and non-static functions are also not exported by default unless explicitly marked as public. * Fix compilation with C++14 DEPRECATED macro expands into [[deprecated]] attribute when compiling C++14. Make sure this attribute goes before GCC-like __attribute__ specifiers, or else the compiler will not recognize them properly. Unfortunately, there is no standard equivalent to visibility attributes. (And I doubt there'll ever be, based on how C++ standards committee operates.) * Windows support in API macros Add [experimental and untested] support for Windows to the API macros. Note that Windows uses slightly different approach to DLL linkage. Just like on Linux and macOS, exported functions should be marked on Windows. However, _imported_ functions should be explicitly marked as well. Effectively, this means that we should mark exported functions with __declspec(dllexport) when compiling DLL object files, but users of the DLL should see functions marked with __declspec(dllimport). We achieve that by using a special macro like THEMIS_EXPORT which is defined only when compling Themis source code, but not when using it. * Add new headers to Carthage Xcode project While not strictly required for build, let's add the headers so that they are visible in Xcode when browsing.
- Loading branch information
Showing
48 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "ge.h" | ||
|
||
SOTER_PRIVATE_API | ||
void ge_p3_tobytes(unsigned char *s,const ge_p3 *h) | ||
{ | ||
fe recip; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "ge.h" | ||
|
||
SOTER_PRIVATE_API | ||
void ge_tobytes(unsigned char *s,const ge_p2 *h) | ||
{ | ||
fe recip; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2019 Cossack Labs Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef SOTER_API_H | ||
#define SOTER_API_H | ||
|
||
#if defined(__GNUC__) || defined(__clang__) | ||
#define SOTER_API __attribute__((visibility("default"))) | ||
#elif defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) | ||
#ifdef SOTER_EXPORT | ||
#define SOTER_API __declspec(dllexport) | ||
#else | ||
#define SOTER_API __declspec(dllimport) | ||
#endif | ||
#else | ||
#define SOTER_API | ||
#endif | ||
|
||
/* | ||
* Marks API that needs to be exported for technical reasons, but otherwise | ||
* is not intended for user consumption. | ||
*/ | ||
#define SOTER_PRIVATE_API SOTER_API | ||
|
||
#endif /* SOTER_API_H */ |
Oops, something went wrong.