Debian Codegraph @

debian/rust-vendor/aws-lc-sys/aws-lc/include/openssl/conf.h

raw
1 // Copyright (C) 1995-1998 Eric Young ([email protected]) All rights reserved.
2 // SPDX-License-Identifier: Apache-2.0
3
4 #ifndef OPENSSL_HEADER_CONF_H
5 #define OPENSSL_HEADER_CONF_H
6
7 #include <openssl/base.h>
8
9 #include <openssl/lhash.h>
10 #include <openssl/stack.h>
11
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15
16
17 // Config files.
18 //
19 // This library handles OpenSSL's config files, which look like:
20 //
21 // # Comment
22 //
23 // # This key is in the default section.
24 // key=value
25 //
26 // [section_name]
27 // key2=value2
28 //
29 // Config files are represented by a |CONF|. Use of this module is strongly
30 // discouraged. It is a remnant of the OpenSSL command-line tool. Parsing an
31 // untrusted input as a config file risks string injection and denial of service
32 // vulnerabilities.
33
34
35 struct conf_value_st {
36 char *section;
37 char *name;
38 char *value;
39 };
40
41 DEFINE_STACK_OF(CONF_VALUE)
42 DECLARE_LHASH_OF(CONF_VALUE)
43
44 struct conf_st {
45 LHASH_OF(CONF_VALUE) *data;
46 };
47
48 // NCONF_new returns a fresh, empty |CONF|, or NULL on error. The |method|
49 // argument must be NULL.
50 OPENSSL_EXPORT CONF *NCONF_new(void *method);
51
52 // NCONF_free frees all the data owned by |conf| and then |conf| itself.
53 OPENSSL_EXPORT void NCONF_free(CONF *conf);
54
55 // NCONF_load parses the file named |filename| and adds the values found to
56 // |conf|. It returns one on success and zero on error. In the event of an
57 // error, if |out_error_line| is not NULL, |*out_error_line| is set to the
58 // number of the line that contained the error.
59 OPENSSL_EXPORT int NCONF_load(CONF *conf, const char *filename,
60 long *out_error_line);
61
62 // NCONF_load_bio acts like |NCONF_load| but reads from |bio| rather than from
63 // a named file.
64 OPENSSL_EXPORT int NCONF_load_bio(CONF *conf, BIO *bio, long *out_error_line);
65
66 // NCONF_get_section returns a stack of values for a given section in |conf|.
67 // If |section| is NULL, the default section is returned. It returns NULL on
68 // error.
69 OPENSSL_EXPORT const STACK_OF(CONF_VALUE) *NCONF_get_section(
70 const CONF *conf, const char *section);
71
72 // NCONF_get_string returns the value of the key |name|, in section |section|.
73 // The |section| argument may be NULL to indicate the default section. It
74 // returns the value or NULL on error.
75 OPENSSL_EXPORT const char *NCONF_get_string(const CONF *conf,
76 const char *section,
77 const char *name);
78
79
80 // General No-op Functions [Deprecated].
81 //
82 // AWS-LC has no support for loading config files to configure AWS-LC, so
83 // the following functions have been deprecated as no-ops.
84
85 // These defines do nothing but are provided to make old code easier to
86 // compile.
87 #define CONF_MFLAGS_DEFAULT_SECTION 0
88 #define CONF_MFLAGS_IGNORE_MISSING_FILE 0
89
90 // CONF_modules_load_file returns one. AWS-LC is defined to have no config
91 // file options, thus loading from |filename| always succeeds by doing nothing.
92 OPENSSL_EXPORT OPENSSL_DEPRECATED int CONF_modules_load_file(
93 const char *filename, const char *appname, unsigned long flags);
94
95 // CONF_get1_default_config_file returns a fixed dummy string. AWS-LC is defined
96 // to have no config file options.
97 OPENSSL_EXPORT OPENSSL_DEPRECATED char *CONF_get1_default_config_file(void);
98
99 // CONF_modules_free does nothing.
100 OPENSSL_EXPORT OPENSSL_DEPRECATED void CONF_modules_free(void);
101
102 // CONF_modules_unload does nothing.
103 OPENSSL_EXPORT OPENSSL_DEPRECATED void CONF_modules_unload(int all);
104
105 // CONF_modules_finish does nothing.
106 OPENSSL_EXPORT OPENSSL_DEPRECATED void CONF_modules_finish(void);
107
108 // OPENSSL_config does nothing. This has been deprecated since OpenSSL 1.1.0.
109 //
110 // TODO (CryptoAlg-2398): Add |OPENSSL_DEPRECATED|. nginx defines -Werror and
111 // depends on this.
112 OPENSSL_EXPORT void OPENSSL_config(const char *config_name);
113
114 // OPENSSL_no_config does nothing. This has been deprecated since OpenSSL
115 // 1.1.0.
116 OPENSSL_EXPORT OPENSSL_DEPRECATED void OPENSSL_no_config(void);
117
118
119 #if defined(__cplusplus)
120 } // extern C
121
122 extern "C++" {
123
124 BSSL_NAMESPACE_BEGIN
125
126 BORINGSSL_MAKE_DELETER(CONF, NCONF_free)
127
128 BSSL_NAMESPACE_END
129
130 } // extern C++
131
132 #endif
133
134 #define CONF_R_LIST_CANNOT_BE_NULL 100
135 #define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 101
136 #define CONF_R_MISSING_EQUAL_SIGN 102
137 #define CONF_R_NO_CLOSE_BRACE 103
138 #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 104
139 #define CONF_R_VARIABLE_HAS_NO_VALUE 105
140 #define CONF_R_VARIABLE_EXPANSION_TOO_LONG 106
141 #define CONF_R_VARIABLE_EXPANSION_NOT_SUPPORTED 107
142 #define CONF_R_NO_CLOSE_QUOTE 108
143
144 #endif // OPENSSL_HEADER_THREAD_H