Adam Langley | 73415b6 | 2015-08-24 18:03:17 -0700 | [diff] [blame] | 1 | include_directories(../include) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 2 | |
Adam Langley | 30eda1d | 2014-06-24 11:15:12 -0700 | [diff] [blame] | 3 | if(APPLE) |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 4 | if (${ARCH} STREQUAL "x86") |
David Benjamin | 4616bb1 | 2015-03-26 18:33:00 -0400 | [diff] [blame] | 5 | set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2") |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 6 | endif() |
| 7 | set(PERLASM_STYLE macosx) |
| 8 | set(ASM_EXT S) |
| 9 | enable_language(ASM) |
Adam Langley | ded9358 | 2014-07-31 15:23:51 -0700 | [diff] [blame] | 10 | elseif(UNIX) |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 11 | if (${ARCH} STREQUAL "aarch64") |
| 12 | # The "armx" Perl scripts look for "64" in the style argument |
| 13 | # in order to decide whether to generate 32- or 64-bit asm. |
| 14 | set(PERLASM_STYLE linux64) |
David Benjamin | 5928c41 | 2015-04-20 17:32:28 -0400 | [diff] [blame] | 15 | elseif (${ARCH} STREQUAL "arm") |
| 16 | set(PERLASM_STYLE linux32) |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 17 | elseif (${ARCH} STREQUAL "x86") |
David Benjamin | 4616bb1 | 2015-03-26 18:33:00 -0400 | [diff] [blame] | 18 | set(PERLASM_FLAGS "-fPIC -DOPENSSL_IA32_SSE2") |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 19 | set(PERLASM_STYLE elf) |
| 20 | else() |
| 21 | set(PERLASM_STYLE elf) |
| 22 | endif() |
| 23 | set(ASM_EXT S) |
| 24 | enable_language(ASM) |
David Benjamin | 3dbecdf | 2016-02-23 17:44:12 -0500 | [diff] [blame] | 25 | set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack") |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 26 | else() |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 27 | if (CMAKE_CL_64) |
| 28 | message("Using nasm") |
| 29 | set(PERLASM_STYLE nasm) |
| 30 | else() |
| 31 | message("Using win32n") |
| 32 | set(PERLASM_STYLE win32n) |
David Benjamin | 4616bb1 | 2015-03-26 18:33:00 -0400 | [diff] [blame] | 33 | set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2") |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 34 | endif() |
David Benjamin | bc786a9 | 2014-10-31 17:27:40 -0400 | [diff] [blame] | 35 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 36 | # On Windows, we use the NASM output, specifically built with Yasm. |
| 37 | set(ASM_EXT asm) |
| 38 | enable_language(ASM_NASM) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 39 | endif() |
| 40 | |
| 41 | function(perlasm dest src) |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 42 | add_custom_command( |
| 43 | OUTPUT ${dest} |
David Benjamin | 3ce3c36 | 2015-02-23 13:06:19 -0500 | [diff] [blame] | 44 | COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${PERLASM_STYLE} ${PERLASM_FLAGS} ${ARGN} > ${dest} |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 45 | DEPENDS |
| 46 | ${src} |
David Benjamin | f06802f | 2015-04-20 13:25:46 -0400 | [diff] [blame] | 47 | ${PROJECT_SOURCE_DIR}/crypto/perlasm/arm-xlate.pl |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 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 | ) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 55 | endfunction() |
| 56 | |
| 57 | if (${ARCH} STREQUAL "x86_64") |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 58 | set( |
| 59 | CRYPTO_ARCH_SOURCES |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 60 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 61 | cpu-intel.c |
| 62 | ) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 63 | endif() |
| 64 | |
| 65 | if (${ARCH} STREQUAL "x86") |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 66 | set( |
| 67 | CRYPTO_ARCH_SOURCES |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 68 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 69 | cpu-intel.c |
| 70 | ) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 71 | endif() |
| 72 | |
| 73 | if (${ARCH} STREQUAL "arm") |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 74 | set( |
| 75 | CRYPTO_ARCH_SOURCES |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 76 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 77 | cpu-arm.c |
Adam Langley | d062c8a | 2015-01-30 15:30:44 -0800 | [diff] [blame] | 78 | cpu-arm-asm.S |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 79 | ) |
Adam Langley | 3e65265 | 2015-01-09 15:44:37 -0800 | [diff] [blame] | 80 | endif() |
| 81 | |
| 82 | if (${ARCH} STREQUAL "aarch64") |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 83 | set( |
| 84 | CRYPTO_ARCH_SOURCES |
Adam Langley | 3e65265 | 2015-01-09 15:44:37 -0800 | [diff] [blame] | 85 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 86 | cpu-arm.c |
| 87 | ) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 88 | endif() |
| 89 | |
| 90 | # Level 0.1 - depends on nothing outside this set. |
| 91 | add_subdirectory(stack) |
| 92 | add_subdirectory(lhash) |
| 93 | add_subdirectory(err) |
| 94 | add_subdirectory(buf) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 95 | add_subdirectory(base64) |
| 96 | add_subdirectory(bytestring) |
| 97 | |
| 98 | # Level 0.2 - depends on nothing but itself |
| 99 | add_subdirectory(sha) |
Adam Langley | c9eb7ea | 2014-08-22 11:06:14 -0700 | [diff] [blame] | 100 | add_subdirectory(md4) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 101 | add_subdirectory(md5) |
| 102 | add_subdirectory(modes) |
| 103 | add_subdirectory(aes) |
| 104 | add_subdirectory(des) |
| 105 | add_subdirectory(rc4) |
| 106 | add_subdirectory(conf) |
Adam Langley | de0b202 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 107 | add_subdirectory(chacha) |
| 108 | add_subdirectory(poly1305) |
Adam Langley | 4fb0dc4 | 2015-11-13 13:09:47 -0800 | [diff] [blame] | 109 | add_subdirectory(curve25519) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 110 | |
| 111 | # Level 1, depends only on 0.* |
| 112 | add_subdirectory(digest) |
| 113 | add_subdirectory(cipher) |
| 114 | add_subdirectory(rand) |
| 115 | add_subdirectory(bio) |
| 116 | add_subdirectory(bn) |
| 117 | add_subdirectory(obj) |
| 118 | add_subdirectory(asn1) |
| 119 | |
| 120 | # Level 2 |
| 121 | add_subdirectory(engine) |
| 122 | add_subdirectory(dh) |
| 123 | add_subdirectory(dsa) |
| 124 | add_subdirectory(rsa) |
| 125 | add_subdirectory(ec) |
| 126 | add_subdirectory(ecdh) |
| 127 | add_subdirectory(ecdsa) |
| 128 | add_subdirectory(hmac) |
| 129 | |
| 130 | # Level 3 |
Adam Langley | 0d107e1 | 2015-05-05 16:36:32 -0700 | [diff] [blame] | 131 | add_subdirectory(cmac) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 132 | add_subdirectory(evp) |
Nick Harper | 4685e87 | 2014-12-09 15:51:28 -0800 | [diff] [blame] | 133 | add_subdirectory(hkdf) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 134 | add_subdirectory(pem) |
| 135 | add_subdirectory(x509) |
| 136 | add_subdirectory(x509v3) |
| 137 | |
| 138 | # Level 4 |
| 139 | add_subdirectory(pkcs8) |
| 140 | |
David Benjamin | 06b94de | 2015-05-09 22:46:47 -0400 | [diff] [blame] | 141 | # Test support code |
| 142 | add_subdirectory(test) |
| 143 | |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 144 | add_library( |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 145 | crypto |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 146 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 147 | crypto.c |
Adam Langley | 6f2e733 | 2015-05-15 12:01:29 -0700 | [diff] [blame] | 148 | directory_posix.c |
| 149 | directory_win.c |
| 150 | ex_data.c |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 151 | mem.c |
Adam Langley | 6f2e733 | 2015-05-15 12:01:29 -0700 | [diff] [blame] | 152 | refcount_c11.c |
| 153 | refcount_lock.c |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 154 | thread.c |
Adam Langley | 65a7e94 | 2015-05-07 18:28:27 -0700 | [diff] [blame] | 155 | thread_none.c |
Adam Langley | d7c5dfb | 2015-03-16 12:48:56 -0700 | [diff] [blame] | 156 | thread_pthread.c |
| 157 | thread_win.c |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 158 | time_support.c |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 159 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 160 | ${CRYPTO_ARCH_SOURCES} |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 161 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 162 | $<TARGET_OBJECTS:stack> |
| 163 | $<TARGET_OBJECTS:lhash> |
| 164 | $<TARGET_OBJECTS:err> |
| 165 | $<TARGET_OBJECTS:base64> |
| 166 | $<TARGET_OBJECTS:bytestring> |
| 167 | $<TARGET_OBJECTS:sha> |
| 168 | $<TARGET_OBJECTS:md4> |
| 169 | $<TARGET_OBJECTS:md5> |
| 170 | $<TARGET_OBJECTS:digest> |
| 171 | $<TARGET_OBJECTS:cipher> |
| 172 | $<TARGET_OBJECTS:modes> |
| 173 | $<TARGET_OBJECTS:aes> |
| 174 | $<TARGET_OBJECTS:des> |
| 175 | $<TARGET_OBJECTS:rc4> |
| 176 | $<TARGET_OBJECTS:conf> |
| 177 | $<TARGET_OBJECTS:chacha> |
| 178 | $<TARGET_OBJECTS:poly1305> |
Adam Langley | 4fb0dc4 | 2015-11-13 13:09:47 -0800 | [diff] [blame] | 179 | $<TARGET_OBJECTS:curve25519> |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 180 | $<TARGET_OBJECTS:buf> |
| 181 | $<TARGET_OBJECTS:bn> |
| 182 | $<TARGET_OBJECTS:bio> |
| 183 | $<TARGET_OBJECTS:rand> |
| 184 | $<TARGET_OBJECTS:obj> |
| 185 | $<TARGET_OBJECTS:asn1> |
| 186 | $<TARGET_OBJECTS:engine> |
| 187 | $<TARGET_OBJECTS:dh> |
| 188 | $<TARGET_OBJECTS:dsa> |
| 189 | $<TARGET_OBJECTS:rsa> |
| 190 | $<TARGET_OBJECTS:ec> |
| 191 | $<TARGET_OBJECTS:ecdh> |
| 192 | $<TARGET_OBJECTS:ecdsa> |
| 193 | $<TARGET_OBJECTS:hmac> |
Adam Langley | 0d107e1 | 2015-05-05 16:36:32 -0700 | [diff] [blame] | 194 | $<TARGET_OBJECTS:cmac> |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 195 | $<TARGET_OBJECTS:evp> |
| 196 | $<TARGET_OBJECTS:hkdf> |
| 197 | $<TARGET_OBJECTS:pem> |
| 198 | $<TARGET_OBJECTS:x509> |
| 199 | $<TARGET_OBJECTS:x509v3> |
| 200 | $<TARGET_OBJECTS:pkcs8> |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 201 | ) |
| 202 | |
Adam Langley | 843ab66 | 2015-04-28 17:46:58 -0700 | [diff] [blame] | 203 | if(NOT MSVC AND NOT ANDROID) |
David Benjamin | 72f5911 | 2015-04-02 16:47:15 -0400 | [diff] [blame] | 204 | target_link_libraries(crypto pthread) |
| 205 | endif() |
| 206 | |
Adam Langley | b15d813 | 2014-11-03 18:51:20 -0800 | [diff] [blame] | 207 | add_executable( |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 208 | constant_time_test |
Adam Langley | b15d813 | 2014-11-03 18:51:20 -0800 | [diff] [blame] | 209 | |
Adam Langley | 4a0f0c4 | 2015-01-28 16:37:10 -0800 | [diff] [blame] | 210 | constant_time_test.c |
David Benjamin | 0b635c5 | 2015-05-15 19:08:49 -0400 | [diff] [blame] | 211 | |
| 212 | $<TARGET_OBJECTS:test_support> |
Adam Langley | b15d813 | 2014-11-03 18:51:20 -0800 | [diff] [blame] | 213 | ) |
| 214 | |
| 215 | target_link_libraries(constant_time_test crypto) |
David Benjamin | 301afaf | 2015-10-14 21:34:40 -0400 | [diff] [blame] | 216 | add_dependencies(all_tests constant_time_test) |
Adam Langley | b15d813 | 2014-11-03 18:51:20 -0800 | [diff] [blame] | 217 | |
Adam Langley | d7c5dfb | 2015-03-16 12:48:56 -0700 | [diff] [blame] | 218 | add_executable( |
| 219 | thread_test |
| 220 | |
| 221 | thread_test.c |
David Benjamin | 0b635c5 | 2015-05-15 19:08:49 -0400 | [diff] [blame] | 222 | |
| 223 | $<TARGET_OBJECTS:test_support> |
Adam Langley | d7c5dfb | 2015-03-16 12:48:56 -0700 | [diff] [blame] | 224 | ) |
| 225 | |
David Benjamin | 72f5911 | 2015-04-02 16:47:15 -0400 | [diff] [blame] | 226 | target_link_libraries(thread_test crypto) |
David Benjamin | 301afaf | 2015-10-14 21:34:40 -0400 | [diff] [blame] | 227 | add_dependencies(all_tests thread_test) |
Adam Langley | d7c5dfb | 2015-03-16 12:48:56 -0700 | [diff] [blame] | 228 | |
Adam Langley | 6f2e733 | 2015-05-15 12:01:29 -0700 | [diff] [blame] | 229 | add_executable( |
| 230 | refcount_test |
| 231 | |
| 232 | refcount_test.c |
| 233 | ) |
| 234 | |
| 235 | target_link_libraries(refcount_test crypto) |
David Benjamin | 301afaf | 2015-10-14 21:34:40 -0400 | [diff] [blame] | 236 | add_dependencies(all_tests refcount_test) |