目录
1. struct crypto_alg定义
加密框架将算法的属性抽象为算法说明数据结构struct crypto_alg,加密框架中的每一个算法(基础算法和衍生算法)都表示为一个算法说明数据结构的实例,因此将struct crypto_alg称为通用算法说明数据结构。后续章节中如无特殊说明,算法说明数据结构和通用算法数据结构均指的是struct crypto_alg。
在include/linux/crypto.h中,算法说明数据结构struct crypto_alg定义如下:
struct crypto_alg {
struct list_head cra_list;
struct list_head cra_users;
u32 cra_flags;
unsigned int cra_blocksize;
unsigned int cra_ctxsize;
unsigned int cra_alignmask;
int cra_priority;
atomic_t cra_refcnt;
char cra_name[CRYPTO_MAX_ALG_NAME];
char cra_driver_name[CRYPTO_MAX_ALG_NAME];
const struct crypto_type *cra_type;
union {
struct ablkcipher_