From: jsing Date: Sat, 24 May 2014 15:03:39 +0000 (+0000) Subject: We have shared global variables - unifdef OPENSSL_EXPORT_VAR_AS_FUNCTION. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=65af98848fc7a42e34d470d10fc1db8e23f9db93;p=openbsd We have shared global variables - unifdef OPENSSL_EXPORT_VAR_AS_FUNCTION. ok miod@ beck@ --- diff --git a/lib/libcrypto/asn1/asn1.h b/lib/libcrypto/asn1/asn1.h index 5d2a7b44186..6543e5aafe3 100644 --- a/lib/libcrypto/asn1/asn1.h +++ b/lib/libcrypto/asn1/asn1.h @@ -386,7 +386,6 @@ TYPEDEF_D2I2D_OF(void); * */ -#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION /* ASN1_ITEM pointer exported type */ typedef const ASN1_ITEM ASN1_ITEM_EXP; @@ -402,27 +401,6 @@ typedef const ASN1_ITEM ASN1_ITEM_EXP; #define DECLARE_ASN1_ITEM(name) \ extern const ASN1_ITEM name##_it; -#else - -/* Platforms that can't easily handle shared global variables are declared - * as functions returning ASN1_ITEM pointers. - */ - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM * ASN1_ITEM_EXP(void); - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -#define ASN1_ITEM_ptr(iptr) (iptr()) - -/* Macro to include ASN1_ITEM pointer from base type */ -#define ASN1_ITEM_ref(iptr) (iptr##_it) - -#define ASN1_ITEM_rptr(ref) (ref##_it()) - -#define DECLARE_ASN1_ITEM(name) \ - const ASN1_ITEM * name##_it(void); - -#endif /* Parameters used by ASN1_STRING_print_ex() */ diff --git a/lib/libcrypto/asn1/asn1t.h b/lib/libcrypto/asn1/asn1t.h index 1b9d4eb40c3..4acba08ee45 100644 --- a/lib/libcrypto/asn1/asn1t.h +++ b/lib/libcrypto/asn1/asn1t.h @@ -71,7 +71,6 @@ extern "C" { #endif -#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION /* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ #define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) @@ -85,25 +84,6 @@ extern "C" { #define ASN1_ITEM_end(itname) \ }; -#else - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr())) - - -/* Macros for start and end of ASN1_ITEM definition */ - -#define ASN1_ITEM_start(itname) \ - const ASN1_ITEM * itname##_it(void) \ - { \ - static const ASN1_ITEM local_it = { - -#define ASN1_ITEM_end(itname) \ - }; \ - return &local_it; \ - } - -#endif /* Macros to aid ASN1 template writing */ @@ -314,13 +294,8 @@ extern "C" { /* Any defined by macros: the field used is in the table itself */ -#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION #define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } #define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -#else -#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } -#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } -#endif /* Plain simple type */ #define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) @@ -393,7 +368,6 @@ extern "C" { #define ASN1_ADB(name) \ static const ASN1_ADB_TABLE name##_adbtbl[] -#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION #define ASN1_ADB_END(name, flags, field, app_table, def, none) \ ;\ @@ -407,27 +381,6 @@ extern "C" { none\ } -#else - -#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ - ;\ - static const ASN1_ITEM *name##_adb(void) \ - { \ - static const ASN1_ADB internal_adb = \ - {\ - flags,\ - offsetof(name, field),\ - app_table,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - }; \ - return (const ASN1_ITEM *) &internal_adb; \ - } \ - void dummy_function(void) - -#endif #define ADB_ENTRY(val, template) {val, template} diff --git a/lib/libssl/src/crypto/asn1/asn1.h b/lib/libssl/src/crypto/asn1/asn1.h index 5d2a7b44186..6543e5aafe3 100644 --- a/lib/libssl/src/crypto/asn1/asn1.h +++ b/lib/libssl/src/crypto/asn1/asn1.h @@ -386,7 +386,6 @@ TYPEDEF_D2I2D_OF(void); * */ -#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION /* ASN1_ITEM pointer exported type */ typedef const ASN1_ITEM ASN1_ITEM_EXP; @@ -402,27 +401,6 @@ typedef const ASN1_ITEM ASN1_ITEM_EXP; #define DECLARE_ASN1_ITEM(name) \ extern const ASN1_ITEM name##_it; -#else - -/* Platforms that can't easily handle shared global variables are declared - * as functions returning ASN1_ITEM pointers. - */ - -/* ASN1_ITEM pointer exported type */ -typedef const ASN1_ITEM * ASN1_ITEM_EXP(void); - -/* Macro to obtain ASN1_ITEM pointer from exported type */ -#define ASN1_ITEM_ptr(iptr) (iptr()) - -/* Macro to include ASN1_ITEM pointer from base type */ -#define ASN1_ITEM_ref(iptr) (iptr##_it) - -#define ASN1_ITEM_rptr(ref) (ref##_it()) - -#define DECLARE_ASN1_ITEM(name) \ - const ASN1_ITEM * name##_it(void); - -#endif /* Parameters used by ASN1_STRING_print_ex() */ diff --git a/lib/libssl/src/crypto/asn1/asn1t.h b/lib/libssl/src/crypto/asn1/asn1t.h index 1b9d4eb40c3..4acba08ee45 100644 --- a/lib/libssl/src/crypto/asn1/asn1t.h +++ b/lib/libssl/src/crypto/asn1/asn1t.h @@ -71,7 +71,6 @@ extern "C" { #endif -#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION /* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ #define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) @@ -85,25 +84,6 @@ extern "C" { #define ASN1_ITEM_end(itname) \ }; -#else - -/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ -#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr())) - - -/* Macros for start and end of ASN1_ITEM definition */ - -#define ASN1_ITEM_start(itname) \ - const ASN1_ITEM * itname##_it(void) \ - { \ - static const ASN1_ITEM local_it = { - -#define ASN1_ITEM_end(itname) \ - }; \ - return &local_it; \ - } - -#endif /* Macros to aid ASN1 template writing */ @@ -314,13 +294,8 @@ extern "C" { /* Any defined by macros: the field used is in the table itself */ -#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION #define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } #define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } -#else -#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } -#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } -#endif /* Plain simple type */ #define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) @@ -393,7 +368,6 @@ extern "C" { #define ASN1_ADB(name) \ static const ASN1_ADB_TABLE name##_adbtbl[] -#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION #define ASN1_ADB_END(name, flags, field, app_table, def, none) \ ;\ @@ -407,27 +381,6 @@ extern "C" { none\ } -#else - -#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ - ;\ - static const ASN1_ITEM *name##_adb(void) \ - { \ - static const ASN1_ADB internal_adb = \ - {\ - flags,\ - offsetof(name, field),\ - app_table,\ - name##_adbtbl,\ - sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ - def,\ - none\ - }; \ - return (const ASN1_ITEM *) &internal_adb; \ - } \ - void dummy_function(void) - -#endif #define ADB_ENTRY(val, template) {val, template} diff --git a/lib/libssl/src/e_os2.h b/lib/libssl/src/e_os2.h index c6e38aa831e..0df4786756a 100644 --- a/lib/libssl/src/e_os2.h +++ b/lib/libssl/src/e_os2.h @@ -80,17 +80,9 @@ extern "C" { OPENSSL_DECLARE_GLOBAL(int,foobar); #define foobar OPENSSL_GLOBAL_REF(foobar) */ -#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION -# 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,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 # define ossl_ssize_t ssize_t #ifdef __cplusplus }