• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
4
5from __future__ import absolute_import, division, print_function
6
7INCLUDES = """
8#include <openssl/engine.h>
9"""
10
11TYPES = """
12typedef ... ENGINE;
13typedef ... UI_METHOD;
14
15static const long Cryptography_HAS_ENGINE;
16"""
17
18FUNCTIONS = """
19ENGINE *ENGINE_by_id(const char *);
20int ENGINE_init(ENGINE *);
21int ENGINE_finish(ENGINE *);
22ENGINE *ENGINE_get_default_RAND(void);
23int ENGINE_set_default_RAND(ENGINE *);
24void ENGINE_unregister_RAND(ENGINE *);
25int ENGINE_ctrl_cmd(ENGINE *, const char *, long, void *, void (*)(void), int);
26int ENGINE_free(ENGINE *);
27const char *ENGINE_get_name(const ENGINE *);
28
29// These bindings are unused by cryptography or pyOpenSSL but are present
30// for advanced users who need them.
31int ENGINE_ctrl_cmd_string(ENGINE *, const char *, const char *, int);
32void ENGINE_load_builtin_engines(void);
33EVP_PKEY *ENGINE_load_private_key(ENGINE *, const char *, UI_METHOD *, void *);
34EVP_PKEY *ENGINE_load_public_key(ENGINE *, const char *, UI_METHOD *, void *);
35"""
36
37CUSTOMIZATIONS = """
38#ifdef OPENSSL_NO_ENGINE
39static const long Cryptography_HAS_ENGINE = 0;
40
41ENGINE *(*ENGINE_by_id)(const char *) = NULL;
42int (*ENGINE_init)(ENGINE *) = NULL;
43int (*ENGINE_finish)(ENGINE *) = NULL;
44ENGINE *(*ENGINE_get_default_RAND)(void) = NULL;
45int (*ENGINE_set_default_RAND)(ENGINE *) = NULL;
46void (*ENGINE_unregister_RAND)(ENGINE *) = NULL;
47int (*ENGINE_ctrl_cmd)(ENGINE *, const char *, long, void *,
48                       void (*)(void), int) = NULL;
49
50int (*ENGINE_free)(ENGINE *) = NULL;
51const char *(*ENGINE_get_id)(const ENGINE *) = NULL;
52const char *(*ENGINE_get_name)(const ENGINE *) = NULL;
53
54int (*ENGINE_ctrl_cmd_string)(ENGINE *, const char *, const char *,
55                              int) = NULL;
56void (*ENGINE_load_builtin_engines)(void) = NULL;
57EVP_PKEY *(*ENGINE_load_private_key)(ENGINE *, const char *, UI_METHOD *,
58                                     void *) = NULL;
59EVP_PKEY *(*ENGINE_load_public_key)(ENGINE *, const char *,
60                                    UI_METHOD *, void *) = NULL;
61
62#else
63static const long Cryptography_HAS_ENGINE = 1;
64#endif
65"""
66