summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/engine.h
diff options
context:
space:
mode:
authorjsing <>2014-06-22 12:16:28 +0000
committerjsing <>2014-06-22 12:16:28 +0000
commit0fc56655c369d9eb08790eff2fab8d2b47085ab1 (patch)
tree1b822059398c5ad77b6b027187d443c62fdc9361 /src/lib/libcrypto/engine/engine.h
parent76145303a8345eadeb8eb36e46f50b090c9770b6 (diff)
downloadopenbsd-0fc56655c369d9eb08790eff2fab8d2b47085ab1.tar.gz
openbsd-0fc56655c369d9eb08790eff2fab8d2b47085ab1.tar.bz2
openbsd-0fc56655c369d9eb08790eff2fab8d2b47085ab1.zip
KNF.
Diffstat (limited to 'src/lib/libcrypto/engine/engine.h')
-rw-r--r--src/lib/libcrypto/engine/engine.h77
1 files changed, 41 insertions, 36 deletions
diff --git a/src/lib/libcrypto/engine/engine.h b/src/lib/libcrypto/engine/engine.h
index 6dfd0ad6d1..24d2c5eac5 100644
--- a/src/lib/libcrypto/engine/engine.h
+++ b/src/lib/libcrypto/engine/engine.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: engine.h,v 1.28 2014/06/12 15:49:29 deraadt Exp $ */ 1/* $OpenBSD: engine.h,v 1.29 2014/06/22 12:16:28 jsing Exp $ */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL 2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -10,7 +10,7 @@
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 14 *
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in 16 * notice, this list of conditions and the following disclaimer in
@@ -57,7 +57,7 @@
57 */ 57 */
58/* ==================================================================== 58/* ====================================================================
59 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 59 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
60 * ECDH support in OpenSSL originally developed by 60 * ECDH support in OpenSSL originally developed by
61 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. 61 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
62 */ 62 */
63 63
@@ -140,7 +140,7 @@ extern "C" {
140 * the existing ENGINE's structural reference count. */ 140 * the existing ENGINE's structural reference count. */
141#define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 141#define ENGINE_FLAGS_BY_ID_COPY (int)0x0004
142 142
143/* This flag if for an ENGINE that does not want its methods registered as 143/* This flag if for an ENGINE that does not want its methods registered as
144 * part of ENGINE_register_all_complete() for example if the methods are 144 * part of ENGINE_register_all_complete() for example if the methods are
145 * not usable as default methods. 145 * not usable as default methods.
146 */ 146 */
@@ -254,26 +254,27 @@ extern "C" {
254 * array). NB: The array must be ordered in increasing order of cmd_num. 254 * array). NB: The array must be ordered in increasing order of cmd_num.
255 * "null-terminated" means that the last ENGINE_CMD_DEFN element has cmd_num set 255 * "null-terminated" means that the last ENGINE_CMD_DEFN element has cmd_num set
256 * to zero and/or cmd_name set to NULL. */ 256 * to zero and/or cmd_name set to NULL. */
257typedef struct ENGINE_CMD_DEFN_st 257typedef struct ENGINE_CMD_DEFN_st {
258 {
259 unsigned int cmd_num; /* The command number */ 258 unsigned int cmd_num; /* The command number */
260 const char *cmd_name; /* The command name itself */ 259 const char *cmd_name; /* The command name itself */
261 const char *cmd_desc; /* A short description of the command */ 260 const char *cmd_desc; /* A short description of the command */
262 unsigned int cmd_flags; /* The input the command expects */ 261 unsigned int cmd_flags; /* The input the command expects */
263 } ENGINE_CMD_DEFN; 262} ENGINE_CMD_DEFN;
264 263
265/* Generic function pointer */ 264/* Generic function pointer */
266typedef int (*ENGINE_GEN_FUNC_PTR)(void); 265typedef int (*ENGINE_GEN_FUNC_PTR)(void);
267/* Generic function pointer taking no arguments */ 266/* Generic function pointer taking no arguments */
268typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *); 267typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *);
269/* Specific control function pointer */ 268/* Specific control function pointer */
270typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void)); 269typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *,
270 void (*f)(void));
271/* Generic load_key function pointer */ 271/* Generic load_key function pointer */
272typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, 272typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,
273 UI_METHOD *ui_method, void *callback_data); 273 UI_METHOD *ui_method, void *callback_data);
274typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl, 274typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl,
275 STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, 275 STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey,
276 STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); 276 STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data);
277
277/* These callback types are for an ENGINE's handler for cipher and digest logic. 278/* These callback types are for an ENGINE's handler for cipher and digest logic.
278 * These handlers have these prototypes; 279 * These handlers have these prototypes;
279 * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); 280 * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid);
@@ -286,10 +287,14 @@ typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl,
286 */ 287 */
287/* Returns to a pointer to the array of supported cipher 'nid's. If the second 288/* Returns to a pointer to the array of supported cipher 'nid's. If the second
288 * parameter is non-NULL it is set to the size of the returned array. */ 289 * parameter is non-NULL it is set to the size of the returned array. */
289typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int); 290typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **,
291 const int **, int);
290typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int); 292typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int);
291typedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **, const int **, int); 293typedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **,
292typedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD **, const int **, int); 294 const int **, int);
295typedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD **,
296 const int **, int);
297
293/* STRUCTURE functions ... all of these functions deal with pointers to ENGINE 298/* STRUCTURE functions ... all of these functions deal with pointers to ENGINE
294 * structures where the pointers have a "structural reference". This means that 299 * structures where the pointers have a "structural reference". This means that
295 * their reference is to allowed access to the structure but it does not imply 300 * their reference is to allowed access to the structure but it does not imply
@@ -405,7 +410,7 @@ int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
405 * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to 410 * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to
406 * use the cmd_name and cmd_optional. */ 411 * use the cmd_name and cmd_optional. */
407int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, 412int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
408 long i, void *p, void (*f)(void), int cmd_optional); 413 long i, void *p, void (*f)(void), int cmd_optional);
409 414
410/* This function passes a command-name and argument to an ENGINE. The cmd_name 415/* This function passes a command-name and argument to an ENGINE. The cmd_name
411 * is converted to a command number and the control command is called using 416 * is converted to a command number and the control command is called using
@@ -427,7 +432,7 @@ int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
427 * compliant ENGINE-based applications can work consistently with the same 432 * compliant ENGINE-based applications can work consistently with the same
428 * configuration for the same ENGINE-enabled devices, across applications. */ 433 * configuration for the same ENGINE-enabled devices, across applications. */
429int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, 434int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
430 int cmd_optional); 435 int cmd_optional);
431 436
432/* These functions are useful for manufacturing new ENGINE structures. They 437/* These functions are useful for manufacturing new ENGINE structures. They
433 * don't address reference counting at all - one uses them to populate an ENGINE 438 * don't address reference counting at all - one uses them to populate an ENGINE
@@ -454,7 +459,7 @@ int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);
454int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); 459int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);
455int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); 460int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);
456int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, 461int ENGINE_set_load_ssl_client_cert_function(ENGINE *e,
457 ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); 462 ENGINE_SSL_CLIENT_CERT_PTR loadssl_f);
458int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); 463int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
459int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); 464int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
460int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); 465int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f);
@@ -463,7 +468,7 @@ int ENGINE_set_flags(ENGINE *e, int flags);
463int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); 468int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
464/* These functions allow control over any per-structure ENGINE data. */ 469/* These functions allow control over any per-structure ENGINE data. */
465int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 470int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
466 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 471 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
467int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); 472int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);
468void *ENGINE_get_ex_data(const ENGINE *e, int idx); 473void *ENGINE_get_ex_data(const ENGINE *e, int idx);
469 474
@@ -502,9 +507,9 @@ const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
502const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); 507const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid);
503const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); 508const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid);
504const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, 509const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
505 const char *str, int len); 510 const char *str, int len);
506const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, 511const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
507 const char *str, int len); 512 const char *str, int len);
508const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); 513const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);
509int ENGINE_get_flags(const ENGINE *e); 514int ENGINE_get_flags(const ENGINE *e);
510 515
@@ -533,13 +538,13 @@ int ENGINE_finish(ENGINE *e);
533 * location, handled by the engine. The storage may be on a card or 538 * location, handled by the engine. The storage may be on a card or
534 * whatever. */ 539 * whatever. */
535EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, 540EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
536 UI_METHOD *ui_method, void *callback_data); 541 UI_METHOD *ui_method, void *callback_data);
537EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, 542EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
538 UI_METHOD *ui_method, void *callback_data); 543 UI_METHOD *ui_method, void *callback_data);
539int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, 544int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s,
540 STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey, 545 STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey,
541 STACK_OF(X509) **pother, 546 STACK_OF(X509) **pother,
542 UI_METHOD *ui_method, void *callback_data); 547 UI_METHOD *ui_method, void *callback_data);
543 548
544/* This returns a pointer for the current ENGINE structure that 549/* This returns a pointer for the current ENGINE structure that
545 * is (by default) performing any RSA operations. The value returned 550 * is (by default) performing any RSA operations. The value returned
@@ -614,24 +619,24 @@ typedef struct st_dynamic_MEM_fns {
614 dyn_MEM_malloc_cb malloc_cb; 619 dyn_MEM_malloc_cb malloc_cb;
615 dyn_MEM_realloc_cb realloc_cb; 620 dyn_MEM_realloc_cb realloc_cb;
616 dyn_MEM_free_cb free_cb; 621 dyn_MEM_free_cb free_cb;
617 } dynamic_MEM_fns; 622} dynamic_MEM_fns;
618/* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use 623/* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use
619 * these types so we (and any other dependant code) can simplify a bit?? */ 624 * these types so we (and any other dependant code) can simplify a bit?? */
620typedef void (*dyn_lock_locking_cb)(int,int,const char *,int); 625typedef void (*dyn_lock_locking_cb)(int, int, const char *, int);
621typedef int (*dyn_lock_add_lock_cb)(int*,int,int,const char *,int); 626typedef int (*dyn_lock_add_lock_cb)(int*, int, int, const char *, int);
622typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)( 627typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)(
623 const char *,int); 628 const char *, int);
624typedef void (*dyn_dynlock_lock_cb)(int,struct CRYPTO_dynlock_value *, 629typedef void (*dyn_dynlock_lock_cb)(int, struct CRYPTO_dynlock_value *,
625 const char *,int); 630 const char *, int);
626typedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *, 631typedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *,
627 const char *,int); 632 const char *, int);
628typedef struct st_dynamic_LOCK_fns { 633typedef struct st_dynamic_LOCK_fns {
629 dyn_lock_locking_cb lock_locking_cb; 634 dyn_lock_locking_cb lock_locking_cb;
630 dyn_lock_add_lock_cb lock_add_lock_cb; 635 dyn_lock_add_lock_cb lock_add_lock_cb;
631 dyn_dynlock_create_cb dynlock_create_cb; 636 dyn_dynlock_create_cb dynlock_create_cb;
632 dyn_dynlock_lock_cb dynlock_lock_cb; 637 dyn_dynlock_lock_cb dynlock_lock_cb;
633 dyn_dynlock_destroy_cb dynlock_destroy_cb; 638 dyn_dynlock_destroy_cb dynlock_destroy_cb;
634 } dynamic_LOCK_fns; 639} dynamic_LOCK_fns;
635/* The top-level structure */ 640/* The top-level structure */
636typedef struct st_dynamic_fns { 641typedef struct st_dynamic_fns {
637 void *static_state; 642 void *static_state;
@@ -639,7 +644,7 @@ typedef struct st_dynamic_fns {
639 const CRYPTO_EX_DATA_IMPL *ex_data_fns; 644 const CRYPTO_EX_DATA_IMPL *ex_data_fns;
640 dynamic_MEM_fns mem_fns; 645 dynamic_MEM_fns mem_fns;
641 dynamic_LOCK_fns lock_fns; 646 dynamic_LOCK_fns lock_fns;
642 } dynamic_fns; 647} dynamic_fns;
643 648
644/* The version checking function should be of this prototype. NB: The 649/* The version checking function should be of this prototype. NB: The
645 * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code. 650 * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code.
@@ -673,7 +678,7 @@ typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);
673 * and returns an int value (zero for failure). 'fn' should have prototype; 678 * and returns an int value (zero for failure). 'fn' should have prototype;
674 * [static] int fn(ENGINE *e, const char *id); */ 679 * [static] int fn(ENGINE *e, const char *id); */
675typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id, 680typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,
676 const dynamic_fns *fns); 681 const dynamic_fns *fns);
677#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ 682#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \
678 extern \ 683 extern \
679 int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ 684 int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \
@@ -704,7 +709,7 @@ typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,
704 * detect this is to have a function that returns a pointer to some static data 709 * detect this is to have a function that returns a pointer to some static data
705 * and let the loading application and loaded ENGINE compare their respective 710 * and let the loading application and loaded ENGINE compare their respective
706 * values. */ 711 * values. */
707void *ENGINE_get_static_state(void); 712 void *ENGINE_get_static_state(void);
708 713
709/* BEGIN ERROR CODES */ 714/* BEGIN ERROR CODES */
710/* The following lines are auto generated by the script mkerr.pl. Any changes 715/* The following lines are auto generated by the script mkerr.pl. Any changes