Skip to content

PSA - TFM manfiest scan #10218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

/*************************** Service Partitions ******************************/

#define ITS_ID (TFM_SP_BASE + 0)
#define PLATFORM_ID (TFM_SP_BASE + 1)
#define CRYPTO_SRV_ID (TFM_SP_BASE + 2)
#define ATTEST_SRV_ID (TFM_SP_BASE + 3)
#define ATTEST_SRV_ID (TFM_SP_BASE + 0)
#define CRYPTO_SRV_ID (TFM_SP_BASE + 1)
#define PLATFORM_ID (TFM_SP_BASE + 2)
#define ITS_ID (TFM_SP_BASE + 3)

/*************************** Test Partitions *********************************/

Expand Down Expand Up @@ -59,4 +59,4 @@
#define TFM_MAX_USER_PARTITIONS (4)
#endif

#endif // __TFM_PARTITION_DEFS_INC__
#endif // __TFM_PARTITION_DEFS_INC__
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
#ifndef __TFM_PARTITION_LIST_INC__
#define __TFM_PARTITION_LIST_INC__

/******** ITS ********/
PARTITION_DECLARE(ITS, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 10, NORMAL, 2048);
PARTITION_ADD_INIT_FUNC(ITS, its_entry);

/******** PLATFORM ********/
PARTITION_DECLARE(PLATFORM, 0
/******** ATTEST_SRV ********/
PARTITION_DECLARE(ATTEST_SRV, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 8, NORMAL, 1024);
PARTITION_ADD_INIT_FUNC(PLATFORM, platform_partition_entry);
, "APPLICATION-ROT", 37, NORMAL, 8192);
PARTITION_ADD_INIT_FUNC(ATTEST_SRV, attest_main);

/******** CRYPTO_SRV ********/
PARTITION_DECLARE(CRYPTO_SRV, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 35, NORMAL, 16384);
PARTITION_ADD_INIT_FUNC(CRYPTO_SRV, crypto_main);

/******** ATTEST_SRV ********/
PARTITION_DECLARE(ATTEST_SRV, 0
/******** PLATFORM ********/
PARTITION_DECLARE(PLATFORM, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 37, NORMAL, 8192);
PARTITION_ADD_INIT_FUNC(ATTEST_SRV, attest_main);
, "APPLICATION-ROT", 8, NORMAL, 1024);
PARTITION_ADD_INIT_FUNC(PLATFORM, platform_partition_entry);

/******** ITS ********/
PARTITION_DECLARE(ITS, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 10, NORMAL, 2048);
PARTITION_ADD_INIT_FUNC(ITS, its_entry);

#ifdef USE_PSA_TEST_PARTITIONS

Expand Down Expand Up @@ -78,4 +78,4 @@ PARTITION_ADD_INIT_FUNC(SMOKE_TESTS_PART1, smoke_part_main);

#endif // USE_PSA_TEST_PARTITIONS

#endif // __TFM_PARTITION_LIST_INC__
#endif // __TFM_PARTITION_LIST_INC__
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,10 @@
#ifndef __TFM_SERVICE_LIST_INC__
#define __TFM_SERVICE_LIST_INC__

/******** ITS ********/
{"PSA_ITS_GET", ITS_ID, PSA_ITS_GET_MSK, 0x00011A00, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_SET", ITS_ID, PSA_ITS_SET_MSK, 0x00011A01, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_INFO", ITS_ID, PSA_ITS_INFO_MSK, 0x00011A02, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_REMOVE", ITS_ID, PSA_ITS_REMOVE_MSK, 0x00011A03, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_RESET", ITS_ID, PSA_ITS_RESET_MSK, 0x00011A04, false, 1, TFM_VERSION_POLICY_RELAXED},

/******** PLATFORM ********/
{"PSA_PLATFORM_LC_GET", PLATFORM_ID, PSA_PLATFORM_LC_GET_MSK, 0x00011000, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_PLATFORM_LC_SET", PLATFORM_ID, PSA_PLATFORM_LC_SET_MSK, 0x00011001, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_PLATFORM_SYSTEM_RESET", PLATFORM_ID, PSA_PLATFORM_SYSTEM_RESET_MSK, 0x00011002, true, 1, TFM_VERSION_POLICY_RELAXED},
/******** ATTEST_SRV ********/
{"PSA_ATTEST_GET_TOKEN_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN, 0x00000F10, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ATTEST_GET_TOKEN_SIZE_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN_SIZE, 0x00000F11, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ATTEST_INJECT_KEY_ID", ATTEST_SRV_ID, PSA_ATTEST_INJECT_KEY, 0x00000F12, true, 1, TFM_VERSION_POLICY_STRICT},

