opensslconf.h.in 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * {- join("\n * ", @autowarntext) -}
  3. *
  4. * Copyright 2016-2018 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. #include <openssl/opensslv.h>
  12. #ifndef HEADER_OPENSSLCONF_H
  13. # define HEADER_OPENSSLCONF_H
  14. # ifdef __cplusplus
  15. extern "C" {
  16. # endif
  17. # ifdef OPENSSL_ALGORITHM_DEFINES
  18. # error OPENSSL_ALGORITHM_DEFINES no longer supported
  19. # endif
  20. /*
  21. * OpenSSL was configured with the following options:
  22. */
  23. {- if (@{$config{openssl_sys_defines}}) {
  24. foreach (@{$config{openssl_sys_defines}}) {
  25. $OUT .= "# ifndef $_\n";
  26. $OUT .= "# define $_ 1\n";
  27. $OUT .= "# endif\n";
  28. }
  29. }
  30. foreach (@{$config{openssl_api_defines}}) {
  31. (my $macro, my $value) = $_ =~ /^(.*?)=(.*?)$/;
  32. $OUT .= "# define $macro $value\n";
  33. }
  34. if (@{$config{openssl_feature_defines}}) {
  35. foreach (@{$config{openssl_feature_defines}}) {
  36. $OUT .= "# ifndef $_\n";
  37. $OUT .= "# define $_\n";
  38. $OUT .= "# endif\n";
  39. }
  40. }
  41. "";
  42. -}
  43. /*
  44. * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers
  45. * don't like that. This will hopefully silence them.
  46. */
  47. # define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
  48. /*
  49. * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the
  50. * declarations of functions deprecated in or before <version>. If this is
  51. * undefined, the value of the macro OPENSSL_API_MIN above is the default.
  52. *
  53. * For any version number up until version 1.1.x, <version> is expected to be
  54. * the calculated version number 0xMNNFFPPSL. For version numbers 3.0.0 and
  55. * on, <version> is expected to be only the major version number (i.e. 3 for
  56. * version 3.0.0).
  57. */
  58. # ifndef DECLARE_DEPRECATED
  59. # define DECLARE_DEPRECATED(f) f;
  60. # ifdef __GNUC__
  61. # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
  62. # undef DECLARE_DEPRECATED
  63. # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
  64. # endif
  65. # endif
  66. # endif
  67. /*
  68. * We convert the OPENSSL_API_COMPAT value to an API level. The API level
  69. * is the major version number for 3.0.0 and on. For earlier versions, it
  70. * uses this scheme, which is close enough for our purposes:
  71. *
  72. * 0.x.y 0 (0.9.8 was the last release in this series)
  73. * 1.0.x 1 (1.0.2 was the last release in this series)
  74. * 1.1.x 2 (1.1.1 was the last release in this series)
  75. */
  76. /* In case someone defined both */
  77. # if defined(OPENSSL_API_COMPAT) && defined(OPENSSL_API_LEVEL)
  78. # error "Disallowed to defined both OPENSSL_API_COMPAT and OPENSSL_API_LEVEL"
  79. # endif
  80. # ifndef OPENSSL_API_COMPAT
  81. # define OPENSSL_API_LEVEL OPENSSL_MIN_API
  82. # else
  83. # if (OPENSSL_API_COMPAT < 0x1000L) /* Major version numbers up to 16777215 */
  84. # define OPENSSL_API_LEVEL OPENSSL_API_COMPAT
  85. # elif (OPENSSL_API_COMPAT & 0xF0000000L) == 0x00000000L
  86. # define OPENSSL_API_LEVEL 0
  87. # elif (OPENSSL_API_COMPAT & 0xFFF00000L) == 0x10000000L
  88. # define OPENSSL_API_LEVEL 1
  89. # elif (OPENSSL_API_COMPAT & 0xFFF00000L) == 0x10100000L
  90. # define OPENSSL_API_LEVEL 2
  91. # else
  92. / * Major number 3 to 15 */
  93. # define OPENSSL_API_LEVEL ((OPENSSL_API_COMPAT >> 28) & 0xF)
  94. # endif
  95. # endif
  96. /*
  97. * Do not deprecate things to be deprecated in version 4.0 before the
  98. * OpenSSL version number matches.
  99. */
  100. # if OPENSSL_VERSION_MAJOR < 4
  101. # define DEPRECATEDIN_4(f) f;
  102. # define OPENSSL_API_4 0
  103. # elif OPENSSL_API_LEVEL < 4
  104. # define DEPRECATEDIN_4(f) DECLARE_DEPRECATED(f)
  105. # define OPENSSL_API_4 0
  106. # else
  107. # define DEPRECATEDIN_4(f)
  108. # define OPENSSL_API_4 1
  109. # endif
  110. # if OPENSSL_API_LEVEL < 3
  111. # define DEPRECATEDIN_3(f) DECLARE_DEPRECATED(f)
  112. # define OPENSSL_API_3 0
  113. # else
  114. # define DEPRECATEDIN_3(f)
  115. # define OPENSSL_API_3 1
  116. # endif
  117. # if OPENSSL_API_LEVEL < 2
  118. # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
  119. # define OPENSSL_API_1_1_0 0
  120. # else
  121. # define DEPRECATEDIN_1_1_0(f)
  122. # define OPENSSL_API_1_1_0 1
  123. # endif
  124. # if OPENSSL_API_LEVEL < 1
  125. # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f)
  126. # define OPENSSL_API_1_0_0 0
  127. # else
  128. # define DEPRECATEDIN_1_0_0(f)
  129. # define OPENSSL_API_1_0_0 1
  130. # endif
  131. # if OPENSSL_API_LEVEL < 0
  132. # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f)
  133. # define OPENSSL_API_0_9_8 0
  134. # else
  135. # define DEPRECATEDIN_0_9_8(f)
  136. # define OPENSSL_API_0_9_8 1
  137. # endif
  138. # ifndef OPENSSL_FILE
  139. # ifdef OPENSSL_NO_FILENAMES
  140. # define OPENSSL_FILE ""
  141. # define OPENSSL_LINE 0
  142. # else
  143. # define OPENSSL_FILE __FILE__
  144. # define OPENSSL_LINE __LINE__
  145. # endif
  146. # endif
  147. /* Generate 80386 code? */
  148. {- $config{processor} eq "386" ? "# define" : "# undef" -} I386_ONLY
  149. # undef OPENSSL_UNISTD
  150. # define OPENSSL_UNISTD {- $target{unistd} -}
  151. {- $config{export_var_as_fn} ? "# define" : "# undef" -} OPENSSL_EXPORT_VAR_AS_FUNCTION
  152. /*
  153. * The following are cipher-specific, but are part of the public API.
  154. */
  155. # if !defined(OPENSSL_SYS_UEFI)
  156. {- $config{bn_ll} ? "# define" : "# undef" -} BN_LLONG
  157. /* Only one for the following should be defined */
  158. {- $config{b64l} ? "# define" : "# undef" -} SIXTY_FOUR_BIT_LONG
  159. {- $config{b64} ? "# define" : "# undef" -} SIXTY_FOUR_BIT
  160. {- $config{b32} ? "# define" : "# undef" -} THIRTY_TWO_BIT
  161. # endif
  162. # define RC4_INT {- $config{rc4_int} -}
  163. # ifdef __cplusplus
  164. }
  165. # endif
  166. #endif /* HEADER_OPENSSLCONF_H */