Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

206 řádky
4.5 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. set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack")
  25. else()
  26. if (CMAKE_CL_64)
  27. message("Using nasm")
  28. set(PERLASM_STYLE nasm)
  29. else()
  30. message("Using win32n")
  31. set(PERLASM_STYLE win32n)
  32. set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2")
  33. endif()
  34. # On Windows, we use the NASM output, specifically built with Yasm.
  35. set(ASM_EXT asm)
  36. enable_language(ASM_NASM)
  37. endif()
  38. function(perlasm dest src)
  39. add_custom_command(
  40. OUTPUT ${dest}
  41. COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${PERLASM_STYLE} ${PERLASM_FLAGS} ${ARGN} ${dest}
  42. DEPENDS
  43. ${src}
  44. ${PROJECT_SOURCE_DIR}/crypto/perlasm/arm-xlate.pl
  45. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86_64-xlate.pl
  46. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86asm.pl
  47. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86gas.pl
  48. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86masm.pl
  49. ${PROJECT_SOURCE_DIR}/crypto/perlasm/x86nasm.pl
  50. WORKING_DIRECTORY .
  51. )
  52. endfunction()
  53. # Level 0.1 - depends on nothing outside this set.
  54. add_subdirectory(stack)
  55. add_subdirectory(lhash)
  56. add_subdirectory(err)
  57. add_subdirectory(buf)
  58. add_subdirectory(base64)
  59. add_subdirectory(bytestring)
  60. # Level 0.2 - depends on nothing but itself
  61. add_subdirectory(sha)
  62. add_subdirectory(md4)
  63. add_subdirectory(md5)
  64. add_subdirectory(modes)
  65. add_subdirectory(aes)
  66. add_subdirectory(des)
  67. add_subdirectory(rc4)
  68. add_subdirectory(conf)
  69. add_subdirectory(chacha)
  70. add_subdirectory(poly1305)
  71. add_subdirectory(curve25519)
  72. add_subdirectory(newhope)
  73. # Level 1, depends only on 0.*
  74. add_subdirectory(digest)
  75. add_subdirectory(cipher)
  76. add_subdirectory(rand)
  77. add_subdirectory(bio)
  78. add_subdirectory(bn)
  79. add_subdirectory(obj)
  80. add_subdirectory(asn1)
  81. # Level 2
  82. add_subdirectory(engine)
  83. add_subdirectory(dh)
  84. add_subdirectory(dsa)
  85. add_subdirectory(rsa)
  86. add_subdirectory(ec)
  87. add_subdirectory(ecdh)
  88. add_subdirectory(ecdsa)
  89. add_subdirectory(hmac)
  90. # Level 3
  91. add_subdirectory(cmac)
  92. add_subdirectory(evp)
  93. add_subdirectory(hkdf)
  94. add_subdirectory(pem)
  95. add_subdirectory(x509)
  96. add_subdirectory(x509v3)
  97. # Level 4
  98. add_subdirectory(pkcs8)
  99. # Test support code
  100. add_subdirectory(test)
  101. add_library(
  102. crypto
  103. cpu-aarch64-linux.c
  104. cpu-arm.c
  105. cpu-arm-linux.c
  106. cpu-intel.c
  107. crypto.c
  108. ex_data.c
  109. mem.c
  110. refcount_c11.c
  111. refcount_lock.c
  112. thread.c
  113. thread_none.c
  114. thread_pthread.c
  115. thread_win.c
  116. time_support.c
  117. $<TARGET_OBJECTS:stack>
  118. $<TARGET_OBJECTS:lhash>
  119. $<TARGET_OBJECTS:err>
  120. $<TARGET_OBJECTS:base64>
  121. $<TARGET_OBJECTS:bytestring>
  122. $<TARGET_OBJECTS:sha>
  123. $<TARGET_OBJECTS:md4>
  124. $<TARGET_OBJECTS:md5>
  125. $<TARGET_OBJECTS:digest>
  126. $<TARGET_OBJECTS:cipher>
  127. $<TARGET_OBJECTS:modes>
  128. $<TARGET_OBJECTS:aes>
  129. $<TARGET_OBJECTS:des>
  130. $<TARGET_OBJECTS:rc4>
  131. $<TARGET_OBJECTS:conf>
  132. $<TARGET_OBJECTS:chacha>
  133. $<TARGET_OBJECTS:poly1305>
  134. $<TARGET_OBJECTS:curve25519>
  135. $<TARGET_OBJECTS:buf>
  136. $<TARGET_OBJECTS:bn>
  137. $<TARGET_OBJECTS:bio>
  138. $<TARGET_OBJECTS:rand>
  139. $<TARGET_OBJECTS:obj>
  140. $<TARGET_OBJECTS:asn1>
  141. $<TARGET_OBJECTS:engine>
  142. $<TARGET_OBJECTS:dh>
  143. $<TARGET_OBJECTS:dsa>
  144. $<TARGET_OBJECTS:rsa>
  145. $<TARGET_OBJECTS:ec>
  146. $<TARGET_OBJECTS:ecdh>
  147. $<TARGET_OBJECTS:ecdsa>
  148. $<TARGET_OBJECTS:hmac>
  149. $<TARGET_OBJECTS:cmac>
  150. $<TARGET_OBJECTS:evp>
  151. $<TARGET_OBJECTS:hkdf>
  152. $<TARGET_OBJECTS:pem>
  153. $<TARGET_OBJECTS:x509>
  154. $<TARGET_OBJECTS:x509v3>
  155. $<TARGET_OBJECTS:pkcs8_lib>
  156. $<TARGET_OBJECTS:newhope>
  157. )
  158. if(NOT MSVC AND NOT ANDROID)
  159. target_link_libraries(crypto pthread)
  160. endif()
  161. add_executable(
  162. constant_time_test
  163. constant_time_test.c
  164. $<TARGET_OBJECTS:test_support>
  165. )
  166. target_link_libraries(constant_time_test crypto)
  167. add_dependencies(all_tests constant_time_test)
  168. add_executable(
  169. thread_test
  170. thread_test.c
  171. $<TARGET_OBJECTS:test_support>
  172. )
  173. target_link_libraries(thread_test crypto)
  174. add_dependencies(all_tests thread_test)
  175. add_executable(
  176. refcount_test
  177. refcount_test.c
  178. )
  179. target_link_libraries(refcount_test crypto)
  180. add_dependencies(all_tests refcount_test)