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.

CMakeLists.txt 4.4 KiB

Build 32-bit assembly with SSE2 enabled. This affects bignum and sha. Also now that we're passing the SSE2 flag, revert the change to ghash-x86.pl which unconditionally sets $sse2, just to minimize upstream divergence. Chromium assumes SSE2 support, so relying on it is okay. See https://crbug.com/349320. Note: this change needs to be mirrored in Chromium to take. bssl speed numbers: SSE2: Did 552 RSA 2048 signing operations in 3007814us (183.5 ops/sec) Did 19003 RSA 2048 verify operations in 3070779us (6188.3 ops/sec) Did 72 RSA 4096 signing operations in 3055885us (23.6 ops/sec) Did 4650 RSA 4096 verify operations in 3024926us (1537.2 ops/sec) Without SSE2: Did 350 RSA 2048 signing operations in 3042021us (115.1 ops/sec) Did 11760 RSA 2048 verify operations in 3003197us (3915.8 ops/sec) Did 46 RSA 4096 signing operations in 3042692us (15.1 ops/sec) Did 3400 RSA 4096 verify operations in 3083035us (1102.8 ops/sec) SSE2: Did 16407000 SHA-1 (16 bytes) operations in 3000141us (5468743.0 ops/sec): 87.5 MB/s Did 4367000 SHA-1 (256 bytes) operations in 3000436us (1455455.1 ops/sec): 372.6 MB/s Did 185000 SHA-1 (8192 bytes) operations in 3002666us (61611.9 ops/sec): 504.7 MB/s Did 9444000 SHA-256 (16 bytes) operations in 3000052us (3147945.4 ops/sec): 50.4 MB/s Did 2283000 SHA-256 (256 bytes) operations in 3000457us (760884.1 ops/sec): 194.8 MB/s Did 89000 SHA-256 (8192 bytes) operations in 3016024us (29509.0 ops/sec): 241.7 MB/s Did 5550000 SHA-512 (16 bytes) operations in 3000350us (1849784.2 ops/sec): 29.6 MB/s Did 1820000 SHA-512 (256 bytes) operations in 3001039us (606456.6 ops/sec): 155.3 MB/s Did 93000 SHA-512 (8192 bytes) operations in 3007874us (30918.8 ops/sec): 253.3 MB/s Without SSE2: Did 10573000 SHA-1 (16 bytes) operations in 3000261us (3524026.7 ops/sec): 56.4 MB/s Did 2937000 SHA-1 (256 bytes) operations in 3000621us (978797.4 ops/sec): 250.6 MB/s Did 123000 SHA-1 (8192 bytes) operations in 3033202us (40551.2 ops/sec): 332.2 MB/s Did 5846000 SHA-256 (16 bytes) operations in 3000294us (1948475.7 ops/sec): 31.2 MB/s Did 1377000 SHA-256 (256 bytes) operations in 3000335us (458948.8 ops/sec): 117.5 MB/s Did 54000 SHA-256 (8192 bytes) operations in 3027962us (17833.8 ops/sec): 146.1 MB/s Did 2075000 SHA-512 (16 bytes) operations in 3000967us (691443.8 ops/sec): 11.1 MB/s Did 638000 SHA-512 (256 bytes) operations in 3000576us (212625.8 ops/sec): 54.4 MB/s Did 30000 SHA-512 (8192 bytes) operations in 3042797us (9859.3 ops/sec): 80.8 MB/s BUG=430237 Change-Id: I47d1c1ffcd71afe4f4a192272f8cb92af9505ee1 Reviewed-on: https://boringssl-review.googlesource.com/4130 Reviewed-by: Adam Langley <agl@google.com>
9 years ago
Build 32-bit assembly with SSE2 enabled. This affects bignum and sha. Also now that we're passing the SSE2 flag, revert the change to ghash-x86.pl which unconditionally sets $sse2, just to minimize upstream divergence. Chromium assumes SSE2 support, so relying on it is okay. See https://crbug.com/349320. Note: this change needs to be mirrored in Chromium to take. bssl speed numbers: SSE2: Did 552 RSA 2048 signing operations in 3007814us (183.5 ops/sec) Did 19003 RSA 2048 verify operations in 3070779us (6188.3 ops/sec) Did 72 RSA 4096 signing operations in 3055885us (23.6 ops/sec) Did 4650 RSA 4096 verify operations in 3024926us (1537.2 ops/sec) Without SSE2: Did 350 RSA 2048 signing operations in 3042021us (115.1 ops/sec) Did 11760 RSA 2048 verify operations in 3003197us (3915.8 ops/sec) Did 46 RSA 4096 signing operations in 3042692us (15.1 ops/sec) Did 3400 RSA 4096 verify operations in 3083035us (1102.8 ops/sec) SSE2: Did 16407000 SHA-1 (16 bytes) operations in 3000141us (5468743.0 ops/sec): 87.5 MB/s Did 4367000 SHA-1 (256 bytes) operations in 3000436us (1455455.1 ops/sec): 372.6 MB/s Did 185000 SHA-1 (8192 bytes) operations in 3002666us (61611.9 ops/sec): 504.7 MB/s Did 9444000 SHA-256 (16 bytes) operations in 3000052us (3147945.4 ops/sec): 50.4 MB/s Did 2283000 SHA-256 (256 bytes) operations in 3000457us (760884.1 ops/sec): 194.8 MB/s Did 89000 SHA-256 (8192 bytes) operations in 3016024us (29509.0 ops/sec): 241.7 MB/s Did 5550000 SHA-512 (16 bytes) operations in 3000350us (1849784.2 ops/sec): 29.6 MB/s Did 1820000 SHA-512 (256 bytes) operations in 3001039us (606456.6 ops/sec): 155.3 MB/s Did 93000 SHA-512 (8192 bytes) operations in 3007874us (30918.8 ops/sec): 253.3 MB/s Without SSE2: Did 10573000 SHA-1 (16 bytes) operations in 3000261us (3524026.7 ops/sec): 56.4 MB/s Did 2937000 SHA-1 (256 bytes) operations in 3000621us (978797.4 ops/sec): 250.6 MB/s Did 123000 SHA-1 (8192 bytes) operations in 3033202us (40551.2 ops/sec): 332.2 MB/s Did 5846000 SHA-256 (16 bytes) operations in 3000294us (1948475.7 ops/sec): 31.2 MB/s Did 1377000 SHA-256 (256 bytes) operations in 3000335us (458948.8 ops/sec): 117.5 MB/s Did 54000 SHA-256 (8192 bytes) operations in 3027962us (17833.8 ops/sec): 146.1 MB/s Did 2075000 SHA-512 (16 bytes) operations in 3000967us (691443.8 ops/sec): 11.1 MB/s Did 638000 SHA-512 (256 bytes) operations in 3000576us (212625.8 ops/sec): 54.4 MB/s Did 30000 SHA-512 (8192 bytes) operations in 3042797us (9859.3 ops/sec): 80.8 MB/s BUG=430237 Change-Id: I47d1c1ffcd71afe4f4a192272f8cb92af9505ee1 Reviewed-on: https://boringssl-review.googlesource.com/4130 Reviewed-by: Adam Langley <agl@google.com>
9 years ago
Build 32-bit assembly with SSE2 enabled. This affects bignum and sha. Also now that we're passing the SSE2 flag, revert the change to ghash-x86.pl which unconditionally sets $sse2, just to minimize upstream divergence. Chromium assumes SSE2 support, so relying on it is okay. See https://crbug.com/349320. Note: this change needs to be mirrored in Chromium to take. bssl speed numbers: SSE2: Did 552 RSA 2048 signing operations in 3007814us (183.5 ops/sec) Did 19003 RSA 2048 verify operations in 3070779us (6188.3 ops/sec) Did 72 RSA 4096 signing operations in 3055885us (23.6 ops/sec) Did 4650 RSA 4096 verify operations in 3024926us (1537.2 ops/sec) Without SSE2: Did 350 RSA 2048 signing operations in 3042021us (115.1 ops/sec) Did 11760 RSA 2048 verify operations in 3003197us (3915.8 ops/sec) Did 46 RSA 4096 signing operations in 3042692us (15.1 ops/sec) Did 3400 RSA 4096 verify operations in 3083035us (1102.8 ops/sec) SSE2: Did 16407000 SHA-1 (16 bytes) operations in 3000141us (5468743.0 ops/sec): 87.5 MB/s Did 4367000 SHA-1 (256 bytes) operations in 3000436us (1455455.1 ops/sec): 372.6 MB/s Did 185000 SHA-1 (8192 bytes) operations in 3002666us (61611.9 ops/sec): 504.7 MB/s Did 9444000 SHA-256 (16 bytes) operations in 3000052us (3147945.4 ops/sec): 50.4 MB/s Did 2283000 SHA-256 (256 bytes) operations in 3000457us (760884.1 ops/sec): 194.8 MB/s Did 89000 SHA-256 (8192 bytes) operations in 3016024us (29509.0 ops/sec): 241.7 MB/s Did 5550000 SHA-512 (16 bytes) operations in 3000350us (1849784.2 ops/sec): 29.6 MB/s Did 1820000 SHA-512 (256 bytes) operations in 3001039us (606456.6 ops/sec): 155.3 MB/s Did 93000 SHA-512 (8192 bytes) operations in 3007874us (30918.8 ops/sec): 253.3 MB/s Without SSE2: Did 10573000 SHA-1 (16 bytes) operations in 3000261us (3524026.7 ops/sec): 56.4 MB/s Did 2937000 SHA-1 (256 bytes) operations in 3000621us (978797.4 ops/sec): 250.6 MB/s Did 123000 SHA-1 (8192 bytes) operations in 3033202us (40551.2 ops/sec): 332.2 MB/s Did 5846000 SHA-256 (16 bytes) operations in 3000294us (1948475.7 ops/sec): 31.2 MB/s Did 1377000 SHA-256 (256 bytes) operations in 3000335us (458948.8 ops/sec): 117.5 MB/s Did 54000 SHA-256 (8192 bytes) operations in 3027962us (17833.8 ops/sec): 146.1 MB/s Did 2075000 SHA-512 (16 bytes) operations in 3000967us (691443.8 ops/sec): 11.1 MB/s Did 638000 SHA-512 (256 bytes) operations in 3000576us (212625.8 ops/sec): 54.4 MB/s Did 30000 SHA-512 (8192 bytes) operations in 3042797us (9859.3 ops/sec): 80.8 MB/s BUG=430237 Change-Id: I47d1c1ffcd71afe4f4a192272f8cb92af9505ee1 Reviewed-on: https://boringssl-review.googlesource.com/4130 Reviewed-by: Adam Langley <agl@google.com>
9 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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)