Commit graph

1421 commits

Author SHA1 Message Date
Yanray Wang
6f09267646 code_size_compare: remove column of percentage for code size change
Percentage is not a useful number when looking at code size changes.
Since it depends on the base of the code size. It might give
misleading information by simply looking at the numbers.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-27 10:19:38 +08:00
Gowtham Suresh Kumar
a12baf8c5f Update test scripts to use latest/earliest compilers
The Ubuntu 16.04 and 22.04 docker images have been updated with
earliest and latest versions of gcc and clang respectively.
This patch adds the necessary component and support functions
required for the CI to run these compilers.

For FreeBSD we invoke the function by name so a condition is added
to disable the existing test_clang_opt function for linux.

Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-26 16:51:45 +01:00
Yanray Wang
ca9a3cbc1d code_size_compare: detect architecture of x86_32 properly
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 17:21:10 +08:00
Yanray Wang
6ae94a0a72 code_size_compare: make sure _remove_worktree executed
Add try and finally to make sure we remove worktree as expected even
if we hit errors by accident.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 17:13:24 +08:00
Yanray Wang
9e8b671b1c code_size_compare: check --record-dir properly
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 15:37:29 +08:00
Manuel Pégourié-Gonnard
182eb1514e Fix KeyType.can_do() for DH+FFDH
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:34:30 +02:00
Manuel Pégourié-Gonnard
636d85724a Shorten DH_FAMILY just like ECC_FAMILY
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:32:42 +02:00
Manuel Pégourié-Gonnard
afe4b79114 Enable DH in generate_psa_tests.py
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:32:42 +02:00
Yanray Wang
a279ca9ff8 code_size_compare: remove unnecessary -r in cp command
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 15:01:12 +08:00
Yanray Wang
6ef5049b9f code_size_compare: simplify some code for python dictionary
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:59:39 +08:00
Yanray Wang
15b1358f22 logging_util: rename argument
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:48:12 +08:00
Yanray Wang
68265f41d7 code_size_compare: use current as default new Git revision
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:45:00 +08:00
Yanray Wang
bef1acd7b8 code_size_compare: left align file names in markdown table
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 11:07:49 +08:00
Yanray Wang
ea842e791b code_size_compare: print prompt message under correct condition
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 11:03:11 +08:00
Yanray Wang
533cde22c0 code_size_compare: set log level as ERROR in option --stdout
If we use option --stdout, the logging level is set as
logging.ERROR. But --verbose is able to overwrite logging level as
logging.INFO if we want to display intermediate log in the process
of code size comparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 10:27:10 +08:00
Yanray Wang
2ba9df2c1b code_size_compare: direct error message by logger.error
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 10:11:34 +08:00
Yanray Wang
e4a3636fac code_size_compare: add comments to make code more readable
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-25 10:37:12 +08:00
Yanray Wang
25bd331899 code_size_compare: round percentage to an integer value
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-25 10:24:23 +08:00
Yanray Wang
f2cd717952 code_size_compare: print 'None' if comparing size for a new file
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
69262fc087 code_size_compare: add extra indication if print to sys.stdout
If we output comparison result into sys.stdout, it will print an
extra line to show information we used for code size comparison in
detail. This would be helpful if we copy & paste code size changes
in Github comment.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
a6cf692e2a code_size_compare: simplify how to generate file name of code size
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
950590099d code_size_compare: simplify CodeSizeGeneratorWithSize
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
5605c6f58f code_size_compare: make CodeSizeBuildInfo more flexible
This commit changes how to infer make command. Although we haven't
supported to pass more options in command line, this is the
preparation work to support those features.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
955671b0ef code_size_compare: replace SimpleNameSpace to a clearer data struct
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
5b64e4c7e0 code_size_compare: clean up comments
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
386c2f9e93 code_size_compare: clean up code to make it more readable
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:15 +08:00
Yanray Wang
21127f7095 code_size_compare: add logging module and tweak prompt message
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 18:07:12 +08:00
Yanray Wang
227576aaa4 code_size_compare: add option --stdout to show result in sys.stdout
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
b664cb7569 code_size_compare: add --markdown to show result in a markdown table
The option --markdown supports to only show the files that
have changed in a markdown table between two commits.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
9b174e90d3 code_size_compare: generate text,data as comparison result
Previously we used dec(total) as comparison result of code size
measurement. However, it's not accurate because dec(total) is
the sum of text, data and bss. Now we show text,data instead
since those are sections we care about in code size perspective
specifically for TF-M.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
802af160b4 code_size_compare: support to measure code size with multiple tools
For time being, code_size_compare.py only supports `size`. This
commit builds up foundation to extend code size measurement with
other tools.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
923f943a3e code_size_compare: introduce SimpleNamespace to store info
We use SimpleNamespace class to store all the information used to
measure code size of objects in library.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
5e9130a5e9 code_size_compare: simplify methods in CodeSizeComparison
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
e0e276046b code_size_compare: add CodeSizeCalculator to calculate code size
CodeSizeCalculator is aimed to calculate code size based on a Git
revision and code size measurement tool. The output of code size is
in utf-8 encoding.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
15c43f3407 code_size_compare: add a base class as CodeSizeGenerator
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Yanray Wang
fc6ed4ddad code_size_compare: add a parser to generate code size with size tool
This commit splits CodeSizeBase as a separate class to prepare a
parser as CodeSizeGenerator. The benefit is we can extend the tool
of code size measurement in order to generate more types of code
size record.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-24 16:44:50 +08:00
Gilles Peskine
7eea4a7a80 Enable MBEDTLS_PSA_CRYPTO_CONFIG in "config.py full"
Back when we introduced MBEDTLS_PSA_CRYPTO_CONFIG and it was still
experimental, it made sense that we tested it separately. Nowadays, the
feature is fully implemented, and the full config without
MBEDTLS_PSA_CRYPTO_CONFIG keeps cryptographic mechanisms that only have a
PSA implementation and aren't in the default build disabled (currently:
PBKDF2). So enable MBEDTLS_PSA_CRYPTO_CONFIG in the full config.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-21 17:50:49 +02:00
Gilles Peskine
5647d06be8
Merge pull request #7518 from gilles-peskine-arm/psa_inject_entropy-file-stability
Fix and test MBEDTLS_PSA_INJECT_ENTROPY
2023-07-21 17:37:15 +02:00
Agathiyan Bragadeesh
cf3554b4e8 Update file permissions
New scripts have updated executable permissions to be consistent with
project requirements.

