1656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* openssl/engine.h */ 2656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 3656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * project 2000. 4656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project */ 5656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* ==================================================================== 6656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. 7656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 8656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Redistribution and use in source and binary forms, with or without 9656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * modification, are permitted provided that the following conditions 10656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * are met: 11656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 12656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 1. Redistributions of source code must retain the above copyright 13656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * notice, this list of conditions and the following disclaimer. 14656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 15656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright 16656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * notice, this list of conditions and the following disclaimer in 17656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the documentation and/or other materials provided with the 18656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * distribution. 19656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 20656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 3. All advertising materials mentioning features or use of this 21656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * software must display the following acknowledgment: 22656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * "This product includes software developed by the OpenSSL Project 23656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 24656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 25656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * endorse or promote products derived from this software without 27656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * prior written permission. For written permission, please contact 28656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * licensing@OpenSSL.org. 29656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 30656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 5. Products derived from this software may not be called "OpenSSL" 31656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * nor may "OpenSSL" appear in their names without prior written 32656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * permission of the OpenSSL Project. 33656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 34656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 6. Redistributions of any form whatsoever must retain the following 35656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * acknowledgment: 36656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * "This product includes software developed by the OpenSSL Project 37656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 38656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 39656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * OF THE POSSIBILITY OF SUCH DAMAGE. 51656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ==================================================================== 52656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 53656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * This product includes cryptographic software written by Eric Young 54656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * (eay@cryptsoft.com). This product includes software written by Tim 55656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Hudson (tjh@cryptsoft.com). 56656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 57656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project */ 58656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* ==================================================================== 59656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 60656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ECDH support in OpenSSL originally developed by 61656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. 62656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project */ 63656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 64656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifndef HEADER_ENGINE_H 65656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define HEADER_ENGINE_H 66656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 67656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/opensslconf.h> 68656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 69656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifdef OPENSSL_NO_ENGINE 70656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#error ENGINE is disabled. 71656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 72656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 73656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifndef OPENSSL_NO_DEPRECATED 74656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/bn.h> 75656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifndef OPENSSL_NO_RSA 76656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/rsa.h> 77656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 78656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifndef OPENSSL_NO_DSA 79656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/dsa.h> 80656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 81656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifndef OPENSSL_NO_DH 82656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/dh.h> 83656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 84656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifndef OPENSSL_NO_ECDH 85656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/ecdh.h> 86656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 87656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifndef OPENSSL_NO_ECDSA 88656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/ecdsa.h> 89656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 90656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/rand.h> 91656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/ui.h> 92656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/err.h> 93656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 94656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 95656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/ossl_typ.h> 96656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#include <openssl/symhacks.h> 97656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 98221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/x509.h> 99221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 100656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifdef __cplusplus 101656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectextern "C" { 102656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 103656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 104656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These flags are used to control combinations of algorithm (methods) 105656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * by bitwise "OR"ing. */ 106656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_RSA (unsigned int)0x0001 107656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_DSA (unsigned int)0x0002 108656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_DH (unsigned int)0x0004 109656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_RAND (unsigned int)0x0008 110656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_ECDH (unsigned int)0x0010 111656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_ECDSA (unsigned int)0x0020 112656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 113656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 114656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_STORE (unsigned int)0x0100 115221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 116221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 117656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Obvious all-or-nothing cases. */ 118656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_ALL (unsigned int)0xFFFF 119656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_METHOD_NONE (unsigned int)0x0000 120656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 121656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used 122656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * internally to control registration of ENGINE implementations, and can be set 123656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to 124656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * initialise registered ENGINEs if they are not already initialised. */ 125656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 126656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 127656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* ENGINE flags that can be set by ENGINE_set_flags(). */ 128656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ /* Not used */ 129656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 130656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This flag is for ENGINEs that wish to handle the various 'CMD'-related 131656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * control commands on their own. Without this flag, ENGINE_ctrl() handles these 132656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * control commands on behalf of the ENGINE using their "cmd_defns" data. */ 133656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 134656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 135656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This flag is for ENGINEs who return new duplicate structures when found via 136656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * "ENGINE_by_id()". When an ENGINE must store state (eg. if ENGINE_ctrl() 137656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * commands are called in sequence as part of some stateful process like 138656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * key-generation setup and execution), it can set this flag - then each attempt 139656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * to obtain the ENGINE will result in it being copied into a new structure. 140656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Normally, ENGINEs don't declare this flag so ENGINE_by_id() just increments 141656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the existing ENGINE's structural reference count. */ 142656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 143656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 144392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstrom/* This flag if for an ENGINE that does not want its methods registered as 145392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstrom * part of ENGINE_register_all_complete() for example if the methods are 146392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstrom * not usable as default methods. 147392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstrom */ 148392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstrom 149392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstrom#define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 150392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstrom 151656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* ENGINEs can support their own command types, and these flags are used in 152656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input each 153656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * command expects. Currently only numeric and string input is supported. If a 154656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * control command supports none of the _NUMERIC, _STRING, or _NO_INPUT options, 155656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * then it is regarded as an "internal" control command - and not for use in 156656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * config setting situations. As such, they're not available to the 157656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() access. Changes to 158656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * this list of 'command types' should be reflected carefully in 159656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */ 160656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 161656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ 162656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 163656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* accepts string input (cast from 'void*' to 'const char *', 4th parameter to 164656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_ctrl) */ 165656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 166656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Indicates that the control command takes *no* input. Ie. the control command 167656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * is unparameterised. */ 168656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 169656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Indicates that the control command is internal. This control command won't 170656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() 171656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * function. */ 172656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 173656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 174656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* NB: These 3 control commands are deprecated and should not be used. ENGINEs 175656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * relying on these commands should compile conditional support for 176656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * compatibility (eg. if these symbols are defined) but should also migrate the 177656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * same functionality to their own ENGINE-specific control functions that can be 178656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * "discovered" by calling applications. The fact these control commands 179656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * wouldn't be "executable" (ie. usable by text-based config) doesn't change the 180656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * fact that application code can find and use them without requiring per-ENGINE 181656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * hacking. */ 182656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 183656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These flags are used to tell the ctrl function what should be done. 184656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * All command numbers are shared between all engines, even if some don't 185656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * make sense to some engines. In such a case, they do nothing but return 186656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */ 187656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_SET_LOGSTREAM 1 188656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 189656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_HUP 3 /* Close and reinitialise any 190656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project handles/connections etc. */ 191656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_SET_USER_INTERFACE 4 /* Alternative to callback */ 192656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_SET_CALLBACK_DATA 5 /* User-specific data, used 193656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project when calling the password 194656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project callback and the user 195656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project interface */ 196656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_LOAD_CONFIGURATION 6 /* Load a configuration, given 197656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project a string that represents a 198656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project file name or so */ 199656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_LOAD_SECTION 7 /* Load data from a given 200656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project section in the already loaded 201656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project configuration */ 202656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 203656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These control commands allow an application to deal with an arbitrary engine 204656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * in a dynamic way. Warn: Negative return values indicate errors FOR THESE 205656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * COMMANDS because zero is used to indicate 'end-of-list'. Other commands, 206656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * including ENGINE-specific command types, return zero for an error. 207656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 208656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * An ENGINE can choose to implement these ctrl functions, and can internally 209656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * manage things however it chooses - it does so by setting the 210656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise the 211656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_ctrl() code handles this on the ENGINE's behalf using the cmd_defns 212656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * data (set using ENGINE_set_cmd_defns()). This means an ENGINE's ctrl() 213656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * handler need only implement its own commands - the above "meta" commands will 214656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * be taken care of. */ 215656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 216656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", then 217656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * all the remaining control commands will return failure, so it is worth 218656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * checking this first if the caller is trying to "discover" the engine's 219656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * capabilities and doesn't want errors generated unnecessarily. */ 220656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 221656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Returns a positive command number for the first command supported by the 222656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * engine. Returns zero if no ctrl commands are supported. */ 223656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 224656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The 'long' argument specifies a command implemented by the engine, and the 225656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * return value is the next command supported, or zero if there are no more. */ 226656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 227656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The 'void*' argument is a command name (cast from 'const char *'), and the 228656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * return value is the command that corresponds to it. */ 229656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_GET_CMD_FROM_NAME 13 230656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The next two allow a command to be converted into its corresponding string 231656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * form. In each case, the 'long' argument supplies the command. In the NAME_LEN 232656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * case, the return value is the length of the command name (not counting a 233656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * trailing EOL). In the NAME case, the 'void*' argument must be a string buffer 234656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * large enough, and it will be populated with the name of the command (WITH a 235656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * trailing EOL). */ 236656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 237656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_GET_NAME_FROM_CMD 15 238656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The next two are similar but give a "short description" of a command. */ 239656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 240656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_GET_DESC_FROM_CMD 17 241656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* With this command, the return value is the OR'd combination of 242656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given 243656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * engine-specific ctrl command expects. */ 244656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_GET_CMD_FLAGS 18 245656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 246656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* ENGINE implementations should start the numbering of their own control 247656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */ 248656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CMD_BASE 200 249656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 250656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* NB: These 2 nCipher "chil" control commands are deprecated, and their 251656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * functionality is now available through ENGINE-specific control commands 252656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 253656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * commands should be migrated to the more general command handling before these 254656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * are removed. */ 255656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 256656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Flags specific to the nCipher "chil" engine */ 257656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 258656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project /* Depending on the value of the (long)i argument, this sets or 259656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * unsets the SimpleForkCheck flag in the CHIL API to enable or 260656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * disable checking and workarounds for applications that fork(). 261656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project */ 262656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_CTRL_CHIL_NO_LOCKING 101 263656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project /* This prevents the initialisation function from providing mutex 264656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * callbacks to the nCipher library. */ 265656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 266656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* If an ENGINE supports its own specific control commands and wishes the 267656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its 268656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries 269656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * to ENGINE_set_cmd_defns(). It should also implement a ctrl() handler that 270656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * supports the stated commands (ie. the "cmd_num" entries as described by the 271656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * array). NB: The array must be ordered in increasing order of cmd_num. 272656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * "null-terminated" means that the last ENGINE_CMD_DEFN element has cmd_num set 273656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * to zero and/or cmd_name set to NULL. */ 274656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef struct ENGINE_CMD_DEFN_st 275656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project { 276656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project unsigned int cmd_num; /* The command number */ 277656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project const char *cmd_name; /* The command name itself */ 278656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project const char *cmd_desc; /* A short description of the command */ 279656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project unsigned int cmd_flags; /* The input the command expects */ 280656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project } ENGINE_CMD_DEFN; 281656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 282656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Generic function pointer */ 283656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef int (*ENGINE_GEN_FUNC_PTR)(void); 284656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Generic function pointer taking no arguments */ 285656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *); 286656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Specific control function pointer */ 287656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void)); 288656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Generic load_key function pointer */ 289656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, 290656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project UI_METHOD *ui_method, void *callback_data); 291e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modadugutypedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl, 292e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modadugu STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, 293e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modadugu STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); 294656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These callback types are for an ENGINE's handler for cipher and digest logic. 295656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * These handlers have these prototypes; 296656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); 297656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); 298656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Looking at how to implement these handlers in the case of cipher support, if 299656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the framework wants the EVP_CIPHER for 'nid', it will call; 300656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) 301656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * If the framework wants a list of supported 'nid's, it will call; 302656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) 303656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project */ 304656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Returns to a pointer to the array of supported cipher 'nid's. If the second 305656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * parameter is non-NULL it is set to the size of the returned array. */ 306656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int); 307656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int); 308221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **, const int **, int); 309221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD **, const int **, int); 310656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* STRUCTURE functions ... all of these functions deal with pointers to ENGINE 311656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * structures where the pointers have a "structural reference". This means that 312656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * their reference is to allowed access to the structure but it does not imply 313656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * that the structure is functional. To simply increment or decrement the 314656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * structural reference count, use ENGINE_by_id and ENGINE_free. NB: This is not 315656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * required when iterating using ENGINE_get_next as it will automatically 316656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * decrement the structural reference count of the "current" ENGINE and 317656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * increment the structural reference count of the ENGINE it returns (unless it 318656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * is NULL). */ 319656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 320656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Get the first/last "ENGINE" type available. */ 321656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_first(void); 322656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_last(void); 323656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ 324656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_next(ENGINE *e); 325656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_prev(ENGINE *e); 326656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Add another "ENGINE" type into the array. */ 327656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_add(ENGINE *e); 328656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Remove an existing "ENGINE" type from the array. */ 329656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_remove(ENGINE *e); 330656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Retrieve an engine from the list by its unique "id" value. */ 331656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_by_id(const char *id); 332656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Add all the built-in engines. */ 333656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_openssl(void); 334656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_dynamic(void); 335656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifndef OPENSSL_NO_STATIC_ENGINE 336656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_4758cca(void); 337656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_aep(void); 338656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_atalla(void); 339656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_chil(void); 340656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_cswift(void); 341656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_nuron(void); 342656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_sureware(void); 343656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_ubsec(void); 344656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_load_padlock(void); 345e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modaduguvoid ENGINE_load_capi(void); 346221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_GMP 347221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ENGINE_load_gmp(void); 348221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 349221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_GOST 350221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ENGINE_load_gost(void); 351e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modadugu#endif 35298d58bb80c64b02a33662f0ea80351d4a1535267Brian Carlstrom#endif 353221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ENGINE_load_cryptodev(void); 354392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstromvoid ENGINE_load_rsax(void); 355392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstromvoid ENGINE_load_rdrand(void); 356221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ENGINE_load_builtin_engines(void); 357656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 358656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation 359656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * "registry" handling. */ 360656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectunsigned int ENGINE_get_table_flags(void); 361656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_set_table_flags(unsigned int flags); 362656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 363656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Manage registration of ENGINEs per "table". For each type, there are 3 364656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * functions; 365656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) 366656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_unregister_***(e) - unregister the implementation from 'e' 367656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list 368656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Cleanup is automatically registered from each table when required, so 369656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_cleanup() will reverse any "register" operations. */ 370656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 371656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_RSA(ENGINE *e); 372656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_RSA(ENGINE *e); 373656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_RSA(void); 374656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 375656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_DSA(ENGINE *e); 376656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_DSA(ENGINE *e); 377656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_DSA(void); 378656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 379656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_ECDH(ENGINE *e); 380656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_ECDH(ENGINE *e); 381656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_ECDH(void); 382656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 383656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_ECDSA(ENGINE *e); 384656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_ECDSA(ENGINE *e); 385656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_ECDSA(void); 386656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 387656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_DH(ENGINE *e); 388656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_DH(ENGINE *e); 389656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_DH(void); 390656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 391656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_RAND(ENGINE *e); 392656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_RAND(ENGINE *e); 393656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_RAND(void); 394656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 395656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_STORE(ENGINE *e); 396656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_STORE(ENGINE *e); 397656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_STORE(void); 398656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 399656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_ciphers(ENGINE *e); 400656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_ciphers(ENGINE *e); 401656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_ciphers(void); 402656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 403656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_digests(ENGINE *e); 404656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_unregister_digests(ENGINE *e); 405656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_register_all_digests(void); 406656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 407221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint ENGINE_register_pkey_meths(ENGINE *e); 408221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ENGINE_unregister_pkey_meths(ENGINE *e); 409221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ENGINE_register_all_pkey_meths(void); 410221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 411221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint ENGINE_register_pkey_asn1_meths(ENGINE *e); 412221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ENGINE_unregister_pkey_asn1_meths(ENGINE *e); 413221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ENGINE_register_all_pkey_asn1_meths(void); 414221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 415656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These functions register all support from the above categories. Note, use of 416656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * these functions can result in static linkage of code your application may not 417656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * need. If you only need a subset of functionality, consider using more 418656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * selective initialisation. */ 419656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_complete(ENGINE *e); 420656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_register_all_complete(void); 421656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 422656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Send parametrised control commands to the engine. The possibilities to send 423656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * down an integer, a pointer to data or a function pointer are provided. Any of 424656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the parameters may or may not be NULL, depending on the command number. In 425656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * actuality, this function only requires a structural (rather than functional) 426656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * reference to an engine, but many control commands may require the engine be 427656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * functional. The caller should be aware of trying commands that require an 428656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * operational ENGINE, and only use functional references in such situations. */ 429656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)); 430656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 431656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This function tests if an ENGINE-specific command is usable as a "setting". 432656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Eg. in an application's config file that gets processed through 433656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to 434656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */ 435656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_cmd_is_executable(ENGINE *e, int cmd); 436656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 437656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This function works like ENGINE_ctrl() with the exception of taking a 438656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * command name instead of a command number, and can handle optional commands. 439656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to 440656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * use the cmd_name and cmd_optional. */ 441656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, 442656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project long i, void *p, void (*f)(void), int cmd_optional); 443656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 444656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This function passes a command-name and argument to an ENGINE. The cmd_name 445656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * is converted to a command number and the control command is called using 446656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 'arg' as an argument (unless the ENGINE doesn't support such a command, in 447656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * which case no control command is called). The command is checked for input 448656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * flags, and if necessary the argument will be converted to a numeric value. If 449656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * cmd_optional is non-zero, then if the ENGINE doesn't support the given 450656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * cmd_name the return value will be success anyway. This function is intended 451656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * for applications to use so that users (or config files) can supply 452656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * engine-specific config data to the ENGINE at run-time to control behaviour of 453656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * specific engines. As such, it shouldn't be used for calling ENGINE_ctrl() 454656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * functions that return data, deal with binary data, or that are otherwise 455656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * supposed to be used directly through ENGINE_ctrl() in application code. Any 456656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * "return" data from an ENGINE_ctrl() operation in this function will be lost - 457656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the return value is interpreted as failure if the return value is zero, 458656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * success otherwise, and this function returns a boolean value as a result. In 459656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * other words, vendors of 'ENGINE'-enabled devices should write ENGINE 460656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * implementations with parameterisations that work in this scheme, so that 461656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * compliant ENGINE-based applications can work consistently with the same 462656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * configuration for the same ENGINE-enabled devices, across applications. */ 463656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, 464656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project int cmd_optional); 465656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 466656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These functions are useful for manufacturing new ENGINE structures. They 467656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * don't address reference counting at all - one uses them to populate an ENGINE 468656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * structure with personalised implementations of things prior to using it 469656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * directly or adding it to the builtin ENGINE list in OpenSSL. These are also 470656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * here so that the ENGINE structure doesn't have to be exposed and break binary 471656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * compatibility! */ 472656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_new(void); 473656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_free(ENGINE *e); 474656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_up_ref(ENGINE *e); 475656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_id(ENGINE *e, const char *id); 476656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_name(ENGINE *e, const char *name); 477656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); 478656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); 479656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth); 480656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth); 481656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); 482656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); 483656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth); 484656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); 485656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); 486656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); 487656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); 488656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); 489656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); 490e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modaduguint ENGINE_set_load_ssl_client_cert_function(ENGINE *e, 491e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modadugu ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); 492656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); 493656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); 494221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); 495221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); 496656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_flags(ENGINE *e, int flags); 497656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); 498656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These functions allow control over any per-structure ENGINE data. */ 499656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 500656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 501656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); 502656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid *ENGINE_get_ex_data(const ENGINE *e, int idx); 503656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 504656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This function cleans up anything that needs it. Eg. the ENGINE_add() function 505656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * automatically ensures the list cleanup function is registered to be called 506656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * from ENGINE_cleanup(). Similarly, all ENGINE_register_*** functions ensure 507656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_cleanup() will clean up after them. */ 508656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_cleanup(void); 509656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 510656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These return values from within the ENGINE structure. These can be useful 511656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * with functional references as well as structural references - it depends 512656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * which you obtained. Using the result for functional purposes if you only 513656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * obtained a structural reference may be problematic! */ 514656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst char *ENGINE_get_id(const ENGINE *e); 515656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst char *ENGINE_get_name(const ENGINE *e); 516656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); 517656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); 518656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e); 519656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e); 520656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst DH_METHOD *ENGINE_get_DH(const ENGINE *e); 521656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); 522656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst STORE_METHOD *ENGINE_get_STORE(const ENGINE *e); 523656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); 524656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); 525656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); 526656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); 527656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); 528656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); 529e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra ModaduguENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); 530656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); 531656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); 532221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); 533221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); 534656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); 535656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); 536221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); 537221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); 538221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, 539221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const char *str, int len); 540221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, 541221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const char *str, int len); 542656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectconst ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); 543656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_get_flags(const ENGINE *e); 544656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 545656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* FUNCTIONAL functions. These functions deal with ENGINE structures 546656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * that have (or will) be initialised for use. Broadly speaking, the 547656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * structural functions are useful for iterating the list of available 548656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * engine types, creating new engine types, and other "list" operations. 549656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * These functions actually deal with ENGINEs that are to be used. As 550656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * such these functions can fail (if applicable) when particular 551656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * engines are unavailable - eg. if a hardware accelerator is not 552656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * attached or not functioning correctly. Each ENGINE has 2 reference 553656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * counts; structural and functional. Every time a functional reference 554656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * is obtained or released, a corresponding structural reference is 555656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * automatically obtained or released too. */ 556656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 557656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Initialise a engine type for use (or up its reference count if it's 558656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * already in use). This will fail if the engine is not currently 559656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * operational and cannot initialise. */ 560656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_init(ENGINE *e); 561656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Free a functional reference to a engine type. This does not require 562656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * a corresponding call to ENGINE_free as it also releases a structural 563656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * reference. */ 564656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_finish(ENGINE *e); 565656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 566656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The following functions handle keys that are stored in some secondary 567656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * location, handled by the engine. The storage may be on a card or 568656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * whatever. */ 569656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectEVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, 570656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project UI_METHOD *ui_method, void *callback_data); 571656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectEVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, 572656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project UI_METHOD *ui_method, void *callback_data); 573e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modaduguint ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, 574e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modadugu STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey, 575e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modadugu STACK_OF(X509) **pother, 576e45f106cb6b47af1f21efe76e933bdea2f5dd1caNagendra Modadugu UI_METHOD *ui_method, void *callback_data); 577656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 578656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This returns a pointer for the current ENGINE structure that 579656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * is (by default) performing any RSA operations. The value returned 580656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * is an incremented reference, so it should be free'd (ENGINE_finish) 581656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * before it is discarded. */ 582656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_default_RSA(void); 583656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Same for the other "methods" */ 584656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_default_DSA(void); 585656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_default_ECDH(void); 586656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_default_ECDSA(void); 587656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_default_DH(void); 588656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_default_RAND(void); 589656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* These functions can be used to get a functional reference to perform 590656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ciphering or digesting corresponding to "nid". */ 591656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_cipher_engine(int nid); 592656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source ProjectENGINE *ENGINE_get_digest_engine(int nid); 593221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromENGINE *ENGINE_get_pkey_meth_engine(int nid); 594221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); 595656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 596656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This sets a new default ENGINE structure for performing RSA 597656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * operations. If the result is non-zero (success) then the ENGINE 598656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * structure will have had its reference count up'd so the caller 599656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * should still free their own reference 'e'. */ 600656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_RSA(ENGINE *e); 601656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_string(ENGINE *e, const char *def_list); 602656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Same for the other "methods" */ 603656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_DSA(ENGINE *e); 604656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_ECDH(ENGINE *e); 605656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_ECDSA(ENGINE *e); 606656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_DH(ENGINE *e); 607656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_RAND(ENGINE *e); 608656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_ciphers(ENGINE *e); 609656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default_digests(ENGINE *e); 610221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint ENGINE_set_default_pkey_meths(ENGINE *e); 611221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint ENGINE_set_default_pkey_asn1_meths(ENGINE *e); 612656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 613656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The combination "set" - the flags are bitwise "OR"d from the 614656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" 615656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * function, this function can result in unnecessary static linkage. If your 616656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * application requires only specific functionality, consider using more 617656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * selective functions. */ 618656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectint ENGINE_set_default(ENGINE *e, unsigned int flags); 619656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 620656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_add_conf_module(void); 621656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 622656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Deprecated functions ... */ 623656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* int ENGINE_clear_defaults(void); */ 624656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 625656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/**************************/ 626656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* DYNAMIC ENGINE SUPPORT */ 627656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/**************************/ 628656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 629656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Binary/behaviour compatibility levels */ 630656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define OSSL_DYNAMIC_VERSION (unsigned long)0x00020000 631656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Binary versions older than this are too old for us (whether we're a loader or 632656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * a loadee) */ 633656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define OSSL_DYNAMIC_OLDEST (unsigned long)0x00020000 634656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 635656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* When compiling an ENGINE entirely as an external shared library, loadable by 636656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' structure 637656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * type provides the calling application's (or library's) error functionality 638656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * and memory management function pointers to the loaded library. These should 639656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * be used/set in the loaded library code so that the loading application's 640656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * 'state' will be used/changed in all operations. The 'static_state' pointer 641656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * allows the loaded library to know if it shares the same static data as the 642656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * calling application (or library), and thus whether these callbacks need to be 643656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * set or not. */ 644656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef void *(*dyn_MEM_malloc_cb)(size_t); 645656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef void *(*dyn_MEM_realloc_cb)(void *, size_t); 646656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef void (*dyn_MEM_free_cb)(void *); 647656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef struct st_dynamic_MEM_fns { 648656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dyn_MEM_malloc_cb malloc_cb; 649656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dyn_MEM_realloc_cb realloc_cb; 650656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dyn_MEM_free_cb free_cb; 651656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project } dynamic_MEM_fns; 652656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use 653656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * these types so we (and any other dependant code) can simplify a bit?? */ 654656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef void (*dyn_lock_locking_cb)(int,int,const char *,int); 655656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef int (*dyn_lock_add_lock_cb)(int*,int,int,const char *,int); 656656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)( 657656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project const char *,int); 658656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef void (*dyn_dynlock_lock_cb)(int,struct CRYPTO_dynlock_value *, 659656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project const char *,int); 660656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *, 661656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project const char *,int); 662656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef struct st_dynamic_LOCK_fns { 663656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dyn_lock_locking_cb lock_locking_cb; 664656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dyn_lock_add_lock_cb lock_add_lock_cb; 665656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dyn_dynlock_create_cb dynlock_create_cb; 666656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dyn_dynlock_lock_cb dynlock_lock_cb; 667656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dyn_dynlock_destroy_cb dynlock_destroy_cb; 668656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project } dynamic_LOCK_fns; 669656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The top-level structure */ 670656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef struct st_dynamic_fns { 671656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project void *static_state; 672656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project const ERR_FNS *err_fns; 673656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project const CRYPTO_EX_DATA_IMPL *ex_data_fns; 674656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dynamic_MEM_fns mem_fns; 675656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project dynamic_LOCK_fns lock_fns; 676656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project } dynamic_fns; 677656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 678656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The version checking function should be of this prototype. NB: The 679656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code. 680656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * If this function returns zero, it indicates a (potential) version 681656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * incompatibility and the loaded library doesn't believe it can proceed. 682656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * Otherwise, the returned value is the (latest) version supported by the 683656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * loading library. The loader may still decide that the loaded code's version 684656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * is unsatisfactory and could veto the load. The function is expected to 685656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * be implemented with the symbol name "v_check", and a default implementation 686656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */ 687656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version); 688656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define IMPLEMENT_DYNAMIC_CHECK_FN() \ 68981c4de7869b646592127e952cda763abf8305069Brian Carlstrom OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ 690656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ 691656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ 692656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project return 0; } 693656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 694656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* This function is passed the ENGINE structure to initialise with its own 695656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * function and command settings. It should not adjust the structural or 696656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * functional reference counts. If this function returns zero, (a) the load will 697656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * be aborted, (b) the previous ENGINE state will be memcpy'd back onto the 698656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * structure, and (c) the shared library will be unloaded. So implementations 699656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * should do their own internal cleanup in failure circumstances otherwise they 700656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * could leak. The 'id' parameter, if non-NULL, represents the ENGINE id that 701656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the loader is looking for. If this is NULL, the shared library can choose to 702656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * return failure or to initialise a 'default' ENGINE. If non-NULL, the shared 703656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * library must initialise only an ENGINE matching the passed 'id'. The function 704656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * is expected to be implemented with the symbol name "bind_engine". A standard 705656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * implementation can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where 706656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the parameter 'fn' is a callback function that populates the ENGINE structure 707656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * and returns an int value (zero for failure). 'fn' should have prototype; 708656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * [static] int fn(ENGINE *e, const char *id); */ 709656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projecttypedef int (*dynamic_bind_engine)(ENGINE *e, const char *id, 710656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project const dynamic_fns *fns); 711656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ 712656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project OPENSSL_EXPORT \ 71381c4de7869b646592127e952cda763abf8305069Brian Carlstrom int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ 71481c4de7869b646592127e952cda763abf8305069Brian Carlstrom OPENSSL_EXPORT \ 715656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ 716656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ 717656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \ 718656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \ 719656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project return 0; \ 720656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \ 721656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \ 722656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \ 723656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \ 724656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \ 725656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \ 726656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project return 0; \ 727656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project if(!ERR_set_implementation(fns->err_fns)) return 0; \ 728656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project skip_cbs: \ 729656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project if(!fn(e,id)) return 0; \ 730656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project return 1; } 731656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 732656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* If the loading application (or library) and the loaded ENGINE library share 733656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * the same static data (eg. they're both dynamically linked to the same 734656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * libcrypto.so) we need a way to avoid trying to set system callbacks - this 735656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * would fail, and for the same reason that it's unnecessary to try. If the 736656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * loaded ENGINE has (or gets from through the loader) its own copy of the 737656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * libcrypto static data, we will need to set the callbacks. The easiest way to 738656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * detect this is to have a function that returns a pointer to some static data 739656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * and let the loading application and loaded ENGINE compare their respective 740656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * values. */ 741656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid *ENGINE_get_static_state(void); 742656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 743221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) 744656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ENGINE_setup_bsd_cryptodev(void); 745656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 746656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 747656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* BEGIN ERROR CODES */ 748656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* The following lines are auto generated by the script mkerr.pl. Any changes 749656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project * made after this point may be overwritten when the script is next run. 750656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project */ 751656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Projectvoid ERR_load_ENGINE_strings(void); 752656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 753656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Error codes for the ENGINE functions. */ 754656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 755656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Function codes. */ 756656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_DYNAMIC_CTRL 180 757656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 758656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_DYNAMIC_LOAD 182 759656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 760656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_ADD 105 761656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_BY_ID 106 762656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 763656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_CTRL 142 764656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_CTRL_CMD 178 765656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 766656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_FINISH 107 767656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_FREE_UTIL 108 768656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_GET_CIPHER 185 769656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 770656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_GET_DIGEST 186 771656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_GET_NEXT 115 772221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 773221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define ENGINE_F_ENGINE_GET_PKEY_METH 192 774656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_GET_PREV 116 775656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_INIT 119 776656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_LIST_ADD 120 777656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_LIST_REMOVE 121 778656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 779656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 780221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 781656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_NEW 122 782656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_REMOVE 123 783656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 784656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_SET_DEFAULT_TYPE 126 785656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_SET_ID 129 786656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_SET_NAME 130 787656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_TABLE_REGISTER 184 788656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_UNLOAD_KEY 152 789656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 790656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_ENGINE_UP_REF 190 791656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_INT_CTRL_HELPER 172 792656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_INT_ENGINE_CONFIGURE 188 793656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_INT_ENGINE_MODULE_INIT 187 794656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_F_LOG_MESSAGE 141 795656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 796656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project/* Reason codes. */ 797656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_ALREADY_LOADED 100 798656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 799656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_CMD_NOT_EXECUTABLE 134 800656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_COMMAND_TAKES_INPUT 135 801656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 802656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_CONFLICTING_ENGINE_ID 103 803656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 804656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_DH_NOT_IMPLEMENTED 139 805656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_DSA_NOT_IMPLEMENTED 140 806656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_DSO_FAILURE 104 807656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_DSO_NOT_FOUND 132 808656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_ENGINES_SECTION_ERROR 148 809221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 810656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 811656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_ENGINE_SECTION_ERROR 149 812656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 813656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 814656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_FINISH_FAILED 106 815656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_GET_HANDLE_FAILED 107 816656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_ID_OR_NAME_MISSING 108 817656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_INIT_FAILED 109 818656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_INTERNAL_LIST_ERROR 110 819656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_INVALID_ARGUMENT 143 820656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_INVALID_CMD_NAME 137 821656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_INVALID_CMD_NUMBER 138 822656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_INVALID_INIT_VALUE 151 823656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_INVALID_STRING 150 824656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_NOT_INITIALISED 117 825656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_NOT_LOADED 112 826656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_NO_CONTROL_FUNCTION 120 827656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_NO_INDEX 144 828656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_NO_LOAD_FUNCTION 125 829656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_NO_REFERENCE 130 830656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_NO_SUCH_ENGINE 116 831656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_NO_UNLOAD_FUNCTION 126 832656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_PROVIDE_PARAMETERS 113 833656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_RSA_NOT_IMPLEMENTED 141 834656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_UNIMPLEMENTED_CIPHER 146 835656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_UNIMPLEMENTED_DIGEST 147 836221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 837656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#define ENGINE_R_VERSION_INCOMPATIBILITY 145 838656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project 839656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#ifdef __cplusplus 840656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project} 841656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 842656d9c7f52f88b3a3daccafa7655dec086c4756eThe Android Open Source Project#endif 843