]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/conf.h
Deprecate the low level Diffie-Hellman functions.
[thirdparty/openssl.git] / include / openssl / conf.h
CommitLineData
21dcbebc 1/*
6738bf14 2 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 3 *
48f4ad77 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
21dcbebc
RS
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
d02b48c6
RE
8 */
9
ae4186b0
DMSP
10#ifndef OPENSSL_CONF_H
11# define OPENSSL_CONF_H
d86167ec
DMSP
12# pragma once
13
14# include <openssl/macros.h>
936c2b9e 15# ifndef OPENSSL_NO_DEPRECATED_3_0
d86167ec
DMSP
16# define HEADER_CONF_H
17# endif
d02b48c6 18
0f113f3e
MC
19# include <openssl/bio.h>
20# include <openssl/lhash.h>
af3e5e1b 21# include <openssl/safestack.h>
0f113f3e 22# include <openssl/e_os2.h>
50cd4768 23# include <openssl/types.h>
52df25cf 24# include <openssl/conferr.h>
9ea1b878 25
82271cee
RL
26#ifdef __cplusplus
27extern "C" {
28#endif
29
0f113f3e
MC
30typedef struct {
31 char *section;
32 char *name;
33 char *value;
34} CONF_VALUE;
d02b48c6 35
85885715 36DEFINE_STACK_OF(CONF_VALUE)
89d6aa10 37DEFINE_LHASH_OF(CONF_VALUE);
d02b48c6 38
d86b6915 39struct conf_st;
d86b6915
RL
40struct conf_method_st;
41typedef struct conf_method_st CONF_METHOD;
42
0f113f3e
MC
43struct conf_method_st {
44 const char *name;
45 CONF *(*create) (CONF_METHOD *meth);
46 int (*init) (CONF *conf);
47 int (*destroy) (CONF *conf);
48 int (*destroy_data) (CONF *conf);
49 int (*load_bio) (CONF *conf, BIO *bp, long *eline);
50 int (*dump) (const CONF *conf, BIO *bp);
51 int (*is_number) (const CONF *conf, char c);
52 int (*to_int) (const CONF *conf, char c);
53 int (*load) (CONF *conf, const char *name, long *eline);
54};
d86b6915 55
bc37d996
DSH
56/* Module definitions */
57
58typedef struct conf_imodule_st CONF_IMODULE;
59typedef struct conf_module_st CONF_MODULE;
60
85885715
DSH
61DEFINE_STACK_OF(CONF_MODULE)
62DEFINE_STACK_OF(CONF_IMODULE)
de121164 63
bc37d996 64/* DSO module function typedefs */
0f113f3e
MC
65typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
66typedef void conf_finish_func (CONF_IMODULE *md);
bc37d996 67
0f113f3e
MC
68# define CONF_MFLAGS_IGNORE_ERRORS 0x1
69# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
70# define CONF_MFLAGS_SILENT 0x4
71# define CONF_MFLAGS_NO_DSO 0x8
72# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
73# define CONF_MFLAGS_DEFAULT_SECTION 0x20
bc37d996 74
d86b6915 75int CONF_set_default_method(CONF_METHOD *meth);
0f113f3e
MC
76void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
77LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
78 long *eline);
79# ifndef OPENSSL_NO_STDIO
3c1d6bbc 80LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
0f113f3e
MC
81 long *eline);
82# endif
83LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
84 long *eline);
3c1d6bbc 85STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
0f113f3e
MC
86 const char *section);
87char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
88 const char *name);
89long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
90 const char *name);
3c1d6bbc 91void CONF_free(LHASH_OF(CONF_VALUE) *conf);
984d6c60 92#ifndef OPENSSL_NO_STDIO
3c1d6bbc 93int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
984d6c60 94#endif
3c1d6bbc 95int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
d02b48c6 96
c35f5c3d 97DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
7253fd55 98
00db8c60 99#ifndef OPENSSL_NO_DEPRECATED_1_1_0
f672aee4
RS
100# define OPENSSL_no_config() \
101 OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
102#endif
cca28b29 103
0f113f3e
MC
104/*
105 * New conf code. The semantics are different from the functions above. If
106 * that wasn't the case, the above functions would have been replaced
107 */
d86b6915 108
0f113f3e
MC
109struct conf_st {
110 CONF_METHOD *meth;
111 void *meth_data;
112 LHASH_OF(CONF_VALUE) *data;
0255c174 113 unsigned int flag_dollarid:1;
0f113f3e 114};
d86b6915
RL
115
116CONF *NCONF_new(CONF_METHOD *meth);
40889b9c 117CONF_METHOD *NCONF_default(void);
936c2b9e 118DEPRECATEDIN_3_0(CONF_METHOD *NCONF_WIN32(void))
d86b6915
RL
119void NCONF_free(CONF *conf);
120void NCONF_free_data(CONF *conf);
121
0f113f3e
MC
122int NCONF_load(CONF *conf, const char *file, long *eline);
123# ifndef OPENSSL_NO_STDIO
124int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
125# endif
126int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
127STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
128 const char *section);
129char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
130int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
131 long *result);
984d6c60 132#ifndef OPENSSL_NO_STDIO
9dd5ae65 133int NCONF_dump_fp(const CONF *conf, FILE *out);
984d6c60 134#endif
9dd5ae65 135int NCONF_dump_bio(const CONF *conf, BIO *out);
d86b6915 136
1a5adcfb 137#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
0f113f3e 138
bc37d996
DSH
139/* Module functions */
140
9dd5ae65 141int CONF_modules_load(const CONF *cnf, const char *appname,
0f113f3e 142 unsigned long flags);
9dd5ae65 143int CONF_modules_load_file(const char *filename, const char *appname,
0f113f3e 144 unsigned long flags);
bc37d996
DSH
145void CONF_modules_unload(int all);
146void CONF_modules_finish(void);
00db8c60 147#ifndef OPENSSL_NO_DEPRECATED_1_1_0
6457615a 148# define CONF_modules_free() while(0) continue
cbf6959f 149#endif
cca28b29 150int CONF_module_add(const char *name, conf_init_func *ifunc,
0f113f3e 151 conf_finish_func *ffunc);
bc37d996 152
9dd5ae65
BL
153const char *CONF_imodule_get_name(const CONF_IMODULE *md);
154const char *CONF_imodule_get_value(const CONF_IMODULE *md);
155void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
bc37d996 156void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
9dd5ae65
BL
157CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
158unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
bc37d996
DSH
159void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
160void *CONF_module_get_usr_data(CONF_MODULE *pmod);
161void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
ba404b5e 162
c9501c22
DSH
163char *CONF_get1_default_config_file(void);
164
f78d4a35 165int CONF_parse_list(const char *list, int sep, int nospc,
0f113f3e
MC
166 int (*list_cb) (const char *elem, int len, void *usr),
167 void *arg);
df5eaa8a 168
3647bee2
DSH
169void OPENSSL_load_builtin_modules(void);
170
957b6db3 171
0cd0a820 172# ifdef __cplusplus
d02b48c6 173}
0cd0a820 174# endif
d02b48c6 175#endif