Hi!
I am currently trying to package openssl 0.9.8x for debian, enabling cryptodev
on linux (using cryptodev-linux). So far all went fine the device shows a much
lower load when excuting the commands with forced backend cryptodev below.
Unfortunatly it is not clear to me how to make it the default engine.
openssl speed -evp aes-128-cbc //uses the dynamic ...
openssl speed -evp aes-128-cbc -engine cryptodev //forced cryptodev engine
Can anyone point me to either some documentation/file regarding howto set the
default engine or prioritize cryptodev?
I attached a patch attempt (including dirty hack) which did _not_ work, I
enabled the setup for bsd cryptodev as soon as HAVE_CRYPTODEV is defined,
moving it up to be the first builtin engine being initalized as well as setting
cryptodev as default as soon as "int ENGINE_register_complete(ENGINE *e)" or
"int "ENGINE_register_all_complete(void)" are called.
Thanks a lot in advance.
Best regards,
Bernhard
--- a/crypto/engine/eng_all.c
+++ b/crypto/engine/eng_all.c
@@ -68,9 +68,15 @@
#if 0
ENGINE_load_openssl();
#endif
-#if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_PADLOCK)
+#ifndef OPENSSL_NO_HW
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
+ ENGINE_load_cryptodev();
+#endif
+#ifndef OPENSSL_NO_HW_PADLOCK
ENGINE_load_padlock();
#endif
+#endif
+
ENGINE_load_dynamic();
#ifndef OPENSSL_NO_STATIC_ENGINE
#ifndef OPENSSL_NO_HW
@@ -104,16 +110,13 @@
#endif
#endif
#ifndef OPENSSL_NO_HW
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
- ENGINE_load_cryptodev();
-#endif
#if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG)
ENGINE_load_capi();
#endif
#endif
}
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
void ENGINE_setup_bsd_cryptodev(void) {
static int bsd_cryptodev_default_loaded = 0;
if (!bsd_cryptodev_default_loaded) {
--- a/crypto/engine/engine.h
+++ b/crypto/engine/engine.h
@@ -705,7 +705,7 @@
* values. */
void *ENGINE_get_static_state(void);
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
void ENGINE_setup_bsd_cryptodev(void);
#endif
--- a/crypto/evp/c_all.c
+++ b/crypto/evp/c_all.c
@@ -83,7 +83,7 @@
OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
#ifndef OPENSSL_NO_ENGINE
-# if defined(__OpenBSD__) || defined(__FreeBSD__)
+# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)
ENGINE_setup_bsd_cryptodev();
# endif
#endif
--- a/crypto/engine/eng_fat.c
+++ b/crypto/engine/eng_fat.c
@@ -154,6 +154,12 @@
ENGINE_register_ECDSA(e);
#endif
ENGINE_register_RAND(e);
+/*XXX make this generic, not fixed to cryptodev, but for now that's acceptable*/
+#if 1
+ const char *name = ENGINE_get_id (e);
+ if (strcmp (name,"cryptodev") == 0)
+ ENGINE_set_default (e, ENGINE_METHOD_ALL & ~ENGINE_METHOD_RAND); /*RAND ENABLE? DUNNO*/
+#endif
return 1;
}