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