engine.h revision 127128
141502Swpaul/* openssl/engine.h */ 241502Swpaul/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 341502Swpaul * project 2000. 441502Swpaul */ 541502Swpaul/* ==================================================================== 641502Swpaul * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. 741502Swpaul * 841502Swpaul * Redistribution and use in source and binary forms, with or without 941502Swpaul * modification, are permitted provided that the following conditions 1041502Swpaul * are met: 1141502Swpaul * 1241502Swpaul * 1. Redistributions of source code must retain the above copyright 1341502Swpaul * notice, this list of conditions and the following disclaimer. 1441502Swpaul * 1541502Swpaul * 2. Redistributions in binary form must reproduce the above copyright 1641502Swpaul * notice, this list of conditions and the following disclaimer in 1741502Swpaul * the documentation and/or other materials provided with the 1841502Swpaul * distribution. 1941502Swpaul * 2041502Swpaul * 3. All advertising materials mentioning features or use of this 2141502Swpaul * software must display the following acknowledgment: 2241502Swpaul * "This product includes software developed by the OpenSSL Project 2341502Swpaul * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 2441502Swpaul * 2541502Swpaul * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 2641502Swpaul * endorse or promote products derived from this software without 2741502Swpaul * prior written permission. For written permission, please contact 2841502Swpaul * licensing@OpenSSL.org. 2941502Swpaul * 3041502Swpaul * 5. Products derived from this software may not be called "OpenSSL" 3141502Swpaul * nor may "OpenSSL" appear in their names without prior written 3244238Swpaul * permission of the OpenSSL Project. 3341502Swpaul * 3441502Swpaul * 6. Redistributions of any form whatsoever must retain the following 3541502Swpaul * acknowledgment: 3641502Swpaul * "This product includes software developed by the OpenSSL Project 3741502Swpaul * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 3841502Swpaul * 3941502Swpaul * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 4041502Swpaul * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4141502Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 4241502Swpaul * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 4341502Swpaul * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 4441502Swpaul * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 4541502Swpaul * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 4641502Swpaul * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4741502Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 4841502Swpaul * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 4941502Swpaul * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 5041502Swpaul * OF THE POSSIBILITY OF SUCH DAMAGE. 5141502Swpaul * ==================================================================== 5241502Swpaul * 5341502Swpaul * This product includes cryptographic software written by Eric Young 5441502Swpaul * (eay@cryptsoft.com). This product includes software written by Tim 5541502Swpaul * Hudson (tjh@cryptsoft.com). 5641502Swpaul * 5741502Swpaul */ 5841502Swpaul 5941502Swpaul#ifndef HEADER_ENGINE_H 6041502Swpaul#define HEADER_ENGINE_H 6141502Swpaul 6241502Swpaul#include <openssl/opensslconf.h> 6341502Swpaul 6441502Swpaul#ifdef OPENSSL_NO_ENGINE 6541502Swpaul#error ENGINE is disabled. 6641502Swpaul#endif 6741502Swpaul 6841502Swpaul#include <openssl/ossl_typ.h> 6941502Swpaul#include <openssl/bn.h> 7041502Swpaul#ifndef OPENSSL_NO_RSA 7141502Swpaul#include <openssl/rsa.h> 7241502Swpaul#endif 7341502Swpaul#ifndef OPENSSL_NO_DSA 7441502Swpaul#include <openssl/dsa.h> 7541502Swpaul#endif 7641502Swpaul#ifndef OPENSSL_NO_DH 7741502Swpaul#include <openssl/dh.h> 7841502Swpaul#endif 7941502Swpaul#include <openssl/rand.h> 8041502Swpaul#include <openssl/ui.h> 8141502Swpaul#include <openssl/symhacks.h> 8241502Swpaul#include <openssl/err.h> 8341502Swpaul 8441502Swpaul#ifdef __cplusplus 8541502Swpaulextern "C" { 8641502Swpaul#endif 8741502Swpaul 8841502Swpaul/* Fixups for missing algorithms */ 8941502Swpaul#ifdef OPENSSL_NO_RSA 9041502Swpaultypedef void RSA_METHOD; 9141502Swpaul#endif 9241502Swpaul#ifdef OPENSSL_NO_DSA 9341502Swpaultypedef void DSA_METHOD; 9441502Swpaul#endif 9541502Swpaul#ifdef OPENSSL_NO_DH 9641502Swpaultypedef void DH_METHOD; 9741502Swpaul#endif 9841502Swpaul 9941591Sarchie/* These flags are used to control combinations of algorithm (methods) 10044238Swpaul * by bitwise "OR"ing. */ 10141502Swpaul#define ENGINE_METHOD_RSA (unsigned int)0x0001 10241502Swpaul#define ENGINE_METHOD_DSA (unsigned int)0x0002 10341502Swpaul#define ENGINE_METHOD_DH (unsigned int)0x0004 10441502Swpaul#define ENGINE_METHOD_RAND (unsigned int)0x0008 10541502Swpaul#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 10641502Swpaul#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 10741502Swpaul/* Obvious all-or-nothing cases. */ 10841502Swpaul#define ENGINE_METHOD_ALL (unsigned int)0xFFFF 10941502Swpaul#define ENGINE_METHOD_NONE (unsigned int)0x0000 11041502Swpaul 11144238Swpaul/* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used 11244238Swpaul * internally to control registration of ENGINE implementations, and can be set 11344238Swpaul * by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to 11444238Swpaul * initialise registered ENGINEs if they are not already initialised. */ 11541502Swpaul#define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 11641502Swpaul 11741502Swpaul/* ENGINE flags that can be set by ENGINE_set_flags(). */ 11841502Swpaul/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ /* Not used */ 11941502Swpaul 12041502Swpaul/* This flag is for ENGINEs that wish to handle the various 'CMD'-related 12141502Swpaul * control commands on their own. Without this flag, ENGINE_ctrl() handles these 12241502Swpaul * control commands on behalf of the ENGINE using their "cmd_defns" data. */ 12341502Swpaul#define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 12441502Swpaul 12541502Swpaul/* This flag is for ENGINEs who return new duplicate structures when found via 12641502Swpaul * "ENGINE_by_id()". When an ENGINE must store state (eg. if ENGINE_ctrl() 12741502Swpaul * commands are called in sequence as part of some stateful process like 12841502Swpaul * key-generation setup and execution), it can set this flag - then each attempt 12941502Swpaul * to obtain the ENGINE will result in it being copied into a new structure. 13041502Swpaul * Normally, ENGINEs don't declare this flag so ENGINE_by_id() just increments 13141502Swpaul * the existing ENGINE's structural reference count. */ 13241502Swpaul#define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 13341502Swpaul 13441502Swpaul/* ENGINEs can support their own command types, and these flags are used in 13541771Sdillon * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input each 13641502Swpaul * command expects. Currently only numeric and string input is supported. If a 13741502Swpaul * control command supports none of the _NUMERIC, _STRING, or _NO_INPUT options, 13841502Swpaul * then it is regarded as an "internal" control command - and not for use in 13941502Swpaul * config setting situations. As such, they're not available to the 14041502Swpaul * ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() access. Changes to 14141502Swpaul * this list of 'command types' should be reflected carefully in 14241502Swpaul * ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */ 14341502Swpaul 14441502Swpaul/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ 14541502Swpaul#define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 14641502Swpaul/* accepts string input (cast from 'void*' to 'const char *', 4th parameter to 14741502Swpaul * ENGINE_ctrl) */ 14841502Swpaul#define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 14941502Swpaul/* Indicates that the control command takes *no* input. Ie. the control command 15041502Swpaul * is unparameterised. */ 15141502Swpaul#define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 15241502Swpaul/* Indicates that the control command is internal. This control command won't 15341502Swpaul * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() 15441502Swpaul * function. */ 15541502Swpaul#define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 15641502Swpaul 15741502Swpaul/* NB: These 3 control commands are deprecated and should not be used. ENGINEs 15841502Swpaul * relying on these commands should compile conditional support for 15941502Swpaul * compatibility (eg. if these symbols are defined) but should also migrate the 16041502Swpaul * same functionality to their own ENGINE-specific control functions that can be 16141502Swpaul * "discovered" by calling applications. The fact these control commands 16241502Swpaul * wouldn't be "executable" (ie. usable by text-based config) doesn't change the 16341502Swpaul * fact that application code can find and use them without requiring per-ENGINE 16441502Swpaul * hacking. */ 16541502Swpaul 16641502Swpaul/* These flags are used to tell the ctrl function what should be done. 16741502Swpaul * All command numbers are shared between all engines, even if some don't 16841502Swpaul * make sense to some engines. In such a case, they do nothing but return 16941502Swpaul * the error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */ 17041502Swpaul#define ENGINE_CTRL_SET_LOGSTREAM 1 17141502Swpaul#define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 17241502Swpaul#define ENGINE_CTRL_HUP 3 /* Close and reinitialise any 17341502Swpaul handles/connections etc. */ 17441502Swpaul#define ENGINE_CTRL_SET_USER_INTERFACE 4 /* Alternative to callback */ 17541502Swpaul#define ENGINE_CTRL_SET_CALLBACK_DATA 5 /* User-specific data, used 17641502Swpaul when calling the password 17741502Swpaul callback and the user 17841502Swpaul interface */ 17941502Swpaul 18041502Swpaul/* These control commands allow an application to deal with an arbitrary engine 18141502Swpaul * in a dynamic way. Warn: Negative return values indicate errors FOR THESE 18241502Swpaul * COMMANDS because zero is used to indicate 'end-of-list'. Other commands, 18341502Swpaul * including ENGINE-specific command types, return zero for an error. 18441502Swpaul * 18541502Swpaul * An ENGINE can choose to implement these ctrl functions, and can internally 18641502Swpaul * manage things however it chooses - it does so by setting the 18741502Swpaul * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise the 18841502Swpaul * ENGINE_ctrl() code handles this on the ENGINE's behalf using the cmd_defns 18941502Swpaul * data (set using ENGINE_set_cmd_defns()). This means an ENGINE's ctrl() 19041502Swpaul * handler need only implement its own commands - the above "meta" commands will 19141502Swpaul * be taken care of. */ 19241502Swpaul 19341502Swpaul/* Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", then 19441502Swpaul * all the remaining control commands will return failure, so it is worth 19541502Swpaul * checking this first if the caller is trying to "discover" the engine's 19641502Swpaul * capabilities and doesn't want errors generated unnecessarily. */ 19741502Swpaul#define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 19841502Swpaul/* Returns a positive command number for the first command supported by the 19941502Swpaul * engine. Returns zero if no ctrl commands are supported. */ 20041502Swpaul#define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 20141502Swpaul/* The 'long' argument specifies a command implemented by the engine, and the 20241502Swpaul * return value is the next command supported, or zero if there are no more. */ 20341502Swpaul#define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 20441502Swpaul/* The 'void*' argument is a command name (cast from 'const char *'), and the 20541502Swpaul * return value is the command that corresponds to it. */ 20641502Swpaul#define ENGINE_CTRL_GET_CMD_FROM_NAME 13 20741502Swpaul/* The next two allow a command to be converted into its corresponding string 20841502Swpaul * form. In each case, the 'long' argument supplies the command. In the NAME_LEN 20941502Swpaul * case, the return value is the length of the command name (not counting a 21041502Swpaul * trailing EOL). In the NAME case, the 'void*' argument must be a string buffer 21141502Swpaul * large enough, and it will be populated with the name of the command (WITH a 21241502Swpaul * trailing EOL). */ 21341502Swpaul#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 21441502Swpaul#define ENGINE_CTRL_GET_NAME_FROM_CMD 15 21541502Swpaul/* The next two are similar but give a "short description" of a command. */ 21641502Swpaul#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 21741502Swpaul#define ENGINE_CTRL_GET_DESC_FROM_CMD 17 21841502Swpaul/* With this command, the return value is the OR'd combination of 21941502Swpaul * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given 22041502Swpaul * engine-specific ctrl command expects. */ 22141502Swpaul#define ENGINE_CTRL_GET_CMD_FLAGS 18 22241502Swpaul 22341502Swpaul/* ENGINE implementations should start the numbering of their own control 22441502Swpaul * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */ 22541502Swpaul#define ENGINE_CMD_BASE 200 22641502Swpaul 22741502Swpaul/* NB: These 2 nCipher "chil" control commands are deprecated, and their 22841502Swpaul * functionality is now available through ENGINE-specific control commands 22941502Swpaul * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 23041502Swpaul * commands should be migrated to the more general command handling before these 23141502Swpaul * are removed. */ 23241502Swpaul 23341502Swpaul/* Flags specific to the nCipher "chil" engine */ 23441502Swpaul#define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 23541502Swpaul /* Depending on the value of the (long)i argument, this sets or 23641502Swpaul * unsets the SimpleForkCheck flag in the CHIL API to enable or 23741502Swpaul * disable checking and workarounds for applications that fork(). 23841502Swpaul */ 23941502Swpaul#define ENGINE_CTRL_CHIL_NO_LOCKING 101 24041502Swpaul /* This prevents the initialisation function from providing mutex 24141502Swpaul * callbacks to the nCipher library. */ 24241502Swpaul 24341502Swpaul/* If an ENGINE supports its own specific control commands and wishes the 24441502Swpaul * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its 24541502Swpaul * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries 24641502Swpaul * to ENGINE_set_cmd_defns(). It should also implement a ctrl() handler that 24741502Swpaul * supports the stated commands (ie. the "cmd_num" entries as described by the 24841502Swpaul * array). NB: The array must be ordered in increasing order of cmd_num. 24941502Swpaul * "null-terminated" means that the last ENGINE_CMD_DEFN element has cmd_num set 25041502Swpaul * to zero and/or cmd_name set to NULL. */ 25141502Swpaultypedef struct ENGINE_CMD_DEFN_st 25241502Swpaul { 25341502Swpaul unsigned int cmd_num; /* The command number */ 25441502Swpaul const char *cmd_name; /* The command name itself */ 25541502Swpaul const char *cmd_desc; /* A short description of the command */ 25641502Swpaul unsigned int cmd_flags; /* The input the command expects */ 25741502Swpaul } ENGINE_CMD_DEFN; 25841502Swpaul 25941502Swpaul/* Generic function pointer */ 26041502Swpaultypedef int (*ENGINE_GEN_FUNC_PTR)(); 26141502Swpaul/* Generic function pointer taking no arguments */ 26241502Swpaultypedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *); 26341502Swpaul/* Specific control function pointer */ 26441502Swpaultypedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)()); 26541502Swpaul/* Generic load_key function pointer */ 26641502Swpaultypedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, 26741502Swpaul UI_METHOD *ui_method, void *callback_data); 26841502Swpaul/* These callback types are for an ENGINE's handler for cipher and digest logic. 26941502Swpaul * These handlers have these prototypes; 27041502Swpaul * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); 27141502Swpaul * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); 27241502Swpaul * Looking at how to implement these handlers in the case of cipher support, if 27341502Swpaul * the framework wants the EVP_CIPHER for 'nid', it will call; 27441502Swpaul * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) 27541502Swpaul * If the framework wants a list of supported 'nid's, it will call; 27641502Swpaul * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) 27741502Swpaul */ 27841502Swpaul/* Returns to a pointer to the array of supported cipher 'nid's. If the second 27941502Swpaul * parameter is non-NULL it is set to the size of the returned array. */ 28041502Swpaultypedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int); 28141502Swpaultypedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int); 28241502Swpaul 28341502Swpaul/* STRUCTURE functions ... all of these functions deal with pointers to ENGINE 28441502Swpaul * structures where the pointers have a "structural reference". This means that 28541502Swpaul * their reference is to allowed access to the structure but it does not imply 28641502Swpaul * that the structure is functional. To simply increment or decrement the 28741502Swpaul * structural reference count, use ENGINE_by_id and ENGINE_free. NB: This is not 28841502Swpaul * required when iterating using ENGINE_get_next as it will automatically 28941502Swpaul * decrement the structural reference count of the "current" ENGINE and 29041502Swpaul * increment the structural reference count of the ENGINE it returns (unless it 29141502Swpaul * is NULL). */ 29241502Swpaul 29341502Swpaul/* Get the first/last "ENGINE" type available. */ 29441502SwpaulENGINE *ENGINE_get_first(void); 29541502SwpaulENGINE *ENGINE_get_last(void); 29641502Swpaul/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ 29741502SwpaulENGINE *ENGINE_get_next(ENGINE *e); 29841502SwpaulENGINE *ENGINE_get_prev(ENGINE *e); 29941502Swpaul/* Add another "ENGINE" type into the array. */ 30041502Swpaulint ENGINE_add(ENGINE *e); 30141502Swpaul/* Remove an existing "ENGINE" type from the array. */ 30241502Swpaulint ENGINE_remove(ENGINE *e); 30341502Swpaul/* Retrieve an engine from the list by its unique "id" value. */ 30441502SwpaulENGINE *ENGINE_by_id(const char *id); 30541502Swpaul/* Add all the built-in engines. */ 30641502Swpaulvoid ENGINE_load_openssl(void); 30741502Swpaulvoid ENGINE_load_dynamic(void); 30841502Swpaulvoid ENGINE_load_cswift(void); 30941502Swpaulvoid ENGINE_load_chil(void); 31041502Swpaulvoid ENGINE_load_atalla(void); 31141502Swpaulvoid ENGINE_load_nuron(void); 31241502Swpaulvoid ENGINE_load_ubsec(void); 31341502Swpaulvoid ENGINE_load_aep(void); 31441502Swpaulvoid ENGINE_load_sureware(void); 31541502Swpaulvoid ENGINE_load_4758cca(void); 31641502Swpaulvoid ENGINE_load_cryptodev(void); 31741502Swpaulvoid ENGINE_load_builtin_engines(void); 31841502Swpaul 31941502Swpaul/* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation 32041502Swpaul * "registry" handling. */ 32141502Swpaulunsigned int ENGINE_get_table_flags(void); 32241502Swpaulvoid ENGINE_set_table_flags(unsigned int flags); 32341502Swpaul 32441502Swpaul/* Manage registration of ENGINEs per "table". For each type, there are 3 32541502Swpaul * functions; 32641502Swpaul * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) 32741502Swpaul * ENGINE_unregister_***(e) - unregister the implementation from 'e' 32841502Swpaul * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list 32941502Swpaul * Cleanup is automatically registered from each table when required, so 33041502Swpaul * ENGINE_cleanup() will reverse any "register" operations. */ 33141502Swpaul 33241502Swpaulint ENGINE_register_RSA(ENGINE *e); 33341502Swpaulvoid ENGINE_unregister_RSA(ENGINE *e); 33441502Swpaulvoid ENGINE_register_all_RSA(void); 33541502Swpaul 33641502Swpaulint ENGINE_register_DSA(ENGINE *e); 33741502Swpaulvoid ENGINE_unregister_DSA(ENGINE *e); 33841502Swpaulvoid ENGINE_register_all_DSA(void); 33941502Swpaul 34041502Swpaulint ENGINE_register_DH(ENGINE *e); 34141502Swpaulvoid ENGINE_unregister_DH(ENGINE *e); 34241502Swpaulvoid ENGINE_register_all_DH(void); 34341502Swpaul 34441502Swpaulint ENGINE_register_RAND(ENGINE *e); 34541502Swpaulvoid ENGINE_unregister_RAND(ENGINE *e); 34641502Swpaulvoid ENGINE_register_all_RAND(void); 34741502Swpaul 34841502Swpaulint ENGINE_register_ciphers(ENGINE *e); 34941502Swpaulvoid ENGINE_unregister_ciphers(ENGINE *e); 35041502Swpaulvoid ENGINE_register_all_ciphers(void); 35141502Swpaul 35241502Swpaulint ENGINE_register_digests(ENGINE *e); 35341502Swpaulvoid ENGINE_unregister_digests(ENGINE *e); 35441502Swpaulvoid ENGINE_register_all_digests(void); 35541502Swpaul 35641502Swpaul/* These functions register all support from the above categories. Note, use of 35741502Swpaul * these functions can result in static linkage of code your application may not 35841502Swpaul * need. If you only need a subset of functionality, consider using more 35941502Swpaul * selective initialisation. */ 36041502Swpaulint ENGINE_register_complete(ENGINE *e); 36141502Swpaulint ENGINE_register_all_complete(void); 36241502Swpaul 36341502Swpaul/* Send parametrised control commands to the engine. The possibilities to send 36441502Swpaul * down an integer, a pointer to data or a function pointer are provided. Any of 36541502Swpaul * the parameters may or may not be NULL, depending on the command number. In 36641502Swpaul * actuality, this function only requires a structural (rather than functional) 36741502Swpaul * reference to an engine, but many control commands may require the engine be 36841502Swpaul * functional. The caller should be aware of trying commands that require an 36941502Swpaul * operational ENGINE, and only use functional references in such situations. */ 37041502Swpaulint ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); 37141502Swpaul 37241502Swpaul/* This function tests if an ENGINE-specific command is usable as a "setting". 37341502Swpaul * Eg. in an application's config file that gets processed through 37441502Swpaul * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to 37541502Swpaul * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */ 37641502Swpaulint ENGINE_cmd_is_executable(ENGINE *e, int cmd); 37741502Swpaul 37841502Swpaul/* This function works like ENGINE_ctrl() with the exception of taking a 37941502Swpaul * command name instead of a command number, and can handle optional commands. 38041502Swpaul * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to 38141502Swpaul * use the cmd_name and cmd_optional. */ 38241502Swpaulint ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, 38341502Swpaul long i, void *p, void (*f)(), int cmd_optional); 38441502Swpaul 38541502Swpaul/* This function passes a command-name and argument to an ENGINE. The cmd_name 38641502Swpaul * is converted to a command number and the control command is called using 38741502Swpaul * 'arg' as an argument (unless the ENGINE doesn't support such a command, in 38841502Swpaul * which case no control command is called). The command is checked for input 38941502Swpaul * flags, and if necessary the argument will be converted to a numeric value. If 39041502Swpaul * cmd_optional is non-zero, then if the ENGINE doesn't support the given 39141502Swpaul * cmd_name the return value will be success anyway. This function is intended 39241502Swpaul * for applications to use so that users (or config files) can supply 39341502Swpaul * engine-specific config data to the ENGINE at run-time to control behaviour of 39441502Swpaul * specific engines. As such, it shouldn't be used for calling ENGINE_ctrl() 39541502Swpaul * functions that return data, deal with binary data, or that are otherwise 39641502Swpaul * supposed to be used directly through ENGINE_ctrl() in application code. Any 39741502Swpaul * "return" data from an ENGINE_ctrl() operation in this function will be lost - 39841502Swpaul * the return value is interpreted as failure if the return value is zero, 39941502Swpaul * success otherwise, and this function returns a boolean value as a result. In 40041502Swpaul * other words, vendors of 'ENGINE'-enabled devices should write ENGINE 40141502Swpaul * implementations with parameterisations that work in this scheme, so that 40241502Swpaul * compliant ENGINE-based applications can work consistently with the same 40341502Swpaul * configuration for the same ENGINE-enabled devices, across applications. */ 40441502Swpaulint ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, 40541502Swpaul int cmd_optional); 40641502Swpaul 40741502Swpaul/* These functions are useful for manufacturing new ENGINE structures. They 40841502Swpaul * don't address reference counting at all - one uses them to populate an ENGINE 40941502Swpaul * structure with personalised implementations of things prior to using it 41041502Swpaul * directly or adding it to the builtin ENGINE list in OpenSSL. These are also 41141502Swpaul * here so that the ENGINE structure doesn't have to be exposed and break binary 41241502Swpaul * compatibility! */ 41341502SwpaulENGINE *ENGINE_new(void); 41441502Swpaulint ENGINE_free(ENGINE *e); 41541502Swpaulint ENGINE_up_ref(ENGINE *e); 41641502Swpaulint ENGINE_set_id(ENGINE *e, const char *id); 41741502Swpaulint ENGINE_set_name(ENGINE *e, const char *name); 41841502Swpaulint ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); 41941502Swpaulint ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); 42041502Swpaulint ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); 42141502Swpaulint ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); 42241502Swpaulint ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); 42341502Swpaulint ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); 42441502Swpaulint ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); 42541502Swpaulint ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); 42641502Swpaulint ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); 42741502Swpaulint ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); 42841502Swpaulint ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); 42941502Swpaulint ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); 43041502Swpaulint ENGINE_set_flags(ENGINE *e, int flags); 43141502Swpaulint ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); 43241502Swpaul/* These functions (and the "get" function lower down) allow control over any 43341502Swpaul * per-structure ENGINE data. */ 43441502Swpaulint ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 43541502Swpaul CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 43641502Swpaulint ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); 43741502Swpaul 43841502Swpaul/* This function cleans up anything that needs it. Eg. the ENGINE_add() function 43941502Swpaul * automatically ensures the list cleanup function is registered to be called 44041502Swpaul * from ENGINE_cleanup(). Similarly, all ENGINE_register_*** functions ensure 44141502Swpaul * ENGINE_cleanup() will clean up after them. */ 44241502Swpaulvoid ENGINE_cleanup(void); 44341502Swpaul 44441502Swpaul/* These return values from within the ENGINE structure. These can be useful 44541502Swpaul * with functional references as well as structural references - it depends 44641502Swpaul * which you obtained. Using the result for functional purposes if you only 44741502Swpaul * obtained a structural reference may be problematic! */ 44841502Swpaulconst char *ENGINE_get_id(const ENGINE *e); 44941502Swpaulconst char *ENGINE_get_name(const ENGINE *e); 45041502Swpaulconst RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); 45141502Swpaulconst DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); 45241502Swpaulconst DH_METHOD *ENGINE_get_DH(const ENGINE *e); 45341502Swpaulconst RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); 45441502SwpaulENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); 45541502SwpaulENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); 45641502SwpaulENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); 45741502SwpaulENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); 45841502SwpaulENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); 45941502SwpaulENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); 46041502SwpaulENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); 46141502SwpaulENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); 46241502Swpaulconst EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); 46341502Swpaulconst EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); 46441502Swpaulconst ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); 46541502Swpaulint ENGINE_get_flags(const ENGINE *e); 46641502Swpaulvoid *ENGINE_get_ex_data(const ENGINE *e, int idx); 46741502Swpaul 46841502Swpaul/* FUNCTIONAL functions. These functions deal with ENGINE structures 46941502Swpaul * that have (or will) be initialised for use. Broadly speaking, the 47041502Swpaul * structural functions are useful for iterating the list of available 47141502Swpaul * engine types, creating new engine types, and other "list" operations. 47241502Swpaul * These functions actually deal with ENGINEs that are to be used. As 47341502Swpaul * such these functions can fail (if applicable) when particular 47441502Swpaul * engines are unavailable - eg. if a hardware accelerator is not 47541502Swpaul * attached or not functioning correctly. Each ENGINE has 2 reference 47641502Swpaul * counts; structural and functional. Every time a functional reference 47741502Swpaul * is obtained or released, a corresponding structural reference is 47841502Swpaul * automatically obtained or released too. */ 47941502Swpaul 48041502Swpaul/* Initialise a engine type for use (or up its reference count if it's 48141502Swpaul * already in use). This will fail if the engine is not currently 48241502Swpaul * operational and cannot initialise. */ 48341502Swpaulint ENGINE_init(ENGINE *e); 48441502Swpaul/* Free a functional reference to a engine type. This does not require 48541502Swpaul * a corresponding call to ENGINE_free as it also releases a structural 48641502Swpaul * reference. */ 48741502Swpaulint ENGINE_finish(ENGINE *e); 48841502Swpaul 48941502Swpaul/* The following functions handle keys that are stored in some secondary 49041502Swpaul * location, handled by the engine. The storage may be on a card or 49141502Swpaul * whatever. */ 49241502SwpaulEVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, 49341502Swpaul UI_METHOD *ui_method, void *callback_data); 49441502SwpaulEVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, 49541502Swpaul UI_METHOD *ui_method, void *callback_data); 49641502Swpaul 49741502Swpaul/* This returns a pointer for the current ENGINE structure that 49841502Swpaul * is (by default) performing any RSA operations. The value returned 49941502Swpaul * is an incremented reference, so it should be free'd (ENGINE_finish) 50041502Swpaul * before it is discarded. */ 50141502SwpaulENGINE *ENGINE_get_default_RSA(void); 50241502Swpaul/* Same for the other "methods" */ 50341502SwpaulENGINE *ENGINE_get_default_DSA(void); 50441502SwpaulENGINE *ENGINE_get_default_DH(void); 50541502SwpaulENGINE *ENGINE_get_default_RAND(void); 50641502Swpaul/* These functions can be used to get a functional reference to perform 50741502Swpaul * ciphering or digesting corresponding to "nid". */ 50841502SwpaulENGINE *ENGINE_get_cipher_engine(int nid); 50941502SwpaulENGINE *ENGINE_get_digest_engine(int nid); 51041502Swpaul 51141502Swpaul/* This sets a new default ENGINE structure for performing RSA 51241502Swpaul * operations. If the result is non-zero (success) then the ENGINE 51341502Swpaul * structure will have had its reference count up'd so the caller 51441502Swpaul * should still free their own reference 'e'. */ 51541502Swpaulint ENGINE_set_default_RSA(ENGINE *e); 51641502Swpaulint ENGINE_set_default_string(ENGINE *e, const char *def_list); 51741502Swpaul/* Same for the other "methods" */ 51841502Swpaulint ENGINE_set_default_DSA(ENGINE *e); 51941502Swpaulint ENGINE_set_default_DH(ENGINE *e); 52041502Swpaulint ENGINE_set_default_RAND(ENGINE *e); 52141502Swpaulint ENGINE_set_default_ciphers(ENGINE *e); 52241502Swpaulint ENGINE_set_default_digests(ENGINE *e); 52341502Swpaul 52441502Swpaul/* The combination "set" - the flags are bitwise "OR"d from the 52541502Swpaul * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" 52641502Swpaul * function, this function can result in unnecessary static linkage. If your 52741502Swpaul * application requires only specific functionality, consider using more 52841502Swpaul * selective functions. */ 52941502Swpaulint ENGINE_set_default(ENGINE *e, unsigned int flags); 53041502Swpaul 53141502Swpaulvoid ENGINE_add_conf_module(void); 53241502Swpaul 53341502Swpaul/* Deprecated functions ... */ 53441502Swpaul/* int ENGINE_clear_defaults(void); */ 53541502Swpaul 53641502Swpaul/**************************/ 53741502Swpaul/* DYNAMIC ENGINE SUPPORT */ 53841502Swpaul/**************************/ 53941502Swpaul 54041502Swpaul/* Binary/behaviour compatibility levels */ 54141502Swpaul#define OSSL_DYNAMIC_VERSION (unsigned long)0x00010200 54241502Swpaul/* Binary versions older than this are too old for us (whether we're a loader or 54341502Swpaul * a loadee) */ 54441502Swpaul#define OSSL_DYNAMIC_OLDEST (unsigned long)0x00010200 54541502Swpaul 54641502Swpaul/* When compiling an ENGINE entirely as an external shared library, loadable by 54741502Swpaul * the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' structure 54841502Swpaul * type provides the calling application's (or library's) error functionality 54941502Swpaul * and memory management function pointers to the loaded library. These should 55041502Swpaul * be used/set in the loaded library code so that the loading application's 55141502Swpaul * 'state' will be used/changed in all operations. */ 55241502Swpaultypedef void *(*dyn_MEM_malloc_cb)(size_t); 55341502Swpaultypedef void *(*dyn_MEM_realloc_cb)(void *, size_t); 55441502Swpaultypedef void (*dyn_MEM_free_cb)(void *); 55541502Swpaultypedef struct st_dynamic_MEM_fns { 55641502Swpaul dyn_MEM_malloc_cb malloc_cb; 55741502Swpaul dyn_MEM_realloc_cb realloc_cb; 55841502Swpaul dyn_MEM_free_cb free_cb; 55941502Swpaul } dynamic_MEM_fns; 56041502Swpaul/* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use 56141502Swpaul * these types so we (and any other dependant code) can simplify a bit?? */ 56241502Swpaultypedef void (*dyn_lock_locking_cb)(int,int,const char *,int); 56341502Swpaultypedef int (*dyn_lock_add_lock_cb)(int*,int,int,const char *,int); 56441502Swpaultypedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)( 56541502Swpaul const char *,int); 56641502Swpaultypedef void (*dyn_dynlock_lock_cb)(int,struct CRYPTO_dynlock_value *, 56741502Swpaul const char *,int); 56841502Swpaultypedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *, 56941502Swpaul const char *,int); 57041502Swpaultypedef struct st_dynamic_LOCK_fns { 57141502Swpaul dyn_lock_locking_cb lock_locking_cb; 57241502Swpaul dyn_lock_add_lock_cb lock_add_lock_cb; 57341502Swpaul dyn_dynlock_create_cb dynlock_create_cb; 57441502Swpaul dyn_dynlock_lock_cb dynlock_lock_cb; 57541502Swpaul dyn_dynlock_destroy_cb dynlock_destroy_cb; 57641502Swpaul } dynamic_LOCK_fns; 57741502Swpaul/* The top-level structure */ 57841502Swpaultypedef struct st_dynamic_fns { 57941502Swpaul const ERR_FNS *err_fns; 58041502Swpaul const CRYPTO_EX_DATA_IMPL *ex_data_fns; 58141502Swpaul dynamic_MEM_fns mem_fns; 58241502Swpaul dynamic_LOCK_fns lock_fns; 58341502Swpaul } dynamic_fns; 58441502Swpaul 58541502Swpaul/* The version checking function should be of this prototype. NB: The 58641502Swpaul * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code. 58741502Swpaul * If this function returns zero, it indicates a (potential) version 58841502Swpaul * incompatibility and the loaded library doesn't believe it can proceed. 58941502Swpaul * Otherwise, the returned value is the (latest) version supported by the 59041502Swpaul * loading library. The loader may still decide that the loaded code's version 59141502Swpaul * is unsatisfactory and could veto the load. The function is expected to 59241502Swpaul * be implemented with the symbol name "v_check", and a default implementation 59341502Swpaul * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */ 59441502Swpaultypedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version); 59541502Swpaul#define IMPLEMENT_DYNAMIC_CHECK_FN() \ 59641502Swpaul unsigned long v_check(unsigned long v) { \ 59741502Swpaul if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ 59841502Swpaul return 0; } 59941502Swpaul 60041502Swpaul/* This function is passed the ENGINE structure to initialise with its own 60141502Swpaul * function and command settings. It should not adjust the structural or 60241502Swpaul * functional reference counts. If this function returns zero, (a) the load will 60341502Swpaul * be aborted, (b) the previous ENGINE state will be memcpy'd back onto the 60441502Swpaul * structure, and (c) the shared library will be unloaded. So implementations 60541502Swpaul * should do their own internal cleanup in failure circumstances otherwise they 60641502Swpaul * could leak. The 'id' parameter, if non-NULL, represents the ENGINE id that 60741502Swpaul * the loader is looking for. If this is NULL, the shared library can choose to 60841502Swpaul * return failure or to initialise a 'default' ENGINE. If non-NULL, the shared 60941502Swpaul * library must initialise only an ENGINE matching the passed 'id'. The function 61041502Swpaul * is expected to be implemented with the symbol name "bind_engine". A standard 61141502Swpaul * implementation can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where 61241502Swpaul * the parameter 'fn' is a callback function that populates the ENGINE structure 61341502Swpaul * and returns an int value (zero for failure). 'fn' should have prototype; 61441502Swpaul * [static] int fn(ENGINE *e, const char *id); */ 61541502Swpaultypedef int (*dynamic_bind_engine)(ENGINE *e, const char *id, 61641502Swpaul const dynamic_fns *fns); 61741502Swpaul#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ 61841502Swpaul int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ 61941502Swpaul if (ERR_get_implementation() != fns->err_fns) \ 62041502Swpaul { \ 62141502Swpaul if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \ 62241502Swpaul fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \ 62341502Swpaul return 0; \ 62441502Swpaul CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \ 62541502Swpaul CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \ 62641502Swpaul CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \ 62741502Swpaul CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \ 62841502Swpaul CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \ 62941502Swpaul if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \ 63041502Swpaul return 0; \ 63141502Swpaul if(!ERR_set_implementation(fns->err_fns)) return 0; \ 63241502Swpaul } \ 63341502Swpaul if(!fn(e,id)) return 0; \ 63441502Swpaul return 1; } 63541502Swpaul 63641502Swpaul#if defined(__OpenBSD__) || defined(__FreeBSD__) 63741502Swpaulvoid ENGINE_setup_bsd_cryptodev(void); 63841502Swpaul#endif 63941502Swpaul 64041502Swpaul/* BEGIN ERROR CODES */ 64141502Swpaul/* The following lines are auto generated by the script mkerr.pl. Any changes 64241502Swpaul * made after this point may be overwritten when the script is next run. 64341502Swpaul */ 64441502Swpaulvoid ERR_load_ENGINE_strings(void); 64541502Swpaul 64641502Swpaul/* Error codes for the ENGINE functions. */ 64741502Swpaul 64841502Swpaul/* Function codes. */ 64941502Swpaul#define ENGINE_F_DYNAMIC_CTRL 180 65041502Swpaul#define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 65141502Swpaul#define ENGINE_F_DYNAMIC_LOAD 182 65241502Swpaul#define ENGINE_F_ENGINE_ADD 105 65341502Swpaul#define ENGINE_F_ENGINE_BY_ID 106 65441502Swpaul#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 65541502Swpaul#define ENGINE_F_ENGINE_CTRL 142 65641502Swpaul#define ENGINE_F_ENGINE_CTRL_CMD 178 65741502Swpaul#define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 65841502Swpaul#define ENGINE_F_ENGINE_FINISH 107 65941502Swpaul#define ENGINE_F_ENGINE_FREE 108 66041502Swpaul#define ENGINE_F_ENGINE_GET_CIPHER 185 66141502Swpaul#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 66241502Swpaul#define ENGINE_F_ENGINE_GET_DIGEST 186 66341502Swpaul#define ENGINE_F_ENGINE_GET_NEXT 115 66441502Swpaul#define ENGINE_F_ENGINE_GET_PREV 116 66541502Swpaul#define ENGINE_F_ENGINE_INIT 119 66641502Swpaul#define ENGINE_F_ENGINE_LIST_ADD 120 66741502Swpaul#define ENGINE_F_ENGINE_LIST_REMOVE 121 66841502Swpaul#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 66941502Swpaul#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 67041502Swpaul#define ENGINE_F_ENGINE_MODULE_INIT 187 67141502Swpaul#define ENGINE_F_ENGINE_NEW 122 67241502Swpaul#define ENGINE_F_ENGINE_REMOVE 123 67341502Swpaul#define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 67441502Swpaul#define ENGINE_F_ENGINE_SET_DEFAULT_TYPE 126 67541502Swpaul#define ENGINE_F_ENGINE_SET_ID 129 67641502Swpaul#define ENGINE_F_ENGINE_SET_NAME 130 67741502Swpaul#define ENGINE_F_ENGINE_TABLE_REGISTER 184 67841502Swpaul#define ENGINE_F_ENGINE_UNLOAD_KEY 152 67941502Swpaul#define ENGINE_F_ENGINE_UP_REF 190 68041502Swpaul#define ENGINE_F_INT_CTRL_HELPER 172 68141502Swpaul#define ENGINE_F_INT_ENGINE_CONFIGURE 188 68241502Swpaul#define ENGINE_F_LOG_MESSAGE 141 68341502Swpaul#define ENGINE_F_SET_DATA_CTX 183 68441502Swpaul 68541502Swpaul/* Reason codes. */ 68641502Swpaul#define ENGINE_R_ALREADY_LOADED 100 68741502Swpaul#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 68841502Swpaul#define ENGINE_R_CMD_NOT_EXECUTABLE 134 68941502Swpaul#define ENGINE_R_COMMAND_TAKES_INPUT 135 69041502Swpaul#define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 69141502Swpaul#define ENGINE_R_CONFLICTING_ENGINE_ID 103 69241502Swpaul#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 69341502Swpaul#define ENGINE_R_DH_NOT_IMPLEMENTED 139 69441502Swpaul#define ENGINE_R_DSA_NOT_IMPLEMENTED 140 69541502Swpaul#define ENGINE_R_DSO_FAILURE 104 69641502Swpaul#define ENGINE_R_DSO_NOT_FOUND 132 69741502Swpaul#define ENGINE_R_ENGINES_SECTION_ERROR 148 69841502Swpaul#define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 69941502Swpaul#define ENGINE_R_ENGINE_SECTION_ERROR 149 70041502Swpaul#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 70141502Swpaul#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 70241502Swpaul#define ENGINE_R_FINISH_FAILED 106 70341502Swpaul#define ENGINE_R_GET_HANDLE_FAILED 107 70441502Swpaul#define ENGINE_R_ID_OR_NAME_MISSING 108 70541502Swpaul#define ENGINE_R_INIT_FAILED 109 70641502Swpaul#define ENGINE_R_INTERNAL_LIST_ERROR 110 70741502Swpaul#define ENGINE_R_INVALID_ARGUMENT 143 70841502Swpaul#define ENGINE_R_INVALID_CMD_NAME 137 70941502Swpaul#define ENGINE_R_INVALID_CMD_NUMBER 138 71041502Swpaul#define ENGINE_R_INVALID_INIT_VALUE 151 71141502Swpaul#define ENGINE_R_INVALID_STRING 150 71241502Swpaul#define ENGINE_R_NOT_INITIALISED 117 71341502Swpaul#define ENGINE_R_NOT_LOADED 112 71441502Swpaul#define ENGINE_R_NO_CONTROL_FUNCTION 120 71541502Swpaul#define ENGINE_R_NO_INDEX 144 71641502Swpaul#define ENGINE_R_NO_LOAD_FUNCTION 125 71741502Swpaul#define ENGINE_R_NO_REFERENCE 130 71841502Swpaul#define ENGINE_R_NO_SUCH_ENGINE 116 71941502Swpaul#define ENGINE_R_NO_UNLOAD_FUNCTION 126 72041502Swpaul#define ENGINE_R_PROVIDE_PARAMETERS 113 72141502Swpaul#define ENGINE_R_RSA_NOT_IMPLEMENTED 141 72241502Swpaul#define ENGINE_R_UNIMPLEMENTED_CIPHER 146 72341502Swpaul#define ENGINE_R_UNIMPLEMENTED_DIGEST 147 72441502Swpaul#define ENGINE_R_VERSION_INCOMPATIBILITY 145 72541502Swpaul 72641502Swpaul#ifdef __cplusplus 72741502Swpaul} 72841502Swpaul#endif 72941502Swpaul#endif 73041502Swpaul