1/* 2 * {- join("\n * ", @autowarntext) -} 3 * 4 * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. 5 * 6 * Licensed under the Apache License 2.0 (the "License"). You may not use 7 * this file except in compliance with the License. You can obtain a copy 8 * in the file LICENSE in the source distribution or at 9 * https://www.openssl.org/source/license.html 10 */ 11 12{- 13use OpenSSL::stackhash qw(generate_stack_macros generate_lhash_macros); 14-} 15 16#ifndef OPENSSL_CONF_H 17# define OPENSSL_CONF_H 18# pragma once 19 20# include <openssl/macros.h> 21# ifndef OPENSSL_NO_DEPRECATED_3_0 22# define HEADER_CONF_H 23# endif 24 25# include <openssl/bio.h> 26# include <openssl/lhash.h> 27# include <openssl/safestack.h> 28# include <openssl/e_os2.h> 29# include <openssl/types.h> 30# include <openssl/conferr.h> 31 32#ifdef __cplusplus 33extern "C" { 34#endif 35 36typedef struct { 37 char *section; 38 char *name; 39 char *value; 40} CONF_VALUE; 41 42{- 43 generate_stack_macros("CONF_VALUE") 44 .generate_lhash_macros("CONF_VALUE"); 45-} 46 47struct conf_st; 48struct conf_method_st; 49typedef struct conf_method_st CONF_METHOD; 50 51# ifndef OPENSSL_NO_DEPRECATED_3_0 52# include <openssl/conftypes.h> 53# endif 54 55/* Module definitions */ 56typedef struct conf_imodule_st CONF_IMODULE; 57typedef struct conf_module_st CONF_MODULE; 58 59STACK_OF(CONF_MODULE); 60STACK_OF(CONF_IMODULE); 61 62/* DSO module function typedefs */ 63typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); 64typedef void conf_finish_func (CONF_IMODULE *md); 65 66# define CONF_MFLAGS_IGNORE_ERRORS 0x1 67# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 68# define CONF_MFLAGS_SILENT 0x4 69# define CONF_MFLAGS_NO_DSO 0x8 70# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 71# define CONF_MFLAGS_DEFAULT_SECTION 0x20 72 73int CONF_set_default_method(CONF_METHOD *meth); 74void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); 75LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, 76 long *eline); 77# ifndef OPENSSL_NO_STDIO 78LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, 79 long *eline); 80# endif 81LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, 82 long *eline); 83STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, 84 const char *section); 85char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, 86 const char *name); 87long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, 88 const char *name); 89void CONF_free(LHASH_OF(CONF_VALUE) *conf); 90#ifndef OPENSSL_NO_STDIO 91int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); 92#endif 93int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); 94#ifndef OPENSSL_NO_DEPRECATED_1_1_0 95OSSL_DEPRECATEDIN_1_1_0 void OPENSSL_config(const char *config_name); 96#endif 97 98#ifndef OPENSSL_NO_DEPRECATED_1_1_0 99# define OPENSSL_no_config() \ 100 OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) 101#endif 102 103/* 104 * New conf code. The semantics are different from the functions above. If 105 * that wasn't the case, the above functions would have been replaced 106 */ 107 108CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth); 109OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf); 110CONF *NCONF_new(CONF_METHOD *meth); 111CONF_METHOD *NCONF_default(void); 112#ifndef OPENSSL_NO_DEPRECATED_3_0 113OSSL_DEPRECATEDIN_3_0 CONF_METHOD *NCONF_WIN32(void); 114#endif 115void NCONF_free(CONF *conf); 116void NCONF_free_data(CONF *conf); 117 118int NCONF_load(CONF *conf, const char *file, long *eline); 119# ifndef OPENSSL_NO_STDIO 120int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); 121# endif 122int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); 123STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf); 124STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, 125 const char *section); 126char *NCONF_get_string(const CONF *conf, const char *group, const char *name); 127int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, 128 long *result); 129#ifndef OPENSSL_NO_STDIO 130int NCONF_dump_fp(const CONF *conf, FILE *out); 131#endif 132int NCONF_dump_bio(const CONF *conf, BIO *out); 133 134#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) 135 136/* Module functions */ 137 138int CONF_modules_load(const CONF *cnf, const char *appname, 139 unsigned long flags); 140int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename, 141 const char *appname, unsigned long flags); 142int CONF_modules_load_file(const char *filename, const char *appname, 143 unsigned long flags); 144void CONF_modules_unload(int all); 145void CONF_modules_finish(void); 146#ifndef OPENSSL_NO_DEPRECATED_1_1_0 147# define CONF_modules_free() while(0) continue 148#endif 149int CONF_module_add(const char *name, conf_init_func *ifunc, 150 conf_finish_func *ffunc); 151 152const char *CONF_imodule_get_name(const CONF_IMODULE *md); 153const char *CONF_imodule_get_value(const CONF_IMODULE *md); 154void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); 155void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); 156CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); 157unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); 158void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); 159void *CONF_module_get_usr_data(CONF_MODULE *pmod); 160void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); 161 162char *CONF_get1_default_config_file(void); 163 164int CONF_parse_list(const char *list, int sep, int nospc, 165 int (*list_cb) (const char *elem, int len, void *usr), 166 void *arg); 167 168void OPENSSL_load_builtin_modules(void); 169 170 171# ifdef __cplusplus 172} 173# endif 174#endif 175