Home
last modified time | relevance | path

Searched hist:"931 c8c5e79f08c60e42b47fadf59d67b1862810b" (Results 1 – 1 of 1) sorted by relevance

/optee_os/ta/pkcs11/src/
H A Dpersistent_token.c931c8c5e79f08c60e42b47fadf59d67b1862810b Wed Aug 14 01:24:22 UTC 2024 Weizhao Jiang <weizhaoj@amazon.com> ta: pkcs11: write db_main and db_objs in one operation

Problem:
There is a potential issue in persistent_token.c::init_persistent_db().
There are two steps to initialize a token DB if it doesn’t exist:
1. Call TEE_CreatePersistentObject() with db_main as the initial data.
2. Truncate the object data and then insert db_obj data.
If a power loss occurs between above two steps, only the db_main data is
present in the database. When the device restarts, it detects the existing
database and successfully reads db_main, but fails to read db_obj, leading
to a TA panic each time.
https://github.com/OP-TEE/optee_os/issues/6977

Solution:
Write both db_main and the initial 4 bytes of db_objs (with a count of 0)
in a single operation during TEE_CreatePersistentObject().

Tested-by: Weizhao Jiang <weizhaoj@amazon.com>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Weizhao Jiang <weizhaoj@amazon.com>