query_config.fmt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Query Mbed TLS compile time configurations from config.h
  3. *
  4. * Copyright (C) 2018, Arm Limited, All Rights Reserved
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  8. * not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * This file is part of Mbed TLS (https://tls.mbed.org)
  20. */
  21. #if !defined(MBEDTLS_CONFIG_FILE)
  22. #include "mbedtls/config.h"
  23. #else
  24. #include MBEDTLS_CONFIG_FILE
  25. #endif
  26. #if defined(MBEDTLS_PLATFORM_C)
  27. #include "mbedtls/platform.h"
  28. #else
  29. #include <stdio.h>
  30. #define mbedtls_printf printf
  31. #endif /* MBEDTLS_PLATFORM_C */
  32. /*
  33. * Include all the headers with public APIs in case they define a macro to its
  34. * default value when that configuration is not set in the config.h.
  35. */
  36. #include "mbedtls/aes.h"
  37. #include "mbedtls/aesni.h"
  38. #include "mbedtls/arc4.h"
  39. #include "mbedtls/aria.h"
  40. #include "mbedtls/asn1.h"
  41. #include "mbedtls/asn1write.h"
  42. #include "mbedtls/base64.h"
  43. #include "mbedtls/bignum.h"
  44. #include "mbedtls/blowfish.h"
  45. #include "mbedtls/camellia.h"
  46. #include "mbedtls/ccm.h"
  47. #include "mbedtls/certs.h"
  48. #include "mbedtls/chacha20.h"
  49. #include "mbedtls/chachapoly.h"
  50. #include "mbedtls/cipher.h"
  51. #include "mbedtls/cmac.h"
  52. #include "mbedtls/ctr_drbg.h"
  53. #include "mbedtls/debug.h"
  54. #include "mbedtls/des.h"
  55. #include "mbedtls/dhm.h"
  56. #include "mbedtls/ecdh.h"
  57. #include "mbedtls/ecdsa.h"
  58. #include "mbedtls/ecjpake.h"
  59. #include "mbedtls/ecp.h"
  60. #include "mbedtls/entropy.h"
  61. #include "mbedtls/entropy_poll.h"
  62. #include "mbedtls/error.h"
  63. #include "mbedtls/gcm.h"
  64. #include "mbedtls/havege.h"
  65. #include "mbedtls/hkdf.h"
  66. #include "mbedtls/hmac_drbg.h"
  67. #include "mbedtls/md.h"
  68. #include "mbedtls/md2.h"
  69. #include "mbedtls/md4.h"
  70. #include "mbedtls/md5.h"
  71. #include "mbedtls/memory_buffer_alloc.h"
  72. #include "mbedtls/net_sockets.h"
  73. #include "mbedtls/nist_kw.h"
  74. #include "mbedtls/oid.h"
  75. #include "mbedtls/padlock.h"
  76. #include "mbedtls/pem.h"
  77. #include "mbedtls/pk.h"
  78. #include "mbedtls/pkcs11.h"
  79. #include "mbedtls/pkcs12.h"
  80. #include "mbedtls/pkcs5.h"
  81. #include "mbedtls/platform_time.h"
  82. #include "mbedtls/platform_util.h"
  83. #include "mbedtls/poly1305.h"
  84. #include "mbedtls/ripemd160.h"
  85. #include "mbedtls/rsa.h"
  86. #include "mbedtls/sha1.h"
  87. #include "mbedtls/sha256.h"
  88. #include "mbedtls/sha512.h"
  89. #include "mbedtls/ssl.h"
  90. #include "mbedtls/ssl_cache.h"
  91. #include "mbedtls/ssl_ciphersuites.h"
  92. #include "mbedtls/ssl_cookie.h"
  93. #include "mbedtls/ssl_internal.h"
  94. #include "mbedtls/ssl_ticket.h"
  95. #include "mbedtls/threading.h"
  96. #include "mbedtls/timing.h"
  97. #include "mbedtls/version.h"
  98. #include "mbedtls/x509.h"
  99. #include "mbedtls/x509_crl.h"
  100. #include "mbedtls/x509_crt.h"
  101. #include "mbedtls/x509_csr.h"
  102. #include "mbedtls/xtea.h"
  103. #include <string.h>
  104. /*
  105. * Helper macros to convert a macro or its expansion into a string
  106. * WARNING: This does not work for expanding function-like macros. However,
  107. * Mbed TLS does not currently have configuration options used in this fashion.
  108. */
  109. #define MACRO_EXPANSION_TO_STR(macro) MACRO_NAME_TO_STR(macro)
  110. #define MACRO_NAME_TO_STR(macro) \
  111. mbedtls_printf( "%s", strlen( #macro "" ) > 0 ? #macro "\n" : "" )
  112. #if defined(_MSC_VER)
  113. /*
  114. * Visual Studio throws the warning 4003 because many Mbed TLS feature macros
  115. * are defined empty. This means that from the preprocessor's point of view
  116. * the macro MBEDTLS_EXPANSION_TO_STR is being invoked without arguments as
  117. * some macros expand to nothing. We suppress that specific warning to get a
  118. * clean build and to ensure that tests treating warnings as errors do not
  119. * fail.
  120. */
  121. #pragma warning(push)
  122. #pragma warning(disable:4003)
  123. #endif /* _MSC_VER */
  124. int query_config( const char *config )
  125. {
  126. CHECK_CONFIG /* If the symbol is not found, return an error */
  127. return( 1 );
  128. }
  129. #if defined(_MSC_VER)
  130. #pragma warning(pop)
  131. #endif /* _MSC_VER */