I
I
Ivan Shysterov2020-07-27 19:49:11
linux
Ivan Shysterov, 2020-07-27 19:49:11

Error: invalid use of incomplete type 'EVP_PKEY' {aka 'struct evp_pkey_st'}?

g++ -Wall -O3 -m64 -march=core2 -mfpmath=sse -mssse3 -ggdb -fno-strict-aliasing -fno-strict-overflow -fwrapv -DCOMMIT=\"7cc19ad27b565157042b93c19e8af48c04254b19\" -fno-omit-frame-pointer -I common -I binlog -I net -I kfs -I drinkless -I skat -I vv -I objs -I . -c -MP -MD -MF dep/KPHP/runtime/openssl.d -MQ objs/KPHP/runtime/openssl.o -o objs/KPHP/runtime/openssl.o KPHP/runtime/openssl.cpp
KPHP/runtime/openssl.cpp: In function ‘bool f$openssl_public_encrypt(const string&, string&, const string&)’:
KPHP/runtime/openssl.cpp:275:11: error: invalid use of incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
if (pkey->type != EVP_PKEY_RSA && pkey->type != EVP_PKEY_RSA2) {
^~
In file included from /usr/include/openssl/err.h:20,
from KPHP/runtime/openssl.cpp:12:
/usr/include/openssl/ossl_typ.h:93:16: note: forward declaration of ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
typedef struct evp_pkey_st EVP_PKEY;
^~~~~~~~~~~
KPHP/runtime/openssl.cpp:275:41: error: invalid use of incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
if (pkey->type != EVP_PKEY_RSA && pkey->type != EVP_PKEY_RSA2) {
^~
In file included from /usr/include/openssl/err.h:20,
from KPHP/runtime/openssl.cpp:12:
/usr/include/openssl/ossl_typ.h:93:16: note: forward declaration of ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
typedef struct evp_pkey_st EVP_PKEY;
^~~~~~~~~~~
KPHP/runtime/openssl.cpp:290:77: error: invalid use of incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
reinterpret_cast <unsigned char *> (php_buf), pkey->pkey.rsa, RSA_PKCS1_PADDING) != key_size) {
^~

In file included from /usr/include/openssl/err.h:20,
from KPHP/runtime/openssl.cpp:12:
/usr/include/openssl/ossl_typ.h:93:16: note: forward declaration of ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
typedef struct evp_pkey_st EVP_PKEY;
^~~~~~~~~~~
KPHP/runtime/openssl.cpp: In function ‘bool f$openssl_private_decrypt(const string&, string&, const string&)’:
KPHP/runtime/openssl.cpp:329:11: error: invalid use of incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
if (pkey->type != EVP_PKEY_RSA && pkey->type != EVP_PKEY_RSA2) {
^~
In file included from /usr/include/openssl/err.h:20,
from KPHP/runtime/openssl.cpp:12:
/usr/include/openssl/ossl_typ.h:93:16: note: forward declaration of ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
typedef struct evp_pkey_st EVP_PKEY;
^~~~~~~~~~~
KPHP/runtime/openssl.cpp:329:41: error: invalid use of incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
if (pkey->type != EVP_PKEY_RSA && pkey->type != EVP_PKEY_RSA2) {
^~
In file included from /usr/include/openssl/err.h:20,
from KPHP/runtime/openssl.cpp:12:
/usr/include/openssl/ossl_typ.h:93:16: note: forward declaration of ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
typedef struct evp_pkey_st EVP_PKEY;
^~~~~~~~~~~
KPHP/runtime/openssl.cpp:342:84: error: invalid use of incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
reinterpret_cast <unsigned char *> (php_buf), pkey->pkey.rsa, RSA_PKCS1_PADDING);
^~

In file included from /usr/include/openssl/err.h:20,
from KPHP/runtime/openssl.cpp:12:
/usr/include/openssl/ossl_typ.h:93:16: note: forward declaration of ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
typedef struct evp_pkey_st EVP_PKEY;
^~~~~~~~~~~

code from the penssl.cpp file itself
if (pkey->type != EVP_PKEY_RSA && pkey->type != EVP_PKEY_RSA2) {
    if (!from_cache) {
      EVP_PKEY_free (pkey);
    }
    dl::leave_critical_section();

    php_warning ("Key type is neither RSA nor RSA2");
    result = string();
    return false;
  }

  int key_size = EVP_PKEY_size (pkey);
  php_assert (PHP_BUF_LEN >= key_size);

  if (RSA_public_encrypt ((int)data.size(), reinterpret_cast <const unsigned char *> (data.c_str()),
                          reinterpret_cast <unsigned char *> (php_buf), pkey->pkey.rsa, RSA_PKCS1_PADDING) != key_size) {
    if (!from_cache) {
      EVP_PKEY_free (pkey);
    }
    dl::leave_critical_section();

    php_warning ("RSA public encrypt failed");
    result = string();
    return false;
  }

code from ossl_typ.h file
typedef struct evp_pkey_st EVP_PKEY;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question