blob: 02e97703cb70fed757f838120699811f57cb1fe0 [file] [log] [blame]
Antonio de Angelis8908f472018-08-31 15:44:25 +01001/*
Antonio de Angelis377a1552018-11-22 17:02:40 +00002 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Antonio de Angelis8908f472018-08-31 15:44:25 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __TFM_CRYPTO_DEFS_H__
9#define __TFM_CRYPTO_DEFS_H__
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include <stdint.h>
16#include <limits.h>
17#include "tfm_api.h"
Antonio de Angelisab85ccd2019-03-25 15:14:29 +000018#include "psa_crypto.h"
Antonio de Angelis8908f472018-08-31 15:44:25 +010019
20/**
Louis Mayencourt7a36f782018-09-24 14:00:57 +010021 * \brief This value is used to mark an handle as invalid.
22 *
23 */
24#define TFM_CRYPTO_INVALID_HANDLE (0xFFFFFFFF)
Antonio de Angelis8908f472018-08-31 15:44:25 +010025
26/**
Antonio de Angelisab85ccd2019-03-25 15:14:29 +000027 * \brief Define miscellaneous literal constants that are used in the service
Antonio de Angelis377a1552018-11-22 17:02:40 +000028 *
29 */
Antonio de Angelis8908f472018-08-31 15:44:25 +010030enum {
31 TFM_CRYPTO_NOT_IN_USE = 0,
32 TFM_CRYPTO_IN_USE = 1
33};
34
Antonio de Angelis377a1552018-11-22 17:02:40 +000035/**
Antonio de Angelisab85ccd2019-03-25 15:14:29 +000036 * \brief This type is used to overcome a limitation in the number of maximum
37 * IOVECs that can be used especially in psa_aead_encrypt and
38 * psa_aead_decrypt. To be removed in case the AEAD APIs number of
39 * parameters passed gets restructured
Antonio de Angelis377a1552018-11-22 17:02:40 +000040 */
Antonio de Angelisab85ccd2019-03-25 15:14:29 +000041#define TFM_CRYPTO_MAX_NONCE_LENGTH (16u)
42struct tfm_crypto_aead_pack_input {
43 psa_key_slot_t key;
44 psa_algorithm_t alg;
45 uint8_t nonce[TFM_CRYPTO_MAX_NONCE_LENGTH];
Antonio de Angelis8908f472018-08-31 15:44:25 +010046};
47
Antonio de Angelis8908f472018-08-31 15:44:25 +010048#ifdef __cplusplus
49}
50#endif
51
52#endif /* __TFM_CRYPTO_DEFS_H__ */