Signed-off-by: Agathiyan Bragadeesh <agabra02@e127300.arm.com>
2023-07-06 18:10:19 +01:00
Agathiyan Bragadeesh
237f91a9ef Add script to manage gitignore anchors
Added scripts which comment and uncomment out patterns relating to
generated files.

Signed-off-by: Agathiyan Bragadeesh <agabra02@e127300.arm.com>
2023-07-06 18:00:48 +01:00
Yanray Wang
699a6c8a6d code_size_compare.py: add comment for sys_arch
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-04 17:27:45 +08:00
Yanray Wang
4c26db0845 code_size_compare.py: run make clean before build libraries
If we don't remove all executable files in current working
directory, we might measure code size between different architecture
and configuration. This generates a wrong code size comparison
report. This commit guarantees it runs `make clean` before build
libraries for code size comparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-04 17:27:45 +08:00
Tom Cosgrove
1940e7bae4
Merge pull request #7671 from yanrayw/7360-code-size-improve-format
code size: improve format of csv file
2023-07-04 09:15:48 +01:00
Dave Rodgman
38939f705a
Merge pull request #7822 from gilles-peskine-arm/code-style-since
code_style.py --since
2023-06-30 11:37:02 +01:00
Paul Elliott
92a55bf5ea
Merge pull request #7793 from minosgalanakis/ecp/6025_fast_reduction_dispatch
[Bignum] Fast reduction dispatch
2023-06-28 17:38:37 +01:00
Minos Galanakis
dae4c038f8 ecp.py: Extended EcpP224K1Raw tests for 32/64 bit architectures.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 18:54:53 +01:00
Minos Galanakis
80c4ae893c bignum_common.py: Added bits_to_limbs method.
This patch introduces a rounding-error-resiliant method to
calculate bits_to_limbs, and is updating `SECP224R1` and
`SECP224K1` to use it.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 16:38:22 +01:00
Gilles Peskine
717a83164e
Merge pull request #7807 from gilles-peskine-arm/mbedtls_ssl_protocol_version_str-no_array
Fix very high stack usage in SSL debug code
2023-06-26 09:36:53 +02:00
Gilles Peskine
163ec4090e Handle deleted files correctly
Don't attempt to run on a file that isn't present now.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-25 22:18:40 +02:00
Gilles Peskine
9d7b24fb26 Fix extra character in debug string
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-23 21:11:46 +02:00
Gilles Peskine
43838b8a24 Add --since option to check files modified since a given commit
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-22 20:31:02 +02:00
Gilles Peskine
22eb82cb8d Clean up subprocess invocation in get_src_files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-22 19:45:01 +02:00
Gilles Peskine
fd235bc9df Fix very high stack usage in SSL debug code
Use a switch instead of an array. The array was very hollow for some enum
types such as mbedtls_ssl_protocol_version (which formerly used small
values, but switched to using the protocol encoding as enum values in Mbed
TLS 3.2.0). Optimizing compilers know how to compile a switch into a lookup
table when the range warrants it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-20 17:48:18 +02:00
Minos Galanakis
450abfd922 test_suite_ecp: Added MBEDTLS_ECP_NIST_OPTIM define guards.
This patch updates `ecp_mod_p_generic_raw` and corresponding
curve test methods, that depend on the NIST optimisation
parameter to not run when it is not included.

