mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-07-16 17:37:42 +00:00
Allow use of persistent keys, including configuring them, importing and exporting them, and destroying them. When getting a slot using psa_get_key_slot, there are 3 scenarios that can occur if the keys lifetime is persistent: 1. Key type is PSA_KEY_TYPE_NONE, no persistent storage entry: - The key slot is treated as a standard empty key slot 2. Key type is PSA_KEY_TYPE_NONE, persistent storage entry exists: - Attempt to load the key from persistent storage 3. Key type is not PSA_KEY_TYPE_NONE: - As checking persistent storage on every use of the key could be expensive, the persistent key is assumed to be saved in persistent storage, the in-memory key is continued to be used.
83 lines
2.3 KiB
Makefile
83 lines
2.3 KiB
Makefile
CFLAGS ?= -O2 -I../include -I../library
|
|
WARNING_CFLAGS ?= \
|
|
-Werror -Wall -Wextra \
|
|
-Wno-unused-function \
|
|
-Wno-overlength-strings \
|
|
-Wdeclaration-after-statement \
|
|
# Don't delete this line.
|
|
|
|
LDFLAGS ?= -L../library -lmbedcrypto
|
|
|
|
DEP := ../library/libmbedcrypto.a
|
|
|
|
# Python executable
|
|
PYTHON ?= python
|
|
|
|
APPS := \
|
|
test_suite_psa_crypto \
|
|
test_suite_psa_crypto_metadata \
|
|
test_suite_psa_crypto_persistent_key \
|
|
test_suite_psa_crypto_storage_file \
|
|
# Don't delete this line.
|
|
|
|
# Look up for associated function files
|
|
func.test_suite_psa_crypto := test_suite_psa_crypto
|
|
func.test_suite_psa_crypto_metadata := test_suite_psa_crypto_metadata
|
|
func.test_suite_psa_crypto_persistent_key := test_suite_psa_crypto_persistent_key
|
|
func.test_suite_psa_crypto_storage_file := test_suite_psa_crypto_storage_file
|
|
|
|
.SILENT:
|
|
|
|
.PHONY: all test clean
|
|
|
|
all: $(APPS)
|
|
|
|
$(DEP):
|
|
$(MAKE) -C ../library
|
|
|
|
C_FILES := $(addsuffix .c,$(APPS))
|
|
|
|
.SECONDEXPANSION:
|
|
$(C_FILES): %.c: suites/$$(func.$$*).function suites/%.data scripts/generate_test_code.py suites/helpers.function suites/main_test.function suites/host_test.function
|
|
echo " Gen $@"
|
|
$(PYTHON) scripts/generate_test_code.py -f suites/$(func.$*).function \
|
|
-d suites/$*.data \
|
|
-t suites/main_test.function \
|
|
-p suites/host_test.function \
|
|
-s suites \
|
|
--helpers-file suites/helpers.function \
|
|
-o .
|
|
|
|
|
|
$(APPS): %: %.c $(DEP)
|
|
echo " CC $<"
|
|
$(CC) $(CFLAGS) $(WARNING_CFLAGS) $< $(LDFLAGS) -o $@
|
|
|
|
clean:
|
|
rm -rf $(APPS) *.c *.data TESTS
|
|
rm -rf data_files/ctr_drbg_seed data_files/hmac_drbg_seed data_files/mpi_write
|
|
|
|
test: $(APPS)
|
|
./test_suite_psa_crypto_metadata
|
|
./test_suite_psa_crypto
|
|
./test_suite_psa_crypto_persistent_key
|
|
./test_suite_psa_crypto_storage_file
|
|
|
|
# Create separate targets for generating embedded tests.
|
|
EMBEDDED_TESTS := $(addprefix embedded_,$(APPS))
|
|
|
|
# Generate test code for target.
|
|
|
|
.SECONDEXPANSION:
|
|
$(EMBEDDED_TESTS): embedded_%: suites/$$(func.$$*).function suites/%.data scripts/generate_test_code.py suites/helpers.function suites/main_test.function suites/target_test.function
|
|
echo " Gen ./TESTS/mbedcrypto/$*/$*.c"
|
|
$(PYTHON) scripts/generate_test_code.py -f suites/$(func.$*).function \
|
|
-d suites/$*.data \
|
|
-t suites/main_test.function \
|
|
-p suites/target_test.function \
|
|
-s suites \
|
|
--helpers-file suites/helpers.function \
|
|
-o ./TESTS/mbedcrypto/$*
|
|
|
|
gen-embedded-test: $(EMBEDDED_TESTS)
|