summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-04-01 15:46:03 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-04-01 15:46:03 +0000
commitc4acfb1fd049f52fb074b103be01cab5cf5c04f8 (patch)
tree71bdfa6dc516553d2cefea531d8aa2591dc60357 /crypto
parent3f7468318dc56f34e1c5e98049b70558fea586b0 (diff)
Add additional OPENSSL_init() handling add dummy call to (hopefully)
ensure OPENSSL_init() is always linked into an application.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/Makefile10
-rw-r--r--crypto/crypto.h2
-rw-r--r--crypto/mem.c3
-rw-r--r--crypto/o_init.c7
4 files changed, 18 insertions, 4 deletions
diff --git a/crypto/Makefile b/crypto/Makefile
index faacc01a54..33503a4d71 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -89,7 +89,15 @@ alphacpuid.s: alphacpuid.pl
$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
o_init.o: o_init.c
- $(CC) $(CFLAGS) -c -o $@ $<
+ case "`(uname -s) 2>/dev/null`" in \
+ OSF1|IRIX*) _WL_INIT="-Wl,-init,OPENSSL_init" ;; \
+ HP-UX) _WL_INIT="-Wl,+init,OPENSSL_init" ;; \
+ AIX) _WL_INIT="-Wl,-binitfini:OPENSSL_init,-bnoobjreorder";; \
+ Darwin) ( while [ "x$1" != "x" -a "x$1" != "x-dynamiclib" ]; do shift; done; \
+ [ $# -ge 1 ] \
+ ) && _WL_INIT="-Wl,-init,_OPENSSL_init" ;; \
+ esac ; \
+ $(CC) $(CFLAGS) $(_WL_INIT) -c -o $@ $<
testapps:
[ -z "$(THIS)" ] || ( if expr " $(SDIRS) " : ".* des " >/dev/null; \
diff --git a/crypto/crypto.h b/crypto/crypto.h
index 469790d7a9..443486d70e 100644
--- a/crypto/crypto.h
+++ b/crypto/crypto.h
@@ -560,8 +560,6 @@ unsigned int *OPENSSL_ia32cap_loc(void);
#define OPENSSL_ia32cap ((OPENSSL_ia32cap_loc())[0])
int OPENSSL_isservice(void);
-void OPENSSL_init(void);
-
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
diff --git a/crypto/mem.c b/crypto/mem.c
index 347c0d8184..7bd29d6766 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -121,10 +121,13 @@ static void (*set_debug_options_func)(long) = NULL;
static long (*get_debug_options_func)(void) = NULL;
#endif
+extern void OPENSSL_init(void);
int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t),
void (*f)(void *))
{
+ /* Dummy call just to ensure OPENSSL_init() gets linked in */
+ OPENSSL_init();
if (!allow_customize)
return 0;
if ((m == 0) || (r == 0) || (f == 0))
diff --git a/crypto/o_init.c b/crypto/o_init.c
index c6bc754df1..1a042ffc99 100644
--- a/crypto/o_init.c
+++ b/crypto/o_init.c
@@ -112,7 +112,12 @@
void OPENSSL_init(void)
{
+ static int done = 0;
+ if (done)
+ return;
+ done = 1;
+#if 1
fprintf(stderr, "Called OPENSSL_init\n");
+#endif
}
-