MT7687 API Reference  LinkIt SDK v4
hal_aes.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_AES_H__
36 #define __HAL_AES_H__
37 #include "hal_platform.h"
38 
39 #ifdef HAL_AES_MODULE_ENABLED
40 
41 #ifdef HAL_AES_USE_PHYSICAL_MEMORY_ADDRESS
42 
144 #else
145 
245 #endif
246 
247 
248 #include "hal_define.h"
249 
250 #ifdef __cplusplus
251 extern "C" {
252 #endif
253 
254 
261 #define HAL_AES_BLOCK_SIZES (16)
262 
265 #define HAL_AES_KEY_LENGTH_128 (16)
266 
269 #define HAL_AES_KEY_LENGTH_192 (24)
270 
273 #define HAL_AES_KEY_LENGTH_256 (32)
274 
277 #define HAL_AES_CBC_IV_LENGTH (16)
278 
290 typedef enum {
294 
304 typedef struct {
305  uint8_t *buffer;
306  uint32_t length;
308 
327  hal_aes_buffer_t *plain_text,
328  hal_aes_buffer_t *key,
329  uint8_t init_vector[HAL_AES_CBC_IV_LENGTH]);
330 
343  hal_aes_buffer_t *encrypted_text,
344  hal_aes_buffer_t *key,
345  uint8_t init_vector[HAL_AES_CBC_IV_LENGTH]);
346 
347 
359  hal_aes_buffer_t *plain_text,
360  hal_aes_buffer_t *key);
361 
373  hal_aes_buffer_t *encrypted_text,
374  hal_aes_buffer_t *key);
375 
376 
377 #ifdef __cplusplus
378 }
379 #endif
380 
385 #endif /* HAL_AES_MODULE_ENABLED */
386 
387 #endif /* __HAL_AES_H__ */
388 
389 
No error occurred.
Definition: hal_aes.h:292
This structure defines the buffer used in the operation.
Definition: hal_aes.h:304
#define HAL_AES_CBC_IV_LENGTH
This macro defines the size of initial vector.
Definition: hal_aes.h:277
hal_aes_status_t hal_aes_cbc_encrypt(hal_aes_buffer_t *encrypted_text, hal_aes_buffer_t *plain_text, hal_aes_buffer_t *key, uint8_t init_vector[HAL_AES_CBC_IV_LENGTH])
This function provides AES encryption in CBC mode.
An error occurred.
Definition: hal_aes.h:291
hal_aes_status_t hal_aes_ecb_encrypt(hal_aes_buffer_t *encrypted_text, hal_aes_buffer_t *plain_text, hal_aes_buffer_t *key)
This function provides AES encryption in EBC mode.
uint8_t * buffer
Data buffer.
Definition: hal_aes.h:305
uint32_t length
Data length.
Definition: hal_aes.h:306
hal_aes_status_t
This enum defines the HAL interface return value.
Definition: hal_aes.h:290
hal_aes_status_t hal_aes_ecb_decrypt(hal_aes_buffer_t *plain_text, hal_aes_buffer_t *encrypted_text, hal_aes_buffer_t *key)
This function provides AES decryption in EBC mode.
hal_aes_status_t hal_aes_cbc_decrypt(hal_aes_buffer_t *plain_text, hal_aes_buffer_t *encrypted_text, hal_aes_buffer_t *key, uint8_t init_vector[HAL_AES_CBC_IV_LENGTH])
This function provides AES decryption in CBC mode.