Reference implementations of PQC
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

578 строки
16 KiB

  1. cmake_minimum_required(VERSION 3.13)
  2. project(cryptocore NONE)
  3. enable_language(C)
  4. enable_language(CXX)
  5. enable_language(ASM)
  6. set(CMAKE_VERBOSE_MAKEFILE ON)
  7. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "~/.cmake/Modules")
  8. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "3rd/cmake-modules")
  9. set(CMAKE_CXX_STANDARD 11)
  10. set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
  11. set(CMAKE_POSITION_INDEPENDENT_CODE ON)
  12. string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
  13. if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
  14. set(ARCH "ARCH_x86_64")
  15. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
  16. set(ARCH "ARCH_x86_64")
  17. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
  18. set(ARCH "ARCH_x86_64")
  19. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
  20. set(ARCH "ARCH_x86")
  21. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
  22. set(ARCH "ARCH_x86")
  23. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
  24. set(ARCH "ARCH_x86")
  25. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
  26. set(ARCH "ARCH_aarch64")
  27. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
  28. set(ARCH "ARCH_aarch64")
  29. else()
  30. message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
  31. endif()
  32. # Arch settings
  33. if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  34. set(MACOSX TRUE)
  35. endif()
  36. if(CMAKE_C_COMPILER_ID MATCHES "Clang")
  37. set(CLANG 1)
  38. endif()
  39. if (MACOSX)
  40. set(CMAKE_C_COMPILER /usr/bin/cc CACHE PATH "" FORCE)
  41. set(CMAKE_CXX_COMPILER /usr/bin/c++ CACHE PATH "" FORCE)
  42. endif()
  43. # Global configuration
  44. set(C_CXX_FLAGS
  45. "-Wno-ignored-qualifiers \
  46. -Wall \
  47. -Werror \
  48. -Wextra \
  49. -Wpedantic \
  50. -Wshadow \
  51. -Wno-variadic-macros \
  52. -Wundef \
  53. -Wunused-result")
  54. if(CLANG)
  55. set(C_CXX_FLAGS
  56. "-Wconditional-uninitialized \
  57. -Wmissing-variable-declarations")
  58. endif()
  59. # Control Debug/Release mode
  60. if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
  61. set(C_CXX_FLAGS "${C_CXX_FLAGS} -g3 -O0 -Wno-unused")
  62. else()
  63. set(C_CXX_FLAGS "${C_CXX_FLAGS} -O3")
  64. endif()
  65. include_directories(
  66. inc
  67. src
  68. )
  69. # Set CPU architecture
  70. set(CMAKE_C_FLAGS "${C_CXX_FLAGS} -D${ARCH}")
  71. set(CMAKE_CXX_FLAGS "${C_CXX_FLAGS} -D${ARCH}")
  72. # Common function for defining algorithm component
  73. function(define_crypto_alg name namespace src inc test_src)
  74. add_library(
  75. pqclean_${name}
  76. OBJECT
  77. ${src}
  78. )
  79. target_include_directories(
  80. pqclean_${name} PRIVATE
  81. src/common
  82. ${inc}
  83. )
  84. target_compile_definitions(
  85. pqclean_${name} PRIVATE
  86. -DPQCLEAN_NAMESPACE=${namespace}
  87. )
  88. add_library(
  89. pqclean_test_${name}
  90. OBJECT
  91. ${test_src}
  92. )
  93. target_compile_definitions(
  94. pqclean_test_${name} PRIVATE
  95. -DPQCLEAN_NAMESPACE=${namespace}
  96. )
  97. target_include_directories(
  98. pqclean_test_${name} PRIVATE
  99. src/common
  100. ${inc}
  101. )
  102. add_executable(
  103. test_runner_${name}
  104. )
  105. target_link_libraries(
  106. test_runner_${name}
  107. common
  108. pqclean_${name}
  109. pqclean_test_${name}
  110. )
  111. endfunction()
  112. function(define_kem_alg name namespace src inc)
  113. define_crypto_alg(${name} ${namespace} "${src}" "${inc}" test/kem/testvectors.c)
  114. endfunction()
  115. function(define_sig_alg name namespace src inc)
  116. define_crypto_alg(${name} ${namespace} "${src}" "${inc}" test/sign/testvectors.c)
  117. endfunction()
  118. # Define sources of the components
  119. set(
  120. SRC_CLEAN_DILITHIUM2
  121. src/sign/dilithium/dilithium2/clean/ntt.c
  122. src/sign/dilithium/dilithium2/clean/packing.c
  123. src/sign/dilithium/dilithium2/clean/poly.c
  124. src/sign/dilithium/dilithium2/clean/polyvec.c
  125. src/sign/dilithium/dilithium2/clean/reduce.c
  126. src/sign/dilithium/dilithium2/clean/rounding.c
  127. src/sign/dilithium/dilithium2/clean/sign.c
  128. src/sign/dilithium/dilithium2/clean/symmetric-shake.c
  129. )
  130. set(
  131. INC_CLEAN_DILITHIUM2
  132. src/sign/dilithium/dilithium2/clean
  133. )
  134. define_sig_alg(dilithium2_clean
  135. PQCLEAN_DILITHIUM2_CLEAN "${SRC_CLEAN_DILITHIUM2}" "${INC_CLEAN_DILITHIUM2}")
  136. set(
  137. SRC_CLEAN_DILITHIUM3
  138. src/sign/dilithium/dilithium3/clean/ntt.c
  139. src/sign/dilithium/dilithium3/clean/packing.c
  140. src/sign/dilithium/dilithium3/clean/poly.c
  141. src/sign/dilithium/dilithium3/clean/polyvec.c
  142. src/sign/dilithium/dilithium3/clean/reduce.c
  143. src/sign/dilithium/dilithium3/clean/rounding.c
  144. src/sign/dilithium/dilithium3/clean/sign.c
  145. src/sign/dilithium/dilithium3/clean/symmetric-shake.c
  146. )
  147. set(
  148. INC_CLEAN_DILITHIUM3
  149. src/sign/dilithium/dilithium3/clean
  150. )
  151. define_sig_alg(dilithium3_clean
  152. PQCLEAN_DILITHIUM3_CLEAN "${SRC_CLEAN_DILITHIUM3}" "${INC_CLEAN_DILITHIUM3}")
  153. set(
  154. SRC_CLEAN_DILITHIUM5
  155. src/sign/dilithium/dilithium5/clean/ntt.c
  156. src/sign/dilithium/dilithium5/clean/packing.c
  157. src/sign/dilithium/dilithium5/clean/poly.c
  158. src/sign/dilithium/dilithium5/clean/polyvec.c
  159. src/sign/dilithium/dilithium5/clean/reduce.c
  160. src/sign/dilithium/dilithium5/clean/rounding.c
  161. src/sign/dilithium/dilithium5/clean/sign.c
  162. src/sign/dilithium/dilithium5/clean/symmetric-shake.c
  163. )
  164. set(
  165. INC_CLEAN_DILITHIUM5
  166. src/sign/dilithium/dilithium5/clean
  167. )
  168. define_sig_alg(dilithium5_clean
  169. PQCLEAN_DILITHIUM5_CLEAN "${SRC_CLEAN_DILITHIUM5}" "${INC_CLEAN_DILITHIUM5}")
  170. set(
  171. SRC_CLEAN_KYBER512
  172. src/kem/kyber/kyber512/clean/cbd.c
  173. src/kem/kyber/kyber512/clean/indcpa.c
  174. src/kem/kyber/kyber512/clean/kem.c
  175. src/kem/kyber/kyber512/clean/ntt.c
  176. src/kem/kyber/kyber512/clean/poly.c
  177. src/kem/kyber/kyber512/clean/polyvec.c
  178. src/kem/kyber/kyber512/clean/reduce.c
  179. src/kem/kyber/kyber512/clean/symmetric-shake.c
  180. src/kem/kyber/kyber512/clean/verify.c
  181. )
  182. set(
  183. INC_CLEAN_KYBER512
  184. src/kem/kyber/kyber512/clean
  185. )
  186. define_kem_alg(kyber512_clean
  187. PQCLEAN_KYBER512_CLEAN "${SRC_CLEAN_KYBER512}" "${INC_CLEAN_KYBER512}")
  188. set(
  189. SRC_CLEAN_KYBER768
  190. src/kem/kyber/kyber768/clean/cbd.c
  191. src/kem/kyber/kyber768/clean/indcpa.c
  192. src/kem/kyber/kyber768/clean/kem.c
  193. src/kem/kyber/kyber768/clean/ntt.c
  194. src/kem/kyber/kyber768/clean/poly.c
  195. src/kem/kyber/kyber768/clean/polyvec.c
  196. src/kem/kyber/kyber768/clean/reduce.c
  197. src/kem/kyber/kyber768/clean/symmetric-shake.c
  198. src/kem/kyber/kyber768/clean/verify.c
  199. )
  200. set(
  201. INC_CLEAN_KYBER768
  202. src/kem/kyber/kyber768/clean
  203. )
  204. define_kem_alg(kyber768_clean
  205. PQCLEAN_KYBER768_CLEAN "${SRC_CLEAN_KYBER768}" "${INC_CLEAN_KYBER768}")
  206. set(
  207. SRC_CLEAN_KYBER1024
  208. src/kem/kyber/kyber1024/clean/cbd.c
  209. src/kem/kyber/kyber1024/clean/indcpa.c
  210. src/kem/kyber/kyber1024/clean/kem.c
  211. src/kem/kyber/kyber1024/clean/ntt.c
  212. src/kem/kyber/kyber1024/clean/poly.c
  213. src/kem/kyber/kyber1024/clean/polyvec.c
  214. src/kem/kyber/kyber1024/clean/reduce.c
  215. src/kem/kyber/kyber1024/clean/symmetric-shake.c
  216. src/kem/kyber/kyber1024/clean/verify.c
  217. )
  218. set(
  219. INC_CLEAN_KYBER1024
  220. src/kem/kyber/kyber1024/clean
  221. )
  222. define_kem_alg(kyber1024_clean
  223. PQCLEAN_KYBER1024_CLEAN "${SRC_CLEAN_KYBER1024}" "${INC_CLEAN_KYBER1024}")
  224. set(
  225. SRC_CLEAN_SABER
  226. src/kem/saber/saber/clean/cbd.c
  227. src/kem/saber/saber/clean/kem.c
  228. src/kem/saber/saber/clean/pack_unpack.c
  229. src/kem/saber/saber/clean/poly.c
  230. src/kem/saber/saber/clean/poly_mul.c
  231. src/kem/saber/saber/clean/SABER_indcpa.c
  232. src/kem/saber/saber/clean/verify.c)
  233. set(
  234. INC_CLEAN_SABER
  235. src/kem/saber/saber/clean)
  236. define_kem_alg(
  237. saber_clean
  238. PQCLEAN_SABER_CLEAN "${SRC_CLEAN_SABER}" "${INC_CLEAN_SABER}")
  239. set(
  240. SRC_CLEAN_FIRESABER
  241. src/kem/saber/firesaber/clean/cbd.c
  242. src/kem/saber/firesaber/clean/kem.c
  243. src/kem/saber/firesaber/clean/pack_unpack.c
  244. src/kem/saber/firesaber/clean/poly.c
  245. src/kem/saber/firesaber/clean/poly_mul.c
  246. src/kem/saber/firesaber/clean/SABER_indcpa.c
  247. src/kem/saber/firesaber/clean/verify.c)
  248. set(
  249. INC_CLEAN_FIRESABER
  250. src/kem/saber/firesaber/clean)
  251. define_kem_alg(
  252. firesaber_clean
  253. PQCLEAN_FIRESABER_CLEAN "${SRC_CLEAN_FIRESABER}" "${INC_CLEAN_FIRESABER}")
  254. set(
  255. SRC_CLEAN_LIGHTSABER
  256. src/kem/saber/lightsaber/clean/cbd.c
  257. src/kem/saber/lightsaber/clean/kem.c
  258. src/kem/saber/lightsaber/clean/pack_unpack.c
  259. src/kem/saber/lightsaber/clean/poly.c
  260. src/kem/saber/lightsaber/clean/poly_mul.c
  261. src/kem/saber/lightsaber/clean/SABER_indcpa.c
  262. src/kem/saber/lightsaber/clean/verify.c)
  263. set(
  264. INC_CLEAN_LIGHTSABER
  265. src/kem/saber/lightsaber/clean)
  266. define_kem_alg(
  267. lightsaber_clean
  268. PQCLEAN_LIGHTSABER_CLEAN "${SRC_CLEAN_LIGHTSABER}" "${INC_CLEAN_LIGHTSABER}")
  269. #function(define_frodo_src path)
  270. #endif()
  271. # -rw-r--r-- 1 kris kris 13783 Mar 1 12:35 kem.c
  272. # -rw-r--r-- 1 kris kris 3343 Mar 1 12:35 matrix_shake.c
  273. # -rw-r--r-- 1 kris kris 1426 Mar 1 12:35 noise.c
  274. # -rw-r--r-- 1 kris kris 9202 Mar 1 12:35 util.c
  275. # AVX2 targets
  276. if(${ARCH} STREQUAL "ARCH_x86_64")
  277. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native")
  278. set(
  279. SRC_AVX2_SABER
  280. src/kem/saber/saber/avx2/cbd.c
  281. src/kem/saber/saber/avx2/kem.c
  282. src/kem/saber/saber/avx2/pack_unpack.c
  283. src/kem/saber/saber/avx2/poly.c
  284. src/kem/saber/saber/avx2/poly_mul.c
  285. src/kem/saber/saber/avx2/SABER_indcpa.c
  286. src/kem/saber/saber/avx2/verify.c)
  287. set(
  288. INC_AVX2_SABER
  289. src/kem/saber/saber/avx2)
  290. define_kem_alg(
  291. saber_avx2
  292. PQCLEAN_SABER_AVX2 "${SRC_AVX2_SABER}" "${INC_AVX2_SABER}")
  293. set(
  294. SRC_AVX2_FIRESABER
  295. src/kem/saber/firesaber/avx2/cbd.c
  296. src/kem/saber/firesaber/avx2/kem.c
  297. src/kem/saber/firesaber/avx2/pack_unpack.c
  298. src/kem/saber/firesaber/avx2/poly.c
  299. src/kem/saber/firesaber/avx2/poly_mul.c
  300. src/kem/saber/firesaber/avx2/SABER_indcpa.c
  301. src/kem/saber/firesaber/avx2/verify.c)
  302. set(
  303. INC_AVX2_FIRESABER
  304. src/kem/saber/firesaber/avx2)
  305. define_kem_alg(
  306. firesaber_avx2
  307. PQCLEAN_FIRESABER_AVX2 "${SRC_AVX2_FIRESABER}" "${INC_AVX2_FIRESABER}")
  308. set(
  309. SRC_AVX2_LIGHTSABER
  310. src/kem/saber/lightsaber/avx2/cbd.c
  311. src/kem/saber/lightsaber/avx2/kem.c
  312. src/kem/saber/lightsaber/avx2/pack_unpack.c
  313. src/kem/saber/lightsaber/avx2/poly.c
  314. src/kem/saber/lightsaber/avx2/poly_mul.c
  315. src/kem/saber/lightsaber/avx2/SABER_indcpa.c
  316. src/kem/saber/lightsaber/avx2/verify.c)
  317. set(
  318. INC_AVX2_LIGHTSABER
  319. src/kem/saber/lightsaber/avx2)
  320. define_kem_alg(
  321. lightsaber_avx2
  322. PQCLEAN_LIGHTSABER_AVX2 "${SRC_AVX2_LIGHTSABER}" "${INC_AVX2_LIGHTSABER}")
  323. set(
  324. SRC_AVX2_DILITHIUM2
  325. src/sign/dilithium/dilithium2/avx2/consts.c
  326. src/sign/dilithium/dilithium2/avx2/f1600x4.S
  327. src/sign/dilithium/dilithium2/avx2/fips202x4.c
  328. src/sign/dilithium/dilithium2/avx2/invntt.S
  329. src/sign/dilithium/dilithium2/avx2/ntt.S
  330. src/sign/dilithium/dilithium2/avx2/packing.c
  331. src/sign/dilithium/dilithium2/avx2/pointwise.S
  332. src/sign/dilithium/dilithium2/avx2/poly.c
  333. src/sign/dilithium/dilithium2/avx2/polyvec.c
  334. src/sign/dilithium/dilithium2/avx2/rejsample.c
  335. src/sign/dilithium/dilithium2/avx2/rounding.c
  336. src/sign/dilithium/dilithium2/avx2/shuffle.S
  337. src/sign/dilithium/dilithium2/avx2/sign.c
  338. src/sign/dilithium/dilithium2/avx2/symmetric-shake.c)
  339. set(
  340. INC_AVX2_DILITHIUM2
  341. src/sign/dilithium/dilithium2/avx2
  342. )
  343. define_sig_alg(dilithium2_avx2
  344. PQCLEAN_DILITHIUM2_AVX2 "${SRC_AVX2_DILITHIUM2}" "${INC_AVX2_DILITHIUM2}")
  345. set(
  346. SRC_AVX2_DILITHIUM3
  347. src/sign/dilithium/dilithium3/avx2/consts.c
  348. src/sign/dilithium/dilithium3/avx2/f1600x4.S
  349. src/sign/dilithium/dilithium3/avx2/fips202x4.c
  350. src/sign/dilithium/dilithium3/avx2/invntt.S
  351. src/sign/dilithium/dilithium3/avx2/ntt.S
  352. src/sign/dilithium/dilithium3/avx2/packing.c
  353. src/sign/dilithium/dilithium3/avx2/pointwise.S
  354. src/sign/dilithium/dilithium3/avx2/poly.c
  355. src/sign/dilithium/dilithium3/avx2/polyvec.c
  356. src/sign/dilithium/dilithium3/avx2/rejsample.c
  357. src/sign/dilithium/dilithium3/avx2/rounding.c
  358. src/sign/dilithium/dilithium3/avx2/shuffle.S
  359. src/sign/dilithium/dilithium3/avx2/sign.c
  360. src/sign/dilithium/dilithium3/avx2/symmetric-shake.c)
  361. set(
  362. INC_AVX2_DILITHIUM3
  363. src/sign/dilithium/dilithium3/avx2
  364. )
  365. define_sig_alg(dilithium3_avx2
  366. PQCLEAN_DILITHIUM3_AVX2 "${SRC_AVX2_DILITHIUM3}" "${INC_AVX2_DILITHIUM3}")
  367. set(
  368. SRC_AVX2_DILITHIUM5
  369. src/sign/dilithium/dilithium5/avx2/consts.c
  370. src/sign/dilithium/dilithium5/avx2/f1600x4.S
  371. src/sign/dilithium/dilithium5/avx2/fips202x4.c
  372. src/sign/dilithium/dilithium5/avx2/invntt.S
  373. src/sign/dilithium/dilithium5/avx2/ntt.S
  374. src/sign/dilithium/dilithium5/avx2/packing.c
  375. src/sign/dilithium/dilithium5/avx2/pointwise.S
  376. src/sign/dilithium/dilithium5/avx2/poly.c
  377. src/sign/dilithium/dilithium5/avx2/polyvec.c
  378. src/sign/dilithium/dilithium5/avx2/rejsample.c
  379. src/sign/dilithium/dilithium5/avx2/rounding.c
  380. src/sign/dilithium/dilithium5/avx2/shuffle.S
  381. src/sign/dilithium/dilithium5/avx2/sign.c
  382. src/sign/dilithium/dilithium5/avx2/symmetric-shake.c)
  383. set(
  384. INC_AVX2_DILITHIUM5
  385. src/sign/dilithium/dilithium5/avx2
  386. )
  387. define_sig_alg(dilithium5_avx2
  388. PQCLEAN_DILITHIUM5_AVX2 "${SRC_AVX2_DILITHIUM5}" "${INC_AVX2_DILITHIUM5}")
  389. set(
  390. SRC_AVX2_KYBER512
  391. src/kem/kyber/kyber512/avx2/cbd.c
  392. src/kem/kyber/kyber512/avx2/consts.c
  393. src/kem/kyber/kyber512/avx2/fips202x4.c
  394. src/kem/kyber/kyber512/avx2/indcpa.c
  395. src/kem/kyber/kyber512/avx2/kem.c
  396. src/kem/kyber/kyber512/avx2/poly.c
  397. src/kem/kyber/kyber512/avx2/polyvec.c
  398. src/kem/kyber/kyber512/avx2/rejsample.c
  399. src/kem/kyber/kyber512/avx2/symmetric-shake.c
  400. src/kem/kyber/kyber512/avx2/verify.c
  401. src/kem/kyber/kyber512/avx2/basemul.S
  402. src/kem/kyber/kyber512/avx2/fq.S
  403. src/kem/kyber/kyber512/avx2/invntt.S
  404. src/kem/kyber/kyber512/avx2/ntt.S
  405. src/kem/kyber/kyber512/avx2/shuffle.S
  406. )
  407. set(
  408. INC_AVX2_KYBER512
  409. src/kem/kyber/kyber512/avx2
  410. )
  411. define_kem_alg(kyber512_avx2
  412. PQCLEAN_KYBER512_AVX2 "${SRC_AVX2_KYBER512}" "${INC_AVX2_KYBER512}")
  413. set(
  414. SRC_AVX2_KYBER768
  415. src/kem/kyber/kyber768/avx2/cbd.c
  416. src/kem/kyber/kyber768/avx2/consts.c
  417. src/kem/kyber/kyber768/avx2/fips202x4.c
  418. src/kem/kyber/kyber768/avx2/indcpa.c
  419. src/kem/kyber/kyber768/avx2/kem.c
  420. src/kem/kyber/kyber768/avx2/poly.c
  421. src/kem/kyber/kyber768/avx2/polyvec.c
  422. src/kem/kyber/kyber768/avx2/rejsample.c
  423. src/kem/kyber/kyber768/avx2/symmetric-shake.c
  424. src/kem/kyber/kyber768/avx2/verify.c
  425. src/kem/kyber/kyber768/avx2/basemul.S
  426. src/kem/kyber/kyber768/avx2/fq.S
  427. src/kem/kyber/kyber768/avx2/invntt.S
  428. src/kem/kyber/kyber768/avx2/ntt.S
  429. src/kem/kyber/kyber768/avx2/shuffle.S
  430. )
  431. set(
  432. INC_AVX2_KYBER768
  433. src/kem/kyber/kyber768/avx2
  434. )
  435. define_kem_alg(kyber768_avx2
  436. PQCLEAN_KYBER768_AVX2 "${SRC_AVX2_KYBER768}" "${INC_AVX2_KYBER768}")
  437. set(
  438. SRC_AVX2_KYBER1024
  439. src/kem/kyber/kyber1024/avx2/cbd.c
  440. src/kem/kyber/kyber1024/avx2/consts.c
  441. src/kem/kyber/kyber1024/avx2/fips202x4.c
  442. src/kem/kyber/kyber1024/avx2/indcpa.c
  443. src/kem/kyber/kyber1024/avx2/kem.c
  444. src/kem/kyber/kyber1024/avx2/poly.c
  445. src/kem/kyber/kyber1024/avx2/polyvec.c
  446. src/kem/kyber/kyber1024/avx2/rejsample.c
  447. src/kem/kyber/kyber1024/avx2/symmetric-shake.c
  448. src/kem/kyber/kyber1024/avx2/verify.c
  449. src/kem/kyber/kyber1024/avx2/basemul.S
  450. src/kem/kyber/kyber1024/avx2/fq.S
  451. src/kem/kyber/kyber1024/avx2/invntt.S
  452. src/kem/kyber/kyber1024/avx2/ntt.S
  453. src/kem/kyber/kyber1024/avx2/shuffle.S
  454. )
  455. set(
  456. INC_AVX2_KYBER1024
  457. src/kem/kyber/kyber1024/avx2
  458. )
  459. define_kem_alg(kyber1024_avx2
  460. PQCLEAN_KYBER1024_AVX2 "${SRC_AVX2_KYBER1024}" "${INC_AVX2_KYBER1024}")
  461. endif()
  462. # The rest of the library
  463. set(SRC_COMMON_GENERIC
  464. src/common/fips202.c
  465. src/common/sp800-185.c
  466. src/common/randombytes.c
  467. )
  468. if(${ARCH} STREQUAL "ARCH_x86_64")
  469. set(SRC_COMMON_AVX2
  470. src/common/keccak4x/KeccakP-1600-times4-SIMD256.c
  471. )
  472. endif()
  473. add_library(
  474. common
  475. OBJECT
  476. ${SRC_COMMON_GENERIC}
  477. ${SRC_COMMON_AVX2}
  478. )
  479. add_library(
  480. pqclean
  481. SHARED
  482. )
  483. add_library(
  484. pqclean_s
  485. STATIC
  486. )
  487. target_link_libraries(
  488. pqclean
  489. common
  490. pqclean_dilithium2_clean
  491. pqclean_dilithium3_clean
  492. pqclean_dilithium5_clean
  493. )
  494. target_link_libraries(
  495. pqclean_s
  496. common
  497. pqclean_dilithium2_clean
  498. pqclean_dilithium3_clean
  499. pqclean_dilithium5_clean
  500. )
  501. install(TARGETS pqclean pqclean_s
  502. PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ WORLD_WRITE
  503. LIBRARY DESTINATION lib
  504. ARCHIVE DESTINATION lib)
  505. install(FILES
  506. ${QRS_PUBLIC_INC}
  507. DESTINATION include/pqclean)
  508. # TODO: this requires changes to testvectors.c
  509. # add_executable(
  510. # test
  511. # )
  512. #
  513. # target_link_libraries(
  514. # test
  515. # pqclean_s
  516. # pqclean_test_dilithium2_clean
  517. # pqclean_test_dilithium3_clean
  518. # pqclean_test_dilithium5_clean
  519. # )