Lines Matching full:engine
1 /* openssl/engine.h */
70 #error ENGINE is disabled.
122 * internally to control registration of ENGINE implementations, and can be set
127 /* ENGINE flags that can be set by ENGINE_set_flags(). */
132 * control commands on behalf of the ENGINE using their "cmd_defns" data. */
136 * "ENGINE_by_id()". When an ENGINE must store state (eg. if ENGINE_ctrl()
139 * to obtain the ENGINE will result in it being copied into a new structure.
141 * the existing ENGINE's structural reference count. */
144 /* This flag if for an ENGINE that does not want its methods registered as
177 * same functionality to their own ENGINE-specific control functions that can be
180 * fact that application code can find and use them without requiring per-ENGINE
203 /* These control commands allow an application to deal with an arbitrary engine
206 * including ENGINE-specific command types, return zero for an error.
208 * An ENGINE can choose to implement these ctrl functions, and can internally
211 * ENGINE_ctrl() code handles this on the ENGINE's behalf using the cmd_defns
212 * data (set using ENGINE_set_cmd_defns()). This means an ENGINE's ctrl()
216 /* Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", then
218 * checking this first if the caller is trying to "discover" the engine's
222 * engine. Returns zero if no ctrl commands are supported. */
224 /* The 'long' argument specifies a command implemented by the engine, and the
243 * engine-specific ctrl command expects. */
246 /* ENGINE implementations should start the numbering of their own control
251 * functionality is now available through ENGINE-specific control commands
256 /* Flags specific to the nCipher "chil" engine */
266 /* If an ENGINE supports its own specific control commands and wishes the
285 typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *);
287 typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void));
289 typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,
291 typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl,
294 /* These callback types are for an ENGINE's handler for cipher and digest logic.
296 * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid);
297 * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid);
306 typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int);
307 typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int);
308 typedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **, const int **, int);
309 typedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD **, const int **, int);
310 /* STRUCTURE functions ... all of these functions deal with pointers to ENGINE
316 * decrement the structural reference count of the "current" ENGINE and
317 * increment the structural reference count of the ENGINE it returns (unless it
320 /* Get the first/last "ENGINE" type available. */
321 ENGINE *ENGINE_get_first(void);
322 ENGINE *ENGINE_get_last(void);
323 /* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */
324 ENGINE *ENGINE_get_next(ENGINE *e);
325 ENGINE *ENGINE_get_prev(ENGINE *e);
326 /* Add another "ENGINE" type into the array. */
327 int ENGINE_add(ENGINE *e);
328 /* Remove an existing "ENGINE" type from the array. */
329 int ENGINE_remove(ENGINE *e);
330 /* Retrieve an engine from the list by its unique "id" value. */
331 ENGINE *ENGINE_by_id(const char *id);
371 int ENGINE_register_RSA(ENGINE *e);
372 void ENGINE_unregister_RSA(ENGINE *e);
375 int ENGINE_register_DSA(ENGINE *e);
376 void ENGINE_unregister_DSA(ENGINE *e);
379 int ENGINE_register_ECDH(ENGINE *e);
380 void ENGINE_unregister_ECDH(ENGINE *e);
383 int ENGINE_register_ECDSA(ENGINE *e);
384 void ENGINE_unregister_ECDSA(ENGINE *e);
387 int ENGINE_register_DH(ENGINE *e);
388 void ENGINE_unregister_DH(ENGINE *e);
391 int ENGINE_register_RAND(ENGINE *e);
392 void ENGINE_unregister_RAND(ENGINE *e);
395 int ENGINE_register_STORE(ENGINE *e);
396 void ENGINE_unregister_STORE(ENGINE *e);
399 int ENGINE_register_ciphers(ENGINE *e);
400 void ENGINE_unregister_ciphers(ENGINE *e);
403 int ENGINE_register_digests(ENGINE *e);
404 void ENGINE_unregister_digests(ENGINE *e);
407 int ENGINE_register_pkey_meths(ENGINE *e);
408 void ENGINE_unregister_pkey_meths(ENGINE *e);
411 int ENGINE_register_pkey_asn1_meths(ENGINE *e);
412 void ENGINE_unregister_pkey_asn1_meths(ENGINE *e);
419 int ENGINE_register_complete(ENGINE *e);
422 /* Send parametrised control commands to the engine. The possibilities to send
426 * reference to an engine, but many control commands may require the engine be
428 * operational ENGINE, and only use functional references in such situations. */
429 int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));
431 /* This function tests if an ENGINE-specific command is usable as a "setting".
435 int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
441 int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
444 /* This function passes a command-name and argument to an ENGINE. The cmd_name
446 * 'arg' as an argument (unless the ENGINE doesn't support such a command, in
449 * cmd_optional is non-zero, then if the ENGINE doesn't support the given
452 * engine-specific config data to the ENGINE at run-time to control behaviour of
459 * other words, vendors of 'ENGINE'-enabled devices should write ENGINE
461 * compliant ENGINE-based applications can work consistently with the same
462 * configuration for the same ENGINE-enabled devices, across applications. */
463 int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
466 /* These functions are useful for manufacturing new ENGINE structures. They
467 * don't address reference counting at all - one uses them to populate an ENGINE
469 * directly or adding it to the builtin ENGINE list in OpenSSL. These are also
470 * here so that the ENGINE structure doesn't have to be exposed and break binary
472 ENGINE *ENGINE_new(void);
473 int ENGINE_free(ENGINE *e);
474 int ENGINE_up_ref(ENGINE *e);
475 int ENGINE_set_id(ENGINE *e, const char *id);
476 int ENGINE_set_name(ENGINE *e, const char *name);
477 int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
478 int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
479 int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth);
480 int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth);
481 int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
482 int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
483 int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth);
484 int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);
485 int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
486 int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
487 int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);
488 int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);
489 int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);
490 int ENGINE_set_load_ssl_client_cert_function(ENGINE *e,
492 int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
493 int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
494 int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f);
495 int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f);
496 int ENGINE_set_flags(ENGINE *e, int flags);
497 int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
498 /* These functions allow control over any per-structure ENGINE data. */
501 int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);
502 void *ENGINE_get_ex_data(const ENGINE *e, int idx);
510 /* These return values from within the ENGINE structure. These can be useful
514 const char *ENGINE_get_id(const ENGINE *e);
515 const char *ENGINE_get_name(const ENGINE *e);
516 const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
517 const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
518 const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e);
519 const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e);
520 const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
521 const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
522 const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e);
523 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);
524 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
525 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);
526 ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);
527 ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);
528 ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);
529 ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e);
530 ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);
531 ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);
532 ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e);
533 ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e);
534 const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);
535 const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
536 const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid);
537 const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid);
538 const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
540 const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
542 const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);
543 int ENGINE_get_flags(const ENGINE *e);
545 /* FUNCTIONAL functions. These functions deal with ENGINE structures
548 * engine types, creating new engine types, and other "list" operations.
552 * attached or not functioning correctly. Each ENGINE has 2 reference
557 /* Initialise a engine type for use (or up its reference count if it's
558 * already in use). This will fail if the engine is not currently
560 int ENGINE_init(ENGINE *e);
561 /* Free a functional reference to a engine type. This does not require
564 int ENGINE_finish(ENGINE *e);
567 * location, handled by the engine. The storage may be on a card or
569 EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
571 EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
573 int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s,
578 /* This returns a pointer for the current ENGINE structure that
582 ENGINE *ENGINE_get_default_RSA(void);
584 ENGINE *ENGINE_get_default_DSA(void);
585 ENGINE *ENGINE_get_default_ECDH(void);
586 ENGINE *ENGINE_get_default_ECDSA(void);
587 ENGINE *ENGINE_get_default_DH(void);
588 ENGINE *ENGINE_get_default_RAND(void);
591 ENGINE *ENGINE_get_cipher_engine(int nid);
592 ENGINE *ENGINE_get_digest_engine(int nid);
593 ENGINE *ENGINE_get_pkey_meth_engine(int nid);
594 ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid);
596 /* This sets a new default ENGINE structure for performing RSA
597 * operations. If the result is non-zero (success) then the ENGINE
600 int ENGINE_set_default_RSA(ENGINE *e);
601 int ENGINE_set_default_string(ENGINE *e, const char *def_list);
603 int ENGINE_set_default_DSA(ENGINE *e);
604 int ENGINE_set_default_ECDH(ENGINE *e);
605 int ENGINE_set_default_ECDSA(ENGINE *e);
606 int ENGINE_set_default_DH(ENGINE *e);
607 int ENGINE_set_default_RAND(ENGINE *e);
608 int ENGINE_set_default_ciphers(ENGINE *e);
609 int ENGINE_set_default_digests(ENGINE *e);
610 int ENGINE_set_default_pkey_meths(ENGINE *e);
611 int ENGINE_set_default_pkey_asn1_meths(ENGINE *e);
618 int ENGINE_set_default(ENGINE *e, unsigned int flags);
626 /* DYNAMIC ENGINE SUPPORT */
635 /* When compiling an ENGINE entirely as an external shared library, loadable by
636 * the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' structure
694 /* This function is passed the ENGINE structure to initialise with its own
697 * be aborted, (b) the previous ENGINE state will be memcpy'd back onto the
700 * could leak. The 'id' parameter, if non-NULL, represents the ENGINE id that
702 * return failure or to initialise a 'default' ENGINE. If non-NULL, the shared
703 * library must initialise only an ENGINE matching the passed 'id'. The function
706 * the parameter 'fn' is a callback function that populates the ENGINE structure
708 * [static] int fn(ENGINE *e, const char *id); */
709 typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,
713 int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \
715 int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
732 /* If the loading application (or library) and the loaded ENGINE library share
736 * loaded ENGINE has (or gets from through the loader) its own copy of the
739 * and let the loading application and loaded ENGINE compare their respective
753 /* Error codes for the ENGINE functions. */