The following curves are affected:
* SECP192R1
* SECP224R1
* SECP256R1
* SECP384R1
* SECP521R1

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Paul Elliott
a2e48f751b Split out mbedtls_ecp_mod_p448_raw()
Switch testing over to using the generic raw functions.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-15 17:16:38 +01:00
Paul Elliott
b4df176610
Merge pull request #7637 from paul-elliott-arm/fixed_ecp_mod_p448
[Bignum] Fixed width for ecp mod p448
2023-06-15 17:12:02 +01:00
Gilles Peskine
0fe0c0cf10
Merge pull request #7775 from daverodgman/version_features_codesize
Shorten encoding of version features
2023-06-15 14:56:00 +02:00
Tom Cosgrove
6edf8b8c7b
Merge pull request #7451 from yanrayw/7376_aes_128bit_only
Introduce config option of 128-bit key only in AES calculation
2023-06-15 10:35:32 +01:00
Dave Rodgman
b28d1c3484 fix check-names failure
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-14 20:06:43 +01:00
Dave Rodgman
90dfc21f6b Shorten encoding of version features
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-14 17:06:53 +01:00
Paul Elliott
b727042501 Move corner test case into python framework
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-13 17:42:01 +01:00
Dave Rodgman
05d71ffe5b Merge remote-tracking branch 'origin/development' into sha3-updated 2023-06-07 18:02:04 +01:00
Yanray Wang
c7a2a6d11d code_size_compare.py: change prompt message in code size measurement
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Yanray Wang
72b105f1ae code_size_compare: clarify input and return types
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Yanray Wang
8804db9d99 code_size_compare.py: integrate code with CodeSizeBase
The code size measurement script generates code size
record / comparison csv file in a more readable format.

The script won't generate new record file if there is an existing
one. It reads the record and stores data into dictionary of code_size
for comparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Yanray Wang
16ebc5725b code_size_compare.py: add a CodeSizeBase class
CodeSizeBase class aims to store size information for a specific
revision. It also has support to write csv report, comparison result
in a more readable format. This commit lays out foundation to
simplify code for CodeSizeComparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Tom Cosgrove
32b06f50df
Merge pull request #7650 from yanrayw/7360-code-size-tfm-medium
code size measurement support for tfm-medium
2023-06-02 13:25:26 +01:00
Yanray Wang
21f1744d76 code_size_compare.py: fix make command logic in default config
If system architecture doesn't match architecture of input argument
for default configuration, it's reported as an error.

