diff options
| author | djm <> | 2009-01-09 12:14:11 +0000 |
|---|---|---|
| committer | djm <> | 2009-01-09 12:14:11 +0000 |
| commit | a0fdc9ec41594852f67ec77dfad9cb06bacc4186 (patch) | |
| tree | c43f6b3a4d93ad2cb3dcf93275295679d895a033 /src/lib/libcrypto/engine | |
| parent | 5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80 (diff) | |
| download | openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.tar.gz openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.tar.bz2 openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.zip | |
import openssl-0.9.8j
Diffstat (limited to 'src/lib/libcrypto/engine')
| -rw-r--r-- | src/lib/libcrypto/engine/eng_all.c | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/eng_cnf.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/eng_err.c | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/eng_int.h | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/eng_padlock.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/eng_pkey.c | 42 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/engine.h | 16 |
7 files changed, 77 insertions, 4 deletions
diff --git a/src/lib/libcrypto/engine/eng_all.c b/src/lib/libcrypto/engine/eng_all.c index 8599046717..d29cd57dc2 100644 --- a/src/lib/libcrypto/engine/eng_all.c +++ b/src/lib/libcrypto/engine/eng_all.c | |||
| @@ -107,6 +107,9 @@ void ENGINE_load_builtin_engines(void) | |||
| 107 | #if defined(__OpenBSD__) || defined(__FreeBSD__) | 107 | #if defined(__OpenBSD__) || defined(__FreeBSD__) |
| 108 | ENGINE_load_cryptodev(); | 108 | ENGINE_load_cryptodev(); |
| 109 | #endif | 109 | #endif |
| 110 | #if defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_NO_CAPIENG) | ||
| 111 | ENGINE_load_capi(); | ||
| 112 | #endif | ||
| 110 | #endif | 113 | #endif |
| 111 | } | 114 | } |
| 112 | 115 | ||
diff --git a/src/lib/libcrypto/engine/eng_cnf.c b/src/lib/libcrypto/engine/eng_cnf.c index a97e01e619..08066cea59 100644 --- a/src/lib/libcrypto/engine/eng_cnf.c +++ b/src/lib/libcrypto/engine/eng_cnf.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* eng_cnf.c */ | 1 | /* eng_cnf.c */ |
| 2 | /* Written by Stephen Henson (shenson@bigfoot.com) for the OpenSSL | 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| 5 | /* ==================================================================== | 5 | /* ==================================================================== |
| @@ -98,6 +98,8 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf) | |||
| 98 | CONF_VALUE *ecmd; | 98 | CONF_VALUE *ecmd; |
| 99 | char *ctrlname, *ctrlvalue; | 99 | char *ctrlname, *ctrlvalue; |
| 100 | ENGINE *e = NULL; | 100 | ENGINE *e = NULL; |
| 101 | int soft = 0; | ||
| 102 | |||
| 101 | name = skip_dot(name); | 103 | name = skip_dot(name); |
| 102 | #ifdef ENGINE_CONF_DEBUG | 104 | #ifdef ENGINE_CONF_DEBUG |
| 103 | fprintf(stderr, "Configuring engine %s\n", name); | 105 | fprintf(stderr, "Configuring engine %s\n", name); |
| @@ -125,6 +127,8 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf) | |||
| 125 | /* Override engine name to use */ | 127 | /* Override engine name to use */ |
| 126 | if (!strcmp(ctrlname, "engine_id")) | 128 | if (!strcmp(ctrlname, "engine_id")) |
| 127 | name = ctrlvalue; | 129 | name = ctrlvalue; |
| 130 | else if (!strcmp(ctrlname, "soft_load")) | ||
| 131 | soft = 1; | ||
| 128 | /* Load a dynamic ENGINE */ | 132 | /* Load a dynamic ENGINE */ |
| 129 | else if (!strcmp(ctrlname, "dynamic_path")) | 133 | else if (!strcmp(ctrlname, "dynamic_path")) |
| 130 | { | 134 | { |
| @@ -147,6 +151,11 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf) | |||
| 147 | if (!e) | 151 | if (!e) |
| 148 | { | 152 | { |
| 149 | e = ENGINE_by_id(name); | 153 | e = ENGINE_by_id(name); |
| 154 | if (!e && soft) | ||
| 155 | { | ||
| 156 | ERR_clear_error(); | ||
| 157 | return 1; | ||
| 158 | } | ||
| 150 | if (!e) | 159 | if (!e) |
| 151 | return 0; | 160 | return 0; |
| 152 | } | 161 | } |
diff --git a/src/lib/libcrypto/engine/eng_err.c b/src/lib/libcrypto/engine/eng_err.c index 369f2e22d3..574ffbb5c0 100644 --- a/src/lib/libcrypto/engine/eng_err.c +++ b/src/lib/libcrypto/engine/eng_err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/engine/eng_err.c */ | 1 | /* crypto/engine/eng_err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -92,6 +92,7 @@ static ERR_STRING_DATA ENGINE_str_functs[]= | |||
| 92 | {ERR_FUNC(ENGINE_F_ENGINE_LIST_REMOVE), "ENGINE_LIST_REMOVE"}, | 92 | {ERR_FUNC(ENGINE_F_ENGINE_LIST_REMOVE), "ENGINE_LIST_REMOVE"}, |
| 93 | {ERR_FUNC(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY), "ENGINE_load_private_key"}, | 93 | {ERR_FUNC(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY), "ENGINE_load_private_key"}, |
| 94 | {ERR_FUNC(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY), "ENGINE_load_public_key"}, | 94 | {ERR_FUNC(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY), "ENGINE_load_public_key"}, |
| 95 | {ERR_FUNC(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT), "ENGINE_load_ssl_client_cert"}, | ||
| 95 | {ERR_FUNC(ENGINE_F_ENGINE_NEW), "ENGINE_new"}, | 96 | {ERR_FUNC(ENGINE_F_ENGINE_NEW), "ENGINE_new"}, |
| 96 | {ERR_FUNC(ENGINE_F_ENGINE_REMOVE), "ENGINE_remove"}, | 97 | {ERR_FUNC(ENGINE_F_ENGINE_REMOVE), "ENGINE_remove"}, |
| 97 | {ERR_FUNC(ENGINE_F_ENGINE_SET_DEFAULT_STRING), "ENGINE_set_default_string"}, | 98 | {ERR_FUNC(ENGINE_F_ENGINE_SET_DEFAULT_STRING), "ENGINE_set_default_string"}, |
diff --git a/src/lib/libcrypto/engine/eng_int.h b/src/lib/libcrypto/engine/eng_int.h index a5b1edebf4..a66f107a44 100644 --- a/src/lib/libcrypto/engine/eng_int.h +++ b/src/lib/libcrypto/engine/eng_int.h | |||
| @@ -170,6 +170,8 @@ struct engine_st | |||
| 170 | ENGINE_LOAD_KEY_PTR load_privkey; | 170 | ENGINE_LOAD_KEY_PTR load_privkey; |
| 171 | ENGINE_LOAD_KEY_PTR load_pubkey; | 171 | ENGINE_LOAD_KEY_PTR load_pubkey; |
| 172 | 172 | ||
| 173 | ENGINE_SSL_CLIENT_CERT_PTR load_ssl_client_cert; | ||
| 174 | |||
| 173 | const ENGINE_CMD_DEFN *cmd_defns; | 175 | const ENGINE_CMD_DEFN *cmd_defns; |
| 174 | int flags; | 176 | int flags; |
| 175 | /* reference count on the structure itself */ | 177 | /* reference count on the structure itself */ |
diff --git a/src/lib/libcrypto/engine/eng_padlock.c b/src/lib/libcrypto/engine/eng_padlock.c index 1ba9d85db4..743558ab33 100644 --- a/src/lib/libcrypto/engine/eng_padlock.c +++ b/src/lib/libcrypto/engine/eng_padlock.c | |||
| @@ -234,8 +234,8 @@ padlock_bind_fn(ENGINE *e, const char *id) | |||
| 234 | return 1; | 234 | return 1; |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | IMPLEMENT_DYNAMIC_CHECK_FN (); | 237 | IMPLEMENT_DYNAMIC_CHECK_FN () |
| 238 | IMPLEMENT_DYNAMIC_BIND_FN (padlock_bind_fn); | 238 | IMPLEMENT_DYNAMIC_BIND_FN (padlock_bind_fn) |
| 239 | #endif /* DYNAMIC_ENGINE */ | 239 | #endif /* DYNAMIC_ENGINE */ |
| 240 | 240 | ||
| 241 | /* ===== Here comes the "real" engine ===== */ | 241 | /* ===== Here comes the "real" engine ===== */ |
diff --git a/src/lib/libcrypto/engine/eng_pkey.c b/src/lib/libcrypto/engine/eng_pkey.c index bc8b21abec..1dfa2e3664 100644 --- a/src/lib/libcrypto/engine/eng_pkey.c +++ b/src/lib/libcrypto/engine/eng_pkey.c | |||
| @@ -69,6 +69,13 @@ int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f) | |||
| 69 | return 1; | 69 | return 1; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, | ||
| 73 | ENGINE_SSL_CLIENT_CERT_PTR loadssl_f) | ||
| 74 | { | ||
| 75 | e->load_ssl_client_cert = loadssl_f; | ||
| 76 | return 1; | ||
| 77 | } | ||
| 78 | |||
| 72 | ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e) | 79 | ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e) |
| 73 | { | 80 | { |
| 74 | return e->load_privkey; | 81 | return e->load_privkey; |
| @@ -79,6 +86,11 @@ ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e) | |||
| 79 | return e->load_pubkey; | 86 | return e->load_pubkey; |
| 80 | } | 87 | } |
| 81 | 88 | ||
| 89 | ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e) | ||
| 90 | { | ||
| 91 | return e->load_ssl_client_cert; | ||
| 92 | } | ||
| 93 | |||
| 82 | /* API functions to load public/private keys */ | 94 | /* API functions to load public/private keys */ |
| 83 | 95 | ||
| 84 | EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, | 96 | EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, |
| @@ -152,3 +164,33 @@ EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, | |||
| 152 | } | 164 | } |
| 153 | return pkey; | 165 | return pkey; |
| 154 | } | 166 | } |
| 167 | |||
| 168 | int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, | ||
| 169 | STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey, | ||
| 170 | STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data) | ||
| 171 | { | ||
| 172 | |||
| 173 | if(e == NULL) | ||
| 174 | { | ||
| 175 | ENGINEerr(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT, | ||
| 176 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 177 | return 0; | ||
| 178 | } | ||
| 179 | CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); | ||
| 180 | if(e->funct_ref == 0) | ||
| 181 | { | ||
| 182 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 183 | ENGINEerr(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT, | ||
| 184 | ENGINE_R_NOT_INITIALISED); | ||
| 185 | return 0; | ||
| 186 | } | ||
| 187 | CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); | ||
| 188 | if (!e->load_ssl_client_cert) | ||
| 189 | { | ||
| 190 | ENGINEerr(ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT, | ||
| 191 | ENGINE_R_NO_LOAD_FUNCTION); | ||
| 192 | return 0; | ||
| 193 | } | ||
| 194 | return e->load_ssl_client_cert(e, s, ca_dn, pcert, ppkey, pother, | ||
| 195 | ui_method, callback_data); | ||
| 196 | } | ||
diff --git a/src/lib/libcrypto/engine/engine.h b/src/lib/libcrypto/engine/engine.h index 3ec59338ff..f503595ece 100644 --- a/src/lib/libcrypto/engine/engine.h +++ b/src/lib/libcrypto/engine/engine.h | |||
| @@ -93,6 +93,8 @@ | |||
| 93 | #include <openssl/err.h> | 93 | #include <openssl/err.h> |
| 94 | #endif | 94 | #endif |
| 95 | 95 | ||
| 96 | #include <openssl/x509.h> | ||
| 97 | |||
| 96 | #include <openssl/ossl_typ.h> | 98 | #include <openssl/ossl_typ.h> |
| 97 | #include <openssl/symhacks.h> | 99 | #include <openssl/symhacks.h> |
| 98 | 100 | ||
| @@ -278,6 +280,9 @@ typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void) | |||
| 278 | /* Generic load_key function pointer */ | 280 | /* Generic load_key function pointer */ |
| 279 | typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, | 281 | typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, |
| 280 | UI_METHOD *ui_method, void *callback_data); | 282 | UI_METHOD *ui_method, void *callback_data); |
| 283 | typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl, | ||
| 284 | STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, | ||
| 285 | STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); | ||
| 281 | /* These callback types are for an ENGINE's handler for cipher and digest logic. | 286 | /* These callback types are for an ENGINE's handler for cipher and digest logic. |
| 282 | * These handlers have these prototypes; | 287 | * These handlers have these prototypes; |
| 283 | * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); | 288 | * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); |
| @@ -334,6 +339,9 @@ void ENGINE_load_ubsec(void); | |||
| 334 | void ENGINE_load_cryptodev(void); | 339 | void ENGINE_load_cryptodev(void); |
| 335 | void ENGINE_load_padlock(void); | 340 | void ENGINE_load_padlock(void); |
| 336 | void ENGINE_load_builtin_engines(void); | 341 | void ENGINE_load_builtin_engines(void); |
| 342 | #ifndef OPENSSL_NO_CAPIENG | ||
| 343 | void ENGINE_load_capi(void); | ||
| 344 | #endif | ||
| 337 | 345 | ||
| 338 | /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation | 346 | /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation |
| 339 | * "registry" handling. */ | 347 | * "registry" handling. */ |
| @@ -459,6 +467,8 @@ int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); | |||
| 459 | int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); | 467 | int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); |
| 460 | int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); | 468 | int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); |
| 461 | int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); | 469 | int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); |
| 470 | int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, | ||
| 471 | ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); | ||
| 462 | int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); | 472 | int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); |
| 463 | int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); | 473 | int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); |
| 464 | int ENGINE_set_flags(ENGINE *e, int flags); | 474 | int ENGINE_set_flags(ENGINE *e, int flags); |
| @@ -494,6 +504,7 @@ ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); | |||
| 494 | ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); | 504 | ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); |
| 495 | ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); | 505 | ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); |
| 496 | ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); | 506 | ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); |
| 507 | ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); | ||
| 497 | ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); | 508 | ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); |
| 498 | ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); | 509 | ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); |
| 499 | const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); | 510 | const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); |
| @@ -529,6 +540,10 @@ EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, | |||
| 529 | UI_METHOD *ui_method, void *callback_data); | 540 | UI_METHOD *ui_method, void *callback_data); |
| 530 | EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, | 541 | EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, |
| 531 | UI_METHOD *ui_method, void *callback_data); | 542 | UI_METHOD *ui_method, void *callback_data); |
| 543 | int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, | ||
| 544 | STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey, | ||
| 545 | STACK_OF(X509) **pother, | ||
| 546 | UI_METHOD *ui_method, void *callback_data); | ||
| 532 | 547 | ||
| 533 | /* This returns a pointer for the current ENGINE structure that | 548 | /* This returns a pointer for the current ENGINE structure that |
| 534 | * is (by default) performing any RSA operations. The value returned | 549 | * is (by default) performing any RSA operations. The value returned |
| @@ -723,6 +738,7 @@ void ERR_load_ENGINE_strings(void); | |||
| 723 | #define ENGINE_F_ENGINE_LIST_REMOVE 121 | 738 | #define ENGINE_F_ENGINE_LIST_REMOVE 121 |
| 724 | #define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 | 739 | #define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 |
| 725 | #define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 | 740 | #define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 |
| 741 | #define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 192 | ||
| 726 | #define ENGINE_F_ENGINE_NEW 122 | 742 | #define ENGINE_F_ENGINE_NEW 122 |
| 727 | #define ENGINE_F_ENGINE_REMOVE 123 | 743 | #define ENGINE_F_ENGINE_REMOVE 123 |
| 728 | #define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 | 744 | #define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 |
