diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/ameth_lib.c')
-rw-r--r-- | src/lib/libcrypto/asn1/ameth_lib.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/lib/libcrypto/asn1/ameth_lib.c b/src/lib/libcrypto/asn1/ameth_lib.c index 8f96e00c93..bbaf6b4dfb 100644 --- a/src/lib/libcrypto/asn1/ameth_lib.c +++ b/src/lib/libcrypto/asn1/ameth_lib.c | |||
@@ -150,8 +150,7 @@ static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type) | |||
150 | EVP_PKEY_ASN1_METHOD tmp; | 150 | EVP_PKEY_ASN1_METHOD tmp; |
151 | const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; | 151 | const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; |
152 | tmp.pkey_id = type; | 152 | tmp.pkey_id = type; |
153 | if (app_methods) | 153 | if (app_methods) { |
154 | { | ||
155 | int idx; | 154 | int idx; |
156 | idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); | 155 | idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); |
157 | if (idx >= 0) | 156 | if (idx >= 0) |
@@ -175,21 +174,18 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type) | |||
175 | { | 174 | { |
176 | const EVP_PKEY_ASN1_METHOD *t; | 175 | const EVP_PKEY_ASN1_METHOD *t; |
177 | 176 | ||
178 | for (;;) | 177 | for (;;) { |
179 | { | ||
180 | t = pkey_asn1_find(type); | 178 | t = pkey_asn1_find(type); |
181 | if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS)) | 179 | if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS)) |
182 | break; | 180 | break; |
183 | type = t->pkey_base_id; | 181 | type = t->pkey_base_id; |
184 | } | 182 | } |
185 | if (pe) | 183 | if (pe) { |
186 | { | ||
187 | #ifndef OPENSSL_NO_ENGINE | 184 | #ifndef OPENSSL_NO_ENGINE |
188 | ENGINE *e; | 185 | ENGINE *e; |
189 | /* type will contain the final unaliased type */ | 186 | /* type will contain the final unaliased type */ |
190 | e = ENGINE_get_pkey_asn1_meth_engine(type); | 187 | e = ENGINE_get_pkey_asn1_meth_engine(type); |
191 | if (e) | 188 | if (e) { |
192 | { | ||
193 | *pe = e; | 189 | *pe = e; |
194 | return ENGINE_get_pkey_asn1_meth(e, type); | 190 | return ENGINE_get_pkey_asn1_meth(e, type); |
195 | } | 191 | } |
@@ -206,13 +202,11 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | |||
206 | const EVP_PKEY_ASN1_METHOD *ameth; | 202 | const EVP_PKEY_ASN1_METHOD *ameth; |
207 | if (len == -1) | 203 | if (len == -1) |
208 | len = strlen(str); | 204 | len = strlen(str); |
209 | if (pe) | 205 | if (pe) { |
210 | { | ||
211 | #ifndef OPENSSL_NO_ENGINE | 206 | #ifndef OPENSSL_NO_ENGINE |
212 | ENGINE *e; | 207 | ENGINE *e; |
213 | ameth = ENGINE_pkey_asn1_find_str(&e, str, len); | 208 | ameth = ENGINE_pkey_asn1_find_str(&e, str, len); |
214 | if (ameth) | 209 | if (ameth) { |
215 | { | ||
216 | /* Convert structural into | 210 | /* Convert structural into |
217 | * functional reference | 211 | * functional reference |
218 | */ | 212 | */ |
@@ -225,8 +219,7 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | |||
225 | #endif | 219 | #endif |
226 | *pe = NULL; | 220 | *pe = NULL; |
227 | } | 221 | } |
228 | for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) | 222 | for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) { |
229 | { | ||
230 | ameth = EVP_PKEY_asn1_get0(i); | 223 | ameth = EVP_PKEY_asn1_get0(i); |
231 | if (ameth->pkey_flags & ASN1_PKEY_ALIAS) | 224 | if (ameth->pkey_flags & ASN1_PKEY_ALIAS) |
232 | continue; | 225 | continue; |
@@ -239,8 +232,7 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | |||
239 | 232 | ||
240 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) | 233 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) |
241 | { | 234 | { |
242 | if (app_methods == NULL) | 235 | if (app_methods == NULL) { |
243 | { | ||
244 | app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp); | 236 | app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp); |
245 | if (!app_methods) | 237 | if (!app_methods) |
246 | return 0; | 238 | return 0; |
@@ -299,8 +291,7 @@ EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | |||
299 | ameth->pkey_base_id = id; | 291 | ameth->pkey_base_id = id; |
300 | ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; | 292 | ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; |
301 | 293 | ||
302 | if (info) | 294 | if (info) { |
303 | { | ||
304 | ameth->info = BUF_strdup(info); | 295 | ameth->info = BUF_strdup(info); |
305 | if (!ameth->info) | 296 | if (!ameth->info) |
306 | goto err; | 297 | goto err; |
@@ -308,8 +299,7 @@ EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | |||
308 | else | 299 | else |
309 | ameth->info = NULL; | 300 | ameth->info = NULL; |
310 | 301 | ||
311 | if (pem_str) | 302 | if (pem_str) { |
312 | { | ||
313 | ameth->pem_str = BUF_strdup(pem_str); | 303 | ameth->pem_str = BUF_strdup(pem_str); |
314 | if (!ameth->pem_str) | 304 | if (!ameth->pem_str) |
315 | goto err; | 305 | goto err; |
@@ -390,8 +380,7 @@ void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, | |||
390 | 380 | ||
391 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) | 381 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) |
392 | { | 382 | { |
393 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) | 383 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { |
394 | { | ||
395 | if (ameth->pem_str) | 384 | if (ameth->pem_str) |
396 | free(ameth->pem_str); | 385 | free(ameth->pem_str); |
397 | if (ameth->info) | 386 | if (ameth->info) |