/src/openssl111/crypto/engine/tb_dsa.c
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | /* | 
| 2 |  |  * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. | 
| 3 |  |  * | 
| 4 |  |  * Licensed under the OpenSSL license (the "License").  You may not use | 
| 5 |  |  * this file except in compliance with the License.  You can obtain a copy | 
| 6 |  |  * in the file LICENSE in the source distribution or at | 
| 7 |  |  * https://www.openssl.org/source/license.html | 
| 8 |  |  */ | 
| 9 |  |  | 
| 10 |  | #include "eng_local.h" | 
| 11 |  |  | 
| 12 |  | static ENGINE_TABLE *dsa_table = NULL; | 
| 13 |  | static const int dummy_nid = 1; | 
| 14 |  |  | 
| 15 |  | void ENGINE_unregister_DSA(ENGINE *e) | 
| 16 | 0 | { | 
| 17 | 0 |     engine_table_unregister(&dsa_table, e); | 
| 18 | 0 | } | 
| 19 |  |  | 
| 20 |  | static void engine_unregister_all_DSA(void) | 
| 21 | 0 | { | 
| 22 | 0 |     engine_table_cleanup(&dsa_table); | 
| 23 | 0 | } | 
| 24 |  |  | 
| 25 |  | int ENGINE_register_DSA(ENGINE *e) | 
| 26 | 6 | { | 
| 27 | 6 |     if (e->dsa_meth) | 
| 28 | 0 |         return engine_table_register(&dsa_table, | 
| 29 | 0 |                                      engine_unregister_all_DSA, e, &dummy_nid, | 
| 30 | 0 |                                      1, 0); | 
| 31 | 6 |     return 1; | 
| 32 | 6 | } | 
| 33 |  |  | 
| 34 |  | void ENGINE_register_all_DSA(void) | 
| 35 | 0 | { | 
| 36 | 0 |     ENGINE *e; | 
| 37 |  | 
 | 
| 38 | 0 |     for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) | 
| 39 | 0 |         ENGINE_register_DSA(e); | 
| 40 | 0 | } | 
| 41 |  |  | 
| 42 |  | int ENGINE_set_default_DSA(ENGINE *e) | 
| 43 | 0 | { | 
| 44 | 0 |     if (e->dsa_meth) | 
| 45 | 0 |         return engine_table_register(&dsa_table, | 
| 46 | 0 |                                      engine_unregister_all_DSA, e, &dummy_nid, | 
| 47 | 0 |                                      1, 1); | 
| 48 | 0 |     return 1; | 
| 49 | 0 | } | 
| 50 |  |  | 
| 51 |  | /* | 
| 52 |  |  * Exposed API function to get a functional reference from the implementation | 
| 53 |  |  * table (ie. try to get a functional reference from the tabled structural | 
| 54 |  |  * references). | 
| 55 |  |  */ | 
| 56 |  | ENGINE *ENGINE_get_default_DSA(void) | 
| 57 | 239k | { | 
| 58 | 239k |     return engine_table_select(&dsa_table, dummy_nid); | 
| 59 | 239k | } | 
| 60 |  |  | 
| 61 |  | /* Obtains an DSA implementation from an ENGINE functional reference */ | 
| 62 |  | const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e) | 
| 63 | 0 | { | 
| 64 | 0 |     return e->dsa_meth; | 
| 65 | 0 | } | 
| 66 |  |  | 
| 67 |  | /* Sets an DSA implementation in an ENGINE structure */ | 
| 68 |  | int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth) | 
| 69 | 0 | { | 
| 70 | 0 |     e->dsa_meth = dsa_meth; | 
| 71 | 0 |     return 1; | 
| 72 | 0 | } |