Give the programmer of extra engines the possibility to actually make
authorRichard Levitte <levitte@openssl.org>
Thu, 29 Jun 2000 16:33:59 +0000 (16:33 +0000)
committerRichard Levitte <levitte@openssl.org>
Thu, 29 Jun 2000 16:33:59 +0000 (16:33 +0000)
it functional :-).

crypto/engine/engine.h
crypto/engine/engine_err.c
crypto/engine/engine_int.h
crypto/engine/engine_list.c
util/libeay.num

index 7c7f181f15a80e4675268cda67ef197a0b61fbc8..6797a356cfb04c2db29ef289e71e0c7306009c4d 100644 (file)
@@ -104,6 +104,13 @@ typedef int (*BN_MOD_EXP_CRT)(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
                const BIGNUM *q, const BIGNUM *dmp1, const BIGNUM *dmq1,
                const BIGNUM *iqmp, BN_CTX *ctx);
 
+/* Generic function pointer */
+typedef void (*ENGINE_GEN_FUNC_PTR)();
+/* Generic function pointer taking no arguments */
+typedef void (*ENGINE_GEN_INT_FUNC_PTR)(void);
+/* Specific control function pointer */
+typedef int (*ENGINE_CTRL_FUNC_PTR)(int cmd, long i, void *p, void (*f)());
+
 /* The list of "engine" types is a static array of (const ENGINE*)
  * pointers (not dynamic because static is fine for now and we otherwise
  * have to hook an appropriate load/unload function in to initialise and
@@ -160,6 +167,9 @@ int ENGINE_set_DH(ENGINE *e, DH_METHOD *dh_meth);
 int ENGINE_set_RAND(ENGINE *e, RAND_METHOD *rand_meth);
 int ENGINE_set_BN_mod_exp(ENGINE *e, BN_MOD_EXP bn_mod_exp);
 int ENGINE_set_BN_mod_exp_crt(ENGINE *e, BN_MOD_EXP_CRT bn_mod_exp_crt);
+int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
+int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
+int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);
 
 /* These return values from within the ENGINE structure. These can
  * be useful with functional references as well as structural
@@ -174,6 +184,9 @@ DH_METHOD *ENGINE_get_DH(ENGINE *e);
 RAND_METHOD *ENGINE_get_RAND(ENGINE *e);
 BN_MOD_EXP ENGINE_get_BN_mod_exp(ENGINE *e);
 BN_MOD_EXP_CRT ENGINE_get_BN_mod_exp_crt(ENGINE *e);
+ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(ENGINE *e);
+ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(ENGINE *e);
+ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(ENGINE *e);
 
 /* ENGINE_new is normally passed a NULL in the first parameter because
  * the calling code doesn't have access to the definition of the ENGINE
@@ -283,9 +296,12 @@ void ERR_load_ENGINE_strings(void);
 #define ENGINE_F_ENGINE_FREE                            108
 #define ENGINE_F_ENGINE_GET_BN_MOD_EXP                  109
 #define ENGINE_F_ENGINE_GET_BN_MOD_EXP_CRT              110
+#define ENGINE_F_ENGINE_GET_CTRL_FUNCTION               144
 #define ENGINE_F_ENGINE_GET_DH                          111
 #define ENGINE_F_ENGINE_GET_DSA                                 112
+#define ENGINE_F_ENGINE_GET_FINISH_FUNCTION             145
 #define ENGINE_F_ENGINE_GET_ID                          113
+#define ENGINE_F_ENGINE_GET_INIT_FUNCTION               146
 #define ENGINE_F_ENGINE_GET_NAME                        114
 #define ENGINE_F_ENGINE_GET_NEXT                        115
 #define ENGINE_F_ENGINE_GET_PREV                        116
@@ -298,10 +314,13 @@ void ERR_load_ENGINE_strings(void);
 #define ENGINE_F_ENGINE_REMOVE                          123
 #define ENGINE_F_ENGINE_SET_BN_MOD_EXP                  124
 #define ENGINE_F_ENGINE_SET_BN_MOD_EXP_CRT              125
+#define ENGINE_F_ENGINE_SET_CTRL_FUNCTION               147
 #define ENGINE_F_ENGINE_SET_DEFAULT_TYPE                126
 #define ENGINE_F_ENGINE_SET_DH                          127
 #define ENGINE_F_ENGINE_SET_DSA                                 128
+#define ENGINE_F_ENGINE_SET_FINISH_FUNCTION             148
 #define ENGINE_F_ENGINE_SET_ID                          129
+#define ENGINE_F_ENGINE_SET_INIT_FUNCTION               149
 #define ENGINE_F_ENGINE_SET_NAME                        130
 #define ENGINE_F_ENGINE_SET_RAND                        131
 #define ENGINE_F_ENGINE_SET_RSA                                 132
index a250367c3b69797a9d6d9157741e306c96a88d66..01c382f5bab2fa4eb33d4ef0cb894f55b03f1ff9 100644 (file)
@@ -84,9 +84,12 @@ static ERR_STRING_DATA ENGINE_str_functs[]=
 {ERR_PACK(0,ENGINE_F_ENGINE_FREE,0),   "ENGINE_free"},
 {ERR_PACK(0,ENGINE_F_ENGINE_GET_BN_MOD_EXP,0), "ENGINE_get_BN_mod_exp"},
 {ERR_PACK(0,ENGINE_F_ENGINE_GET_BN_MOD_EXP_CRT,0),     "ENGINE_get_BN_mod_exp_crt"},
+{ERR_PACK(0,ENGINE_F_ENGINE_GET_CTRL_FUNCTION,0),      "ENGINE_get_ctrl_function"},
 {ERR_PACK(0,ENGINE_F_ENGINE_GET_DH,0), "ENGINE_get_DH"},
 {ERR_PACK(0,ENGINE_F_ENGINE_GET_DSA,0),        "ENGINE_get_DSA"},
+{ERR_PACK(0,ENGINE_F_ENGINE_GET_FINISH_FUNCTION,0),    "ENGINE_get_finish_function"},
 {ERR_PACK(0,ENGINE_F_ENGINE_GET_ID,0), "ENGINE_get_id"},
+{ERR_PACK(0,ENGINE_F_ENGINE_GET_INIT_FUNCTION,0),      "ENGINE_get_init_function"},
 {ERR_PACK(0,ENGINE_F_ENGINE_GET_NAME,0),       "ENGINE_get_name"},
 {ERR_PACK(0,ENGINE_F_ENGINE_GET_NEXT,0),       "ENGINE_get_next"},
 {ERR_PACK(0,ENGINE_F_ENGINE_GET_PREV,0),       "ENGINE_get_prev"},
@@ -99,10 +102,13 @@ static ERR_STRING_DATA ENGINE_str_functs[]=
 {ERR_PACK(0,ENGINE_F_ENGINE_REMOVE,0), "ENGINE_remove"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_BN_MOD_EXP,0), "ENGINE_set_BN_mod_exp"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_BN_MOD_EXP_CRT,0),     "ENGINE_set_BN_mod_exp_crt"},
+{ERR_PACK(0,ENGINE_F_ENGINE_SET_CTRL_FUNCTION,0),      "ENGINE_set_ctrl_function"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_DEFAULT_TYPE,0),       "ENGINE_SET_DEFAULT_TYPE"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_DH,0), "ENGINE_set_DH"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_DSA,0),        "ENGINE_set_DSA"},
+{ERR_PACK(0,ENGINE_F_ENGINE_SET_FINISH_FUNCTION,0),    "ENGINE_set_finish_function"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_ID,0), "ENGINE_set_id"},
+{ERR_PACK(0,ENGINE_F_ENGINE_SET_INIT_FUNCTION,0),      "ENGINE_set_init_function"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_NAME,0),       "ENGINE_set_name"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_RAND,0),       "ENGINE_set_RAND"},
 {ERR_PACK(0,ENGINE_F_ENGINE_SET_RSA,0),        "ENGINE_set_RSA"},
index fc9291dea2ab831ee90e8a35539fee1a9b59daa6..aedf6617f61f03afdea00def86effd8ce1bfe415 100644 (file)
@@ -86,6 +86,13 @@ typedef int (*BN_MOD_EXP_CRT)(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
                const BIGNUM *q, const BIGNUM *dmp1, const BIGNUM *dmq1,
                const BIGNUM *iqmp, BN_CTX *ctx);
 
+/* Generic function pointer */
+typedef int (*ENGINE_GEN_FUNC_PTR)();
+/* Generic function pointer taking no arguments */
+typedef int (*ENGINE_GEN_INT_FUNC_PTR)(void);
+/* Specific control function pointer */
+typedef int (*ENGINE_CTRL_FUNC_PTR)(int cmd, long i, void *p, void (*f)());
+
 #endif
 
 /* This is a structure for storing implementations of various crypto
index 20833ac20e5f5176400363fac6cec424e8c0d64e..0e50497145c8dc3848e23f9a76d2d0d07a45f5d3 100644 (file)
@@ -514,6 +514,42 @@ int ENGINE_set_BN_mod_exp_crt(ENGINE *e, BN_MOD_EXP_CRT bn_mod_exp_crt)
        return 1;
        }
 
+int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f)
+       {
+       if((e == NULL) || (init_f == NULL))
+               {
+               ENGINEerr(ENGINE_F_ENGINE_SET_INIT_FUNCTION,
+                       ERR_R_PASSED_NULL_PARAMETER);
+               return 0;
+               }
+       e->init = init_f;
+       return 1;
+       }
+
+int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f)
+       {
+       if((e == NULL) || (finish_f == NULL))
+               {
+               ENGINEerr(ENGINE_F_ENGINE_SET_FINISH_FUNCTION,
+                       ERR_R_PASSED_NULL_PARAMETER);
+               return 0;
+               }
+       e->finish = finish_f;
+       return 1;
+       }
+
+int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f)
+       {
+       if((e == NULL) || (ctrl_f == NULL))
+               {
+               ENGINEerr(ENGINE_F_ENGINE_SET_CTRL_FUNCTION,
+                       ERR_R_PASSED_NULL_PARAMETER);
+               return 0;
+               }
+       e->ctrl = ctrl_f;
+       return 1;
+       }
+
 const char *ENGINE_get_id(ENGINE *e)
        {
        if(e == NULL)
@@ -601,3 +637,37 @@ BN_MOD_EXP_CRT ENGINE_get_BN_mod_exp_crt(ENGINE *e)
                }
        return e->bn_mod_exp_crt;
        }
+
+ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(ENGINE *e)
+       {
+       if(e == NULL)
+               {
+               ENGINEerr(ENGINE_F_ENGINE_GET_INIT_FUNCTION,
+                       ERR_R_PASSED_NULL_PARAMETER);
+               return NULL;
+               }
+       return e->init;
+       }
+
+ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(ENGINE *e)
+       {
+       if(e == NULL)
+               {
+               ENGINEerr(ENGINE_F_ENGINE_GET_FINISH_FUNCTION,
+                       ERR_R_PASSED_NULL_PARAMETER);
+               return NULL;
+               }
+       return e->finish;
+       }
+
+ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(ENGINE *e)
+       {
+       if(e == NULL)
+               {
+               ENGINEerr(ENGINE_F_ENGINE_GET_CTRL_FUNCTION,
+                       ERR_R_PASSED_NULL_PARAMETER);
+               return NULL;
+               }
+       return e->ctrl;
+       }
+
index 3c593f1a01812a7ee6ea7f50292851e7e89c3660..33cb311459aa71168f31f18486441b4658d8a438 100755 (executable)
@@ -1890,3 +1890,9 @@ ENGINE_add                              2465
 DH_set_default_openssl_method           2466
 ENGINE_get_DSA                          2467
 ENGINE_ctrl                             2468
+ENGINE_get_finish_function              2469
+ENGINE_get_init_function                2470
+ENGINE_set_init_function                2471
+ENGINE_set_finish_function              2472
+ENGINE_get_ctrl_function                2473
+ENGINE_set_ctrl_function                2474