diff options
author | Adam Langley <agl@chromium.org> | 2014-07-31 03:02:14 +0400 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-08-01 02:03:11 +0400 |
commit | eb7d2ed1fe8a33b3e3871502ba7e12efaf94360c (patch) | |
tree | f6bcb80a83aef47e8a23210618792c08c54cba92 /crypto/rc4 | |
parent | 60d4c0e81042e4c014f38575a72c4befded62eef (diff) |
Add visibility rules.
This change marks public symbols as dynamically exported. This means
that it becomes viable to build a shared library of libcrypto and libssl
with -fvisibility=hidden.
On Windows, one not only needs to mark functions for export in a
component, but also for import when using them from a different
component. Because of this we have to build with
|BORINGSSL_IMPLEMENTATION| defined when building the code. Other
components, when including our headers, won't have that defined and then
the |OPENSSL_EXPORT| tag becomes an import tag instead. See the #defines
in base.h
In the asm code, symbols are now hidden by default and those that need
to be exported are wrapped by a C function.
In order to support Chromium, a couple of libssl functions were moved to
ssl.h from ssl_locl.h: ssl_get_new_session and ssl_update_cache.
Change-Id: Ib4b76e2f1983ee066e7806c24721e8626d08a261
Reviewed-on: https://boringssl-review.googlesource.com/1350
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/rc4')
-rw-r--r-- | crypto/rc4/asm/rc4-586.pl | 12 | ||||
-rw-r--r-- | crypto/rc4/asm/rc4-x86_64.pl | 17 | ||||
-rw-r--r-- | crypto/rc4/rc4.c | 19 |
3 files changed, 33 insertions, 15 deletions
diff --git a/crypto/rc4/asm/rc4-586.pl b/crypto/rc4/asm/rc4-586.pl index e3f3b044..fc860ae2 100644 --- a/crypto/rc4/asm/rc4-586.pl +++ b/crypto/rc4/asm/rc4-586.pl @@ -152,8 +152,8 @@ if ($alt=0) { &external_label("OPENSSL_ia32cap_P"); -# void RC4(RC4_KEY *key,size_t len,const unsigned char *inp,unsigned char *out); -&function_begin("RC4"); +# void asm_RC4(RC4_KEY *key,size_t len,const unsigned char *inp,unsigned char *out); +&function_begin("asm_RC4"); &mov ($dat,&wparam(0)); # load key schedule pointer &mov ($ty, &wparam(1)); # load len &mov ($inp,&wparam(2)); # load inp @@ -293,7 +293,7 @@ if ($alt=0) { &mov (&DWP(-4,$dat),$yy); # save key->y &mov (&BP(-8,$dat),&LB($xx)); # save key->x &set_label("abort"); -&function_end("RC4"); +&function_end("asm_RC4"); ######################################################################## @@ -303,8 +303,8 @@ $idi="ebp"; $ido="ecx"; $idx="edx"; -# void RC4_set_key(RC4_KEY *key,int len,const unsigned char *data); -&function_begin("RC4_set_key"); +# void asm_RC4_set_key(RC4_KEY *key,int len,const unsigned char *data); +&function_begin("asm_RC4_set_key"); &mov ($out,&wparam(0)); # load key &mov ($idi,&wparam(1)); # load len &mov ($inp,&wparam(2)); # load data @@ -382,7 +382,7 @@ $idx="edx"; &xor ("eax","eax"); &mov (&DWP(-8,$out),"eax"); # key->x=0; &mov (&DWP(-4,$out),"eax"); # key->y=0; -&function_end("RC4_set_key"); +&function_end("asm_RC4_set_key"); # const char *RC4_options(void); &function_begin_B("RC4_options"); diff --git a/crypto/rc4/asm/rc4-x86_64.pl b/crypto/rc4/asm/rc4-x86_64.pl index a5b2216a..797ae13f 100644 --- a/crypto/rc4/asm/rc4-x86_64.pl +++ b/crypto/rc4/asm/rc4-x86_64.pl @@ -125,10 +125,11 @@ $code=<<___; .text .extern OPENSSL_ia32cap_P -.globl RC4 -.type RC4,\@function,4 +.globl asm_RC4 +.type asm_RC4,\@function,4 .align 16 -RC4: or $len,$len +asm_RC4: + or $len,$len jne .Lentry ret .Lentry: @@ -423,7 +424,7 @@ $code.=<<___; add \$24,%rsp .Lepilogue: ret -.size RC4,.-RC4 +.size asm_RC4,.-asm_RC4 ___ } @@ -431,10 +432,10 @@ $idx="%r8"; $ido="%r9"; $code.=<<___; -.globl RC4_set_key -.type RC4_set_key,\@function,3 +.globl asm_RC4_set_key +.type asm_RC4_set_key,\@function,3 .align 16 -RC4_set_key: +asm_RC4_set_key: lea 8($dat),$dat lea ($inp,$len),$inp neg $len @@ -502,7 +503,7 @@ RC4_set_key: mov %eax,-8($dat) mov %eax,-4($dat) ret -.size RC4_set_key,.-RC4_set_key +.size asm_RC4_set_key,.-asm_RC4_set_key .globl RC4_options .type RC4_options,\@abi-omnipotent diff --git a/crypto/rc4/rc4.c b/crypto/rc4/rc4.c index a93f96ed..ec3de231 100644 --- a/crypto/rc4/rc4.c +++ b/crypto/rc4/rc4.c @@ -345,4 +345,21 @@ void RC4_set_key(RC4_KEY *rc4key, unsigned len, const uint8_t *key) { } } -#endif +#else + +/* In this case several functions are provided by asm code. However, one cannot + * control asm symbol visibility with command line flags and such so they are + * always hidden and wrapped by these C functions, which can be so + * controlled. */ + +void asm_RC4(RC4_KEY *key, size_t len, const uint8_t *in, uint8_t *out); +void RC4(RC4_KEY *key, size_t len, const uint8_t *in, uint8_t *out) { + asm_RC4(key, len, in, out); +} + +void asm_RC4_set_key(RC4_KEY *rc4key, unsigned len, const uint8_t *key); +void RC4_set_key(RC4_KEY *rc4key, unsigned len, const uint8_t *key) { + RC4_set_key(rc4key, len, key); +} + +#endif /* OPENSSL_NO_ASM || (!OPENSSL_X86_64 && !OPENSSL_X86) */ |