/******** CRYPTO_SRV ********/
{"PSA_CRYPTO_INIT_ID", CRYPTO_SRV_ID, PSA_CRYPTO_INIT, 0x00000F00, true, 1, TFM_VERSION_POLICY_STRICT},
Expand All @@ -35,10 +28,17 @@
{"PSA_GENERATOR_ID", CRYPTO_SRV_ID, PSA_GENERATOR, 0x00000F09, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ENTROPY_ID", CRYPTO_SRV_ID, PSA_ENTROPY_INJECT, 0x00000F0A, true, 1, TFM_VERSION_POLICY_STRICT},

/******** ATTEST_SRV ********/
{"PSA_ATTEST_GET_TOKEN_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN, 0x00000F10, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ATTEST_GET_TOKEN_SIZE_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN_SIZE, 0x00000F11, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ATTEST_INJECT_KEY_ID", ATTEST_SRV_ID, PSA_ATTEST_INJECT_KEY, 0x00000F12, true, 1, TFM_VERSION_POLICY_STRICT},
/******** PLATFORM ********/
{"PSA_PLATFORM_LC_GET", PLATFORM_ID, PSA_PLATFORM_LC_GET_MSK, 0x00011000, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_PLATFORM_LC_SET", PLATFORM_ID, PSA_PLATFORM_LC_SET_MSK, 0x00011001, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_PLATFORM_SYSTEM_RESET", PLATFORM_ID, PSA_PLATFORM_SYSTEM_RESET_MSK, 0x00011002, true, 1, TFM_VERSION_POLICY_RELAXED},

/******** ITS ********/
{"PSA_ITS_GET", ITS_ID, PSA_ITS_GET_MSK, 0x00011A00, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_SET", ITS_ID, PSA_ITS_SET_MSK, 0x00011A01, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_INFO", ITS_ID, PSA_ITS_INFO_MSK, 0x00011A02, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_REMOVE", ITS_ID, PSA_ITS_REMOVE_MSK, 0x00011A03, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_RESET", ITS_ID, PSA_ITS_RESET_MSK, 0x00011A04, false, 1, TFM_VERSION_POLICY_RELAXED},

#ifdef USE_PSA_TEST_PARTITIONS

Expand Down Expand Up @@ -81,4 +81,4 @@

#endif // USE_PSA_TEST_PARTITIONS

#endif // __TFM_SERVICE_LIST_INC__
#endif // __TFM_SERVICE_LIST_INC__
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,13 @@
#ifndef __TFM_SPM_SIGNAL_DEFS_H__
#define __TFM_SPM_SIGNAL_DEFS_H__

/******** ITS ********/
#define PSA_ITS_GET_MSK_POS (4UL)
#define PSA_ITS_GET_MSK (1UL << PSA_ITS_GET_MSK_POS)
#define PSA_ITS_SET_MSK_POS (5UL)
#define PSA_ITS_SET_MSK (1UL << PSA_ITS_SET_MSK_POS)
#define PSA_ITS_INFO_MSK_POS (6UL)
#define PSA_ITS_INFO_MSK (1UL << PSA_ITS_INFO_MSK_POS)
#define PSA_ITS_REMOVE_MSK_POS (7UL)
#define PSA_ITS_REMOVE_MSK (1UL << PSA_ITS_REMOVE_MSK_POS)
#define PSA_ITS_RESET_MSK_POS (8UL)
#define PSA_ITS_RESET_MSK (1UL << PSA_ITS_RESET_MSK_POS)

/******** PLATFORM ********/
#define PSA_PLATFORM_LC_GET_MSK_POS (4UL)
#define PSA_PLATFORM_LC_GET_MSK (1UL << PSA_PLATFORM_LC_GET_MSK_POS)
#define PSA_PLATFORM_LC_SET_MSK_POS (5UL)
#define PSA_PLATFORM_LC_SET_MSK (1UL << PSA_PLATFORM_LC_SET_MSK_POS)
#define PSA_PLATFORM_SYSTEM_RESET_MSK_POS (6UL)
#define PSA_PLATFORM_SYSTEM_RESET_MSK (1UL << PSA_PLATFORM_SYSTEM_RESET_MSK_POS)
/******** ATTEST_SRV ********/
#define PSA_ATTEST_GET_TOKEN_POS (4UL)
#define PSA_ATTEST_GET_TOKEN (1UL << PSA_ATTEST_GET_TOKEN_POS)
#define PSA_ATTEST_GET_TOKEN_SIZE_POS (5UL)
#define PSA_ATTEST_GET_TOKEN_SIZE (1UL << PSA_ATTEST_GET_TOKEN_SIZE_POS)
#define PSA_ATTEST_INJECT_KEY_POS (6UL)
#define PSA_ATTEST_INJECT_KEY (1UL << PSA_ATTEST_INJECT_KEY_POS)

/******** CRYPTO_SRV ********/
#define PSA_CRYPTO_INIT_POS (4UL)
Expand All @@ -54,13 +42,25 @@
#define PSA_ENTROPY_INJECT_POS (14UL)
#define PSA_ENTROPY_INJECT (1UL << PSA_ENTROPY_INJECT_POS)

/******** ATTEST_SRV ********/
#define PSA_ATTEST_GET_TOKEN_POS (4UL)
#define PSA_ATTEST_GET_TOKEN (1UL << PSA_ATTEST_GET_TOKEN_POS)
#define PSA_ATTEST_GET_TOKEN_SIZE_POS (5UL)
#define PSA_ATTEST_GET_TOKEN_SIZE (1UL << PSA_ATTEST_GET_TOKEN_SIZE_POS)
#define PSA_ATTEST_INJECT_KEY_POS (6UL)
#define PSA_ATTEST_INJECT_KEY (1UL << PSA_ATTEST_INJECT_KEY_POS)
/******** PLATFORM ********/
#define PSA_PLATFORM_LC_GET_MSK_POS (4UL)
#define PSA_PLATFORM_LC_GET_MSK (1UL << PSA_PLATFORM_LC_GET_MSK_POS)
#define PSA_PLATFORM_LC_SET_MSK_POS (5UL)
#define PSA_PLATFORM_LC_SET_MSK (1UL << PSA_PLATFORM_LC_SET_MSK_POS)
#define PSA_PLATFORM_SYSTEM_RESET_MSK_POS (6UL)
#define PSA_PLATFORM_SYSTEM_RESET_MSK (1UL << PSA_PLATFORM_SYSTEM_RESET_MSK_POS)

/******** ITS ********/
#define PSA_ITS_GET_MSK_POS (4UL)
#define PSA_ITS_GET_MSK (1UL << PSA_ITS_GET_MSK_POS)
#define PSA_ITS_SET_MSK_POS (5UL)
#define PSA_ITS_SET_MSK (1UL << PSA_ITS_SET_MSK_POS)
#define PSA_ITS_INFO_MSK_POS (6UL)
#define PSA_ITS_INFO_MSK (1UL << PSA_ITS_INFO_MSK_POS)
#define PSA_ITS_REMOVE_MSK_POS (7UL)
#define PSA_ITS_REMOVE_MSK (1UL << PSA_ITS_REMOVE_MSK_POS)
#define PSA_ITS_RESET_MSK_POS (8UL)
#define PSA_ITS_RESET_MSK (1UL << PSA_ITS_RESET_MSK_POS)

#ifdef USE_PSA_TEST_PARTITIONS

Expand Down Expand Up @@ -120,4 +120,4 @@

#endif // USE_PSA_TEST_PARTITIONS

#endif // __TFM_SPM_SIGNAL_DEFS_H__
#endif // __TFM_SPM_SIGNAL_DEFS_H__
30 changes: 15 additions & 15 deletions components/TARGET_PSA/inc/psa_manifest/sid.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,10 @@

/*********** WARNING: This is an auto-generated file. Do not edit! ***********/

/******** ITS ********/
#define PSA_ITS_GET 0x00011A00
#define PSA_ITS_SET 0x00011A01
#define PSA_ITS_INFO 0x00011A02
#define PSA_ITS_REMOVE 0x00011A03
#define PSA_ITS_RESET 0x00011A04

/******** PLATFORM ********/
#define PSA_PLATFORM_LC_GET 0x00011000
#define PSA_PLATFORM_LC_SET 0x00011001
#define PSA_PLATFORM_SYSTEM_RESET 0x00011002
/******** ATTEST_SRV ********/
#define PSA_ATTEST_GET_TOKEN_ID 0x00000F10
#define PSA_ATTEST_GET_TOKEN_SIZE_ID 0x00000F11
#define PSA_ATTEST_INJECT_KEY_ID 0x00000F12

/******** CRYPTO_SRV ********/
#define PSA_CRYPTO_INIT_ID 0x00000F00
Expand All @@ -42,10 +35,17 @@
#define PSA_GENERATOR_ID 0x00000F09
#define PSA_ENTROPY_ID 0x00000F0A

/******** ATTEST_SRV ********/
#define PSA_ATTEST_GET_TOKEN_ID 0x00000F10
#define PSA_ATTEST_GET_TOKEN_SIZE_ID 0x00000F11
#define PSA_ATTEST_INJECT_KEY_ID 0x00000F12
/******** PLATFORM ********/
#define PSA_PLATFORM_LC_GET 0x00011000
#define PSA_PLATFORM_LC_SET 0x00011001
#define PSA_PLATFORM_SYSTEM_RESET 0x00011002

/******** ITS ********/
#define PSA_ITS_GET 0x00011A00
#define PSA_ITS_SET 0x00011A01
#define PSA_ITS_INFO 0x00011A02
#define PSA_ITS_REMOVE 0x00011A03
#define PSA_ITS_RESET 0x00011A04



Expand Down
13 changes: 3 additions & 10 deletions tools/psa/generate_tfm_partition_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,12 @@
sys.path.insert(0, ROOT)

from tools.psa.mbed_spm_tfm_common import \
Manifest, validate_partition_manifests, manifests_discovery, MBED_OS_ROOT, SERVICES_DIR, TESTS_DIR
Manifest, validate_partition_manifests, manifests_discovery, MBED_OS_ROOT

__version__ = '1.0'
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
TEMPLATES_LIST_FILE = path_join(SCRIPT_DIR, 'tfm', 'tfm_generated_file_list.json')

SERVICES_MANIFESTS = [
path_join(SERVICES_DIR, 'storage', 'its', 'pits_psa.json'),
path_join(SERVICES_DIR, 'platform', 'platform_psa.json'),
path_join(SERVICES_DIR, 'crypto', 'crypto_partition_psa.json'),
path_join(SERVICES_DIR, 'attestation', 'attestation_partition_psa.json')
]


def parse_manifests(manifests_files):
region_list = []
Expand Down Expand Up @@ -104,8 +97,8 @@ def generate_partition_source_files(service_manifest_files, test_manifest_files,


def generate_tfm_code():
_, tests_manifests = manifests_discovery(TESTS_DIR)
generate_partition_source_files(SERVICES_MANIFESTS, tests_manifests)
service_manifests, tests_manifests = manifests_discovery(MBED_OS_ROOT)
generate_partition_source_files(service_manifests, tests_manifests)


if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions tools/psa/tfm/templates/sid.h.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
{% endfor %}

{% endfor %}
{# End of file #}
1 change: 1 addition & 0 deletions tools/psa/tfm/templates/tfm_partition_defs.inc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@
#endif

#endif // __TFM_PARTITION_DEFS_INC__
{# End of file #}
1 change: 1 addition & 0 deletions tools/psa/tfm/templates/tfm_partition_list.inc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ PARTITION_ADD_INIT_FUNC({{partition.name|upper}}, {{partition.entry_point}});
#endif // USE_PSA_TEST_PARTITIONS

#endif // __TFM_PARTITION_LIST_INC__
{# End of file #}
1 change: 1 addition & 0 deletions tools/psa/tfm/templates/tfm_service_list.inc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
#endif // USE_PSA_TEST_PARTITIONS

#endif // __TFM_SERVICE_LIST_INC__
{# End of file #}
1 change: 1 addition & 0 deletions tools/psa/tfm/templates/tfm_spm_signal_defs.h.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
#endif // USE_PSA_TEST_PARTITIONS

#endif // __TFM_SPM_SIGNAL_DEFS_H__
{# End of file #}