History log of /optee_os/core/tee/fs_htree.c (Results 1 – 25 of 31)
Revision Date Author Comments
# 6e1990d7 03-Nov-2025 Ox Yeh <ox.yeh@mediatek.com>

core: fs_htree: fix incorrect data type in create_and_sync

Fixes an incorrect data type used in the create_and_sync function.
When this function calls tee_fs_htree_sync_to_storage, it may invoke
tee

core: fs_htree: fix incorrect data type in create_and_sync

Fixes an incorrect data type used in the create_and_sync function.
When this function calls tee_fs_htree_sync_to_storage, it may invoke
tee_fs_htree_close to free the input hash tree in error cases.
Therefore, the input type should be struct tee_fs_htree **ht_arg
to handle these scenarios correctly.

Link: https://github.com/OP-TEE/optee_os/issues/7512
Fixes: 5a9d570a8d7f ("core: fs_htree: re-init hash tree when both tag and counter are zero")

Signed-off-by: Ox Yeh <ox.yeh@mediatek.com>
Reviewed-by: Menson Chen <menson.chen@mediatek.com>
Reviewed-by: Rayan Hu <rayan.hu@mediatek.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 5a9d570a 03-Oct-2025 Ox Yeh <ox.yeh@mediatek.com>

core: fs_htree: re-init hash tree when both tag and counter are zero

Creating and update a hash tree involves several RPC commands.
If a power loss occurs during the creation flow, it may result
in

core: fs_htree: re-init hash tree when both tag and counter are zero

Creating and update a hash tree involves several RPC commands.
If a power loss occurs during the creation flow, it may result
in a hash tree with an incomplete header and a counter value of 0.
If attempting to read this file subsequently leads to a
TEE_ERROR_CORRUPT_OBJECT error.

Instead of returning TEE_ERROR_CORRUPT_OBJECT, continue the
initialization flow to support subsequent functionality.

Link: https://github.com/OP-TEE/optee_os/issues/7512
Fixes: 50a814981d8b ("core: provide a hash tree for secure storage")

Signed-off-by: Ox Yeh <ox.yeh@mediatek.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# d0ea0f9f 23-Apr-2025 Etienne Carriere <etienne.carriere@foss.st.com>

core: fs_htree: Fix AAD length when CFG_REE_FS_HTREE_HASH_SIZE_COMPAT=y

Correct the hash size declared in AAD length declared in REE FS hash
tree authentication sequence when CFG_REE_FS_HTREE_HASH_S

core: fs_htree: Fix AAD length when CFG_REE_FS_HTREE_HASH_SIZE_COMPAT=y

Correct the hash size declared in AAD length declared in REE FS hash
tree authentication sequence when CFG_REE_FS_HTREE_HASH_SIZE_COMPAT is
enabled in which case the hash is truncated to the size of the
FEK key (TEE_FS_HTREE_FEK_SIZE).

The issue has currently no impact since REE FS hash tree authentication
is based on AES-GCM but it would be of importance if, for example, one
moves to an AES-CCM scheme while still enabling
CFG_REE_FS_HTREE_HASH_SIZE_COMPAT (even if unlikely to happen).
To prevent such issue in the future, let's declare the effectively
used hash size.

Suggested-by: Jens Wiklander <jens.wiklander@linaro.org>
Link: https://github.com/OP-TEE/optee_os/pull/7340/commits/087325faec7c057a638cca80f0549e9abe49f190#r2024716984
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 89da7ffe 31-Mar-2025 Anil Kumar Reddy <areddy3@marvell.com>

core: fs_htree: Fix wrong AAD length in authenc_init()

In authenc_init(), AAD length field passed to
crypto_authenc_init() does not match with the total
AAd data passed via crypto_authenc_update_aad

core: fs_htree: Fix wrong AAD length in authenc_init()

In authenc_init(), AAD length field passed to
crypto_authenc_init() does not match with the total
AAd data passed via crypto_authenc_update_aad() for
lower layer crypto computation.

To fix this issue and to support the legacy without
breaking existing REE file system content, introduce
a config CFG_REE_FS_HTREE_HASH_SIZE_COMPAT.

