blob: 72cd4272c38ea9c594e955ae0df7d104784778fd [file] [log] [blame]
/*
* Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef TS_CRYPTO_CIPHER_H
#define TS_CRYPTO_CIPHER_H
#include <stdint.h>
/**
* Cipher operations on arbitrary sized data involve three operations,
* a setup, called once, an update called 1..* times and a finish
* to finalise theh hash operation. Operations may be aborted
* using the abort operation.
*/
/****************************************
* cipher_setup operation definition (encrypt or decrypt)
*/
/* Mandatory fixed sized input parameters */
struct __attribute__ ((__packed__)) ts_crypto_cipher_setup_in
{
uint32_t key_id;
uint32_t alg;
};
/* Mandatory fixed sized output parameters */
struct __attribute__ ((__packed__)) ts_crypto_cipher_setup_out
{
uint32_t op_handle;
};
/****************************************
* cipher_generate_iv operation definition
*/
/* Mandatory fixed sized input parameters */
struct __attribute__ ((__packed__)) ts_crypto_cipher_generate_iv_in
{
uint32_t op_handle;
};
/* Variable length output parameter tags */
enum
{
TS_CRYPTO_CIPHER_GENERATE_IV_OUT_TAG_IV = 1
};
/****************************************
* cipher_set_iv operation definition
*/
/* Mandatory fixed sized input parameters */
struct __attribute__ ((__packed__)) ts_crypto_cipher_set_iv_in
{
uint32_t op_handle;
};
/* Variable length input parameter tags */
enum
{
TS_CRYPTO_CIPHER_SET_IV_IN_TAG_IV = 1
};
/****************************************
* cipher_update operation definition
*/
/* Mandatory fixed sized input parameters */
struct __attribute__ ((__packed__)) ts_crypto_cipher_update_in
{
uint32_t op_handle;
};
/* Variable length input parameter tags */
enum
{
TS_CRYPTO_CIPHER_UPDATE_IN_TAG_DATA = 1
};
/* Variable length output parameter tags */
enum
{
TS_CRYPTO_CIPHER_UPDATE_OUT_TAG_DATA = 1
};
/****************************************
* cipher_finish operation definition
*/
/* Mandatory fixed sized input parameters */
struct __attribute__ ((__packed__)) ts_crypto_cipher_finish_in
{
uint32_t op_handle;
};
/* Variable length output parameter tags */
enum
{
TS_CRYPTO_CIPHER_FINISH_OUT_TAG_DATA = 1
};
/****************************************
* cipher_abort operation definition
*/
/* Mandatory fixed sized input parameters */
struct __attribute__ ((__packed__)) ts_crypto_cipher_abort_in
{
uint32_t op_handle;
};
#endif /* TS_CRYPTO_CIPHER_H */