MAX32672 Peripheral Driver API
Peripheral Driver API for the MAX32672
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
aes.h
Go to the documentation of this file.
1
7/******************************************************************************
8 *
9 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
10 * Analog Devices, Inc.),
11 * Copyright (C) 2023-2024 Analog Devices, Inc.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 ******************************************************************************/
26
27#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32672_AES_H_
28#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32672_AES_H_
29
30/***** Includes *****/
31#include "aes_regs.h"
32#include "sys_aeskeys_regs.h"
33#include "usr_aeskeys_regs.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
45/***** Definitions *****/
46
47typedef void (*mxc_aes_complete_t)(void *req, int result);
48
49/* ************************************************************************* */
50/* Cipher Definitions */
51/* ************************************************************************* */
52
57typedef enum {
62
67typedef enum {
72
77struct _mxc_aes_cipher_req_t {
78 uint32_t length;
79 uint32_t *inputData;
80 uint32_t *resultData;
83 mxc_aes_complete_t callback;
84} typedef mxc_aes_req_t;
85
86/***** Function Prototypes *****/
87
88/* ************************************************************************* */
89/* Global Control/Configuration functions */
90/* ************************************************************************* */
91
97int MXC_AES_Init(void);
98
104void MXC_AES_EnableInt(uint32_t interrupt);
105
111void MXC_AES_DisableInt(uint32_t interrupt);
112
119
126
131void MXC_AES_DMACallback(int ch, int error);
132
139
146
154void MXC_AES_SetExtKey(const void *key, mxc_aes_keys_t len);
155
161
167
172void MXC_AES_Start(void);
173
179uint32_t MXC_AES_GetFlags(void);
180
186void MXC_AES_ClearFlags(uint32_t flags);
187
197
207
217
225int MXC_AES_TXDMAConfig(void *src_addr, int len);
226
234int MXC_AES_RXDMAConfig(void *dest_addr, int len);
235
244int MXC_AES_GenericAsync(mxc_aes_req_t *req, uint8_t enc);
245
255
265
266#ifdef __cplusplus
267}
268#endif
271#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32672_AES_H_
Registers, Bit Masks and Bit Positions for the AES Peripheral Module.
#define MXC_S_AES_CTRL_KEY_SIZE_AES128
Definition: aes_regs.h:125
#define MXC_S_AES_CTRL_KEY_SIZE_AES256
Definition: aes_regs.h:129
#define MXC_S_AES_CTRL_KEY_SIZE_AES192
Definition: aes_regs.h:127
mxc_aes_enc_type_t encryption
Encrytion type or mxc_aes_enc_type_t.
Definition: aes.h:82
uint32_t * resultData
Pointer to encrypted data.
Definition: aes.h:80
mxc_aes_keys_t keySize
Size of AES key.
Definition: aes.h:81
uint32_t * inputData
Pointer to input data.
Definition: aes.h:79
uint32_t length
Length of the data.
Definition: aes.h:78
void MXC_AES_SetKeySize(mxc_aes_keys_t key)
Set Key size for encryption or decryption.
mxc_aes_keys_t MXC_AES_GetKeySize(void)
Get the currently set key size.
mxc_aes_enc_type_t
Enumeration type to select AES key source and encryption type.
Definition: aes.h:67
uint32_t MXC_AES_GetFlags(void)
Get Interrupt flags set.
void MXC_AES_DisableInt(uint32_t interrupt)
Disable AES Interrupts.
void MXC_AES_FlushInputFIFO(void)
Flush Input Data FIFO.
void MXC_AES_DMACallback(int ch, int error)
This function should be called from the DMA Handler when using Async functions.
void MXC_AES_EnableInt(uint32_t interrupt)
Enable AES Interrupts.
int MXC_AES_Encrypt(mxc_aes_req_t *req)
Perform an encryption.
int MXC_AES_Decrypt(mxc_aes_req_t *req)
Perform a decryption.
int MXC_AES_Init(void)
Enable portions of the AES.
int MXC_AES_IsBusy(void)
Checks the global AES Busy Status.
mxc_aes_keys_t
Enumeration type to select AES key.
Definition: aes.h:57
int MXC_AES_TXDMAConfig(void *src_addr, int len)
Perform AES TX using DMA. Configures DMA request and starts the transmission.
int MXC_AES_EncryptAsync(mxc_aes_req_t *req)
Perform an encryption using Interrupt.
void MXC_AES_FlushOutputFIFO(void)
Flush Output Data FIFO.
int MXC_AES_Shutdown(void)
Disable and reset portions of the AES.
void MXC_AES_Start(void)
Start AES Calculations.
int MXC_AES_GenericAsync(mxc_aes_req_t *req, uint8_t enc)
Perform encryption or decryption using DMA.
int MXC_AES_RXDMAConfig(void *dest_addr, int len)
Perform AES RX using DMA. Configures DMA request and receives data from AES FIFO.
int MXC_AES_Generic(mxc_aes_req_t *req)
int MXC_AES_DecryptAsync(mxc_aes_req_t *req)
Perform a decryption using Interrupt.
void MXC_AES_ClearFlags(uint32_t flags)
Clear the interrupts.
void MXC_AES_SetExtKey(const void *key, mxc_aes_keys_t len)
Set the external key.
@ MXC_AES_ENCRYPT_EXT_KEY
Encryption using External key.
Definition: aes.h:68
@ MXC_AES_DECRYPT_EXT_KEY
Encryption using internal key.
Definition: aes.h:69
@ MXC_AES_DECRYPT_INT_KEY
Decryption using internal key.
Definition: aes.h:70
@ MXC_AES_192BITS
Select AES-192 bit key.
Definition: aes.h:59
@ MXC_AES_256BITS
Select AES-256 bit key.
Definition: aes.h:60
@ MXC_AES_128BITS
Select AES-128 bit key.
Definition: aes.h:58
Structure used to set up AES request.
Definition: aes.h:77
Registers, Bit Masks and Bit Positions for the SYS_AESKEYS Peripheral Module.
Registers, Bit Masks and Bit Positions for the USR_AESKEYS Peripheral Module.