/*
*
* Copyright 2018,2019 NXP
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _FSL_SSCP_MU_H_
#define _FSL_SSCP_MU_H_
//#include "fsl_mu.h"
#include "fsl_sscp.h"
typedef uint32_t MU_Type;
/*!
@defgroup sscp_mu SSCP over MU
@details This section describes definition of the messages for the MU to invoke services
and MU implementation specific functions to initialize SSCP MU link, deinitialize SSCP MU link
and MU invoke command.
@ingroup sscp
# MU commands
## Symmetric cipher
### Symmetric cipher in one go
@copydetails sss_cipher_one_go
AES in Counter Mode | TX | MU TXn register value
|
Command | 0 | kSSCP_CMD_SSS_SymmetricCryptCtr
|
paramTypes | 1 | Context, MemrefInput, MemrefOutput, MemrefInOut, MemrefInOut, MemrefInOut
|
word | 2 | Pointer to ::_sss_sscp_symmetric
|
word | 3 | Pointer to input data buffer
|
word | 4 | Length of the input data buffer in bytes
|
word | 5 | Pointer to output data buffer
|
word | 6 | Pointer to uint32_t with length of the output data buffer in bytes
|
word | 7 | Pointer to Initial Counter Block
|
word | 8 | Length of the Initial Counter Block in bytes
|
word | 9 | Pointer to Last Encrypted Counter Block
|
word | 10 | Length of the Last Encrypted Counter Block in bytes
|
word | 11 | Pointer to uint32_t specifying number of bytes left unused in the Last Encrypted
Counter Block
|
word | 12 | sizeof(uint32_t)
|
### Authenticated encryption with additional data
@copydetails sss_aead_one_go
Authenticated Encryption with Additional Data | TX | MU TXn register value
|
Command | 0 | kSSCP_CMD_SSS_AeadOneGo
|
paramTypes | 1 | Context, MemrefInput, MemrefOutput, MemrefOutput, MemrefInput, MemrefInput,
MemrefOutput
|
word | 2 | Pointer to ::_sss_sscp_aead
|
word | 3 | Pointer to input data buffer
|
word | 4 | Length of the input data buffer in bytes
|
word | 5 | Pointer to output data buffer
|
word | 6 | Pointer to uint32_t with length of the output data buffer in bytes
|
word | 7 | Pointer to nonce buffer
|
word | 8 | Length of the nonce buffer in bytes
|
word | 9 | Pointer to aad buffer
|
word | 10 | Length of the aad buffer in bytes
|
word | 11 | Pointer to tag buffer
|
word | 12 | Pointer to uint32_t with length of the tag buffer in bytes
|
## Digest
### Message digest in one go
@copydetails sss_digest_one_go
Key Store Set Key | TX | MU TXn register value
|
Command | 0 | kSSCP_CMD_SSS_KeyStoreSetKey
|
paramTypes | 1 | Context, Context, MemrefInput, ValueInput, MemrefInput
|
word | 2 | Pointer to ::_sss_sscp_key_store
|
word | 3 | Pointer to ::_sss_sscp_object
|
word | 4 | Pointer to key buffer
|
word | 5 | Length of key buffer in bytes
|
word | 6 | Key Length in bits
|
word | 7 | Zero
|
word | 8 | Pointer to options buffer
|
word | 9 | Length of the options buffer in bytes
|
*/
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @addtogroup sscp_mu
* @{
*/
/**
* struct _sscp_mu_context - SSCP context struct for MU implementation
*
* This data type is used to keep context of the SSCP link.
* It is completely implementation specific.
*
* @param context Container for the implementation specific data.
*/
typedef struct _sscp_mu_context
{
fn_sscp_invoke_command_t invoke;
/*! Implementation specific part */
MU_Type *base;
} sscp_mu_context_t;
/*! @brief Initializes the SSCP link
*
* This function initializes the SSCP for operation - e.g.underlaying hardware is initialized
* and prepared for data exchange.
*
* @param context Context structure for the SSCP.
* @param base The MU peripheral base address to be used for communication
*
* @returns Status of the operation
* @retval kStatus_SSCP_Success SSCP init success
* @retval kStatus_SSCP_Fail SSCP init failure
*/
sscp_status_t sscp_mu_init(sscp_context_t *context, MU_Type *base);
/*! @brief Close the SSCP link
*
* This function closes the SSCP link - e.g.underlying hardware is disabled.
*
* @param context Context structure for the SSCP.
*/
void sscp_mu_deinit(sscp_context_t *context);
/*! @brief Sends a command and associated parameters to security sub-system
*
* The commandID and operation content is serialized and sent over to the selected security sub-system.
* This is implementation specific function.
* The function can invoke both blocking and non-blocking secure functions in the selected security sub-system.
*
* @param context Initialized SSCP context
* @param commandID Command - an id of a remote secure function to be invoked
* @param op Description of function arguments as a sequence of buffers and values
* @param ret Return code of the remote secure function (application layer return value)
*
* @returns Status of the operation
* @retval kStatus_SSCP_Success A blocking command has completed or a non-blocking command has been accepted.
* @retval kStatus_SSCP_Fail Operation failure, for example hardware fail.
* @retval kStatus_SSCP_InvalidArgument One of the arguments is invalid for the function to execute.
*/
sscp_status_t sscp_mu_invoke_command(sscp_context_t *context, uint32_t commandID, sscp_operation_t *op, uint32_t *ret);
#if defined(__cplusplus)
}
#endif
/*!
*@}
*/ /* end of sscp_mu */
#endif /* _FSL_SSCP_MU_H_ */