Loading...
Searching...
No Matches
lifetime.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 TU Dresden
3 * Copyright (C) 2021 HAW Hamburg
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
22#ifndef PSA_CRYPTO_PSA_KEY_LIFETIME_H
23#define PSA_CRYPTO_PSA_KEY_LIFETIME_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#include <stdint.h>
30
67typedef uint32_t psa_key_lifetime_t;
68
107typedef uint8_t psa_key_persistence_t;
108
143typedef uint32_t psa_key_location_t;
144
156#define PSA_KEY_LIFETIME_VOLATILE ((psa_key_lifetime_t)0x00000000)
157
171#define PSA_KEY_LIFETIME_PERSISTENT ((psa_key_lifetime_t)0x00000001)
172
178#define PSA_KEY_PERSISTENCE_VOLATILE ((psa_key_persistence_t)0x00)
179
185#define PSA_KEY_PERSISTENCE_DEFAULT ((psa_key_persistence_t)0x01)
186
192#define PSA_KEY_PERSISTENCE_READ_ONLY ((psa_key_persistence_t)0xff)
193
202#define PSA_KEY_LOCATION_LOCAL_STORAGE ((psa_key_location_t)0x000000)
203
215#define PSA_KEY_LOCATION_PRIMARY_SECURE_ELEMENT ((psa_key_location_t)0x000001)
216
220#define PSA_KEY_LOCATION_VENDOR_FLAG ((psa_key_location_t)0x800000)
221
225#define PSA_KEY_LOCATION_SE_MIN (PSA_KEY_LOCATION_VENDOR_FLAG)
226
230#define PSA_KEY_LOCATION_SE_MAX ((psa_key_location_t)0x8000ff)
231
237#define PSA_KEY_LIFETIME_GET_PERSISTENCE(lifetime) \
238 ((psa_key_persistence_t)((lifetime) & 0x000000ff))
239
245#define PSA_KEY_LIFETIME_GET_LOCATION(lifetime) \
246 ((psa_key_location_t)((lifetime) >> 8))
247
263#define PSA_KEY_LIFETIME_IS_VOLATILE(lifetime) \
264 (PSA_KEY_LIFETIME_GET_PERSISTENCE(lifetime) == PSA_KEY_PERSISTENCE_VOLATILE)
265
274#define PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(persistence, location) \
275 ((location) << 8 | (persistence))
276
277#ifdef __cplusplus
278}
279#endif
280
281#endif /* PSA_CRYPTO_PSA_KEY_LIFETIME_H */
uint8_t psa_key_persistence_t
Encoding of key persistence levels.
Definition lifetime.h:107
uint32_t psa_key_location_t
Encoding of key location indicators.
Definition lifetime.h:143
uint32_t psa_key_lifetime_t
Encoding of key lifetimes.
Definition lifetime.h:67