Files
kunlun/plc/halmac/inc/mac_crypto.h
2024-09-28 14:24:04 +08:00

50 lines
1.8 KiB
C

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef MAC_CRYPTO_H
#define MAC_CRYPTO_H
#include "iot_pkt_api.h"
/**
* @brief mac_crypto_check_msdu_buf check if the pkt is big enough for
fill zero
*
* @param vdev: vdev pointer
* @param p_data_buf : point to input msdu pkt
* @param proto: see PLC_PROTO_TYPE_XX
* @retval: the msdu pkt with fill data
*/
uint32_t mac_crypto_check_msdu_buf(mac_vdev_t *vdev,
iot_pkt_t **p_data_buf, uint32_t proto);
/**
* @brief mac_encrypt_msdu_handle encrypt msdu data
fill zero
*
* @param data_buf: input msdu pkt
* @param iv: input iv buffer
* @param proto: see PLC_PROTO_TYPE_XX
* @param key_idx: use witch key to encrypt
*
* @retval: error code. see CRYPTO_RET_XXX
*/
uint32_t mac_encrypt_msdu_handle(iot_pkt_t *data_buf,
uint8_t *iv, uint32_t proto, uint8_t key_idx);
#endif // MAC_CRYPTO_H