summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/eng_padlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/engine/eng_padlock.c')
-rw-r--r--src/lib/libcrypto/engine/eng_padlock.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/lib/libcrypto/engine/eng_padlock.c b/src/lib/libcrypto/engine/eng_padlock.c
index 743558ab33..9f7a85a8da 100644
--- a/src/lib/libcrypto/engine/eng_padlock.c
+++ b/src/lib/libcrypto/engine/eng_padlock.c
@@ -104,10 +104,14 @@
104# if (defined(__GNUC__) && (defined(__i386__) || defined(__i386))) || \ 104# if (defined(__GNUC__) && (defined(__i386__) || defined(__i386))) || \
105 (defined(_MSC_VER) && defined(_M_IX86)) 105 (defined(_MSC_VER) && defined(_M_IX86))
106# define COMPILE_HW_PADLOCK 106# define COMPILE_HW_PADLOCK
107static ENGINE *ENGINE_padlock (void);
108# endif 107# endif
109#endif 108#endif
110 109
110#ifdef OPENSSL_NO_DYNAMIC_ENGINE
111#ifdef COMPILE_HW_PADLOCK
112static ENGINE *ENGINE_padlock (void);
113#endif
114
111void ENGINE_load_padlock (void) 115void ENGINE_load_padlock (void)
112{ 116{
113/* On non-x86 CPUs it just returns. */ 117/* On non-x86 CPUs it just returns. */
@@ -120,17 +124,21 @@ void ENGINE_load_padlock (void)
120#endif 124#endif
121} 125}
122 126
127#endif
128
123#ifdef COMPILE_HW_PADLOCK 129#ifdef COMPILE_HW_PADLOCK
124/* We do these includes here to avoid header problems on platforms that 130/* We do these includes here to avoid header problems on platforms that
125 do not have the VIA padlock anyway... */ 131 do not have the VIA padlock anyway... */
126#ifdef _MSC_VER 132#include <stdlib.h>
133#ifdef _WIN32
127# include <malloc.h> 134# include <malloc.h>
128# define alloca _alloca 135# ifndef alloca
129#elif defined(NETWARE_CLIB) && defined(__GNUC__) 136# define alloca _alloca
130 void *alloca(size_t); 137# endif
131# define alloca(s) __builtin_alloca(s) 138#elif defined(__GNUC__)
132#else 139# ifndef alloca
133# include <stdlib.h> 140# define alloca(s) __builtin_alloca(s)
141# endif
134#endif 142#endif
135 143
136/* Function for ENGINE detection and control */ 144/* Function for ENGINE detection and control */
@@ -191,6 +199,8 @@ padlock_bind_helper(ENGINE *e)
191 return 1; 199 return 1;
192} 200}
193 201
202#ifdef OPENSSL_NO_DYNAMIC_ENGINE
203
194/* Constructor */ 204/* Constructor */
195static ENGINE * 205static ENGINE *
196ENGINE_padlock(void) 206ENGINE_padlock(void)
@@ -209,6 +219,8 @@ ENGINE_padlock(void)
209 return eng; 219 return eng;
210} 220}
211 221
222#endif
223
212/* Check availability of the engine */ 224/* Check availability of the engine */
213static int 225static int
214padlock_init(ENGINE *e) 226padlock_init(ENGINE *e)
@@ -234,7 +246,7 @@ padlock_bind_fn(ENGINE *e, const char *id)
234 return 1; 246 return 1;
235} 247}
236 248
237IMPLEMENT_DYNAMIC_CHECK_FN () 249IMPLEMENT_DYNAMIC_CHECK_FN()
238IMPLEMENT_DYNAMIC_BIND_FN (padlock_bind_fn) 250IMPLEMENT_DYNAMIC_BIND_FN (padlock_bind_fn)
239#endif /* DYNAMIC_ENGINE */ 251#endif /* DYNAMIC_ENGINE */
240 252
@@ -1213,6 +1225,14 @@ static RAND_METHOD padlock_rand = {
1213 padlock_rand_status, /* rand status */ 1225 padlock_rand_status, /* rand status */
1214}; 1226};
1215 1227
1228#else /* !COMPILE_HW_PADLOCK */
1229#ifndef OPENSSL_NO_DYNAMIC_ENGINE
1230OPENSSL_EXPORT
1231int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns);
1232OPENSSL_EXPORT
1233int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { return 0; }
1234IMPLEMENT_DYNAMIC_CHECK_FN()
1235#endif
1216#endif /* COMPILE_HW_PADLOCK */ 1236#endif /* COMPILE_HW_PADLOCK */
1217 1237
1218#endif /* !OPENSSL_NO_HW_PADLOCK */ 1238#endif /* !OPENSSL_NO_HW_PADLOCK */