Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

216 wiersze
4.4 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-x86_64-asm.${ASM_EXT}
  56. cpu-intel.c
  57. )
  58. endif()
  59. if (${ARCH} STREQUAL "x86")
  60. set(
  61. CRYPTO_ARCH_SOURCES
  62. cpu-x86-asm.${ASM_EXT}
  63. cpu-intel.c
  64. )
  65. endif()
  66. if (${ARCH} STREQUAL "arm")
  67. set(
  68. CRYPTO_ARCH_SOURCES
  69. cpu-arm.c
  70. cpu-arm-asm.S
  71. )
  72. endif()
  73. if (${ARCH} STREQUAL "aarch64")
  74. set(
  75. CRYPTO_ARCH_SOURCES
  76. cpu-arm.c
  77. )
  78. endif()
  79. # Level 0.1 - depends on nothing outside this set.
  80. add_subdirectory(stack)
  81. add_subdirectory(lhash)
  82. add_subdirectory(err)
  83. add_subdirectory(buf)
  84. add_subdirectory(base64)
  85. add_subdirectory(bytestring)
  86. # Level 0.2 - depends on nothing but itself
  87. add_subdirectory(sha)
  88. add_subdirectory(md4)
  89. add_subdirectory(md5)
  90. add_subdirectory(modes)
  91. add_subdirectory(aes)
  92. add_subdirectory(des)
  93. add_subdirectory(rc4)
  94. add_subdirectory(conf)
  95. add_subdirectory(chacha)
  96. add_subdirectory(poly1305)
  97. # Level 1, depends only on 0.*
  98. add_subdirectory(digest)
  99. add_subdirectory(cipher)
  100. add_subdirectory(rand)
  101. add_subdirectory(bio)
  102. add_subdirectory(bn)
  103. add_subdirectory(obj)
  104. add_subdirectory(asn1)
  105. # Level 2
  106. add_subdirectory(engine)
  107. add_subdirectory(dh)
  108. add_subdirectory(dsa)
  109. add_subdirectory(rsa)
  110. add_subdirectory(ec)
  111. add_subdirectory(ecdh)
  112. add_subdirectory(ecdsa)
  113. add_subdirectory(hmac)
  114. # Level 3
  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. add_library(
  123. crypto
  124. crypto.c
  125. mem.c
  126. thread.c
  127. thread_pthread.c
  128. thread_win.c
  129. ex_data.c
  130. time_support.c
  131. directory_posix.c
  132. directory_win.c
  133. ${CRYPTO_ARCH_SOURCES}
  134. $<TARGET_OBJECTS:stack>
  135. $<TARGET_OBJECTS:lhash>
  136. $<TARGET_OBJECTS:err>
  137. $<TARGET_OBJECTS:base64>
  138. $<TARGET_OBJECTS:bytestring>
  139. $<TARGET_OBJECTS:sha>
  140. $<TARGET_OBJECTS:md4>
  141. $<TARGET_OBJECTS:md5>
  142. $<TARGET_OBJECTS:digest>
  143. $<TARGET_OBJECTS:cipher>
  144. $<TARGET_OBJECTS:modes>
  145. $<TARGET_OBJECTS:aes>
  146. $<TARGET_OBJECTS:des>
  147. $<TARGET_OBJECTS:rc4>
  148. $<TARGET_OBJECTS:conf>
  149. $<TARGET_OBJECTS:chacha>
  150. $<TARGET_OBJECTS:poly1305>
  151. $<TARGET_OBJECTS:buf>
  152. $<TARGET_OBJECTS:bn>
  153. $<TARGET_OBJECTS:bio>
  154. $<TARGET_OBJECTS:rand>
  155. $<TARGET_OBJECTS:obj>
  156. $<TARGET_OBJECTS:asn1>
  157. $<TARGET_OBJECTS:engine>
  158. $<TARGET_OBJECTS:dh>
  159. $<TARGET_OBJECTS:dsa>
  160. $<TARGET_OBJECTS:rsa>
  161. $<TARGET_OBJECTS:ec>
  162. $<TARGET_OBJECTS:ecdh>
  163. $<TARGET_OBJECTS:ecdsa>
  164. $<TARGET_OBJECTS:hmac>
  165. $<TARGET_OBJECTS:evp>
  166. $<TARGET_OBJECTS:hkdf>
  167. $<TARGET_OBJECTS:pem>
  168. $<TARGET_OBJECTS:x509>
  169. $<TARGET_OBJECTS:x509v3>
  170. $<TARGET_OBJECTS:pkcs8>
  171. )
  172. if(NOT MSVC)
  173. target_link_libraries(crypto pthread)
  174. endif()
  175. add_executable(
  176. constant_time_test
  177. constant_time_test.c
  178. )
  179. target_link_libraries(constant_time_test crypto)
  180. add_executable(
  181. thread_test
  182. thread_test.c
  183. )
  184. target_link_libraries(thread_test crypto)
  185. perlasm(cpu-x86_64-asm.${ASM_EXT} cpu-x86_64-asm.pl)
  186. perlasm(cpu-x86-asm.${ASM_EXT} cpu-x86-asm.pl)