By default this config is enabled to support the legacy
REE FS hash tree that uses truncated hash implementation.

Link: https://github.com/OP-TEE/optee_os/issues/7331
Signed-off-by: Anil Kumar Reddy <areddy3@marvell.com>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 623b9bd4 23-Aug-2023 Jens Wiklander <jens.wiklander@linaro.org>

core: use monotonic counter for secure storage without RPMB

If OP-TEE is configured without RPMB (CFG_REE_FS_INTEGRITY_RPMB=n), use
the non-volatile monotonic counter interface instead to protect ag

core: use monotonic counter for secure storage without RPMB

If OP-TEE is configured without RPMB (CFG_REE_FS_INTEGRITY_RPMB=n), use
the non-volatile monotonic counter interface instead to protect against
rollback of the REE FS base secure storage.

If configured without CFG_WARN_INSECURE=y, accept
TEE_ERROR_NOT_IMPLEMENTED error from nv_counter_get_ree_fs() and
nv_counter_incr_ree_fs_to() and warn once to make clear that the
configuration isn't secure.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Tested-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 499f488f 25-Oct-2022 Joakim Nordell <joakim.nordell@axis.com>

core: avoid TA panic when secure storage is corrupt

init_head_from_data() triggers a TA panic in case corrupt data is read
from the secure storage, for instance by request from the PKCS#11
trusted a

core: avoid TA panic when secure storage is corrupt

init_head_from_data() triggers a TA panic in case corrupt data is read
from the secure storage, for instance by request from the PKCS#11
trusted application.
"Every Trusted Storage implementation is expected to return
TEE_ERROR_CORRUPT_OBJECT if a Trusted Application attempts to open
an object and the TEE determines that its contents (or those of the
storage itself) have been tampered with or rolled back."
See TEE Internal Core API Specification v1.1.2, section 5.7.1.

Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Zengxx <zengxiaoxu@huawei.com>
Signed-off-by: Joakim Nordell <joakim.nordell@axis.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>

show more ...


# 52ee414b 04-Mar-2019 Jens Wiklander <jens.wiklander@linaro.org>

core: remove algo from crypto_authenc_*()

Removes the algo parameters from all crypto_authenc_*() functions except
crypto_authenc_alloc_ctx().

Reviewed-by: Etienne Carriere <etienne.carriere@linaro

core: remove algo from crypto_authenc_*()

Removes the algo parameters from all crypto_authenc_*() functions except
crypto_authenc_alloc_ctx().

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 6b3a371c 01-Mar-2019 Jens Wiklander <jens.wiklander@linaro.org>

core: remove algo from crypto_hash_*()

Removes the algo parameters from all crypto_hash_*() functions except
crypto_hash_alloc_ctx().

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Ack

core: remove algo from crypto_hash_*()

Removes the algo parameters from all crypto_hash_*() functions except
crypto_hash_alloc_ctx().

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 48e10604 14-Feb-2019 Jerome Forissier <jerome.forissier@linaro.org>

libutils: remove buf_compare_ct()

Now that we have consttime_memcmp(), buf_compare_ct() is redundant.
Every time buf_compare_ct() is used, consttime_memcmp() may be used
instead.

This commit remove

libutils: remove buf_compare_ct()

Now that we have consttime_memcmp(), buf_compare_ct() is redundant.
Every time buf_compare_ct() is used, consttime_memcmp() may be used
instead.

This commit removes buf_compare_ct(). A compatibility wrapper is kept
in <string_ext.h> to avoid knowingly breaking the build of any TA that
may use it.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 6009538c 24-Oct-2018 Jens Wiklander <jens.wiklander@linaro.org>

core: introduce generic optee_rpc_cmd.h

Replaces the OPTEE_MSG RPC command protocol descriptions in optee_msg.h
and optee_msg_supplicant with a generic optee_rpc_cmd.h. Defined names
are also refact

core: introduce generic optee_rpc_cmd.h

