?? engine.h
字號:
* framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries * to ENGINE_set_cmd_defns(). It should also implement a ctrl() handler that * supports the stated commands (ie. the "cmd_num" entries as described by the * array). NB: The array must be ordered in increasing order of cmd_num. * "null-terminated" means that the last ENGINE_CMD_DEFN element has cmd_num set * to zero and/or cmd_name set to NULL. */typedef struct ENGINE_CMD_DEFN_st { unsigned int cmd_num; /* The command number */ const char *cmd_name; /* The command name itself */ const char *cmd_desc; /* A short description of the command */ unsigned int cmd_flags; /* The input the command expects */ } ENGINE_CMD_DEFN;/* Generic function pointer */typedef int (*ENGINE_GEN_FUNC_PTR)();/* Generic function pointer taking no arguments */typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *);/* Specific control function pointer */typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)());/* Generic load_key function pointer */typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, UI_METHOD *ui_method, void *callback_data);/* These callback types are for an ENGINE's handler for cipher and digest logic. * These handlers have these prototypes; * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); * Looking at how to implement these handlers in the case of cipher support, if * the framework wants the EVP_CIPHER for 'nid', it will call; * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) * If the framework wants a list of supported 'nid's, it will call; * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) *//* Returns to a pointer to the array of supported cipher 'nid's. If the second * parameter is non-NULL it is set to the size of the returned array. */typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int);typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int);/* STRUCTURE functions ... all of these functions deal with pointers to ENGINE * structures where the pointers have a "structural reference". This means that * their reference is to allowed access to the structure but it does not imply * that the structure is functional. To simply increment or decrement the * structural reference count, use ENGINE_by_id and ENGINE_free. NB: This is not * required when iterating using ENGINE_get_next as it will automatically * decrement the structural reference count of the "current" ENGINE and * increment the structural reference count of the ENGINE it returns (unless it * is NULL). *//* Get the first/last "ENGINE" type available. */ENGINE *ENGINE_get_first(void);ENGINE *ENGINE_get_last(void);/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ENGINE *ENGINE_get_next(ENGINE *e);ENGINE *ENGINE_get_prev(ENGINE *e);/* Add another "ENGINE" type into the array. */int ENGINE_add(ENGINE *e);/* Remove an existing "ENGINE" type from the array. */int ENGINE_remove(ENGINE *e);/* Retrieve an engine from the list by its unique "id" value. */ENGINE *ENGINE_by_id(const char *id);/* Add all the built-in engines. */void ENGINE_load_openssl(void);void ENGINE_load_dynamic(void);void ENGINE_load_cswift(void);void ENGINE_load_chil(void);void ENGINE_load_atalla(void);void ENGINE_load_nuron(void);void ENGINE_load_ubsec(void);void ENGINE_load_aep(void);void ENGINE_load_sureware(void);void ENGINE_load_4758cca(void);void ENGINE_load_cryptodev(void);void ENGINE_load_builtin_engines(void);/* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation * "registry" handling. */unsigned int ENGINE_get_table_flags(void);void ENGINE_set_table_flags(unsigned int flags);/* Manage registration of ENGINEs per "table". For each type, there are 3 * functions; * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) * ENGINE_unregister_***(e) - unregister the implementation from 'e' * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list * Cleanup is automatically registered from each table when required, so * ENGINE_cleanup() will reverse any "register" operations. */int ENGINE_register_RSA(ENGINE *e);void ENGINE_unregister_RSA(ENGINE *e);void ENGINE_register_all_RSA(void);int ENGINE_register_DSA(ENGINE *e);void ENGINE_unregister_DSA(ENGINE *e);void ENGINE_register_all_DSA(void);int ENGINE_register_DH(ENGINE *e);void ENGINE_unregister_DH(ENGINE *e);void ENGINE_register_all_DH(void);int ENGINE_register_RAND(ENGINE *e);void ENGINE_unregister_RAND(ENGINE *e);void ENGINE_register_all_RAND(void);int ENGINE_register_ciphers(ENGINE *e);void ENGINE_unregister_ciphers(ENGINE *e);void ENGINE_register_all_ciphers(void);int ENGINE_register_digests(ENGINE *e);void ENGINE_unregister_digests(ENGINE *e);void ENGINE_register_all_digests(void);/* These functions register all support from the above categories. Note, use of * these functions can result in static linkage of code your application may not * need. If you only need a subset of functionality, consider using more * selective initialisation. */int ENGINE_register_complete(ENGINE *e);int ENGINE_register_all_complete(void);/* Send parametrised control commands to the engine. The possibilities to send * down an integer, a pointer to data or a function pointer are provided. Any of * the parameters may or may not be NULL, depending on the command number. In * actuality, this function only requires a structural (rather than functional) * reference to an engine, but many control commands may require the engine be * functional. The caller should be aware of trying commands that require an * operational ENGINE, and only use functional references in such situations. */int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());/* This function tests if an ENGINE-specific command is usable as a "setting". * Eg. in an application's config file that gets processed through * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */int ENGINE_cmd_is_executable(ENGINE *e, int cmd);/* This function works like ENGINE_ctrl() with the exception of taking a * command name instead of a command number, and can handle optional commands. * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to * use the cmd_name and cmd_optional. */int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p, void (*f)(), int cmd_optional);/* This function passes a command-name and argument to an ENGINE. The cmd_name * is converted to a command number and the control command is called using * 'arg' as an argument (unless the ENGINE doesn't support such a command, in * which case no control command is called). The command is checked for input * flags, and if necessary the argument will be converted to a numeric value. If * cmd_optional is non-zero, then if the ENGINE doesn't support the given * cmd_name the return value will be success anyway. This function is intended * for applications to use so that users (or config files) can supply * engine-specific config data to the ENGINE at run-time to control behaviour of * specific engines. As such, it shouldn't be used for calling ENGINE_ctrl() * functions that return data, deal with binary data, or that are otherwise * supposed to be used directly through ENGINE_ctrl() in application code. Any * "return" data from an ENGINE_ctrl() operation in this function will be lost - * the return value is interpreted as failure if the return value is zero, * success otherwise, and this function returns a boolean value as a result. In * other words, vendors of 'ENGINE'-enabled devices should write ENGINE * implementations with parameterisations that work in this scheme, so that * compliant ENGINE-based applications can work consistently with the same * configuration for the same ENGINE-enabled devices, across applications. */int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, int cmd_optional);/* These functions are useful for manufacturing new ENGINE structures. They * don't address reference counting at all - one uses them to populate an ENGINE * structure with personalised implementations of things prior to using it * directly or adding it to the builtin ENGINE list in OpenSSL. These are also * here so that the ENGINE structure doesn't have to be exposed and break binary * compatibility! */ENGINE *ENGINE_new(void);int ENGINE_free(ENGINE *e);int ENGINE_up_ref(ENGINE *e);int ENGINE_set_id(ENGINE *e, const char *id);int ENGINE_set_name(ENGINE *e, const char *name);int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);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);int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);int ENGINE_set_flags(ENGINE *e, int flags);int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);/* These functions (and the "get" function lower down) allow control over any * per-structure ENGINE data. */int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);/* This function cleans up anything that needs it. Eg. the ENGINE_add() function * automatically ensures the list cleanup function is registered to be called * from ENGINE_cleanup(). Similarly, all ENGINE_register_*** functions ensure * ENGINE_cleanup() will clean up after them. */void ENGINE_cleanup(void);/* These return values from within the ENGINE structure. These can be useful * with functional references as well as structural references - it depends * which you obtained. Using the result for functional purposes if you only * obtained a structural reference may be problematic! */const char *ENGINE_get_id(const ENGINE *e);const char *ENGINE_get_name(const ENGINE *e);const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);const DH_METHOD *ENGINE_get_DH(const ENGINE *e);const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);int ENGINE_get_flags(const ENGINE *e);void *ENGINE_get_ex_data(const ENGINE *e, int idx);/* FUNCTIONAL functions. These functions deal with ENGINE structures * that have (or will) be initialised for use. Broadly speaking, the * structural functions are useful for iterating the list of available * engine types, creating new engine types, and other "list" operations. * These functions actually deal with ENGINEs that are to be used. As * such these functions can fail (if applicable) when particular * engines are unavailable - eg. if a hardware accelerator is not * attached or not functioning correctly. Each ENGINE has 2 reference * counts; structural and functional. Every time a functional reference * is obtained or released, a corresponding structural reference is * automatically obtained or released too. *//* Initialise a engine type for use (or up its reference count if it's * already in use). This will fail if the engine is not currently * operational and cannot initialise. */int ENGINE_init(ENGINE *e);/* Free a functional reference to a engine type. This does not require * a corresponding call to ENGINE_free as it also releases a structural * reference. */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -