From: Andy Polyakov Date: Sun, 20 May 2007 20:11:19 +0000 (+0000) Subject: OPENSSL_IMPLEMENT_GLOBAL caused more grief than it's worth (it's used twice X-Git-Tag: OpenSSL_0_9_8k^2~820 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e4317d2031759900d964e6f2ab03589b4317dfa2;p=oweals%2Fopenssl.git OPENSSL_IMPLEMENT_GLOBAL caused more grief than it's worth (it's used twice in legacy code). I'd rather just remove it along with legacy interface, but it's probably not as appropriate as I'd like. Reimplement the macro. --- diff --git a/crypto/des/enc_read.c b/crypto/des/enc_read.c index ce82125b6f..b86620f568 100644 --- a/crypto/des/enc_read.c +++ b/crypto/des/enc_read.c @@ -63,7 +63,7 @@ /* This has some uglies in it but it works - even over sockets. */ /*extern int errno;*/ -OPENSSL_IMPLEMENT_GLOBAL(int,DES_rw_mode)=DES_PCBC_MODE; +OPENSSL_IMPLEMENT_GLOBAL(int,DES_rw_mode,DES_PCBC_MODE) /* diff --git a/crypto/des/set_key.c b/crypto/des/set_key.c index 55efe03f42..d8499998b7 100644 --- a/crypto/des/set_key.c +++ b/crypto/des/set_key.c @@ -65,7 +65,7 @@ */ #include "des_locl.h" -OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */ +OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ static const unsigned char odd_parity[256]={ 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, diff --git a/e_os2.h b/e_os2.h index 3f72b06786..e17527ab40 100644 --- a/e_os2.h +++ b/e_os2.h @@ -266,20 +266,19 @@ extern "C" { The way it's done allows definitions like this: // in foobar.c - OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0; + OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) // in foobar.h OPENSSL_DECLARE_GLOBAL(int,foobar); #define foobar OPENSSL_GLOBAL_REF(foobar) */ #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION -# define OPENSSL_IMPLEMENT_GLOBAL(type,name) \ - extern type _hide_##name; \ - type *_shadow_##name(void) { return &_hide_##name; } \ - static type _hide_##name +# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ + type *_shadow_##name(void) \ + { static type _hide_##name=value; return &_hide_##name; } # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) #else -# define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name +# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value; # define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name # define OPENSSL_GLOBAL_REF(name) _shadow_##name #endif