Replaces the OPTEE_MSG RPC command protocol descriptions in optee_msg.h
and optee_msg_supplicant with a generic optee_rpc_cmd.h. Defined names
are also refactored to mirror the new structure.

Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 655c204e 18-May-2018 Jens Wiklander <jens.wiklander@linaro.org>

core: htree: fix meta inclusion in root hash

Prior to this patch was the size of the meta data supplied as the size
of the pointer to meta data. With this patch the size is corrected to be
the size

core: htree: fix meta inclusion in root hash

Prior to this patch was the size of the meta data supplied as the size
of the pointer to meta data. With this patch the size is corrected to be
the size of meta data itself.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Fixes: https://github.com/OP-TEE/optee_os/issues/2330
Fixes: 94a72998bc1d ("core: fs_htree: include meta in root hash")
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 112261f7 13-Feb-2018 Jerome Forissier <jerome.forissier@linaro.org>

core: fs_htree: fix authenc_init() error path

- Add missing crypto_authenc_free_ctx()
- Do not call crypto_authenc_final() if crypto_authenc_init() was not
successful

Signed-off-by: Jerome Forissie

core: fs_htree: fix authenc_init() error path

- Add missing crypto_authenc_free_ctx()
- Do not call crypto_authenc_final() if crypto_authenc_init() was not
successful

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reported-by: Summer Qin <summer.qin@arm.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 94a72998 01-Feb-2018 Jens Wiklander <jens.wiklander@linaro.org>

core: fs_htree: include meta in root hash

Includes the meta data when calculating the hash of the root node to
detect changes in file length while number of blocks is unchanged.

Signed-off-by: Jens

core: fs_htree: include meta in root hash

Includes the meta data when calculating the hash of the root node to
detect changes in file length while number of blocks is unchanged.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Fixes: https://github.com/OP-TEE/optee_os/issues/2094
Reported-by: Kevin Peng <kevinp@marvell.com>
Tested-by: Kevin Peng <kevinp@marvell.com>
[jf: add Fixes:, Reported-by: and Tested-by: tags]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# 33e4def6 25-Jan-2018 Jerome Forissier <jerome.forissier@linaro.org>

core: REE FS: make sure dirty flag is set when object is truncated

When an object is truncated but the number of blocks is unchanged, only
the metadata's length field is modified. The hash tree laye

core: REE FS: make sure dirty flag is set when object is truncated

When an object is truncated but the number of blocks is unchanged, only
the metadata's length field is modified. The hash tree layer has to be
notified so that it knows it has to flush the data before closing the
object, otherwise the truncation is lost.
Add a function for that purpose: tee_fs_htree_meta_set_dirty(), and
call it whenever meta->length is updated.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# d7ac7d0f 21-Dec-2017 Jens Wiklander <jens.wiklander@linaro.org>

core: crypto.h manages authenc context memory

To ease integration with other crypto libraries change the authenc context
interface in crypto.h to manage the memory used for the authenc context.

Rev

core: crypto.h manages authenc context memory

To ease integration with other crypto libraries change the authenc context
interface in crypto.h to manage the memory used for the authenc context.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# ecf2e014 21-Dec-2017 Jens Wiklander <jens.wiklander@linaro.org>

core: crypto.h manages hash context memory

To ease integration with other crypto libraries change the hash context
interface in crypto.h to manage the memory used for the hash context.

Reviewed-by:

core: crypto.h manages hash context memory

To ease integration with other crypto libraries change the hash context
interface in crypto.h to manage the memory used for the hash context.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# b1d7375c 15-Dec-2017 Jerome Forissier <jerome.forissier@linaro.org>

Remove 'All rights reserved' from Linaro files

The text 'All rights reserved' is useless [1]. The Free Software
Foundation's REUSE Initiative best practices document [2] does not
contain these words

Remove 'All rights reserved' from Linaro files

The text 'All rights reserved' is useless [1]. The Free Software
Foundation's REUSE Initiative best practices document [2] does not
contain these words. Therefore, we can safely remove the text from the
files that are owned by Linaro.

Generated by:
spdxify.py --linaro-only --strip-arr optee_os/