Additionally, it prints out help message to show which architecture
and configuration option should be used.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-01 23:26:48 +08:00
Yanray Wang
502c54f8c1 code_size_compare.py: classify arguments in parser
This commit splits parsed arguments into required group and optional
group to present help message clearer to users.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-31 11:46:54 +08:00
Yanray Wang
c18cd89b71 code_size_compare.py: add prompt for unsupported arch and config
Add prompt message for a series of supported combination of
architecture and configuration when someone tries unsupported
combinations.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-31 11:46:35 +08:00
Yanray Wang
aba7158a6f code_size_compare.py: add armv8-m option for arch
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-29 17:16:56 +08:00
Yanray Wang
60430bda37 code_size_compare.py: change default path of armclang
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-29 14:48:23 +08:00
Yanray Wang
a3841ab299 code_size_compare.py: add missing aes.o in code size comparison
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-25 15:51:40 +08:00
Yanray Wang
369cd96176 code_size_compare.py: add suffix to code size report
This commit adds suffix of architecture and configuration to the
file of code size record and comparison result.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-25 15:51:40 +08:00
Aditya Deshpande
41a0aad78d code_size_compare.py: clean up worktree in errors of subprocess
With this change, the program cleans up worktree in errors of
execution of subprocess.checkout. Additionally, the error log is
printed out for users.

Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-25 15:51:40 +08:00
Yanray Wang
6a86258eab code_size_compare.py: support measurement of tfm-medium
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-25 15:51:38 +08:00
Yanray Wang
23bd53239d code_size_compare.py: add --arch and detection of host arch
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-25 15:49:54 +08:00
Minos Galanakis
2daa374ea8 ecp_curves: Minor refactoring of mbedtls_ecp_mod_p255_raw()
* Fixed whitespace issues.
* Renamed variables to align with bignum conventions.
* Updated alignment on test input data.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
aada68f1be ecp.py: Fixed types for arguments() overrides.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
c2c967b1f0 ecp.py: Added tests for mbedtls_ecp_mod_p255_raw
This patch introduces the `EcpP255Raw` test class for testing
the curve using the preestablished `ecp_mod_p_generic_raw()`
test. The test's logic has been updated accordingly.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Paul Elliott
26070670d6
Merge pull request #7565 from gabor-mezei-arm/7263_split_out_Koblitz_raw_functions
[Bignum] Split out _raw Koblitz reduction functions
2023-05-22 16:03:17 +01:00
Gilles Peskine
63df4ec3ca
Merge pull request #7589 from daverodgman/pr4990
Replace references to Mbed Crypto (rebase)
2023-05-16 19:14:51 +02:00
Paul Elliott
f0806bee66
Merge pull request #7489 from minosgalanakis/ecp/7246_xtrack_core_shift_l
[Bignum]: Introduce left shift from prototype
2023-05-16 17:13:19 +01:00
Gabor Mezei
03558b847e
Add _raw function to P256K1
Modified the testing to use the generic fast reduction test function.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:30:03 +02:00
Gabor Mezei
e42bb6294e
Add _raw function to P224K1
Modified the testing to use the generic fast reduction test function.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:30:03 +02:00
Gabor Mezei
dacfe56370
Add _raw function to P192K1
Modified the testing to use the generic fast reduction test function.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:29:57 +02:00
Minos Galanakis
99453ad9f0 bignum_core.py: Simplified result calculation for BignumCoreShiftL
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-16 15:28:19 +01:00
Fredrik Hesse
0ec8a90d48 Replace references to Mbed Crypto with Mbed TLS through-out documentation and comments.
Signed-off-by: Fredrik Hesse <fredrik@hesse.se>
2023-05-12 15:00:45 +01:00
Fredrik Hesse
cc207bc379 Replace references to Mbed Crypto with Mbed TLS through-out documentation and comments.
Signed-off-by: Fredrik Hesse <fredrik@hesse.se>
2023-05-12 14:59:01 +01:00
Gabor Mezei
23b10109bb
Add test cases to test overflow in the Kobltz reduction
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-12 12:34:12 +02:00
Minos Galanakis
013167ed7f bignum_common.py: Addressed minor typos
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-11 10:54:44 +01:00
Paul Elliott
481a6a8edb
Merge pull request #7482 from gabor-mezei-arm/6029_use_core_api_in_ecp_mod_koblitz
[Bignum] Use core API in ecp_mod_koblitz()
2023-05-10 17:24:46 +01:00
Bence Szépkúti
ddfd0a27df
Merge pull request #7399 from lpy4105/issue/7014/certificate-audit-script
cert_audit: Add test certificate date audit script
2023-05-09 13:10:01 +02:00
Pengyu Lv
eb2c39ed2b Install cryptography only on linux platform
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-09 02:15:58 +00:00
Gabor Mezei
9bf1aaf385
Fix input parameter alignment in P256K1 test cases
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-05 16:32:28 +02:00
Pol Henarejos
d06c6fc45b
Merge branch 'development' into sha3
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2023-05-05 16:01:18 +02:00
Yanray Wang
a87046704f Add checks if MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH enabled
This commit adds configuration check in check_config.h if
MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH enabled.
Furthermore, MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH is disabled
by default in scripts/config.py for full configuration.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-05-05 11:21:18 +08:00
Paul Elliott
b6432832d0
Merge pull request #7490 from paul-elliott-arm/test_ecp_mod_p448
[Bignum] Add unit tests for ecp_mod_p448
2023-05-04 11:39:44 +01:00
Paul Elliott
b8bd47dd68 Remove unrequired limb size calculation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-03 14:16:54 +01:00
Paul Elliott
b7fd1d6044 Correct max canonical multiplication result
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-03 14:16:48 +01:00
Gilles Peskine
a08def9871 Tests: provide necessary functions for MBEDTLS_PSA_INJECT_ENTROPY
The build option MBEDTLS_PSA_INJECT_ENTROPY requires some extra platform
functions, for historical reasons. To enable us to test this option, provide
a version of these functions for testing.

