OpenSSL Engine数据结构

OpenSSL Engine数据结构定义在crypto/engine/eng_int.h文件中。

/*
 * This is a structure for storing implementations of various crypto
 * algorithms and functions.
 */
struct engine_st {
    const char *id;  //Engine标识
    const char *name; //Engine名字
    const RSA_METHOD *rsa_meth; //RSA方法集合
    const DSA_METHOD *dsa_meth; //DSA方法集合
    const DH_METHOD *dh_meth;  //DH方法集合
    const EC_KEY_METHOD *ec_meth; //ECDH方法集合
    const RAND_METHOD *rand_meth; //随机数方法集合
    /* Cipher handling is via this callback */
    /*对称算法选取函数。硬件一般会支持多种对称算法,
    该回调函数用来从用户实现的多个对称算法中根据某种条件(一般是算法nid)来选择其中的一种.*/
    ENGINE_CIPHERS_PTR ciphers;
    /* Digest handling is via this callback */
    /*摘要算法选取函数。
    该回调函数用来从用户实现的多个摘要算法中根据某种条件(一般是算法nid)来选择其中的一种*/
    ENGINE_DIGESTS_PTR digests;
    /* Public key handling via this callback */
    /*公钥算法选取函数*/
    ENGINE_PKEY_METHS_PTR pkey_meths;
    /* ASN1 public key handling via this callback */
    ENGINE_PKEY_ASN1_METHS_PTR pkey_asn1_meths;
    ENGINE_GEN_INT_FUNC_PTR destroy; //销毁引擎函数
    ENGINE_GEN_INT_FUNC_PTR init; //初始化引擎函数
    ENGINE_GEN_INT_FUNC_PTR finish; //完成回调函数
    //控制函数,可通过控制函数传入不同的命令,实现登录密码设备、修改口令等操作。
    ENGINE_CTRL_FUNC_PTR ctrl; 
    ENGINE_LOAD_KEY_PTR load_privkey; //加载私钥函数
    ENGINE_LOAD_KEY_PTR load_pubkey; //加载公钥函数
    ENGINE_SSL_CLIENT_CERT_PTR load_ssl_client_cert;
    const ENGINE_CMD_DEFN *cmd_defns;
    int flags;
    /* reference count on the structure itself */
    int struct_ref;
    /*
     * reference count on usability of the engine type. NB: This controls the
     * loading and initialisation of any functionality required by this
     * engine, whereas the previous count is simply to cope with
     * (de)allocation of this structure. Hence, running_ref <= struct_ref at
     * all times.
     */
    int funct_ref;
    /* A place to store per-ENGINE data */
    CRYPTO_EX_DATA ex_data; //扩展数据结构,可用来存放用户数据
    /* Used to maintain the linked-list of engines. */
    /*用于构建Engine链表,openssl中的硬件Engine可能不止一个*/
    struct engine_st *prev; 
    struct engine_st *next;
};
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值