Browse Source

Remove EXPORT_VAR_AS_FUNC

We only export functions, not global, so remove the config option
and some of the #ifdef stuff.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9285)
Rich Salz 4 years ago
parent
commit
211da00b79

+ 2 - 0
CHANGES

@@ -14,6 +14,8 @@
 
   *) Removed DES_check_key.  Also removed OPENSSL_IMPLEMENT_GLOBAL,
      OPENSSL_GLOBAL_REF, OPENSSL_DECLARE_GLOBAL.
+     Also removed "export var as function" capability; we do not export
+     variables, only functions.
      [Rich Salz]
 
   *) RC5_32_set_key has been changed to return an int type, with 0 indicating

+ 0 - 2
Configurations/10-main.conf

@@ -1274,7 +1274,6 @@ my %targets = (
         shared_target    => "win-shared", # meaningless except it gives Configure a hint
         thread_scheme    => "winthreads",
         dso_scheme       => "win32",
-        bn_ops           => "EXPORT_VAR_AS_FN",
         perl_platform    => 'Windows::MSVC',
         # additional parameter to build_scheme denotes install-path "flavour"
         build_scheme     => add("VC-common", { separator => undef }),
@@ -1426,7 +1425,6 @@ my %targets = (
                                     threads("-D_MT")),
         lib_cppflags     => "-DL_ENDIAN",
         ex_libs          => add("-lws2_32 -lgdi32 -lcrypt32"),
-        bn_ops           => "EXPORT_VAR_AS_FN",
         thread_scheme    => "winthreads",
         dso_scheme       => "win32",
         shared_target    => "mingw-shared",

+ 2 - 2
Configurations/50-win-onecore.conf

@@ -47,7 +47,7 @@ my %targets = (
         inherit_from    => [ "VC-noCE-common" ],
         defines         => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
                                "OPENSSL_SYS_WIN_CORE"),
-        bn_ops          => "BN_LLONG RC4_CHAR EXPORT_VAR_AS_FN",
+        bn_ops          => "BN_LLONG RC4_CHAR",
         lflags          => add("/NODEFAULTLIB:kernel32.lib"),
         ex_libs         => "onecore.lib",
         multilib        => "-arm",
@@ -56,7 +56,7 @@ my %targets = (
         inherit_from    => [ "VC-noCE-common" ],
         defines         => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
                                "OPENSSL_SYS_WIN_CORE"),
-        bn_ops          => "SIXTY_FOUR_BIT RC4_CHAR EXPORT_VAR_AS_FN",
+        bn_ops          => "SIXTY_FOUR_BIT RC4_CHAR",
         lflags          => add("/NODEFAULTLIB:kernel32.lib"),
         ex_libs         => "onecore.lib",
         multilib        => "-arm64",

+ 0 - 3
Configurations/README

@@ -236,9 +236,6 @@ In each table entry, the following keys are significant:
                                                 up of 'unsigned char's;
                            RC4_INT              RC4 key schedule is made
                                                 up of 'unsigned int's;
-                           EXPORT_VAR_AS_FN     for shared libraries,
-                                                export vars as
-                                                accessor functions.
 
 
 [1] as part of the target configuration, one can have a key called

+ 0 - 2
Configure

@@ -1456,7 +1456,6 @@ if (!$disabled{asm} && !$predefined_C{__MACH__} && $^O ne 'VMS') {
 # Deal with bn_ops ###################################################
 
 $config{bn_ll}                  =0;
-$config{export_var_as_fn}       =0;
 my $def_int="unsigned int";
 $config{rc4_int}                =$def_int;
 ($config{b64l},$config{b64},$config{b32})=(0,0,1);
@@ -1464,7 +1463,6 @@ $config{rc4_int}                =$def_int;
 my $count = 0;
 foreach (sort split(/\s+/,$target{bn_ops})) {
     $count++ if /SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT/;
-    $config{export_var_as_fn}=1                 if $_ eq 'EXPORT_VAR_AS_FN';
     $config{bn_ll}=1                            if $_ eq 'BN_LLONG';
     $config{rc4_int}="unsigned char"            if $_ eq 'RC4_CHAR';
     ($config{b64l},$config{b64},$config{b32})

+ 4 - 23
include/openssl/asn1.h

@@ -310,23 +310,6 @@ TYPEDEF_D2I2D_OF(void);
  *
  */
 
-# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
-
-/* ASN1_ITEM pointer exported type */
-typedef const ASN1_ITEM ASN1_ITEM_EXP;
-
-/* 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) \
-        OPENSSL_EXTERN const ASN1_ITEM name##_it;
-
-# else
 
 /*
  * Platforms that can't easily handle shared global variables are declared as
@@ -337,18 +320,16 @@ typedef const ASN1_ITEM ASN1_ITEM_EXP;
 typedef const ASN1_ITEM *ASN1_ITEM_EXP (void);
 
 /* Macro to obtain ASN1_ITEM pointer from exported type */
-#  define ASN1_ITEM_ptr(iptr) (iptr())
+# 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_ref(iptr) (iptr##_it)
 
-#  define ASN1_ITEM_rptr(ref) (ref##_it())
+# define ASN1_ITEM_rptr(ref) (ref##_it())
 
-#  define DECLARE_ASN1_ITEM(name) \
+# define DECLARE_ASN1_ITEM(name) \
         const ASN1_ITEM * name##_it(void);
 
-# endif
-
 /* Parameters used by ASN1_STRING_print_ex() */
 
 /*

+ 8 - 50
include/openssl/asn1t.h

@@ -25,44 +25,24 @@
 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))
-
-/* Macros for start and end of ASN1_ITEM definition */
-
-#  define ASN1_ITEM_start(itname) \
-        const ASN1_ITEM itname##_it = {
-
-#  define static_ASN1_ITEM_start(itname) \
-        static const ASN1_ITEM itname##_it = {
-
-#  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)()))
+# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)()))
 
 /* Macros for start and end of ASN1_ITEM definition */
 
-#  define ASN1_ITEM_start(itname) \
+# define ASN1_ITEM_start(itname) \
         const ASN1_ITEM * itname##_it(void) \
         { \
                 static const ASN1_ITEM local_it = {
 
-#  define static_ASN1_ITEM_start(itname) \
+# define static_ASN1_ITEM_start(itname) \
         static ASN1_ITEM_start(itname)
 
-#  define ASN1_ITEM_end(itname) \
+# define ASN1_ITEM_end(itname) \
                 }; \
         return &local_it; \
         }
 
-# endif
-
 /* Macros to aid ASN1 template writing */
 
 # define ASN1_ITEM_TEMPLATE(tname) \
@@ -335,13 +315,9 @@ 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
+# 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 }
+
 /* Plain simple type */
 # define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
 /* Embedded simple type */
@@ -421,23 +397,7 @@ 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, adb_cb, def, none) \
-        ;\
-        static const ASN1_ADB name##_adb = {\
-                flags,\
-                offsetof(name, field),\
-                adb_cb,\
-                name##_adbtbl,\
-                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
-                def,\
-                none\
-        }
-
-# else
-
-#  define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
+# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
         ;\
         static const ASN1_ITEM *name##_adb(void) \
         { \
@@ -455,8 +415,6 @@ extern "C" {
         } \
         void dummy_function(void)
 
-# endif
-
 # define ADB_ENTRY(val, template) {val, template}
 
 # define ASN1_ADB_TEMPLATE(name) \

+ 0 - 2
include/openssl/opensslconf.h.in

@@ -165,8 +165,6 @@ extern "C" {
 /* Generate 80386 code? */
 {- $config{processor} eq "386" ? "# define" : "# undef" -} I386_ONLY
 
-{- $config{export_var_as_fn} ? "# define" : "# undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION
-
 /*
  * The following are cipher-specific, but are part of the public API.
  */

+ 0 - 1
util/find-doc-nits

@@ -266,7 +266,6 @@ sub parsenum()
     while ( <$IN> ) {
         next if /^#/;
         next if /\bNOEXIST\b/;
-        next if /\bEXPORT_VAR_AS_FUNC\b/;
         my @fields = split();
         die "Malformed line $_"
             if scalar @fields != 2 && scalar @fields != 4;

File diff suppressed because it is too large
+ 109 - 218
util/libcrypto.num


+ 4 - 8
util/mkdef.pl

@@ -109,24 +109,20 @@ my $libname = platform->sharedname($name);
 my %OS_data = (
     solaris     => { writer     => \&writer_linux,
                      sort       => sorter_linux(),
-                     platforms  => { UNIX                       => 1,
-                                     EXPORT_VAR_AS_FUNCTION     => 0 } },
+                     platforms  => { UNIX                       => 1 } },
     linux       => 'solaris',   # alias
     "bsd-gcc"   => 'solaris',   # alias
     aix         => { writer     => \&writer_aix,
                      sort       => sorter_unix(),
-                     platforms  => { UNIX                       => 1,
-                                     EXPORT_VAR_AS_FUNCTION     => 0 } },
+                     platforms  => { UNIX                       => 1 } },
     VMS         => { writer     => \&writer_VMS,
                      sort       => OpenSSL::Ordinals::by_number(),
-                     platforms  => { VMS                        => 1,
-                                     EXPORT_VAR_AS_FUNCTION     => 0 } },
+                     platforms  => { VMS                        => 1 } },
     vms         => 'VMS',       # alias
     WINDOWS     => { writer     => \&writer_windows,
                      sort       => OpenSSL::Ordinals::by_name(),
                      platforms  => { WIN32                      => 1,
-                                     _WIN32                     => 1,
-                                     EXPORT_VAR_AS_FUNCTION     => 1 } },
+                                     _WIN32                     => 1 } },
     windows     => 'WINDOWS',   # alias
     WIN32       => 'WINDOWS',   # alias
     win32       => 'WIN32',     # alias

+ 0 - 2
util/perl/OpenSSL/Ordinals.pm

@@ -342,8 +342,6 @@ sub _parse_platforms {
 #       if ($def =~ m{^__DragonFly__$})             { $platforms{$&} = $op; }
 #       if ($def =~ m{^__OpenBSD__$})               { $platforms{$&} = $op; }
 #       if ($def =~ m{^__NetBSD__$})                { $platforms{$&} = $op; }
-        if ($def =~
-            m{^OPENSSL_(EXPORT_VAR_AS_FUNCTION)$})  { $platforms{$1} = $op; }
         if ($def =~ m{^OPENSSL_SYS_})               { $platforms{$'} = $op; }
     }
 

+ 0 - 4
util/perl/OpenSSL/ParseC.pm

@@ -400,11 +400,7 @@ EOF
     { regexp   => qr/DECLARE_ASN1_ITEM<<<\((.*)\)>>>/,
       massager => sub {
           return (<<"EOF");
-#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
-OPENSSL_EXTERN const ASN1_ITEM *$1_it;
-#else
 const ASN1_ITEM *$1_it(void);
-#endif
 EOF
       },
     },

Some files were not shown because too many files changed in this diff