| OLD | NEW |
| 1 /* crypto/engine/eng_fat.c */ | 1 /* crypto/engine/eng_fat.c */ |
| 2 /* ==================================================================== | 2 /* ==================================================================== |
| 3 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. | 3 * Copyright (c) 1999-2001 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 |
| 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. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #ifndef OPENSSL_NO_ECDH | 82 #ifndef OPENSSL_NO_ECDH |
| 83 if((flags & ENGINE_METHOD_ECDH) && !ENGINE_set_default_ECDH(e)) | 83 if((flags & ENGINE_METHOD_ECDH) && !ENGINE_set_default_ECDH(e)) |
| 84 return 0; | 84 return 0; |
| 85 #endif | 85 #endif |
| 86 #ifndef OPENSSL_NO_ECDSA | 86 #ifndef OPENSSL_NO_ECDSA |
| 87 if((flags & ENGINE_METHOD_ECDSA) && !ENGINE_set_default_ECDSA(e)) | 87 if((flags & ENGINE_METHOD_ECDSA) && !ENGINE_set_default_ECDSA(e)) |
| 88 return 0; | 88 return 0; |
| 89 #endif | 89 #endif |
| 90 if((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) | 90 if((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e)) |
| 91 return 0; | 91 return 0; |
| 92 if((flags & ENGINE_METHOD_PKEY_METHS) |
| 93 && !ENGINE_set_default_pkey_meths(e)) |
| 94 return 0; |
| 95 if((flags & ENGINE_METHOD_PKEY_ASN1_METHS) |
| 96 && !ENGINE_set_default_pkey_asn1_meths(e)) |
| 97 return 0; |
| 92 return 1; | 98 return 1; |
| 93 } | 99 } |
| 94 | 100 |
| 95 /* Set default algorithms using a string */ | 101 /* Set default algorithms using a string */ |
| 96 | 102 |
| 97 static int int_def_cb(const char *alg, int len, void *arg) | 103 static int int_def_cb(const char *alg, int len, void *arg) |
| 98 { | 104 { |
| 99 unsigned int *pflags = arg; | 105 unsigned int *pflags = arg; |
| 100 if (!strncmp(alg, "ALL", len)) | 106 if (!strncmp(alg, "ALL", len)) |
| 101 *pflags |= ENGINE_METHOD_ALL; | 107 *pflags |= ENGINE_METHOD_ALL; |
| 102 else if (!strncmp(alg, "RSA", len)) | 108 else if (!strncmp(alg, "RSA", len)) |
| 103 *pflags |= ENGINE_METHOD_RSA; | 109 *pflags |= ENGINE_METHOD_RSA; |
| 104 else if (!strncmp(alg, "DSA", len)) | 110 else if (!strncmp(alg, "DSA", len)) |
| 105 *pflags |= ENGINE_METHOD_DSA; | 111 *pflags |= ENGINE_METHOD_DSA; |
| 106 else if (!strncmp(alg, "ECDH", len)) | 112 else if (!strncmp(alg, "ECDH", len)) |
| 107 *pflags |= ENGINE_METHOD_ECDH; | 113 *pflags |= ENGINE_METHOD_ECDH; |
| 108 else if (!strncmp(alg, "ECDSA", len)) | 114 else if (!strncmp(alg, "ECDSA", len)) |
| 109 *pflags |= ENGINE_METHOD_ECDSA; | 115 *pflags |= ENGINE_METHOD_ECDSA; |
| 110 else if (!strncmp(alg, "DH", len)) | 116 else if (!strncmp(alg, "DH", len)) |
| 111 *pflags |= ENGINE_METHOD_DH; | 117 *pflags |= ENGINE_METHOD_DH; |
| 112 else if (!strncmp(alg, "RAND", len)) | 118 else if (!strncmp(alg, "RAND", len)) |
| 113 *pflags |= ENGINE_METHOD_RAND; | 119 *pflags |= ENGINE_METHOD_RAND; |
| 114 else if (!strncmp(alg, "CIPHERS", len)) | 120 else if (!strncmp(alg, "CIPHERS", len)) |
| 115 *pflags |= ENGINE_METHOD_CIPHERS; | 121 *pflags |= ENGINE_METHOD_CIPHERS; |
| 116 else if (!strncmp(alg, "DIGESTS", len)) | 122 else if (!strncmp(alg, "DIGESTS", len)) |
| 117 *pflags |= ENGINE_METHOD_DIGESTS; | 123 *pflags |= ENGINE_METHOD_DIGESTS; |
| 124 else if (!strncmp(alg, "PKEY", len)) |
| 125 *pflags |= |
| 126 ENGINE_METHOD_PKEY_METHS|ENGINE_METHOD_PKEY_ASN1_METHS; |
| 127 else if (!strncmp(alg, "PKEY_CRYPTO", len)) |
| 128 *pflags |= ENGINE_METHOD_PKEY_METHS; |
| 129 else if (!strncmp(alg, "PKEY_ASN1", len)) |
| 130 *pflags |= ENGINE_METHOD_PKEY_ASN1_METHS; |
| 118 else | 131 else |
| 119 return 0; | 132 return 0; |
| 120 return 1; | 133 return 1; |
| 121 } | 134 } |
| 122 | 135 |
| 123 | 136 |
| 124 int ENGINE_set_default_string(ENGINE *e, const char *def_list) | 137 int ENGINE_set_default_string(ENGINE *e, const char *def_list) |
| 125 { | 138 { |
| 126 unsigned int flags = 0; | 139 unsigned int flags = 0; |
| 127 if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) | 140 if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 147 #ifndef OPENSSL_NO_DH | 160 #ifndef OPENSSL_NO_DH |
| 148 ENGINE_register_DH(e); | 161 ENGINE_register_DH(e); |
| 149 #endif | 162 #endif |
| 150 #ifndef OPENSSL_NO_ECDH | 163 #ifndef OPENSSL_NO_ECDH |
| 151 ENGINE_register_ECDH(e); | 164 ENGINE_register_ECDH(e); |
| 152 #endif | 165 #endif |
| 153 #ifndef OPENSSL_NO_ECDSA | 166 #ifndef OPENSSL_NO_ECDSA |
| 154 ENGINE_register_ECDSA(e); | 167 ENGINE_register_ECDSA(e); |
| 155 #endif | 168 #endif |
| 156 ENGINE_register_RAND(e); | 169 ENGINE_register_RAND(e); |
| 170 ENGINE_register_pkey_meths(e); |
| 157 return 1; | 171 return 1; |
| 158 } | 172 } |
| 159 | 173 |
| 160 int ENGINE_register_all_complete(void) | 174 int ENGINE_register_all_complete(void) |
| 161 { | 175 { |
| 162 ENGINE *e; | 176 ENGINE *e; |
| 163 | 177 |
| 164 for(e=ENGINE_get_first() ; e ; e=ENGINE_get_next(e)) | 178 for(e=ENGINE_get_first() ; e ; e=ENGINE_get_next(e)) |
| 165 ENGINE_register_complete(e); | 179 ENGINE_register_complete(e); |
| 166 return 1; | 180 return 1; |
| 167 } | 181 } |
| OLD | NEW |