25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

236 lines
4.8 KiB

  1. include_directories(../include)
  2. if(APPLE)
  3. if (${ARCH} STREQUAL "x86")
  4. set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2")
  5. endif()
  6. set(PERLASM_STYLE macosx)
  7. set(ASM_EXT S)
  8. enable_language(ASM)
  9. elseif(UNIX)
  10. if (${ARCH} STREQUAL "aarch64")
  11. # The "armx" Perl scripts look for "64" in the style argument
  12. # in order to decide whether to generate 32- or 64-bit asm.
  13. set(PERLASM_STYLE linux64)
  14. elseif (${ARCH} STREQUAL "arm")
  15. set(PERLASM_STYLE linux32)
  16. elseif (${ARCH} STREQUAL "x86")
  17. set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2")
  18. set(PERLASM_STYLE elf)
  19. else()
  20. set(PERLASM_STYLE elf)
  21. endif()
  22. set(ASM_EXT S)
  23. enable_language(ASM)
  24. else()
  25. if (CMAKE_CL_64)
  26. message("Using nasm")
  27. set(PERLASM_STYLE nasm)
  28. else()
  29. message("Using win32n")
  30. set(PERLASM_STYLE win32n)
  31. set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2")
  32. endif()
  33. # On Windows, we use the NASM output, specifically built with Yasm.
  34. set(ASM_EXT asm)
  35. enable_language(ASM_NASM)
  36. endif()
  37. function(perlasm dest src)
  38. add_custom_command(
  39. OUTPUT ${dest}
  40. COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${PERLASM_STYLE} ${PERLASM_FLAGS} ${ARGN} > ${dest}
  41. DEPENDS
  42. ${src}
  43. ${PROJECT_SOURCE_DIR}/crypto/perlasm/arm-xlate.pl
  44. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86_64-xlate.pl
  45. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86asm.pl
  46. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86gas.pl
  47. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86masm.pl
  48. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86nasm.pl
  49. WORKING_DIRECTORY .
  50. )
  51. endfunction()
  52. if (${ARCH} STREQUAL "x86_64")
  53. set(
  54. CRYPTO_ARCH_SOURCES
  55. cpu-intel.c
  56. )
  57. endif()
  58. if (${ARCH} STREQUAL "x86")
  59. set(
  60. CRYPTO_ARCH_SOURCES
  61. cpu-intel.c
  62. )
  63. endif()
  64. if (${ARCH} STREQUAL "arm")
  65. set(
  66. CRYPTO_ARCH_SOURCES
  67. cpu-arm.c
  68. cpu-arm-asm.S
  69. )
  70. endif()
  71. if (${ARCH} STREQUAL "aarch64")
  72. set(
  73. CRYPTO_ARCH_SOURCES
  74. cpu-arm.c
  75. )
  76. endif()
  77. # Level 0.1 - depends on nothing outside this set.
  78. add_subdirectory(stack)
  79. add_subdirectory(lhash)
  80. add_subdirectory(err)
  81. add_subdirectory(buf)
  82. add_subdirectory(base64)
  83. add_subdirectory(bytestring)
  84. # Level 0.2 - depends on nothing but itself
  85. add_subdirectory(sha)
  86. add_subdirectory(md4)
  87. add_subdirectory(md5)
  88. add_subdirectory(modes)
  89. add_subdirectory(aes)
  90. add_subdirectory(des)
  91. add_subdirectory(rc4)
  92. add_subdirectory(conf)
  93. add_subdirectory(chacha)
  94. add_subdirectory(poly1305)
  95. add_subdirectory(curve25519)
  96. # Level 1, depends only on 0.*
  97. add_subdirectory(digest)
  98. add_subdirectory(cipher)
  99. add_subdirectory(rand)
  100. add_subdirectory(bio)
  101. add_subdirectory(bn)
  102. add_subdirectory(obj)
  103. add_subdirectory(asn1)
  104. # Level 2
  105. add_subdirectory(engine)
  106. add_subdirectory(dh)
  107. add_subdirectory(dsa)
  108. add_subdirectory(rsa)
  109. add_subdirectory(ec)
  110. add_subdirectory(ecdh)
  111. add_subdirectory(ecdsa)
  112. add_subdirectory(hmac)
  113. # Level 3
  114. add_subdirectory(cmac)
  115. add_subdirectory(evp)
  116. add_subdirectory(hkdf)
  117. add_subdirectory(pem)
  118. add_subdirectory(x509)
  119. add_subdirectory(x509v3)
  120. # Level 4
  121. add_subdirectory(pkcs8)
  122. # Test support code
  123. add_subdirectory(test)
  124. add_library(
  125. crypto
  126. crypto.c
  127. directory_posix.c
  128. directory_win.c
  129. ex_data.c
  130. mem.c
  131. refcount_c11.c
  132. refcount_lock.c
  133. thread.c
  134. thread_none.c
  135. thread_pthread.c
  136. thread_win.c
  137. time_support.c
  138. ${CRYPTO_ARCH_SOURCES}
  139. $<TARGET_OBJECTS:stack>
  140. $<TARGET_OBJECTS:lhash>
  141. $<TARGET_OBJECTS:err>
  142. $<TARGET_OBJECTS:base64>
  143. $<TARGET_OBJECTS:bytestring>
  144. $<TARGET_OBJECTS:sha>
  145. $<TARGET_OBJECTS:md4>
  146. $<TARGET_OBJECTS:md5>
  147. $<TARGET_OBJECTS:digest>
  148. $<TARGET_OBJECTS:cipher>
  149. $<TARGET_OBJECTS:modes>
  150. $<TARGET_OBJECTS:aes>
  151. $<TARGET_OBJECTS:des>
  152. $<TARGET_OBJECTS:rc4>
  153. $<TARGET_OBJECTS:conf>
  154. $<TARGET_OBJECTS:chacha>
  155. $<TARGET_OBJECTS:poly1305>
  156. $<TARGET_OBJECTS:curve25519>
  157. $<TARGET_OBJECTS:buf>
  158. $<TARGET_OBJECTS:bn>
  159. $<TARGET_OBJECTS:bio>
  160. $<TARGET_OBJECTS:rand>
  161. $<TARGET_OBJECTS:obj>
  162. $<TARGET_OBJECTS:asn1>
  163. $<TARGET_OBJECTS:engine>
  164. $<TARGET_OBJECTS:dh>
  165. $<TARGET_OBJECTS:dsa>
  166. $<TARGET_OBJECTS:rsa>
  167. $<TARGET_OBJECTS:ec>
  168. $<TARGET_OBJECTS:ecdh>
  169. $<TARGET_OBJECTS:ecdsa>
  170. $<TARGET_OBJECTS:hmac>
  171. $<TARGET_OBJECTS:cmac>
  172. $<TARGET_OBJECTS:evp>
  173. $<TARGET_OBJECTS:hkdf>
  174. $<TARGET_OBJECTS:pem>
  175. $<TARGET_OBJECTS:x509>
  176. $<TARGET_OBJECTS:x509v3>
  177. $<TARGET_OBJECTS:pkcs8>
  178. )
  179. if(NOT MSVC AND NOT ANDROID)
  180. target_link_libraries(crypto pthread)
  181. endif()
  182. add_executable(
  183. constant_time_test
  184. constant_time_test.c
  185. $<TARGET_OBJECTS:test_support>
  186. )
  187. target_link_libraries(constant_time_test crypto)
  188. add_dependencies(all_tests constant_time_test)
  189. add_executable(
  190. thread_test
  191. thread_test.c
  192. $<TARGET_OBJECTS:test_support>
  193. )
  194. target_link_libraries(thread_test crypto)
  195. add_dependencies(all_tests thread_test)
  196. add_executable(
  197. refcount_test
  198. refcount_test.c
  199. )
  200. target_link_libraries(refcount_test crypto)
  201. add_dependencies(all_tests refcount_test)