目录
1.2 CBC算法模板实例(crypto_cbc_create)
1.2.4 skcipher_register_instance
1. 通用算法模板实例
1.1 数据结构定义
在加密框架中,将根据算法模式(即算法模板)和基础算法动态创建的算法定义为算法模板实例,数据结构为struct crypto_instance,在include\crypto\algapi.h中定义如下所示。
struct crypto_instance {
struct crypto_alg alg;
struct crypto_template *tmpl;
struct hlist_node list;
void *__ctx[] CRYPTO_MINALIGN_ATTR;
};
算法模板实例数据结构为struct crypto_instance各成员变量含义如下所示:
1) alg:算法模板实例对应的算法说明。
2) tmpl:算法模板实例使用的算法模板。
3) list:算法模板实例在算法模板的实例哈希链表中对应的节点。
4) __ctx:算法模板实例的上下文。当前只指向crypto_spawn,我个人理解可能是架构设计者考虑到未来扩展性,就将crypto_spawn与crypto_instance拆分开来了。
由算法模板实例数据结构定义,算法