You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

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