Document OPENSSL_VERSION_TEXT macro
[openssl.git] / ms / uplink.c
index 4f480a7981712dde22e522f6d6e3890ef243d8d6..7f7abfbe57eb985433b2155153ebbf5ca2de77c6 100644 (file)
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
 #if (defined(_WIN64) || defined(_WIN32_WCE)) && !defined(UNICODE)
 # define UNICODE
 #endif
@@ -90,6 +99,34 @@ void OPENSSL_Uplink(volatile void **table, int index)
     table[index] = func;
 }
 
+#if defined(_MSC_VER) && defined(_M_IX86)
+# define LAZY(i)         \
+__declspec(naked) static void lazy##i (void) {  \
+        _asm    push i                          \
+        _asm    push OFFSET OPENSSL_UplinkTable \
+        _asm    call OPENSSL_Uplink             \
+        _asm    add  esp,8                      \
+        _asm    jmp  OPENSSL_UplinkTable+4*i    }
+
+# if APPLINK_MAX>25
+#  error "Add more stubs..."
+# endif
+/* make some in advance... */
+LAZY(1) LAZY(2) LAZY(3) LAZY(4) LAZY(5)
+    LAZY(6) LAZY(7) LAZY(8) LAZY(9) LAZY(10)
+    LAZY(11) LAZY(12) LAZY(13) LAZY(14) LAZY(15)
+    LAZY(16) LAZY(17) LAZY(18) LAZY(19) LAZY(20)
+    LAZY(21) LAZY(22) LAZY(23) LAZY(24) LAZY(25)
+void *OPENSSL_UplinkTable[] = {
+    (void *)APPLINK_MAX,
+    lazy1, lazy2, lazy3, lazy4, lazy5,
+    lazy6, lazy7, lazy8, lazy9, lazy10,
+    lazy11, lazy12, lazy13, lazy14, lazy15,
+    lazy16, lazy17, lazy18, lazy19, lazy20,
+    lazy21, lazy22, lazy23, lazy24, lazy25,
+};
+#endif
+
 #ifdef SELFTEST
 main()
 {