Skip to content

Adjustments for OpenSSL 3.0.0 #142

@tomuben

Description

@tomuben

Background

In OpenSSL 3.0.0 several functions which are used in r-exasol are declared as deprecated:

FAILED: CMakeFiles/r_exasol_tests.dir/home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp.o 
  /usr/bin/c++  -I/home/runner/work/r-exasol/r-exasol/tests/cpp/../../src -I/usr/share/R/include -I/home/runner/work/r-exasol/b/_deps/catch-src/single_include -g -fno-omit-frame-pointer -fsanitize=address -Wall -Wextra -pedantic -Werror -Wno-deprecated -std=gnu++14 -MD -MT CMakeFiles/r_exasol_tests.dir/home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp.o -MF CMakeFiles/r_exasol_tests.dir/home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp.o.d -o CMakeFiles/r_exasol_tests.dir/home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp.o -c /home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp
  /home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp: In member function ‘void exa::ssl::Certificate::mkcert(int, int, int)’:
  Error: /home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp:97:18: error: ‘RSA* RSA_new()’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
     97 |     rsa = RSA_new();
        |           ~~~~~~~^~
  In file included from /usr/include/openssl/x509.h:36,
                   from /home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.h:4,
                   from /home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp:2:
  /usr/include/openssl/rsa.h:201:28: note: declared here
    201 | OSSL_DEPRECATEDIN_3_0 RSA *RSA_new(void);
        |                            ^~~~~~~
  Error: /home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp:102:34: error: ‘int RSA_generate_key_ex(RSA*, int, BIGNUM*, BN_GENCB*)’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
    102 |     int ret = RSA_generate_key_ex(rsa, bits, bn, nullptr);
        |               ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /usr/include/openssl/x509.h:36,
                   from /home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.h:4,
                   from /home/runner/work/r-exasol/r-exasol/src/r_exasol/ssl/certificate.cpp:2:
  /usr/include/openssl/rsa.h:2[60](https://github.com/exasol/r-exasol/actions/runs/3759303716/jobs/6388707194#step:7:62):27: note: declared here
    260 | OSSL_DEPRECATEDIN_3_0 int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e,
        |                           ^~~~~~~~~~~~~~~~~~~
  cc1plus: all warnings being treated as errors

The OpenSSL 3.0.0 migration guide claims:

Deprecated low-level object creation

Low-level objects were created using methods such as RSA_new(3), RSA_up_ref(3) and RSA_free(3). Applications should instead use the high-level EVP_PKEY APIs, e.g. EVP_PKEY_new(3), EVP_PKEY_up_ref(3) and EVP_PKEY_free(3). See also EVP_PKEY_CTX_new_from_name(3) and EVP_PKEY_CTX_new_from_pkey(3).

EVP_PKEYs may be created in a variety of ways: See also "Deprecated low-level key generation functions", "Deprecated low-level key reading and writing functions" and "Deprecated low-level key parameter setters".

Acceptance Criteria

  1. Adjust to new OpenSSL interface (using high level key generation functions)
  2. Treat all warnings as errors again here

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringCode improvement without behavior change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions