diff options
Diffstat (limited to 'src/lib/libcrypto/hidden/README')
-rw-r--r-- | src/lib/libcrypto/hidden/README | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/libcrypto/hidden/README b/src/lib/libcrypto/hidden/README new file mode 100644 index 0000000000..c41830cf55 --- /dev/null +++ b/src/lib/libcrypto/hidden/README | |||
@@ -0,0 +1,40 @@ | |||
1 | The goals: | ||
2 | 1) calls from inside libcrypto to other libcrypto functions should | ||
3 | be via identifiers that are of hidden visibility and -- to avoid | ||
4 | confusion or conflicts -- are in the reserved namespace. By | ||
5 | doing this these calls are protected from being overridden by | ||
6 | applications and on many platforms can avoid creation or use of | ||
7 | GOT or PLT entries. I've chosen a prefix of "_lcry_" for this. | ||
8 | Note that these symbols aren't in the dynamic symbol table of the | ||
9 | libcrypto.so shared library...but they are visible in the static | ||
10 | library. | ||
11 | |||
12 | 2) calls from libssl to symbols in libcrypto should be via identifiers | ||
13 | which won't be accidentally overridden by the application, libc, | ||
14 | other random crypto libraries that are pulled in, etc. I've | ||
15 | chosen a prefix of "_libre_" for this. | ||
16 | |||
17 | These will not be declared directly; instead, the gcc "asm labels" | ||
18 | extension will be used rename the function. In order to actually | ||
19 | set up the desired asm labels, we use these in the internal .h | ||
20 | files: | ||
21 | |||
22 | LCRYPTO_USED(x) Symbols used both internally and externally | ||
23 | In builds of libcrypto, this makes gcc convert use of x to | ||
24 | use _libre_x instead. In other builds that use these headers, | ||
25 | it makes gcc convert use of x to use _libre_x instead. Use | ||
26 | LCRYPTO_ALIAS(x) to create the external aliases. | ||
27 | ex: LCRYPTO_USED(SSL_get_verify_mode) | ||
28 | |||
29 | LCRYPTO_UNUSED(x) Symbols that are not used internally or by libssl | ||
30 | No renaming is done. In builds of libcrypto, the symbol | ||
31 | is marked as deprecated to detect unintentional use of such | ||
32 | a synbol, so that it can be marked as used going forward. | ||
33 | ex: LCRYPTO_UNUSED(SSL_CIPHER_get_name) | ||
34 | |||
35 | Finally, to create the expected aliases, we use these in the .c files | ||
36 | where the definitions are: | ||
37 | LCRYPTO_ALIAS(x) | ||
38 | This defines both x and _libre_x as strong aliases for _lcry_x. | ||
39 | Match uses of this with uses of LCRYPTO_USED() | ||
40 | ex: LCRYPTO_ALIAS(SSL_get_verify_mode) | ||