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
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.
Although, if I remove rsa_meth then it works fine.
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);
This means that RSA_METH structure is not defined. You need to include its definition which is in openssl/rsa.h
Please include openssl/rsa.h or
add
#include <openssl/rsa.h>
to your code before this code.
You are dereferencing ctx->client_cert_engine, which is an ENGINE * (pointer to struct engine_st).
Try including <openssl/engine.h>
.