2 * Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (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
10 /* We need to use some engine deprecated APIs */
11 #define OPENSSL_SUPPRESS_DEPRECATED
13 #include "eng_local.h"
15 static ENGINE_TABLE *rsa_table = NULL;
16 static const int dummy_nid = 1;
18 void ENGINE_unregister_RSA(ENGINE *e)
20 engine_table_unregister(&rsa_table, e);
23 static void engine_unregister_all_RSA(void)
25 engine_table_cleanup(&rsa_table);
28 int ENGINE_register_RSA(ENGINE *e)
31 return engine_table_register(&rsa_table,
32 engine_unregister_all_RSA, e, &dummy_nid,
37 void ENGINE_register_all_RSA(void)
41 for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
42 ENGINE_register_RSA(e);
45 int ENGINE_set_default_RSA(ENGINE *e)
48 return engine_table_register(&rsa_table,
49 engine_unregister_all_RSA, e, &dummy_nid,
55 * Exposed API function to get a functional reference from the implementation
56 * table (ie. try to get a functional reference from the tabled structural
59 ENGINE *ENGINE_get_default_RSA(void)
61 return engine_table_select(&rsa_table, dummy_nid);
64 /* Obtains an RSA implementation from an ENGINE functional reference */
65 const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e)
70 /* Sets an RSA implementation in an ENGINE structure */
71 int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth)
73 e->rsa_meth = rsa_meth;