1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/openLuat-luatos-soc-air101

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
wm_crypto.h 2.7 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
Wendal Chen Отправлено 4 лет назад d72653d
/**
* @file wm_crypto.h
*
* @brief crypto driver module
*
* @author dave
*
* Copyright (c) 2014 Winner Microelectronics Co., Ltd.
*/
#ifndef WM_CRYPTO_H
#define WM_CRYPTO_H
/**
* @brief Encrypt plain data by 128 AES crypto
* @param[in] key the key for encryption
* @param[in] iv the IV value for encryption
* @param[in] data where the plain data stored
* @param[in] data_len length of the plain data to be encrypted
* @retval 0 finish Encryption successfully
* @retval -1 Error
* @note Encrypted data will be placed into the plain @data area
*
*/
int aes_128_cbc_encrypt (const u8 *key, const u8 *iv, u8 *data, size_t data_len) ;
/**
* @brief Decrypt data by 128 AES crypto
* @param[in] key the key for encryption
* @param[in] iv the IV value for encryption
* @param[in] data where the plain data stored
* @param[in] data_len length of the plain data to be decrypted
* @retval 0 finish Decryption successfully
* @retval -1 Error
* @note plain data will be placed into the encrypted @data area
*
*/
int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data,
size_t data_len);
/**
* @brief XOR RC4 stream to given data with skip-stream-start
* @param[in] key RC4 key
* @param[in] keylen RC4 key length
* @param[in] data data to be XOR'ed with RC4 stream
* @param[in] data_len length of the plain data to be encrypted
* @retval 0 finish Encryption/Decryption successfully
* @retval -1 Error
* @note this function should be used for Encryption & Decryption both For the Encryption, the plain @data
* will be replaced by the encrypted output, and vice versa;
*/
int rc4(const u8 *key, size_t keylen, u8 *data, size_t data_len);
/**
* @brief MD5 hash for data vector
* @param[in] addr Pointers to the data area
* @param[in] len Lengths of the data block
* @param[in] mac Buffer for the hash (16 bytes)
* @retval 0 finish caculation successfully
* @retval -1 Error
* @note
*/
int md5(const u8 *addr, int len, u8 *mac);
/**
* @brief HMAC-MD5 over data buffer (RFC 2104)
* @param[in] key Key for HMAC operations
* @param[in] keylen Length of the key in bytes
* @param[in] data data to be caculated
* @param[in] data_len Lengths of the data block
* @param[in] mac Buffer for the hash (16 bytes)
* @retval 0 finish caculation successfully
* @retval -1 Error
* @note
*/
int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, u8 *mac);
/**
* @brief SHA1 hash for data vector
* @param[in] addr Pointers to the data area
* @param[in] len Lengths of the data block
* @param[in] mac Buffer for the hash (16 bytes)
* @retval 0 finish caculation successfully
* @retval -1 Error
* @note
*/
int sha1(const u8 *addr, int len, u8 *mac);
#endif

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/openLuat-luatos-soc-air101.git
git@gitlife.ru:oschina-mirror/openLuat-luatos-soc-air101.git
oschina-mirror
openLuat-luatos-soc-air101
openLuat-luatos-soc-air101
v1021.air601