spsdk-pqc 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. spsdk_pqc-0.3.1/LICENSE +31 -0
  2. spsdk_pqc-0.3.1/MANIFEST.in +14 -0
  3. spsdk_pqc-0.3.1/PKG-INFO +51 -0
  4. spsdk_pqc-0.3.1/README.md +28 -0
  5. spsdk_pqc-0.3.1/SW_Content_Register_spsdk_pqc.txt +19 -0
  6. spsdk_pqc-0.3.1/pyproject.toml +207 -0
  7. spsdk_pqc-0.3.1/ref/.gitignore +8 -0
  8. spsdk_pqc-0.3.1/ref/CMakeLists.txt +96 -0
  9. spsdk_pqc-0.3.1/ref/Makefile +249 -0
  10. spsdk_pqc-0.3.1/ref/PQCgenKAT_sign.c +261 -0
  11. spsdk_pqc-0.3.1/ref/aes256ctr.c +551 -0
  12. spsdk_pqc-0.3.1/ref/aes256ctr.h +26 -0
  13. spsdk_pqc-0.3.1/ref/api.h +152 -0
  14. spsdk_pqc-0.3.1/ref/config.h +44 -0
  15. spsdk_pqc-0.3.1/ref/fips202.c +774 -0
  16. spsdk_pqc-0.3.1/ref/fips202.h +57 -0
  17. spsdk_pqc-0.3.1/ref/ntt.c +98 -0
  18. spsdk_pqc-0.3.1/ref/ntt.h +13 -0
  19. spsdk_pqc-0.3.1/ref/packing.c +237 -0
  20. spsdk_pqc-0.3.1/ref/packing.h +38 -0
  21. spsdk_pqc-0.3.1/ref/params.h +74 -0
  22. spsdk_pqc-0.3.1/ref/poly.c +907 -0
  23. spsdk_pqc-0.3.1/ref/poly.h +79 -0
  24. spsdk_pqc-0.3.1/ref/polyvec.c +390 -0
  25. spsdk_pqc-0.3.1/ref/polyvec.h +93 -0
  26. spsdk_pqc-0.3.1/ref/precomp.gp +12 -0
  27. spsdk_pqc-0.3.1/ref/randombytes.c +80 -0
  28. spsdk_pqc-0.3.1/ref/randombytes.h +9 -0
  29. spsdk_pqc-0.3.1/ref/reduce.c +69 -0
  30. spsdk_pqc-0.3.1/ref/reduce.h +22 -0
  31. spsdk_pqc-0.3.1/ref/rng.c +222 -0
  32. spsdk_pqc-0.3.1/ref/rng.h +55 -0
  33. spsdk_pqc-0.3.1/ref/rounding.c +102 -0
  34. spsdk_pqc-0.3.1/ref/rounding.h +19 -0
  35. spsdk_pqc-0.3.1/ref/sign.c +336 -0
  36. spsdk_pqc-0.3.1/ref/sign.h +42 -0
  37. spsdk_pqc-0.3.1/ref/symmetric-aes.c +13 -0
  38. spsdk_pqc-0.3.1/ref/symmetric-shake.c +28 -0
  39. spsdk_pqc-0.3.1/ref/symmetric.h +63 -0
  40. spsdk_pqc-0.3.1/ref/test/.gitignore +19 -0
  41. spsdk_pqc-0.3.1/ref/test/cpucycles.c +17 -0
  42. spsdk_pqc-0.3.1/ref/test/cpucycles.h +33 -0
  43. spsdk_pqc-0.3.1/ref/test/speed_print.c +51 -0
  44. spsdk_pqc-0.3.1/ref/test/speed_print.h +9 -0
  45. spsdk_pqc-0.3.1/ref/test/test_dilithium.c +65 -0
  46. spsdk_pqc-0.3.1/ref/test/test_mul.c +60 -0
  47. spsdk_pqc-0.3.1/ref/test/test_speed.c +87 -0
  48. spsdk_pqc-0.3.1/ref/test/test_vectors.c +251 -0
  49. spsdk_pqc-0.3.1/requirements_dev.txt +10 -0
  50. spsdk_pqc-0.3.1/setup.cfg +4 -0
  51. spsdk_pqc-0.3.1/setup.py +75 -0
  52. spsdk_pqc-0.3.1/spsdk_pqc/__init__.py +16 -0
  53. spsdk_pqc-0.3.1/spsdk_pqc/wrapper.py +293 -0
  54. spsdk_pqc-0.3.1/spsdk_pqc.egg-info/PKG-INFO +51 -0
  55. spsdk_pqc-0.3.1/spsdk_pqc.egg-info/SOURCES.txt +57 -0
  56. spsdk_pqc-0.3.1/spsdk_pqc.egg-info/dependency_links.txt +1 -0
  57. spsdk_pqc-0.3.1/spsdk_pqc.egg-info/top_level.txt +1 -0
  58. spsdk_pqc-0.3.1/tests/__init__.py +22 -0
  59. spsdk_pqc-0.3.1/tests/test_basic_dil3.py +26 -0