(These versions would actually work in production, but providing them in the
library in a way that doesn't break existing users might be slightly tricky,
so it's out of scope of this commit.)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 21:18:33 +02:00
Aditya Deshpande
ebd624e691 Minor formatting change to driver wrapper jinja template
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
695e44b5a0 Rename p256m to p256 for uniform function/macro prefixes
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
e41f7e457f Integrate p256-m as an example driver alongside Mbed TLS and write documentation for the example.
(Reapplying changes as one commit on top of development post codestyle change instead of rewriting old branch)

Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:09 +01:00
Paul Elliott
16648be171 Add Curve 448 tests
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-04-26 22:23:27 +01:00
Minos Galanakis
c787cf73b3 bignum_core.py: Add "BignumCoreShiftL()"
This patch introduces automatic test input generation for
`mpi_core_shift_l()` function.

It also adds two utility functions in bignum_common.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-26 17:04:20 +01:00
Minos Galanakis
d6751dcd8b ecp_curves: Added unit-tests for secp256k1
This patch introduces basic unit-testing for the `ecp_mod_p256k1()`.

The method is exposed through the ecp_invasive interface, and
the standard testing data is being provided by the python framework.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-25 13:30:59 +01:00
Pengyu Lv
1381598aa3 cert_audit: Check the version of cryptography
The script requires cryptography >= 35.0.0, we
need to check the version and provide meaningful
error message when the package version was too
old.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-04-25 14:55:38 +08:00
Minos Galanakis
e5dab975c6 ecp_curves: Added unit-tests for secp224k1
This patch introduces basic unit-testing for the `ecp_mod_p224k1()`.

The method is exposed through the ecp_invasive interface, and
the standard testing data is being provided by the python framework.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-18 14:13:20 +01:00
Gabor Mezei
cec506083b
Fix test case dependency
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-17 14:56:03 +02:00
Gabor Mezei
bda7f87e2a
Add dependency for P192K1 tests
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-13 13:11:05 +02:00
Gabor Mezei
b86ead3cb2
Add generated tests for ecp_mod_p192k1
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-13 12:47:59 +02:00
Minos Galanakis
0a325b6767 ecp.py: Set test-dependencies as attributes.
This patch enables declaring dependencie as test-class
members. ECP curve functions have been updated
to use the new capability.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-06 16:33:10 +01:00
Minos Galanakis
1358648f77 test_suite_ecp: Introduced ecp_mod_p_generic_raw
This patch replaces similiarly structured test functions
for:

* MBEDTLS_ECP_DP_SECP192R1
* MBEDTLS_ECP_DP_SECP224R1
* MBEDTLS_ECP_DP_SECP256R1
* MBEDTLS_ECP_DP_SECP384R1
* MBEDTLS_ECP_DP_BP512R1R1

with a more generic version, which adjusts the parameters, based on the `curve_id` field,
provided by the testing data.

The python test framework has been updated to provide that extra field.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-06 16:27:12 +01:00
Janos Follath
44c6694be7
Merge pull request #7351 from gabor-mezei-arm/7109_ecp_fast_reduction_testing
Test unlikely cases of ECC modular reduction
2023-04-06 15:55:19 +01:00
Minos Galanakis
00bd8925a7 bignum: Removed merge scaffolding.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-04-05 16:13:11 +01:00
Janos Follath
13c73de6de
Merge pull request #6233 from tom-cosgrove-arm/issue-6226-core-mul
Bignum: extract core_mul from the prototype
2023-04-04 13:36:22 +01:00
Ronald Cron
219f978097
Merge pull request #7059 from ronald-cron-arm/psa-crypto-misc
PSA cryptography miscellaneous
2023-04-04 10:54:03 +02:00
Gabor Mezei
b0f013784f
Multplication is simmetric so only generate unique combinations
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-04-03 17:26:44 +02:00
Gabor Mezei
87223ab1ce
Add generated test for core_mul
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-31 16:17:06 +02:00
Gabor Mezei
5ded38e0e1
Fix 0 limb size for value 0
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-31 16:17:06 +02:00
Dave Rodgman
b8f5ba826b
Merge pull request #6891 from yuhaoth/pr/add-milliseconds-platform-function
Add milliseconds platform time function
2023-03-31 11:47:37 +01:00
Ronald Cron
e6e6b75ad3 psa: Remove MBEDTLS_PSA_CRYPTO_DRIVERS configuration option
The support for the PSA crypto driver interface
is not optional anymore as the implementation of
the PSA cryptography interface has been restructured
around the PSA crypto driver interface (see
psa-crypto-implementation-structure.md). There is
thus no purpose for the configuration options
MBEDTLS_PSA_CRYPTO_DRIVERS anymore.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2023-03-31 09:07:54 +02:00
Gabor Mezei
d8c0e1aa8d
Fix comments
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:34:49 +02:00
Gabor Mezei
c33a36b5df
Typo: reorder testing classes
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:32:47 +02:00
Gabor Mezei
a8d0da3880
Add test cases for P256 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:31:05 +02:00
Gabor Mezei
54ad647e8d
Add test cases for P384 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:30:32 +02:00
Gabor Mezei
fede276392
Typo: reformat numbers
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:29:40 +02:00
Gabor Mezei
a9a68728b3
Add test cases for P521 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:09:35 +02:00
Gabor Mezei
64a229f6ac
Add test cases for P224 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:09:35 +02:00
Gabor Mezei
62adc726d0
Add test cases for P192 fast reduction testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-28 15:09:35 +02:00
Minos Galanakis
4af90bbcda EcpP384R1Raw: Added test case for 2nd round of carry reduction.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-03-21 15:46:51 +00:00
Minos Galanakis
37f4cb6d0e ecp_curves: Minor rework for p384
This patch adjusts formatting, documentation and testing.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-03-21 15:46:50 +00:00
Minos Galanakis
f359c91f9b ecp test generator: Added EcpPp384R1Raw().
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-03-21 15:45:18 +00:00
Dave Rodgman
0e2b06a1ce
Merge pull request #7083 from KloolK/record-size-limit/parsing
Add parsing for Record Size Limit extension in TLS 1.3
2023-03-17 10:18:34 +00:00
Janos Follath
c18cd0c8e6
Merge pull request #7230 from gabor-mezei-arm/6850_Secp256r1_fast_reduction
Extract Secp256r1 fast reduction from the prototype
2023-03-16 19:43:25 +00:00
Jan Bruckner
151f64283f Add parsing for Record Size Limit extension in TLS 1.3
Fixes #7007

Signed-off-by: Jan Bruckner <jan@janbruckner.de>
2023-03-14 08:41:25 +01:00
Dave Rodgman
bf4016e5d5
Merge pull request #6567 from mprse/ecjpake-driver-dispatch 2023-03-09 19:23:05 +00:00
Gabor Mezei
fffd6d9ded
Fix maximum cannonical value
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-09 13:43:15 +01:00
Gabor Mezei
e4710ae9ed
Add and fix comments
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-09 13:43:02 +01:00
Gabor Mezei
eb591ff94d
Add test generation for ecp_mod_p256_raw
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-08 14:12:20 +01:00
Janos Follath
fe780a3c4b
Merge pull request #7184 from gabor-mezei-arm/6349_Secp224r1_fast_reduction
Extract Secp224r1 fast reduction from the prototype
2023-03-07 10:57:58 +00:00
Gabor Mezei
a2ef6a8e38
The is_valid() function is needed to not filter out test cases
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-06 16:57:25 +01:00
Gabor Mezei
61ef3603eb
Correct the maximum canonical value in tests
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-06 16:32:16 +01:00
Gabor Mezei
d034b3d0d2
Code style: have two empty lines before and after class definitions
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-06 16:32:15 +01:00
Gabor Mezei
5e33e6f5d4
Remove unnecessary function override
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-06 16:32:12 +01:00
Pol Henarejos
f61d6c0a2b
Merge branch 'development' into sha3 2023-03-04 00:03:06 +01:00
Gabor Mezei
931fd646ff
Use lower case hex number
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-03-01 16:50:00 +01:00
Gilles Peskine
802ff1b116
Merge pull request #7147 from paul-elliott-arm/interruptible_sign_hash_codestyle_drivers
Remove driver entry points for psa_{get|set}_max_ops()
2023-03-01 10:46:09 +01:00
Gabor Mezei
98791e7781
Add more test cases for P224 testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-02-27 15:59:34 +01:00