conf.h.in 5.7 KB

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