Link: [1] https://en.wikipedia.org/wiki/All_rights_reserved
Link: [2] https://reuse.software/practices/
Link: [3] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Joakim Bech <joakim.bech@linaro.org>

show more ...


# 78b7c7c7 15-Dec-2017 Jerome Forissier <jerome.forissier@linaro.org>

Remove license notice from Linaro files

Now that we have added SPDX identifiers, we can safely remove the
verbose license text from the files that are owned by Linaro.

Generated by [1]:
spdxify.p

Remove license notice from Linaro files

Now that we have added SPDX identifiers, we can safely remove the
verbose license text from the files that are owned by Linaro.

Generated by [1]:
spdxify.py --linaro-only --strip-license-text optee_os/

Link: [1] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Joakim Bech <joakim.bech@linaro.org>

show more ...


# 1bb92983 15-Dec-2017 Jerome Forissier <jerome.forissier@linaro.org>

Add SPDX license identifiers

Adds one SPDX-License-Identifier line [1] to each source files that
contains license text.

Generated by [2]:
spdxify.py --add-spdx optee_os/

The scancode tool [3] wa

Add SPDX license identifiers

Adds one SPDX-License-Identifier line [1] to each source files that
contains license text.

Generated by [2]:
spdxify.py --add-spdx optee_os/

The scancode tool [3] was used to double check the license matching
code in the Python script. All the licenses detected by scancode are
either detected by spdxify.py, or have no SPDX identifier, or are false
matches.

Link: [1] https://spdx.org/licenses/
Link: [2] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py
Link: [3] https://github.com/nexB/scancode-toolkit
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Joakim Bech <joakim.bech@linaro.org>

show more ...


# 09eedd2d 28-Nov-2017 Jens Wiklander <jens.wiklander@linaro.org>

core: fs_htree: bugfix creating empty file

Fixes problem with creating an empty htree file.

Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Acked-by: Jerome Forissier <jerome.forissier@lina

core: fs_htree: bugfix creating empty file

Fixes problem with creating an empty htree file.

Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# e1770e71 13-Nov-2017 Jens Wiklander <jens.wiklander@linaro.org>

core: rename to <crypto/crypto.h>

Renames core/include/tee/tee_cryp_provider.h to
core/include/crypto/crypto.h

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere

core: rename to <crypto/crypto.h>

Renames core/include/tee/tee_cryp_provider.h to
core/include/crypto/crypto.h

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 8875ce46 10-Nov-2017 Jens Wiklander <jens.wiklander@linaro.org>

Replace struct authenc_ops with function interface

Adds crypto_authenc_*() replacing struct authenc_ops in crypto_ops.

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne

Replace struct authenc_ops with function interface

Adds crypto_authenc_*() replacing struct authenc_ops in crypto_ops.

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# b887bd8f 09-Nov-2017 Jens Wiklander <jens.wiklander@linaro.org>

Replace struct hash_ops with function interface

Adds crypto_hash_get_ctx_size(), crypto_hash_init(),
crypto_hash_update() and crypto_hash_final() replacing struct hash_ops
in crypto_ops.

Acked-by:

Replace struct hash_ops with function interface

Adds crypto_hash_get_ctx_size(), crypto_hash_init(),
crypto_hash_update() and crypto_hash_final() replacing struct hash_ops
in crypto_ops.

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 36a063ef 03-Nov-2017 Jens Wiklander <jens.wiklander@linaro.org>

Replace struct prng_ops with function interface

Adds crypto_rng_add_entropy() and crypto_rng_read() replacing
struct prng_ops in crypto_ops.

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.o

Replace struct prng_ops with function interface

Adds crypto_rng_add_entropy() and crypto_rng_read() replacing
struct prng_ops in crypto_ops.

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU)
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 455856d4 19-Apr-2017 Jens Wiklander <jens.wiklander@linaro.org>

Remove SQL-FS

With recent developments in REE-FS SQL-FS has become redundant. This
patch removes SQL-FS.

Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Acked-by: Jerome Forissier <jerome.forissi

Remove SQL-FS

With recent developments in REE-FS SQL-FS has become redundant. This
patch removes SQL-FS.

Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU)
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


12