18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#include <linux/types.h> 38c2ecf20Sopenharmony_ci#include <crypto/aes.h> 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_cistruct aes_key { 68c2ecf20Sopenharmony_ci u8 key[AES_MAX_KEYLENGTH]; 78c2ecf20Sopenharmony_ci int rounds; 88c2ecf20Sopenharmony_ci}; 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciint aes_p8_set_encrypt_key(const u8 *userKey, const int bits, 118c2ecf20Sopenharmony_ci struct aes_key *key); 128c2ecf20Sopenharmony_ciint aes_p8_set_decrypt_key(const u8 *userKey, const int bits, 138c2ecf20Sopenharmony_ci struct aes_key *key); 148c2ecf20Sopenharmony_civoid aes_p8_encrypt(const u8 *in, u8 *out, const struct aes_key *key); 158c2ecf20Sopenharmony_civoid aes_p8_decrypt(const u8 *in, u8 *out, const struct aes_key *key); 168c2ecf20Sopenharmony_civoid aes_p8_cbc_encrypt(const u8 *in, u8 *out, size_t len, 178c2ecf20Sopenharmony_ci const struct aes_key *key, u8 *iv, const int enc); 188c2ecf20Sopenharmony_civoid aes_p8_ctr32_encrypt_blocks(const u8 *in, u8 *out, 198c2ecf20Sopenharmony_ci size_t len, const struct aes_key *key, 208c2ecf20Sopenharmony_ci const u8 *iv); 218c2ecf20Sopenharmony_civoid aes_p8_xts_encrypt(const u8 *in, u8 *out, size_t len, 228c2ecf20Sopenharmony_ci const struct aes_key *key1, const struct aes_key *key2, u8 *iv); 238c2ecf20Sopenharmony_civoid aes_p8_xts_decrypt(const u8 *in, u8 *out, size_t len, 248c2ecf20Sopenharmony_ci const struct aes_key *key1, const struct aes_key *key2, u8 *iv); 25