CMakeLists.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. # All rights reserved.
  3. #
  4. # This software is supplied "AS IS" without any warranties.
  5. # RDA assumes no responsibility or liability for the use of the software,
  6. # conveys no license or title under any patent, copyright, or mask work
  7. # right to the product. RDA reserves the right to make changes in the
  8. # software without notification. RDA also make no representation or
  9. # warranty that such application will be suitable for the specified use
  10. # without further testing or modification.
  11. configure_file(include/mbedtls_config.h.in ${out_inc_dir}/mbedtls_config.h)
  12. if(CONFIG_MBEDTLS_SUPPORT_SM2)
  13. file(GLOB headers 3rdparty/sm2/include/*.h)
  14. install_headers(${headers} OUTPUT ${out_inc_dir}/mbedtls)
  15. endif()
  16. set(target mbedtls)
  17. add_app_libraries($<TARGET_FILE:${target}>)
  18. add_library(${target} STATIC)
  19. set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${out_lib_dir})
  20. #target_compile_definitions(${target} PRIVATE AT_MQTTSN_SUPPORT=1)
  21. target_include_directories(${target} PUBLIC include)
  22. target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
  23. target_include_targets(${target} PRIVATE kernel driver calclib net lwip cfw)
  24. set(MBEDLIBDIR library)
  25. set(src_crypto
  26. ${MBEDLIBDIR}/mbed_aes.c
  27. ${MBEDLIBDIR}/mbed_aesni.c
  28. ${MBEDLIBDIR}/arc4.c
  29. ${MBEDLIBDIR}/aria.c
  30. ${MBEDLIBDIR}/asn1parse.c
  31. ${MBEDLIBDIR}/asn1write.c
  32. ${MBEDLIBDIR}/base64.c
  33. ${MBEDLIBDIR}/bignum.c
  34. ${MBEDLIBDIR}/blowfish.c
  35. ${MBEDLIBDIR}/camellia.c
  36. ${MBEDLIBDIR}/ccm.c
  37. ${MBEDLIBDIR}/cipher.c
  38. ${MBEDLIBDIR}/chacha20.c
  39. ${MBEDLIBDIR}/chachapoly.c
  40. ${MBEDLIBDIR}/poly1305.c
  41. ${MBEDLIBDIR}/cipher.c
  42. ${MBEDLIBDIR}/cipher_wrap.c
  43. ${MBEDLIBDIR}/constant_time.c
  44. ${MBEDLIBDIR}/cmac.c
  45. ${MBEDLIBDIR}/ctr_drbg.c
  46. ${MBEDLIBDIR}/des.c
  47. ${MBEDLIBDIR}/dhm.c
  48. ${MBEDLIBDIR}/ecdh.c
  49. ${MBEDLIBDIR}/ecdsa.c
  50. ${MBEDLIBDIR}/ecjpake.c
  51. ${MBEDLIBDIR}/ecp.c
  52. ${MBEDLIBDIR}/ecp_curves.c
  53. ${MBEDLIBDIR}/entropy.c
  54. ${MBEDLIBDIR}/entropy_poll.c
  55. ${MBEDLIBDIR}/error.c
  56. ${MBEDLIBDIR}/gcm.c
  57. ${MBEDLIBDIR}/havege.c
  58. ${MBEDLIBDIR}/hkdf.c
  59. ${MBEDLIBDIR}/hmac_drbg.c
  60. ${MBEDLIBDIR}/md.c
  61. ${MBEDLIBDIR}/md2.c
  62. ${MBEDLIBDIR}/md4.c
  63. ${MBEDLIBDIR}/md5.c
  64. ${MBEDLIBDIR}/memory_buffer_alloc.c
  65. ${MBEDLIBDIR}/mps_reader.c
  66. ${MBEDLIBDIR}/mps_trace.c
  67. ${MBEDLIBDIR}/nist_kw.c
  68. ${MBEDLIBDIR}/oid.c
  69. ${MBEDLIBDIR}/padlock.c
  70. ${MBEDLIBDIR}/pem.c
  71. ${MBEDLIBDIR}/pk.c
  72. ${MBEDLIBDIR}/pk_wrap.c
  73. ${MBEDLIBDIR}/pkcs12.c
  74. ${MBEDLIBDIR}/pkcs5.c
  75. ${MBEDLIBDIR}/pkparse.c
  76. ${MBEDLIBDIR}/pkwrite.c
  77. ${MBEDLIBDIR}/platform.c
  78. ${MBEDLIBDIR}/platform_util.c
  79. ${MBEDLIBDIR}/poly1305.c
  80. ${MBEDLIBDIR}/psa_crypto.c
  81. ${MBEDLIBDIR}/psa_crypto_aead.c
  82. ${MBEDLIBDIR}/psa_crypto_cipher.c
  83. ${MBEDLIBDIR}/psa_crypto_client.c
  84. ${MBEDLIBDIR}/psa_crypto_driver_wrappers.c
  85. ${MBEDLIBDIR}/psa_crypto_ecp.c
  86. ${MBEDLIBDIR}/psa_crypto_hash.c
  87. ${MBEDLIBDIR}/psa_crypto_mac.c
  88. ${MBEDLIBDIR}/psa_crypto_rsa.c
  89. ${MBEDLIBDIR}/psa_crypto_se.c
  90. ${MBEDLIBDIR}/psa_crypto_slot_management.c
  91. ${MBEDLIBDIR}/psa_crypto_storage.c
  92. ${MBEDLIBDIR}/psa_its_file.c
  93. ${MBEDLIBDIR}/ripemd160.c
  94. ${MBEDLIBDIR}/rsa.c
  95. ${MBEDLIBDIR}/rsa_internal.c
  96. ${MBEDLIBDIR}/sha1.c
  97. ${MBEDLIBDIR}/mbed_sha256.c
  98. ${MBEDLIBDIR}/sha512.c
  99. ${MBEDLIBDIR}/threading.c
  100. ${MBEDLIBDIR}/timing.c
  101. ${MBEDLIBDIR}/version.c
  102. ${MBEDLIBDIR}/version_features.c
  103. ${MBEDLIBDIR}/xtea.c
  104. )
  105. if(CONFIG_MBEDTLS_SUPPORT_SM2)
  106. set(src_crypto ${src_crypto}
  107. 3rdparty/sm2/src/ecdsa_sm2.c
  108. )
  109. endif()
  110. set(src_x509
  111. ${MBEDLIBDIR}/certs.c
  112. ${MBEDLIBDIR}/pkcs11.c
  113. ${MBEDLIBDIR}/x509.c
  114. ${MBEDLIBDIR}/x509_create.c
  115. ${MBEDLIBDIR}/x509_crl.c
  116. ${MBEDLIBDIR}/x509_crt.c
  117. ${MBEDLIBDIR}/x509_csr.c
  118. ${MBEDLIBDIR}/x509write_crt.c
  119. ${MBEDLIBDIR}/x509write_csr.c
  120. )
  121. set(src_tls
  122. ${MBEDLIBDIR}/mbed_debug.c
  123. ${MBEDLIBDIR}/net_sockets.c
  124. ${MBEDLIBDIR}/ssl_cache.c
  125. ${MBEDLIBDIR}/ssl_ciphersuites.c
  126. ${MBEDLIBDIR}/ssl_cli.c
  127. ${MBEDLIBDIR}/ssl_cookie.c
  128. ${MBEDLIBDIR}/ssl_msg.c
  129. ${MBEDLIBDIR}/ssl_srv.c
  130. ${MBEDLIBDIR}/ssl_ticket.c
  131. ${MBEDLIBDIR}/ssl_tls.c
  132. ${MBEDLIBDIR}/ssl_tls13_keys.c
  133. )
  134. target_sources(${target} PRIVATE
  135. ${src_crypto}
  136. ${src_x509}
  137. ${src_tls}
  138. )