tpm2-software / tpm2-tss-engine

OpenSSL Engine for TPM2 devices
https://tpm2-software.github.io
BSD 3-Clause "New" or "Revised" License
151 stars 100 forks source link

‘RSA_new’ is deprecated: Since OpenSSL 3.0 #255

Closed Igorbunow closed 2 years ago

Igorbunow commented 2 years ago

Bulid errors

CC       src/tpm2tss_genkey-tpm2tss-genkey.o
src/tpm2tss-genkey.c: In function ‘genkey_rsa’:
src/tpm2tss-genkey.c:253:5: error: ‘RSA_new’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  253 |     rsa = RSA_new();
      |     ^~~
In file included from /usr/include/openssl/engine.h:25,
                 from src/tpm2tss-genkey.c:39:
/usr/include/openssl/rsa.h:201:28: note: declared here
  201 | OSSL_DEPRECATEDIN_3_0 RSA *RSA_new(void);
      |                            ^~~~~~~
src/tpm2tss-genkey.c:261:9: error: ‘RSA_free’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  261 |         RSA_free(rsa);
      |         ^~~~~~~~
/usr/include/openssl/rsa.h:293:28: note: declared here
  293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
      |                            ^~~~~~~~
src/tpm2tss-genkey.c:272:9: error: ‘RSA_free’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  272 |         RSA_free(rsa);
      |         ^~~~~~~~
/usr/include/openssl/rsa.h:293:28: note: declared here
  293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
      |                            ^~~~~~~~
src/tpm2tss-genkey.c:275:5: error: ‘RSA_get_ex_data’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  275 |     memcpy(tpm2Data, RSA_get_app_data(rsa), sizeof(*tpm2Data));
      |     ^~~~~~
/usr/include/openssl/rsa.h:446:29: note: declared here
  446 | OSSL_DEPRECATEDIN_3_0 void *RSA_get_ex_data(const RSA *r, int idx);
      |                             ^~~~~~~~~~~~~~~
src/tpm2tss-genkey.c:278:5: error: ‘RSA_free’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  278 |     RSA_free(rsa);
      |     ^~~~~~~~
/usr/include/openssl/rsa.h:293:28: note: declared here
  293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
      |                            ^~~~~~~~
src/tpm2tss-genkey.c: In function ‘genkey_ecdsa’:
src/tpm2tss-genkey.c:294:5: error: ‘EC_KEY_new’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  294 |     eckey = EC_KEY_new();
      |     ^~~~~
In file included from /usr/include/openssl/engine.h:28:
/usr/include/openssl/ec.h:968:31: note: declared here
  968 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new(void);
      |                               ^~~~~~~~~~
src/tpm2tss-genkey.c:300:9: error: ‘EC_KEY_free’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  300 |         EC_KEY_free(eckey);
      |         ^~~~~~~~~~~
/usr/include/openssl/ec.h:1003:28: note: declared here
 1003 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
      |                            ^~~~~~~~~~~
src/tpm2tss-genkey.c:308:9: error: ‘EC_KEY_free’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  308 |         EC_KEY_free(eckey);
      |         ^~~~~~~~~~~
/usr/include/openssl/ec.h:1003:28: note: declared here
 1003 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
      |                            ^~~~~~~~~~~
src/tpm2tss-genkey.c:313:5: error: ‘EC_KEY_free’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  313 |     EC_KEY_free(eckey);
      |     ^~~~~~~~~~~
/usr/include/openssl/ec.h:1003:28: note: declared here
 1003 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
      |                            ^~~~~~~~~~~
src/tpm2tss-genkey.c: In function ‘main’:
src/tpm2tss-genkey.c:346:5: error: ‘ENGINE_by_id’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  346 |     ENGINE *tpm_engine = ENGINE_by_id("tpm2tss");
      |     ^~~~~~
/usr/include/openssl/engine.h:336:31: note: declared here
  336 | OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_by_id(const char *id);
      |                               ^~~~~~~~~~~~
src/tpm2tss-genkey.c:348:9: error: ‘ENGINE_by_id’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  348 |         tpm_engine = ENGINE_by_id("libtpm2tss");
      |         ^~~~~~~~~~
/usr/include/openssl/engine.h:336:31: note: declared here
  336 | OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_by_id(const char *id);
      |                               ^~~~~~~~~~~~
src/tpm2tss-genkey.c:354:5: error: ‘ENGINE_init’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  354 |     int init_res = ENGINE_init(tpm_engine);
      |     ^~~
/usr/include/openssl/engine.h:620:27: note: declared here
  620 | OSSL_DEPRECATEDIN_3_0 int ENGINE_init(ENGINE *e);
      |                           ^~~~~~~~~~~
src/tpm2tss-genkey.c:355:5: error: ‘ENGINE_get_name’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  355 |     VERB("Engine name: %s\nInit result: %d \n", ENGINE_get_name(tpm_engine),
      |     ^~~~
/usr/include/openssl/engine.h:553:35: note: declared here
  553 | OSSL_DEPRECATEDIN_3_0 const char *ENGINE_get_name(const ENGINE *e);
      |                                   ^~~~~~~~~~~~~~~
src/tpm2tss-genkey.c:361:13: error: ‘ENGINE_ctrl’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  361 |             !ENGINE_ctrl(tpm_engine, TPM2TSS_SET_OWNERAUTH, 0, opt.ownerpw, NULL)) {
      |             ^
/usr/include/openssl/engine.h:429:27: note: declared here
  429 | OSSL_DEPRECATEDIN_3_0 int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p,
      |                           ^~~~~~~~~~~
src/tpm2tss-genkey.c:367:13: error: ‘ENGINE_ctrl’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  367 |             !ENGINE_ctrl(tpm_engine, TPM2TSS_SET_PARENTAUTH, 0, opt.parentpw, NULL)) {
      |             ^
/usr/include/openssl/engine.h:429:27: note: declared here
  429 | OSSL_DEPRECATEDIN_3_0 int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p,
      |                           ^~~~~~~~~~~
src/tpm2tss-genkey.c:373:13: error: ‘ENGINE_ctrl’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  373 |             !ENGINE_ctrl(tpm_engine, TPM2TSS_SET_TCTI, 0, opt.tcti_conf, NULL)) {
      |             ^
/usr/include/openssl/engine.h:429:27: note: declared here
  429 | OSSL_DEPRECATEDIN_3_0 int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p,
      |                           ^~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:1428: src/tpm2tss_genkey-tpm2tss-genkey.o] Error 1
williamcroberts commented 2 years ago

So are engines, use the provider interface and the tpm2 provider provided here: https://github.com/tpm2-software/tpm2-openssl