@@ -91,6 +91,108 @@ component_test_accel_ecc_all_but_ecp_light() {
9191 ctest
9292}
9393
94+ # This is a common configuration helper used directly from
95+ # common_test_accel_ecc_ffdh_no_bignum and indirectly from:
96+ # - component_test_accel_ecc_no_bignum
97+ # - accelerate all EC algs, disable RSA and FFDH
98+ # - component_test_accel_ecc_ffdh_no_bignum
99+ # - accelerate all EC and FFDH algs, disable only RSA
100+ #
101+ # This function accepts one parameter:
102+ # $1: a string value which states which components are tested. Allowed values
103+ # are "ECC" or "ECC_DH".
104+ config_accel_ecc_ffdh_no_bignum () {
105+ test_target=" $1 "
106+
107+ scripts/config.py " full"
108+
109+ # Disable all the features that auto-enable ECP_LIGHT (see build_info.h)
110+ scripts/config.py unset MBEDTLS_PK_PARSE_EC_EXTENDED
111+ scripts/config.py unset MBEDTLS_PK_PARSE_EC_COMPRESSED
112+ scripts/config.py unset PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE
113+
114+ # RSA support is intentionally disabled on this test because RSA_C depends
115+ # on BIGNUM_C.
116+ scripts/config.py unset-all " PSA_WANT_KEY_TYPE_RSA_[0-9A-Z_a-z]*"
117+ scripts/config.py unset-all " PSA_WANT_ALG_RSA_[0-9A-Z_a-z]*"
118+
119+ if [ " $test_target " = " ECC" ]; then
120+ # When testing ECC only, we disable FFDH support.
121+ scripts/config.py unset PSA_WANT_ALG_FFDH
122+ scripts/config.py unset-all " PSA_WANT_KEY_TYPE_DH_[0-9A-Z_a-z]*"
123+ scripts/config.py unset-all " PSA_WANT_DH_RFC7919_[0-9]*"
124+ fi
125+
126+ # Restartable feature is not yet supported by PSA. Once it will in
127+ # the future, the following line could be removed (see issues
128+ # 6061, 6332 and following ones)
129+ scripts/config.py unset MBEDTLS_ECP_RESTARTABLE
130+ }
131+
132+ # Common helper used by:
133+ # - component_test_accel_ecc_no_bignum
134+ # - component_test_accel_ecc_ffdh_no_bignum
135+ #
136+ # The goal is to build and test accelerating either:
137+ # - ECC only or
138+ # - both ECC and FFDH
139+ common_test_accel_ecc_ffdh_no_bignum () {
140+ test_target=" $1 "
141+
142+ # This is an internal helper to simplify text message handling
143+ if [ " $test_target " = " ECC_DH" ]; then
144+ accel_text=" ECC/FFDH"
145+ removed_text=" ECP - DH"
146+ else
147+ accel_text=" ECC"
148+ removed_text=" ECP"
149+ fi
150+
151+ msg " build: full + accelerated $accel_text algs - $removed_text - BIGNUM"
152+
153+ # Configure
154+ # ---------
155+
156+ config_accel_ecc_ffdh_no_bignum " $test_target "
157+
158+ if [ " $test_target " = " ECC_DH" ]; then
159+ user_config_accel_file_path=" ../tests/configs/user-config-accel-ecc-ffdh.h"
160+ else
161+ user_config_accel_file_path=" ../tests/configs/user-config-accel-ecc.h"
162+ fi
163+
164+ # Build
165+ # -----
166+
167+ cd $OUT_OF_SOURCE_DIR
168+ cmake -DTF_PSA_CRYPTO_TEST_DRIVER=On \
169+ -DTF_PSA_CRYPTO_USER_CONFIG_FILE=" ${user_config_accel_file_path} " ..
170+ make
171+
172+ # Make sure any built-in EC alg was not re-enabled
173+ not grep mbedtls_ecdsa_ ${CMAKE_BUILTIN_BUILD_DIR} /ecdsa.o
174+ not grep mbedtls_psa_key_agreement_ecdh ${CMAKE_BUILTIN_BUILD_DIR} /psa_crypto_ecp.o
175+ not grep mbedtls_ecjpake_ ${CMAKE_BUILTIN_BUILD_DIR} /ecjpake.o
176+ # Also ensure that ECP, RSA or BIGNUM modules were not re-enabled
177+ not grep mbedtls_ecp_ ${CMAKE_BUILTIN_BUILD_DIR} /ecp.o
178+ not grep mbedtls_rsa_ ${CMAKE_BUILTIN_BUILD_DIR} /rsa.o
179+ not grep mbedtls_mpi_ ${CMAKE_BUILTIN_BUILD_DIR} /bignum.o
180+
181+ # Run the tests
182+ # -------------
183+
184+ msg " test suites: full + accelerated $accel_text algs - $removed_text - BIGNUM"
185+ ctest
186+ }
187+
188+ component_test_accel_ecc_no_bignum () {
189+ common_test_accel_ecc_ffdh_no_bignum " ECC"
190+ }
191+
192+ component_test_accel_ecc_ffdh_no_bignum () {
193+ common_test_accel_ecc_ffdh_no_bignum " ECC_DH"
194+ }
195+
94196component_test_accel_ecc_some_key_types () {
95197 msg " build: full with accelerated EC algs and some key types"
96198
0 commit comments