summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2014-05-24 15:03:39 +0000
committerjsing <>2014-05-24 15:03:39 +0000
commit1f49ee4e13baccf615ca6a97211b5561fb3f3dd5 (patch)
treee8367bbda5ab93df59954ed5a379bc73e1970c91 /src
parentae5e81b467d11eadeb07490348d2cabfbed02f83 (diff)
downloadopenbsd-1f49ee4e13baccf615ca6a97211b5561fb3f3dd5.tar.gz
openbsd-1f49ee4e13baccf615ca6a97211b5561fb3f3dd5.tar.bz2
openbsd-1f49ee4e13baccf615ca6a97211b5561fb3f3dd5.zip
We have shared global variables - unifdef OPENSSL_EXPORT_VAR_AS_FUNCTION.
ok miod@ beck@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/asn1.h22
-rw-r--r--src/lib/libcrypto/asn1/asn1t.h47
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1.h22
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1t.h47
-rw-r--r--src/lib/libssl/src/e_os2.h8
5 files changed, 0 insertions, 146 deletions
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 5d2a7b4418..6543e5aafe 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -386,7 +386,6 @@ TYPEDEF_D2I2D_OF(void);
386 * 386 *
387 */ 387 */
388 388
389#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
390 389
391/* ASN1_ITEM pointer exported type */ 390/* ASN1_ITEM pointer exported type */
392typedef const ASN1_ITEM ASN1_ITEM_EXP; 391typedef const ASN1_ITEM ASN1_ITEM_EXP;
@@ -402,27 +401,6 @@ typedef const ASN1_ITEM ASN1_ITEM_EXP;
402#define DECLARE_ASN1_ITEM(name) \ 401#define DECLARE_ASN1_ITEM(name) \
403 extern const ASN1_ITEM name##_it; 402 extern const ASN1_ITEM name##_it;
404 403
405#else
406
407/* Platforms that can't easily handle shared global variables are declared
408 * as functions returning ASN1_ITEM pointers.
409 */
410
411/* ASN1_ITEM pointer exported type */
412typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
413
414/* Macro to obtain ASN1_ITEM pointer from exported type */
415#define ASN1_ITEM_ptr(iptr) (iptr())
416
417/* Macro to include ASN1_ITEM pointer from base type */
418#define ASN1_ITEM_ref(iptr) (iptr##_it)
419
420#define ASN1_ITEM_rptr(ref) (ref##_it())
421
422#define DECLARE_ASN1_ITEM(name) \
423 const ASN1_ITEM * name##_it(void);
424
425#endif
426 404
427/* Parameters used by ASN1_STRING_print_ex() */ 405/* Parameters used by ASN1_STRING_print_ex() */
428 406
diff --git a/src/lib/libcrypto/asn1/asn1t.h b/src/lib/libcrypto/asn1/asn1t.h
index 1b9d4eb40c..4acba08ee4 100644
--- a/src/lib/libcrypto/asn1/asn1t.h
+++ b/src/lib/libcrypto/asn1/asn1t.h
@@ -71,7 +71,6 @@ extern "C" {
71#endif 71#endif
72 72
73 73
74#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
75 74
76/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ 75/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
77#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) 76#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr))
@@ -85,25 +84,6 @@ extern "C" {
85#define ASN1_ITEM_end(itname) \ 84#define ASN1_ITEM_end(itname) \
86 }; 85 };
87 86
88#else
89
90/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
91#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr()))
92
93
94/* Macros for start and end of ASN1_ITEM definition */
95
96#define ASN1_ITEM_start(itname) \
97 const ASN1_ITEM * itname##_it(void) \
98 { \
99 static const ASN1_ITEM local_it = {
100
101#define ASN1_ITEM_end(itname) \
102 }; \
103 return &local_it; \
104 }
105
106#endif
107 87
108 88
109/* Macros to aid ASN1 template writing */ 89/* Macros to aid ASN1 template writing */
@@ -314,13 +294,8 @@ extern "C" {
314 294
315/* Any defined by macros: the field used is in the table itself */ 295/* Any defined by macros: the field used is in the table itself */
316 296
317#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
318#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } 297#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
319#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } 298#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
320#else
321#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }
322#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }
323#endif
324/* Plain simple type */ 299/* Plain simple type */
325#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) 300#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
326 301
@@ -393,7 +368,6 @@ extern "C" {
393#define ASN1_ADB(name) \ 368#define ASN1_ADB(name) \
394 static const ASN1_ADB_TABLE name##_adbtbl[] 369 static const ASN1_ADB_TABLE name##_adbtbl[]
395 370
396#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
397 371
398#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ 372#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
399 ;\ 373 ;\
@@ -407,27 +381,6 @@ extern "C" {
407 none\ 381 none\
408 } 382 }
409 383
410#else
411
412#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
413 ;\
414 static const ASN1_ITEM *name##_adb(void) \
415 { \
416 static const ASN1_ADB internal_adb = \
417 {\
418 flags,\
419 offsetof(name, field),\
420 app_table,\
421 name##_adbtbl,\
422 sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
423 def,\
424 none\
425 }; \
426 return (const ASN1_ITEM *) &internal_adb; \
427 } \
428 void dummy_function(void)
429
430#endif
431 384
432#define ADB_ENTRY(val, template) {val, template} 385#define ADB_ENTRY(val, template) {val, template}
433 386
diff --git a/src/lib/libssl/src/crypto/asn1/asn1.h b/src/lib/libssl/src/crypto/asn1/asn1.h
index 5d2a7b4418..6543e5aafe 100644
--- a/src/lib/libssl/src/crypto/asn1/asn1.h
+++ b/src/lib/libssl/src/crypto/asn1/asn1.h
@@ -386,7 +386,6 @@ TYPEDEF_D2I2D_OF(void);
386 * 386 *
387 */ 387 */
388 388
389#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
390 389
391/* ASN1_ITEM pointer exported type */ 390/* ASN1_ITEM pointer exported type */
392typedef const ASN1_ITEM ASN1_ITEM_EXP; 391typedef const ASN1_ITEM ASN1_ITEM_EXP;
@@ -402,27 +401,6 @@ typedef const ASN1_ITEM ASN1_ITEM_EXP;
402#define DECLARE_ASN1_ITEM(name) \ 401#define DECLARE_ASN1_ITEM(name) \
403 extern const ASN1_ITEM name##_it; 402 extern const ASN1_ITEM name##_it;
404 403
405#else
406
407/* Platforms that can't easily handle shared global variables are declared
408 * as functions returning ASN1_ITEM pointers.
409 */
410
411/* ASN1_ITEM pointer exported type */
412typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
413
414/* Macro to obtain ASN1_ITEM pointer from exported type */
415#define ASN1_ITEM_ptr(iptr) (iptr())
416
417/* Macro to include ASN1_ITEM pointer from base type */
418#define ASN1_ITEM_ref(iptr) (iptr##_it)
419
420#define ASN1_ITEM_rptr(ref) (ref##_it())
421
422#define DECLARE_ASN1_ITEM(name) \
423 const ASN1_ITEM * name##_it(void);
424
425#endif
426 404
427/* Parameters used by ASN1_STRING_print_ex() */ 405/* Parameters used by ASN1_STRING_print_ex() */
428 406
diff --git a/src/lib/libssl/src/crypto/asn1/asn1t.h b/src/lib/libssl/src/crypto/asn1/asn1t.h
index 1b9d4eb40c..4acba08ee4 100644
--- a/src/lib/libssl/src/crypto/asn1/asn1t.h
+++ b/src/lib/libssl/src/crypto/asn1/asn1t.h
@@ -71,7 +71,6 @@ extern "C" {
71#endif 71#endif
72 72
73 73
74#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
75 74
76/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ 75/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
77#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) 76#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr))
@@ -85,25 +84,6 @@ extern "C" {
85#define ASN1_ITEM_end(itname) \ 84#define ASN1_ITEM_end(itname) \
86 }; 85 };
87 86
88#else
89
90/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
91#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr()))
92
93
94/* Macros for start and end of ASN1_ITEM definition */
95
96#define ASN1_ITEM_start(itname) \
97 const ASN1_ITEM * itname##_it(void) \
98 { \
99 static const ASN1_ITEM local_it = {
100
101#define ASN1_ITEM_end(itname) \
102 }; \
103 return &local_it; \
104 }
105
106#endif
107 87
108 88
109/* Macros to aid ASN1 template writing */ 89/* Macros to aid ASN1 template writing */
@@ -314,13 +294,8 @@ extern "C" {
314 294
315/* Any defined by macros: the field used is in the table itself */ 295/* Any defined by macros: the field used is in the table itself */
316 296
317#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
318#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } 297#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
319#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } 298#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
320#else
321#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }
322#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }
323#endif
324/* Plain simple type */ 299/* Plain simple type */
325#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) 300#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
326 301
@@ -393,7 +368,6 @@ extern "C" {
393#define ASN1_ADB(name) \ 368#define ASN1_ADB(name) \
394 static const ASN1_ADB_TABLE name##_adbtbl[] 369 static const ASN1_ADB_TABLE name##_adbtbl[]
395 370
396#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
397 371
398#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ 372#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
399 ;\ 373 ;\
@@ -407,27 +381,6 @@ extern "C" {
407 none\ 381 none\
408 } 382 }
409 383
410#else
411
412#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
413 ;\
414 static const ASN1_ITEM *name##_adb(void) \
415 { \
416 static const ASN1_ADB internal_adb = \
417 {\
418 flags,\
419 offsetof(name, field),\
420 app_table,\
421 name##_adbtbl,\
422 sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
423 def,\
424 none\
425 }; \
426 return (const ASN1_ITEM *) &internal_adb; \
427 } \
428 void dummy_function(void)
429
430#endif
431 384
432#define ADB_ENTRY(val, template) {val, template} 385#define ADB_ENTRY(val, template) {val, template}
433 386
diff --git a/src/lib/libssl/src/e_os2.h b/src/lib/libssl/src/e_os2.h
index c6e38aa831..0df4786756 100644
--- a/src/lib/libssl/src/e_os2.h
+++ b/src/lib/libssl/src/e_os2.h
@@ -80,17 +80,9 @@ extern "C" {
80 OPENSSL_DECLARE_GLOBAL(int,foobar); 80 OPENSSL_DECLARE_GLOBAL(int,foobar);
81 #define foobar OPENSSL_GLOBAL_REF(foobar) 81 #define foobar OPENSSL_GLOBAL_REF(foobar)
82*/ 82*/
83#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
84# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \
85 type *_shadow_##name(void) \
86 { static type _hide_##name=value; return &_hide_##name; }
87# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
88# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
89#else
90# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value; 83# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value;
91# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name 84# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
92# define OPENSSL_GLOBAL_REF(name) _shadow_##name 85# define OPENSSL_GLOBAL_REF(name) _shadow_##name
93#endif
94# define ossl_ssize_t ssize_t 86# define ossl_ssize_t ssize_t
95#ifdef __cplusplus 87#ifdef __cplusplus
96} 88}