user4981459
user4981459

Reputation:

Openssl 1.1.1d invalid use of incomplete type ‘struct dsa_st’

I am migrating from openssl 1.0.2s to 1.1.1d and getting below error.

I searched on openssl docs and it seems calling the fields has changed. I am not sure how I need to implement that in my code.

const BIGNUM * const *KeyPairImpl::getField(const string &field) const
{
  if (field == "P")
    return &dsa_->p;
  else if (field == "Q")
    return &dsa_->q;
  else if (field == "G")
    return &dsa_->g;
  else if (field == "X")
    return &dsa_->priv_key;
  else if (field == "Y")
    return &dsa_->pub_key;
  else
    // unknown field name
    return NULL;
}

Error

KeyPair.cpp: In member function ‘const BIGNUM* const* KeyPairImpl::getField(const std::string&) const’:
KeyPair.cpp:84: error: invalid use of incomplete type ‘struct dsa_st’
/usr/local/ssl_1.1.1d/include/openssl/ossl_typ.h:107: error: forward declaration of ‘struct dsa_st’
KeyPair.cpp:86: error: invalid use of incomplete type ‘struct dsa_st’
/usr/local/ssl_1.1.1d/include/openssl/ossl_typ.h:107: error: forward declaration of ‘struct dsa_st’
KeyPair.cpp:88: error: invalid use of incomplete type ‘struct dsa_st’
/usr/local/ssl_1.1.1d/include/openssl/ossl_typ.h:107: error: forward declaration of ‘struct dsa_st’
KeyPair.cpp:90: error: invalid use of incomplete type ‘struct dsa_st’
/usr/local/ssl_1.1.1d/include/openssl/ossl_typ.h:107: error: forward declaration of ‘struct dsa_st’
KeyPair.cpp:92: error: invalid use of incomplete type ‘struct dsa_st’
/usr/local/ssl_1.1.1d/include/openssl/ossl_typ.h:107: error: forward declaration of ‘struct dsa_st’
cc1plus: warnings being treated as errors

Upvotes: 0

Views: 3843

Answers (1)

Shane Powell
Shane Powell

Reputation: 14138

Openssl 1.1.1 does not allow you direct access to the internal structures any longer. You need to use the provided API functions to access internal data (if provided).

For dsa_->p use DSA_get0_p

For dsa_->q use DSA_get0_q

For dsa_->g use DSA_get0_g

For dsa_->priv_key use DSA_get0_priv_key

For dsa_->pub_key use DSA_get0_pub_key

e.g.

return DSA_get0_p(dsa_);

Upvotes: 5

Related Questions