blob: 5e7e0ce50ca08ff23275f02323dca0bdc2ed0c28 [file] [log] [blame]
Balint Dobszaydc945e92024-01-15 16:07:21 +01001/*
2 * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef CRYPTO_PARTITION_H
8#define CRYPTO_PARTITION_H
9
10#include "service/crypto/backend/crypto_backend.h"
11#include <stdint.h>
12
13/**
14 * Concerned with partitioning of the crypto service backed key store to protect
15 * keys and key store resource. Key partitioning for stored keys is handled by
16 * associating keys with a namespace that reflects the owner.
17 */
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/**
24 * \brief Returns the key id namespace associated with a client id
25 *
26 * \param client_id The uniform identifier for the client
27 * \return The associated key id namespace
28 */
29key_id_namespace_t crypto_partition_get_namespace(uint32_t client_id);
30
31/**
32 * \brief Returns a namespaced key id
33 *
34 * \param client_id The uniform identifier for the client
35 * \param key_id The key id
36 * \return The namespaced key id
37 */
38namespaced_key_id_t crypto_partition_get_namespaced_key_id(uint32_t client_id, psa_key_id_t key_id);
39
40/**
41 * \brief Associate a key with an owner
42 *
43 * \param attributes Key attributes object
44 * \param client_id The uniform identifier for the client
45 */
46void crypto_partition_bind_to_owner(psa_key_attributes_t *attributes, uint32_t client_id);
47
48#ifdef __cplusplus
49} /* extern "C" */
50#endif
51
52#endif /* CRYPTO_PARTITION_H */