diff options
Diffstat (limited to 'src/lib/libcrypto/engine/eng_fat.c')
| -rw-r--r-- | src/lib/libcrypto/engine/eng_fat.c | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/src/lib/libcrypto/engine/eng_fat.c b/src/lib/libcrypto/engine/eng_fat.c index e01067566e..f5ad01b80e 100644 --- a/src/lib/libcrypto/engine/eng_fat.c +++ b/src/lib/libcrypto/engine/eng_fat.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | * are met: | 7 | * are met: |
| 8 | * | 8 | * |
| 9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * | 11 | * |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
| @@ -54,55 +54,58 @@ | |||
| 54 | */ | 54 | */ |
| 55 | /* ==================================================================== | 55 | /* ==================================================================== |
| 56 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 56 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 57 | * ECDH support in OpenSSL originally developed by | 57 | * ECDH support in OpenSSL originally developed by |
| 58 | * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. | 58 | * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. |
| 59 | */ | 59 | */ |
| 60 | 60 | ||
| 61 | #include "eng_int.h" | 61 | #include "eng_int.h" |
| 62 | #include <openssl/conf.h> | 62 | #include <openssl/conf.h> |
| 63 | 63 | ||
| 64 | int ENGINE_set_default(ENGINE *e, unsigned int flags) | 64 | int |
| 65 | { | 65 | ENGINE_set_default(ENGINE *e, unsigned int flags) |
| 66 | if((flags & ENGINE_METHOD_CIPHERS) && !ENGINE_set_default_ciphers(e)) | 66 | { |
| 67 | if ((flags & ENGINE_METHOD_CIPHERS) && !ENGINE_set_default_ciphers(e)) | ||
| 67 | return 0; | 68 | return 0; |
| 68 | if((flags & ENGINE_METHOD_DIGESTS) && !ENGINE_set_default_digests(e)) | 69 | if ((flags & ENGINE_METHOD_DIGESTS) && !ENGINE_set_default_digests(e)) |
| 69 | return 0; | 70 | return 0; |
| 70 | #ifndef OPENSSL_NO_RSA | 71 | #ifndef OPENSSL_NO_RSA |
| 71 | if((flags & ENGINE_METHOD_RSA) && !ENGINE_set_default_RSA(e)) | 72 | if ((flags & ENGINE_METHOD_RSA) && !ENGINE_set_default_RSA(e)) |
| 72 | return 0; | 73 | return 0; |
| 73 | #endif | 74 | #endif |
| 74 | #ifndef OPENSSL_NO_DSA | 75 | #ifndef OPENSSL_NO_DSA |
| 75 | if((flags & ENGINE_METHOD_DSA) && !ENGINE_set_default_DSA(e)) | 76 | if ((flags & ENGINE_METHOD_DSA) && !ENGINE_set_default_DSA(e)) |
| 76 | return 0; | 77 | return 0; |
| 77 | #endif | 78 | #endif |
| 78 | #ifndef OPENSSL_NO_DH | 79 | #ifndef OPENSSL_NO_DH |
| 79 | if((flags & ENGINE_METHOD_DH) && !ENGINE_set_default_DH(e)) | 80 | if ((flags & ENGINE_METHOD_DH) && !ENGINE_set_default_DH(e)) |
| 80 | return 0; | 81 | return 0; |
| 81 | #endif | 82 | #endif |
| 82 | #ifndef OPENSSL_NO_ECDH | 83 | #ifndef OPENSSL_NO_ECDH |
| 83 | if((flags & ENGINE_METHOD_ECDH) && !ENGINE_set_default_ECDH(e)) | 84 | if ((flags & ENGINE_METHOD_ECDH) && !ENGINE_set_default_ECDH(e)) |
| 84 | return 0; | 85 | return 0; |
| 85 | #endif | 86 | #endif |
| 86 | #ifndef OPENSSL_NO_ECDSA | 87 | #ifndef OPENSSL_NO_ECDSA |
| 87 | if((flags & ENGINE_METHOD_ECDSA) && !ENGINE_set_default_ECDSA(e)) | 88 | if ((flags & ENGINE_METHOD_ECDSA) && !ENGINE_set_default_ECDSA(e)) |
| 88 | return 0; | 89 | return 0; |
| 89 | #endif | 90 | #endif |
| 90 | if((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) | 91 | if ((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) |
| 91 | return 0; | 92 | return 0; |
| 92 | if((flags & ENGINE_METHOD_PKEY_METHS) | 93 | if ((flags & ENGINE_METHOD_PKEY_METHS) && |
| 93 | && !ENGINE_set_default_pkey_meths(e)) | 94 | !ENGINE_set_default_pkey_meths(e)) |
| 94 | return 0; | 95 | return 0; |
| 95 | if((flags & ENGINE_METHOD_PKEY_ASN1_METHS) | 96 | if ((flags & ENGINE_METHOD_PKEY_ASN1_METHS) && |
| 96 | && !ENGINE_set_default_pkey_asn1_meths(e)) | 97 | !ENGINE_set_default_pkey_asn1_meths(e)) |
| 97 | return 0; | 98 | return 0; |
| 98 | return 1; | 99 | return 1; |
| 99 | } | 100 | } |
| 100 | 101 | ||
| 101 | /* Set default algorithms using a string */ | 102 | /* Set default algorithms using a string */ |
| 102 | 103 | ||
| 103 | static int int_def_cb(const char *alg, int len, void *arg) | 104 | static int |
| 104 | { | 105 | int_def_cb(const char *alg, int len, void *arg) |
| 106 | { | ||
| 105 | unsigned int *pflags = arg; | 107 | unsigned int *pflags = arg; |
| 108 | |||
| 106 | if (!strncmp(alg, "ALL", len)) | 109 | if (!strncmp(alg, "ALL", len)) |
| 107 | *pflags |= ENGINE_METHOD_ALL; | 110 | *pflags |= ENGINE_METHOD_ALL; |
| 108 | else if (!strncmp(alg, "RSA", len)) | 111 | else if (!strncmp(alg, "RSA", len)) |
| @@ -123,7 +126,7 @@ static int int_def_cb(const char *alg, int len, void *arg) | |||
| 123 | *pflags |= ENGINE_METHOD_DIGESTS; | 126 | *pflags |= ENGINE_METHOD_DIGESTS; |
| 124 | else if (!strncmp(alg, "PKEY", len)) | 127 | else if (!strncmp(alg, "PKEY", len)) |
| 125 | *pflags |= | 128 | *pflags |= |
| 126 | ENGINE_METHOD_PKEY_METHS|ENGINE_METHOD_PKEY_ASN1_METHS; | 129 | ENGINE_METHOD_PKEY_METHS|ENGINE_METHOD_PKEY_ASN1_METHS; |
| 127 | else if (!strncmp(alg, "PKEY_CRYPTO", len)) | 130 | else if (!strncmp(alg, "PKEY_CRYPTO", len)) |
| 128 | *pflags |= ENGINE_METHOD_PKEY_METHS; | 131 | *pflags |= ENGINE_METHOD_PKEY_METHS; |
| 129 | else if (!strncmp(alg, "PKEY_ASN1", len)) | 132 | else if (!strncmp(alg, "PKEY_ASN1", len)) |
| @@ -131,24 +134,25 @@ static int int_def_cb(const char *alg, int len, void *arg) | |||
| 131 | else | 134 | else |
| 132 | return 0; | 135 | return 0; |
| 133 | return 1; | 136 | return 1; |
| 134 | } | 137 | } |
| 135 | 138 | ||
| 136 | 139 | int | |
| 137 | int ENGINE_set_default_string(ENGINE *e, const char *def_list) | 140 | ENGINE_set_default_string(ENGINE *e, const char *def_list) |
| 138 | { | 141 | { |
| 139 | unsigned int flags = 0; | 142 | unsigned int flags = 0; |
| 140 | if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) | 143 | |
| 141 | { | 144 | if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) { |
| 142 | ENGINEerr(ENGINE_F_ENGINE_SET_DEFAULT_STRING, | 145 | ENGINEerr(ENGINE_F_ENGINE_SET_DEFAULT_STRING, |
| 143 | ENGINE_R_INVALID_STRING); | 146 | ENGINE_R_INVALID_STRING); |
| 144 | ERR_asprintf_error_data("str=%s",def_list); | 147 | ERR_asprintf_error_data("str=%s",def_list); |
| 145 | return 0; | 148 | return 0; |
| 146 | } | ||
| 147 | return ENGINE_set_default(e, flags); | ||
| 148 | } | 149 | } |
| 150 | return ENGINE_set_default(e, flags); | ||
| 151 | } | ||
| 149 | 152 | ||
| 150 | int ENGINE_register_complete(ENGINE *e) | 153 | int |
| 151 | { | 154 | ENGINE_register_complete(ENGINE *e) |
| 155 | { | ||
| 152 | ENGINE_register_ciphers(e); | 156 | ENGINE_register_ciphers(e); |
| 153 | ENGINE_register_digests(e); | 157 | ENGINE_register_digests(e); |
| 154 | #ifndef OPENSSL_NO_RSA | 158 | #ifndef OPENSSL_NO_RSA |
| @@ -169,14 +173,15 @@ int ENGINE_register_complete(ENGINE *e) | |||
| 169 | ENGINE_register_RAND(e); | 173 | ENGINE_register_RAND(e); |
| 170 | ENGINE_register_pkey_meths(e); | 174 | ENGINE_register_pkey_meths(e); |
| 171 | return 1; | 175 | return 1; |
| 172 | } | 176 | } |
| 173 | 177 | ||
| 174 | int ENGINE_register_all_complete(void) | 178 | int |
| 175 | { | 179 | ENGINE_register_all_complete(void) |
| 180 | { | ||
| 176 | ENGINE *e; | 181 | ENGINE *e; |
| 177 | 182 | ||
| 178 | for(e=ENGINE_get_first() ; e ; e=ENGINE_get_next(e)) | 183 | for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) |
| 179 | if (!(e->flags & ENGINE_FLAGS_NO_REGISTER_ALL)) | 184 | if (!(e->flags & ENGINE_FLAGS_NO_REGISTER_ALL)) |
| 180 | ENGINE_register_complete(e); | 185 | ENGINE_register_complete(e); |
| 181 | return 1; | 186 | return 1; |
| 182 | } | 187 | } |
