This changes the existing hardware ENGINE implementations to dynamically
[openssl.git] / crypto / engine / engine_int.h
index d44f64855937c5f1880ac83360aa8c430303f577..90a47a73256c0590b16ad6266e820eb1b5c37b82 100644 (file)
 extern "C" {
 #endif
 
+/* If we compile with this symbol defined, then both reference counts in the
+ * ENGINE structure will be monitored with a line of output on stderr for each
+ * change. This prints the engine's pointer address (truncated to unsigned int),
+ * "struct" or "funct" to indicate the reference type, the before and after
+ * reference count, and the file:line-number pair. The "engine_ref_debug"
+ * statements must come *after* the change. */
+#ifdef ENGINE_REF_COUNT_DEBUG
+
+#define engine_ref_debug(e, isfunct, diff) \
+       fprintf(stderr, "engine: %08x %s from %d to %d (%s:%d)\n", \
+               (unsigned int)(e), (isfunct ? "funct" : "struct"), \
+               ((isfunct) ? ((e)->funct_ref - (diff)) : ((e)->struct_ref - (diff))), \
+               ((isfunct) ? (e)->funct_ref : (e)->struct_ref), \
+               (__FILE__), (__LINE__));
+
+#else
+
+#define engine_ref_debug(e, isfunct, diff)
+
+#endif
+
+typedef struct engine_evp_cipher_st
+       {
+       const EVP_CIPHER *cipher;
+       } ENGINE_EVP_CIPHER;
+
+DECLARE_STACK_OF(ENGINE_EVP_CIPHER)
+
+void ENGINE_free_engine_cipher(ENGINE_EVP_CIPHER *p);
+
 /* NB: Bitwise OR-able values for the "flags" variable in ENGINE are now exposed
  * in engine.h. */
 
@@ -79,6 +109,7 @@ struct engine_st
        const DSA_METHOD *dsa_meth;
        const DH_METHOD *dh_meth;
        const RAND_METHOD *rand_meth;
+
        BN_MOD_EXP bn_mod_exp;
        BN_MOD_EXP_CRT bn_mod_exp_crt;
        ENGINE_GEN_INT_FUNC_PTR init;
@@ -86,6 +117,9 @@ struct engine_st
        ENGINE_CTRL_FUNC_PTR ctrl;
        ENGINE_LOAD_KEY_PTR load_privkey;
        ENGINE_LOAD_KEY_PTR load_pubkey;
+
+       STACK_OF(ENGINE_EVP_CIPHER) *ciphers;
+
        const ENGINE_CMD_DEFN *cmd_defns;
        int flags;
        /* reference count on the structure itself */
@@ -107,7 +141,11 @@ struct engine_st
  * do not return references - they are purely for bootstrapping). */
 
 /* Returns a structure of software only methods (the default). */
-ENGINE *ENGINE_openssl();
+ENGINE *ENGINE_openssl(void);
+
+/* Returns the "dynamic" ENGINE for loading entire ENGINE implementations from
+ * shared libraries. */
+ENGINE *ENGINE_dynamic(void);
 
 #ifndef OPENSSL_NO_HW
 
@@ -115,26 +153,30 @@ ENGINE *ENGINE_openssl();
 /* Returns a structure of cswift methods ... NB: This can exist and be
  * "used" even on non-cswift systems because the "init" will fail if the
  * card/library are not found. */
-ENGINE *ENGINE_cswift();
+ENGINE *ENGINE_cswift(void);
 #endif /* !OPENSSL_NO_HW_CSWIFT */
 
 #ifndef OPENSSL_NO_HW_NCIPHER
-ENGINE *ENGINE_ncipher();
+ENGINE *ENGINE_ncipher(void);
 #endif /* !OPENSSL_NO_HW_NCIPHER */
 
 #ifndef OPENSSL_NO_HW_ATALLA
 /* Returns a structure of atalla methods. */
-ENGINE *ENGINE_atalla();
+ENGINE *ENGINE_atalla(void);
 #endif /* !OPENSSL_NO_HW_ATALLA */
 
 #ifndef OPENSSL_NO_HW_NURON
-ENGINE *ENGINE_nuron();
+ENGINE *ENGINE_nuron(void);
 #endif /* !OPENSSL_NO_HW_NURON */
 
 #ifndef OPENSSL_NO_HW_UBSEC
-ENGINE *ENGINE_ubsec();
+ENGINE *ENGINE_ubsec(void);
 #endif /* !OPENSSL_NO_HW_UBSEC */
 
+#ifdef OPENSSL_OPENBSD_DEV_CRYPTO
+ENGINE *ENGINE_openbsd_dev_crypto(void);
+#endif
+
 #endif /* !OPENSSL_NO_HW */
 
 #ifdef  __cplusplus