HWCryptoHook_CallerContext *cactx);
static void hwcrhk_log_message(void *logstr, const char *message);
+/* The definitions for control commands specific to this engine */
+#define HWCRHK_CMD_SO_PATH ENGINE_CMD_BASE
+#define HWCRHK_CMD_FORK_CHECK (ENGINE_CMD_BASE + 1)
+#define HWCRHK_CMD_THREAD_LOCKING (ENGINE_CMD_BASE + 2)
+static const ENGINE_CMD_DEFN hwcrhk_cmd_defns[] = {
+ {HWCRHK_CMD_SO_PATH,
+ "SO_PATH",
+ "Specifies the path to the 'hwcrhk' shared library",
+ ENGINE_CMD_FLAG_STRING},
+ {HWCRHK_CMD_FORK_CHECK,
+ "FORK_CHECK",
+ "Turns fork() checking on or off (boolean)",
+ ENGINE_CMD_FLAG_NUMERIC},
+ {HWCRHK_CMD_THREAD_LOCKING,
+ "THREAD_LOCKING",
+ "Turns thread-safe locking on or off (boolean)",
+ ENGINE_CMD_FLAG_NUMERIC},
+ {0, NULL, NULL, 0}
+ };
+
/* Our internal RSA_METHOD that we provide pointers to */
static RSA_METHOD hwcrhk_rsa =
{
!ENGINE_set_finish_function(ret, hwcrhk_finish) ||
!ENGINE_set_ctrl_function(ret, hwcrhk_ctrl) ||
!ENGINE_set_load_privkey_function(ret, hwcrhk_load_privkey) ||
- !ENGINE_set_load_pubkey_function(ret, hwcrhk_load_pubkey))
+ !ENGINE_set_load_pubkey_function(ret, hwcrhk_load_pubkey) ||
+ !ENGINE_set_cmd_defns(ret, hwcrhk_cmd_defns))
{
ENGINE_free(ret);
return NULL;
static HWCryptoHook_ModExpCRT_t *p_hwcrhk_ModExpCRT = NULL;
/* Used in the DSO operations. */
-static const char *HWCRHK_LIBNAME = "nfhwcrhk";
+static const char def_HWCRHK_LIBNAME[] = "nfhwcrhk";
+static const char *HWCRHK_LIBNAME = def_HWCRHK_LIBNAME;
static const char *n_hwcrhk_Init = "HWCryptoHook_Init";
static const char *n_hwcrhk_Finish = "HWCryptoHook_Finish";
static const char *n_hwcrhk_ModExp = "HWCryptoHook_ModExp";
switch(cmd)
{
+ case HWCRHK_CMD_SO_PATH:
+ if(hwcrhk_dso)
+ {
+ ENGINEerr(ENGINE_F_HWCRHK_CTRL,ENGINE_R_ALREADY_LOADED);
+ return 0;
+ }
+ if(p == NULL)
+ {
+ ENGINEerr(ENGINE_F_HWCRHK_CTRL,ERR_R_PASSED_NULL_PARAMETER);
+ return 0;
+ }
+ HWCRHK_LIBNAME = (const char *)p;
+ return 1;
case ENGINE_CTRL_SET_LOGSTREAM:
{
BIO *bio = (BIO *)p;
/* this enables or disables the "SimpleForkCheck" flag used in the
* initialisation structure. */
case ENGINE_CTRL_CHIL_SET_FORKCHECK:
+ case HWCRHK_CMD_FORK_CHECK:
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
if(i)
hwcrhk_globals.flags |=
disable_mutex_callbacks = 1;
CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
break;
+ case HWCRHK_CMD_THREAD_LOCKING:
+ CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
+ disable_mutex_callbacks = ((i == 0) ? 0 : 1);
+ CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
+ break;
/* The command isn't understood by this engine */
default: