Skip to content

Commit 20478ba

Browse files
author
Oren Cohen
committed
Last update
1 parent b0cbe81 commit 20478ba

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

components/TARGET_PSA/services/psa_prot_internal_storage/COMPONENT_PSA_SRV_IMPL/pits_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ psa_its_status_t psa_its_set_impl(int32_t pid, psa_its_uid_t uid, uint32_t data_
210210
its_init();
211211
}
212212

213-
if ((create_flags & (~PSA_ITS_FLAGS_BIT_MASK)) != 0) {
213+
if ((create_flags & (~PSA_ITS_FLAGS_MSK)) != 0) {
214214
return PSA_ITS_ERROR_FLAGS_NOT_SUPPORTED;
215215
}
216216

@@ -243,7 +243,7 @@ psa_its_status_t psa_its_get_impl(int32_t pid, psa_its_uid_t uid, uint32_t data_
243243

244244
if (status == MBED_SUCCESS) {
245245
if (data_offset > kv_info.size) {
246-
return PSA_PS_ERROR_OFFSET_INVALID;
246+
return PSA_ITS_ERROR_OFFSET_INVALID;
247247
}
248248

249249
// Verify (size + offset) does not wrap around

components/TARGET_PSA/services/psa_prot_internal_storage/COMPONENT_PSA_SRV_IMPL/pits_impl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ extern "C"
2727

2828
#define PITS_DATA_PTR_AT_OFFSET(ptr, offset) ((void *)(((uintptr_t)ptr) + ((uintptr_t)offset)))
2929
#define STR_EXPAND(tok) #tok
30-
#define PSA_ITS_FLAGS_BIT_MASK (PSA_ITS_FLAG_NONE | PSA_ITS_FLAG_WRITE_ONCE)
3130

3231
psa_its_status_t psa_its_set_impl(int32_t pid, psa_its_uid_t uid, uint32_t data_length, const void *p_data, psa_its_create_flags_t create_flags);
3332
psa_its_status_t psa_its_get_impl(int32_t pid, psa_its_uid_t uid, uint32_t data_offset, uint32_t data_length, void *p_data);

components/TARGET_PSA/services/psa_prot_internal_storage/psa_prot_internal_storage.h

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
/* Copyright (c) 2018 ARM Limited
2-
*
3-
* SPDX-License-Identifier: Apache-2.0
1+
#ifndef __INTERNAL_TRUSTED_STORAGE_H__
2+
#define __INTERNAL_TRUSTED_STORAGE_H__
3+
/* Copyright (C) 2019, ARM Limited, All Rights Reserved
4+
* SPDX-License-Identifier: Apache-2.0
45
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
6+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
89
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* http://www.apache.org/licenses/LICENSE-2.0
1011
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
1617
*/
17-
18-
#ifndef __INTERNAL_TRUSTED_STORAGE_H__
19-
#define __INTERNAL_TRUSTED_STORAGE_H__
20-
2118
/** @file
2219
@brief This file describes the PSA Internal Trusted Storage API
2320
*/
@@ -41,6 +38,12 @@ typedef uint64_t psa_its_uid_t;
4138

4239
#define PSA_ITS_FLAG_NONE 0 /**< No flags to pass */
4340
#define PSA_ITS_FLAG_WRITE_ONCE ( 1 << 0 ) /**< The data associated with the key will not be able to be modified or deleted. Intended to be used to set bits in `psa_its_create_flags_t` */
41+
/** Mask for all of the ITS Flags
42+
*/
43+
#define PSA_ITS_FLAGS_MSK ( \
44+
PSA_ITS_FLAG_NONE | \
45+
PSA_ITS_FLAG_WRITE_ONCE \
46+
)
4447

4548
/**
4649
* \brief A container for metadata associated with a specific key
@@ -59,10 +62,10 @@ typedef uint32_t psa_its_status_t;
5962
#define PSA_ITS_ERROR_FLAGS_NOT_SUPPORTED 2 /**< The operation failed because one or more of the flags provided in `create_flags` is not supported or is not valid */
6063
#define PSA_ITS_ERROR_INSUFFICIENT_SPACE 3 /**< The operation failed because there was insufficient space on the storage medium */
6164
#define PSA_ITS_ERROR_STORAGE_FAILURE 4 /**< The operation failed because the physical storage has failed (Fatal error) */
62-
#define PSA_ITS_ERROR_INVALID_ARGUMENTS 5 /**< The operation failed because one of the provided pointers is invalid, for example is `NULL` or references memory the caller cannot access */
65+
#define PSA_ITS_ERROR_INVALID_ARGUMENTS 5 /**< The operation failed because one of the provided pointers is invalid, for example is `NULL` or references memory the caller cannot access */
6366
#define PSA_ITS_ERROR_UID_NOT_FOUND 6 /**< The operation failed because the provided key value was not found in the storage */
6467
#define PSA_ITS_ERROR_INCORRECT_SIZE 7 /**< The operation failed because the data associated with provided key is not the same size as `data_size`, or `offset+data_size` is too large for the data, but `offset` is less than the size */
65-
#define PSA_PS_ERROR_OFFSET_INVALID 8 /**< The operation failed because an offset was supplied that is invalid for the existing data associated with the uid. For example, offset is greater that the size of the data */
68+
#define PSA_ITS_ERROR_OFFSET_INVALID 8 /**< The operation failed because an offset was supplied that is invalid for the existing data associated with the uid. For example, offset is greater that the size of the data */
6669

6770
/**
6871
* \brief create a new or modify an existing uid/value pair
@@ -104,7 +107,7 @@ psa_its_status_t psa_its_set(psa_its_uid_t uid,
104107
* \retval PSA_ITS_ERROR_STORAGE_FAILURE The operation failed because the physical storage has failed (Fatal error)
105108
* \retval PSA_ITS_ERROR_INVALID_ARGUMENTS The operation failed because one of the provided pointers(`p_data`, `p_data_length`)
106109
* is invalid. For example is `NULL` or references memory the caller cannot access
107-
* \retval PSA_PS_ERROR_OFFSET_INVALID The operation failed because an offset was supplied that is invalid for the existing data associated with the
110+
* \retval PSA_ITS_ERROR_OFFSET_INVALID The operation failed because an offset was supplied that is invalid for the existing data associated with the
108111
* uid. For example, offset + size is invalid
109112
*/
110113
psa_its_status_t psa_its_get(psa_its_uid_t uid,

0 commit comments

Comments
 (0)