OpenSSL取消引用指向不完整类型的指针 [英] OpenSSL dereferencing pointer to incomplete type
问题描述
我正在使用OpenSSL库.我正在尝试访问struct engine_st的rsa_meth属性.这样做的代码如下:
I am working with OpenSSL library. I am trying to access rsa_meth attribute of struct engine_st. The code for doing is as follows:
ctx-> client_cert_engine-> rsa_meth
ctx->client_cert_engine->rsa_meth
其中ctx的类型为SSL_CTX *.
where ctx is of type SSL_CTX *.
我尝试包括所有必要的头文件,但仍然可以给我:
I tried to include all the necessary header files but still it is giving me:
dereferencing pointer to incomplete type.
尽管,如果我删除了rsa_meth,它就可以正常工作.
Although, if I remove rsa_meth then it works fine.
推荐答案
engine_st(这是client_cert_engine的意思)是一个内部结构定义(位于crypto/engine/eng_int.h中),并且未在公共标头中公开. (可能)这是为了防止在结构发生更改时出现二进制兼容性问题.与其尝试取消引用,不如使用engine.h标头中定义的getter:
engine_st (which is what client_cert_engine is) is an internal struct definition (it's in crypto/engine/eng_int.h) and is not exposed in the public header. This is (probably) to prevent a binary compatibility issue in the event of a change to the struct. Instead of trying to dereference, use the getters defined in the engine.h header:
const char *ENGINE_get_id(const ENGINE *e);
const char *ENGINE_get_name(const ENGINE *e);
const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e);
const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e);
const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e);
这篇关于OpenSSL取消引用指向不完整类型的指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!