18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _CRYPTO_TWOFISH_H 38c2ecf20Sopenharmony_ci#define _CRYPTO_TWOFISH_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/types.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define TF_MIN_KEY_SIZE 16 88c2ecf20Sopenharmony_ci#define TF_MAX_KEY_SIZE 32 98c2ecf20Sopenharmony_ci#define TF_BLOCK_SIZE 16 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistruct crypto_tfm; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* Structure for an expanded Twofish key. s contains the key-dependent 148c2ecf20Sopenharmony_ci * S-boxes composed with the MDS matrix; w contains the eight "whitening" 158c2ecf20Sopenharmony_ci * subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note 168c2ecf20Sopenharmony_ci * that k[i] corresponds to what the Twofish paper calls K[i+8]. */ 178c2ecf20Sopenharmony_cistruct twofish_ctx { 188c2ecf20Sopenharmony_ci u32 s[4][256], w[8], k[32]; 198c2ecf20Sopenharmony_ci}; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ciint __twofish_setkey(struct twofish_ctx *ctx, const u8 *key, 228c2ecf20Sopenharmony_ci unsigned int key_len); 238c2ecf20Sopenharmony_ciint twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len); 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#endif 26