@@ -0,0 +1,31 @@
1
+
2
+
3
+ BSD 3-Clause "New" or "Revised" License
4
+
5
+ Copyright 2024 NXP
6
+
7
+ Redistribution and use in source and binary forms, with or without modification,
8
+ are permitted provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above copyright notice, this
14
+ list of conditions and the following disclaimer in the documentation and/or
15
+ other materials provided with the distribution.
16
+
17
+ * Neither the name of the copyright holder nor the names of its
18
+ contributors may be used to endorse or promote products derived from this
19
+ software without specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30
+ OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
@@ -0,0 +1,14 @@
1
+ include CONTRIBUTING.rst
2
+ include HISTORY.rst
3
+ include LICENSE
4
+ include README.rst
5
+ include SW_Content_Register_spsdk_pqc.txt
6
+ include requirements*
7
+
8
+ recursive-include ref *
9
+ recursive-include tests *
10
+ recursive-exclude * __pycache__
11
+ recursive-exclude * *.py[co]
12
+ recursive-exclude .github *
13
+
14
+ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.1
2
+ Name: spsdk-pqc
3
+ Version: 0.3.1
4
+ Summary: Post-Quatum Crypto support for SPSDK
5
+ Author: NXP
6
+ Maintainer-email: NXP <michal.starecek@nxp.com>
7
+ License: BSD-3-Clause
8
+ Project-URL: Homepage, https://github.com/nxp-mcuxpresso/spsdk_plugins/tree/master/pqc
9
+ Project-URL: Issues, https://github.com/nxp-mcuxpresso/spsdk_plugins/issues
10
+ Keywords: NXP,SPSDK,PQC,Dilithium
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+
24
+
25
+ Post-Quantum Crypto plugin for SPSDK
26
+ ====================================
27
+
28
+
29
+ * Free software: BSD-3-Clause
30
+
31
+
32
+ Features
33
+ --------
34
+
35
+ * Supported parameters: Dilithium 3, Randomized signature, SHAKE-based matrix extensions
36
+ * SUpported operation: Generate key pair, Sign data, Verify signature
37
+
38
+
39
+ Installation
40
+ ------------
41
+
42
+ * Activate virtual env, where you have SPSDK
43
+ - if SPSDK is not installed, the latest one will be installed automatically from [PyPI](https://pypi.org/project/spsdk/)
44
+ * `pip install spsdk-pqc`
45
+ * Use tools such as nxpcrypto, nxpimage as you usually do.
46
+
47
+
48
+ Credits
49
+ -------
50
+
51
+ This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [SPSDK Debug Probe project template](https://github.com/nxp-mcuxpresso/spsdk/blob/master/examples/plugins/templates/cookiecutter-spsdk-debug-probe-plugin.zip).
@@ -0,0 +1,28 @@
1
+
2
+ Post-Quantum Crypto plugin for SPSDK
3
+ ====================================
4
+
5
+
6
+ * Free software: BSD-3-Clause
7
+
8
+
9
+ Features
10
+ --------
11
+
12
+ * Supported parameters: Dilithium 3, Randomized signature, SHAKE-based matrix extensions
13
+ * SUpported operation: Generate key pair, Sign data, Verify signature
14
+
15
+
16
+ Installation
17
+ ------------
18
+
19
+ * Activate virtual env, where you have SPSDK
20
+ - if SPSDK is not installed, the latest one will be installed automatically from [PyPI](https://pypi.org/project/spsdk/)
21
+ * `pip install spsdk-pqc`
22
+ * Use tools such as nxpcrypto, nxpimage as you usually do.
23
+
24
+
25
+ Credits
26
+ -------
27
+
28
+ This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [SPSDK Debug Probe project template](https://github.com/nxp-mcuxpresso/spsdk/blob/master/examples/plugins/templates/cookiecutter-spsdk-debug-probe-plugin.zip).
@@ -0,0 +1,19 @@
1
+ NXP Software Content Register
2
+
3
+ Package: spsdk-pqc
4
+ Version: 0.3.1
5
+ Outgoing License: BSD-3-Clause
6
+ License Files: LICENSE
7
+ Type of content: Source code
8
+ Description and comments: NXP Secure Provisioning SDK Team - Post-Quantum Crypto support for SPSDK
9
+ Origin: NXP (BSD-3-Clause)
10
+ URL: https://github.com/nxp-mcuxpresso/spsdk_plugins/tree/master/pqc
11
+
12
+
13
+ Dilithium Reference code
14
+ Name: Dilithium
15
+ Version: 3e9b9f1
16
+ License: Public Domain or Apache-2
17
+ Location: ref
18
+ Type: Source
19
+ URL: https://github.com/pq-crystals/dilithium
@@ -0,0 +1,207 @@
1
+ [project]
2
+ name = "spsdk-pqc"
3
+ description = "Post-Quatum Crypto support for SPSDK"
4
+ dynamic = ["version"]
5
+
6
+ requires-python = ">= 3.9"
7
+ dependencies = []
8
+
9
+ authors = [{ name = "NXP" }]
10
+ maintainers = [{ name = "NXP", email = "michal.starecek@nxp.com" }]
11
+ readme = { file = "README.md", content-type = "text/markdown" }
12
+ license = { text = "BSD-3-Clause" }
13
+
14
+ keywords = ["NXP", "SPSDK", "PQC", "Dilithium"]
15
+ classifiers = [
16
+ "Development Status :: 2 - Pre-Alpha",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: BSD License",
19
+ "Natural Language :: English",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/nxp-mcuxpresso/spsdk_plugins/tree/master/pqc"
29
+ Issues = "https://github.com/nxp-mcuxpresso/spsdk_plugins/issues"
30
+
31
+
32
+ [build-system]
33
+ requires = ["setuptools >= 61.0", "wheel"]
34
+ build-backend = "setuptools.build_meta"
35
+
36
+ [tool.setuptools]
37
+ packages = ["spsdk_pqc"]
38
+
39
+ [tool.setuptools.dynamic]
40
+ version = { attr = "spsdk_pqc.__version__" }
41
+
42
+ [tool.bumpversion]
43
+ current_version = "0.3.1"
44
+
45
+ [[tool.bumpversion.files]]
46
+ filename = "spsdk_pqc/__init__.py"
47
+ search = '__version__ = "{current_version}"'
48
+ replace = '__version__ = "{new_version}"'
49
+
50
+ [[tool.bumpversion.files]]
51
+ filename = "SW_Content_Register_spsdk_pqc.txt"
52
+ search = "{current_version}"
53
+ replace = "{new_version}"
54
+
55
+
56
+ [tool.pytest.ini_options]
57
+ testpaths = ["tests"]
58
+ junit_family = "xunit1"
59
+
60
+ [tool.coverage.report]
61
+ exclude_lines = ["pragma: no cover", "safe_main()", "sys.exit(main())"]
62
+
63
+ [tool.coverage.run]
64
+ relative_files = true
65
+
66
+ [tool.black]
67
+ line-length = 100
68
+ target-version = ["py39", "py310", "py311", "py312"]
69
+ include = '\.pyi?$'
70
+
71
+ [tool.isort]
72
+ multi_line_output = 3
73
+ include_trailing_comma = true
74
+ force_grid_wrap = 0
75
+ use_parentheses = true
76
+ ensure_newline_before_comments = true
77
+ line_length = 100
78
+
79
+ [tool.mypy]
80
+ disallow_untyped_defs = true
81
+ ignore_missing_imports = true
82
+ warn_unused_ignores = true
83
+
84
+ [tool.pydocstyle]
85
+ convention = "google"
86
+ add_ignore = "D105,D301"
87
+ match = '(?!test_|__version__).*\.py'
88
+
89
+ [tool.pylint]
90
+ format = { max-line-length = 120 }
91
+ "messages control" = { disable = ["logging-fstring-interpolation"] }
92
+
93
+
94
+ [tool.checker_depencecies.spdx]
95
+ "Apache-2.0" = [
96
+ "Apache 2.0",
97
+ "Apache-2.0 License",
98
+ "Apache Software License 2.0",
99
+ "Apache License, Version 2.0",
100
+ "Apache License 2.0",
101
+ "Apache Software License",
102
+ ]
103
+ "BSD-2-Clause" = ["BSD", "BSD 2-Clause License"]
104
+ "BSD-3-Clause" = [
105
+ "BSD",
106
+ "BSD License",
107
+ "BSD 3-Clause",
108
+ "BSD (3 clause)",
109
+ "BSD 3-Clause License",
110
+ "Modified BSD License",
111
+ ]
112
+ "MIT" = ["MIT License", "MIT license"]
113
+ "MPL-2.0" = ["MPL 2.0", "Mozilla Public License 2.0 (MPL 2.0)"]
114
+ "NLPL" = ["Public domain", "Public Domain"]
115
+ "PSF-2.0" = ["PSF", "PSFL", "Python Software Foundation License"]
116
+ "GPL-2.0-or-later" = []
117
+ "LGPL-2.0-only" = ["LGPL-2.0"]
118
+ "LGPL-2.1-or-later" = []
119
+ "LGPL-3.0-only" = ["LGPL-3.0"]
120
+ "ISC" = ["ISC license"]
121
+
122
+ [tool.nxp_codecheck]
123
+ git_parent_branch = "origin/master"
124
+ output_directory = "reports"
125
+ default_check_paths = ["spsdk_pqc"]
126
+
127
+ # *********************************** Checker list ***********************************
128
+ [[tool.nxp_codecheck.checkers]]
129
+ name = "PYTEST"
130
+ method = "check_pytest"
131
+ # check_paths = [] # The default check paths could be overrides by local settings
132
+ info_only = false
133
+ kwargs = { disable_xdist = true }
134
+
135
+ # [[tool.nxp_codecheck.checkers]]
136
+ # name = "GITCOV"
137
+ # method = "check_gitcov"
138
+ # # check_paths = [] # The default check paths could be overrides by local settings
139
+ # info_only = true
140
+ # dependencies = ["PYTEST"]
141
+ [[tool.nxp_codecheck.checkers]]
142
+ name = "PYLINT"
143
+ method = "check_pylint"
144
+ # check_paths = [] # The default check paths could be overrides by local settings
145
+ info_only = false
146
+ [[tool.nxp_codecheck.checkers]]
147
+ name = "MYPY"
148
+ method = "check_mypy"
149
+ # check_paths = [] # The default check paths could be overrides by local settings
150
+ info_only = false
151
+ [[tool.nxp_codecheck.checkers]]
152
+ name = "DEPENDENCIES"
153
+ method = "check_dependencies"
154
+ # check_paths = [] # The default check paths could be overrides by local settings
155
+ info_only = false
156
+ fixer = "fix_dependencies"
157
+ [[tool.nxp_codecheck.checkers]]
158
+ name = "PYDOCSTYLE"
159
+ method = "check_pydocstyle"
160
+ # check_paths = [] # The default check paths could be overrides by local settings
161
+ info_only = false
162
+ [[tool.nxp_codecheck.checkers]]
163
+ name = "RADON_C"
164
+ method = "check_radon"
165
+ # check_paths = [] # The default check paths could be overrides by local settings
166
+ info_only = true
167
+ kwargs = { min_rank = "C" }
168
+ [[tool.nxp_codecheck.checkers]]
169
+ name = "RADON_D"
170
+ method = "check_radon"
171
+ # check_paths = [] # The default check paths could be overrides by local settings
172
+ info_only = false
173
+ kwargs = { min_rank = "D" }
174
+ [[tool.nxp_codecheck.checkers]]
175
+ name = "BLACK"
176
+ method = "check_black"
177
+ # check_paths = [] # The default check paths could be overrides by local settings
178
+ info_only = false
179
+ dependencies = []
180
+ fixer = "fix_black"
181
+ [[tool.nxp_codecheck.checkers]]
182
+ name = "ISORT"
183
+ method = "check_isort"
184
+ # check_paths = [] # The default check paths could be overrides by local settings
185
+ info_only = false
186
+ dependencies = []
187
+ fixer = "fix_isort"
188
+ [[tool.nxp_codecheck.checkers]]
189
+ name = "COPYRIGHT"
190
+ method = "check_copyright_year"
191
+ # check_paths = [] # The default check paths could be overrides by local settings
192
+ info_only = false
193
+ dependencies = []
194
+ fixer = "fix_copyright_year"
195
+ [[tool.nxp_codecheck.checkers]]
196
+ name = "PY_HEADERS"
197
+ method = "check_py_file_headers"
198
+ # check_paths = [] # The default check paths could be overrides by local settings
199
+ info_only = false
200
+ dependencies = []
201
+ fixer = "fix_py_file_headers"
202
+ [[tool.nxp_codecheck.checkers]]
203
+ name = "CYCLIC"
204
+ method = "check_cyclic_imports"
205
+ # check_paths = [] # The default check paths could be overrides by local settings
206
+ info_only = false
207
+ dependencies = []
@@ -0,0 +1,8 @@
1
+ *.so
2
+ *.o
3
+ PQCgenKAT_sign2
4
+ PQCgenKAT_sign2aes
5
+ PQCgenKAT_sign3
6
+ PQCgenKAT_sign3aes
7
+ PQCgenKAT_sign5
8
+ PQCgenKAT_sign5aes
@@ -0,0 +1,96 @@
1
+ set(DILITHIUM_SRCS sign.c packing.c polyvec.c poly.c ntt.c reduce.c rounding.c)
2
+ set(DILITHIUM_FIPS202_SRCS ${DILITHIUM_SRCS} symmetric-shake.c)
3
+ set(DILITHIUM_AES_SRCS ${DILITHIUM_SRCS} symmetric-aes.c)
4
+ set(FIPS202_SRCS fips202.c)
5
+ set(AES256CTR_SRCS aes256ctr.c)
6
+ set(TEST_DILITHIUM_SRCS test/test_dilithium.c randombytes.c)
7
+ set(TEST_VECTORS_SRCS test/test_vectors.c)
8
+ set(TEST_SPEED_SRCS test/test_speed.c test/speed_print.c test/cpucycles.c randombytes.c)
9
+
10
+ if(MSVC)
11
+ add_compile_options(/nologo /O2 /W4 /wd4146 /wd4244)
12
+ string(REGEX REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
13
+ else()
14
+ add_compile_options(-Wall -Wextra -Wpedantic -Werror)
15
+ add_compile_options(-Wmissing-prototypes -Wredundant-decls -Wshadow -Wpointer-arith)
16
+ add_compile_options(-O3 -fomit-frame-pointer)
17
+ endif()
18
+
19
+ add_library(fips202_ref ${FIPS202_SRCS})
20
+ add_library(aes256ctr_ref ${AES256CTR_SRCS})
21
+
22
+ # Dilithium 2
23
+ add_library(dilithium2_ref ${DILITHIUM_FIPS202_SRCS})
24
+ add_library(dilithium2aes_ref ${DILITHIUM_AES_SRCS})
25
+ target_compile_definitions(dilithium2_ref PUBLIC DILITHIUM_MODE=2)
26
+ target_compile_definitions(dilithium2aes_ref PUBLIC DILITHIUM_MODE=2 DILITHIUM_USE_AES)
27
+ target_link_libraries(dilithium2_ref INTERFACE fips202_ref)
28
+ target_link_libraries(dilithium2aes_ref INTERFACE fips202_ref aes256ctr_ref)
29
+
30
+ add_executable(test_dilithium2_ref ${TEST_DILITHIUM_SRCS})
31
+ add_executable(test_vectors2_ref ${TEST_VECTORS_SRCS})
32
+ add_executable(test_dilithium2aes_ref ${TEST_DILITHIUM_SRCS})
33
+ add_executable(test_vectors2aes_ref ${TEST_VECTORS_SRCS})
34
+ target_link_libraries(test_dilithium2_ref dilithium2_ref)
35
+ target_link_libraries(test_vectors2_ref dilithium2_ref)
36
+ target_link_libraries(test_dilithium2aes_ref dilithium2aes_ref)
37
+ target_link_libraries(test_vectors2aes_ref dilithium2aes_ref)
38
+
39
+ # Dilithium 3
40
+ add_library(dilithium3_ref ${DILITHIUM_FIPS202_SRCS})
41
+ add_library(dilithium3aes_ref ${DILITHIUM_AES_SRCS})
42
+ target_compile_definitions(dilithium3_ref PUBLIC DILITHIUM_MODE=3)
43
+ target_compile_definitions(dilithium3aes_ref PUBLIC DILITHIUM_MODE=3 DILITHIUM_USE_AES)
44
+ target_link_libraries(dilithium3_ref INTERFACE fips202_ref)
45
+ target_link_libraries(dilithium3aes_ref INTERFACE fips202_ref aes256ctr_ref)
46
+
47
+ add_executable(test_dilithium3_ref ${TEST_DILITHIUM_SRCS})
48
+ add_executable(test_vectors3_ref ${TEST_VECTORS_SRCS})
49
+ add_executable(test_dilithium3aes_ref ${TEST_DILITHIUM_SRCS})
50
+ add_executable(test_vectors3aes_ref ${TEST_VECTORS_SRCS})
51
+ target_link_libraries(test_dilithium3_ref dilithium3_ref)
52
+ target_link_libraries(test_vectors3_ref dilithium3_ref)
53
+ target_link_libraries(test_dilithium3aes_ref dilithium3aes_ref)
54
+ target_link_libraries(test_vectors3aes_ref dilithium3aes_ref)
55
+
56
+ # Dilithium 5
57
+ add_library(dilithium5_ref ${DILITHIUM_FIPS202_SRCS})
58
+ add_library(dilithium5aes_ref ${DILITHIUM_AES_SRCS})
59
+ target_compile_definitions(dilithium5_ref PUBLIC DILITHIUM_MODE=5)
60
+ target_compile_definitions(dilithium5aes_ref PUBLIC DILITHIUM_MODE=5 DILITHIUM_USE_AES)
61
+ target_link_libraries(dilithium5_ref INTERFACE fips202_ref)
62
+ target_link_libraries(dilithium5aes_ref INTERFACE fips202_ref aes256ctr_ref)
63
+
64
+ add_executable(test_dilithium5_ref ${TEST_DILITHIUM_SRCS})
65
+ add_executable(test_vectors5_ref ${TEST_VECTORS_SRCS})
66
+ add_executable(test_dilithium5aes_ref ${TEST_DILITHIUM_SRCS})
67
+ add_executable(test_vectors5aes_ref ${TEST_VECTORS_SRCS})
68
+ target_link_libraries(test_dilithium5_ref dilithium5_ref)
69
+ target_link_libraries(test_vectors5_ref dilithium5_ref)
70
+ target_link_libraries(test_dilithium5aes_ref dilithium5aes_ref)
71
+ target_link_libraries(test_vectors5aes_ref dilithium5aes_ref)
72
+
73
+ add_test(NAME dilithium2_ref COMMAND test_dilithium2_ref)
74
+ add_test(NAME dilithium2aes_ref COMMAND test_dilithium2aes_ref)
75
+ add_test(NAME dilithium3_ref COMMAND test_dilithium3_ref)
76
+ add_test(NAME dilithium3aes_ref COMMAND test_dilithium3aes_ref)
77
+ add_test(NAME dilithium5_ref COMMAND test_dilithium5_ref)
78
+ add_test(NAME dilithium5aes_ref COMMAND test_dilithium5aes_ref)
79
+
80
+ if(WIN32)
81
+ add_test(NAME vectors2_ref COMMAND PowerShell -Command "$<TARGET_FILE:test_vectors2_ref> | dos2unix > tvecs2")
82
+ add_test(NAME vectors2aes_ref COMMAND PowerShell -Command "$<TARGET_FILE:test_vectors2aes_ref> | dos2unix > tvecs2aes")
83
+ add_test(NAME vectors3_ref COMMAND PowerShell -Command "$<TARGET_FILE:test_vectors3_ref> | dos2unix > tvecs3")
84
+ add_test(NAME vectors3aes_ref COMMAND PowerShell -Command "$<TARGET_FILE:test_vectors3aes_ref> | dos2unix > tvecs3aes")
85
+ add_test(NAME vectors5_ref COMMAND PowerShell -Command "$<TARGET_FILE:test_vectors5_ref> | dos2unix > tvecs5")
86
+ add_test(NAME vectors5aes_ref COMMAND PowerShell -Command "$<TARGET_FILE:test_vectors5aes_ref> | dos2unix > tvecs5aes")
87
+ else()
88
+ add_test(NAME vectors2_ref COMMAND sh -c "\"$<TARGET_FILE:test_vectors2_ref>\" > tvecs2")
89
+ add_test(NAME vectors2aes_ref COMMAND sh -c "\"$<TARGET_FILE:test_vectors2aes_ref>\" > tvecs2aes")
90
+ add_test(NAME vectors3_ref COMMAND sh -c "\"$<TARGET_FILE:test_vectors3_ref>\" > tvecs3")
91
+ add_test(NAME vectors3aes_ref COMMAND sh -c "\"$<TARGET_FILE:test_vectors3aes_ref>\" > tvecs3aes")
92
+ add_test(NAME vectors5_ref COMMAND sh -c "\"$<TARGET_FILE:test_vectors5_ref>\" > tvecs5")
93
+ add_test(NAME vectors5aes_ref COMMAND sh -c "\"$<TARGET_FILE:test_vectors5aes_ref>\" > tvecs5aes")
94
+ endif()
95
+
96
+ add_test(NAME hashes COMMAND sha256sum -c ../../SHA256SUMS)