MAX32680 Peripheral Driver API
Peripheral Driver API for the MAX32680
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
aes.h
1
6/******************************************************************************
7 *
8 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9 * Analog Devices, Inc.),
10 * Copyright (C) 2023-2024 Analog Devices, Inc.
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 ******************************************************************************/
25
26#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_AES_H_
27#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_AES_H_
28
29/***** Includes *****/
30#include "aes_regs.h"
31#include "aeskeys_regs.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
44/***** Definitions *****/
45
46typedef void (*mxc_aes_complete_t)(void *req, int result);
47
48/* ************************************************************************* */
49/* Cipher Definitions */
50/* ************************************************************************* */
51
56typedef enum {
61
66typedef enum {
71
76typedef struct _mxc_aes_cipher_req_t {
77 uint32_t length;
78 uint32_t *inputData;
79 uint32_t *resultData;
82 mxc_aes_complete_t callback;
84
85/***** Function Prototypes *****/
86
87/* ************************************************************************* */
88/* Global Control/Configuration functions */
89/* ************************************************************************* */
90
96int MXC_AES_Init(void);
97
103void MXC_AES_EnableInt(uint32_t interrupt);
104
110void MXC_AES_DisableInt(uint32_t interrupt);
111
118
125
130void MXC_AES_DMACallback(int ch, int error);
131
136
143
150
156
162
167void MXC_AES_Start(void);
168
174uint32_t MXC_AES_GetFlags(void);
175
181void MXC_AES_ClearFlags(uint32_t flags);
182
192
202
212
220int MXC_AES_TXDMAConfig(void *src_addr, int len);
221
229int MXC_AES_RXDMAConfig(void *dest_addr, int len);
230
239int MXC_AES_GenericAsync(mxc_aes_req_t *req, uint8_t enc);
240
250
260
266void MXC_AES_SetExtKey(const void *key, mxc_aes_keys_t len);
267
268#ifdef __cplusplus
269}
270#endif
273#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_AES_H_
Registers, Bit Masks and Bit Positions for the AES Peripheral Module.
Registers, Bit Masks and Bit Positions for the AESKEYS 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:81
uint32_t * resultData
Pointer to encrypted data.
Definition: aes.h:79
mxc_aes_keys_t keySize
Size of AES key.
Definition: aes.h:80
uint32_t * inputData
Pointer to input data.
Definition: aes.h:78
uint32_t length
Length of the data.
Definition: aes.h:77
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:66
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:56
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.
void MXC_AES_GenerateKey(void)
This function should be called before encryption to genrate external key.
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:67
@ MXC_AES_DECRYPT_EXT_KEY
Encryption using internal key.
Definition: aes.h:68
@ MXC_AES_DECRYPT_INT_KEY
Decryption using internal key.
Definition: aes.h:69
@ MXC_AES_192BITS
Select AES-192 bit key.
Definition: aes.h:58
@ MXC_AES_256BITS
Select AES-256 bit key.
Definition: aes.h:59
@ MXC_AES_128BITS
Select AES-128 bit key.
Definition: aes.h:57
Structure used to set up AES request.
Definition: aes.h:76