yahoo / yahoo/NetCHASM

NetCHASM doesn't build against OpenSSL3.0

Open
#16 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
15
Forks
13
Avg merge
4d 7h
Merged PRs (30d)
2

Description

Expected Behavior

NetCHASM should build under Ubuntu LTS 22.04 and CentOS 9 which be default use OpenSSL3.

Current Behavior

NetCHASM fails to compile against OpenSSL3 because it uses a function that has been removed: FIPS_mode_set(). Here is the compile error:

/home/ubuntu/NetCHASM/src/internal/HMStateManager.cpp:106:5: error: ‘FIPS_mode_set’ was not declared in this scope
  106 |     FIPS_mode_set(0);
      |     ^~~~~~~~~~~~~
make[2]: *** [src/internal/CMakeFiles/netchasm_core.dir/build.make:692: src/internal/CMakeFiles/netchasm_core.dir/HMStateManager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:426: src/internal/CMakeFiles/netchasm_core.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Note that there are also some functions used in NetCHASM that have been deprecated in OpenSSL3 (and some deprecated in OpenSSL 1.1.0). These functions will still work for now, but it is advisable to use the newer, non-deprecated functions to avoid the build breaking in the future. I've attached a full build log against OpenSSL3 which contains all the warnings of deprecated functions. Here is an example:

/home/ubuntu/NetCHASM/src/api/HMControlTLSSocketClient.cpp: In constructor ‘HMControlTLSSocketClient::HMControlTLSSocketClient(HMAPIIPAddress&, uint16_t, std::string&, std::string&, std::string&)’:
/home/ubuntu/NetCHASM/src/api/HMControlTLSSocketClient.cpp:100:40: warning: ‘const SSL_METHOD* TLSv1_2_method()’ is deprecated: Since OpenSSL 1.1.0 [-Wdeprecated-declarations]
  100 |     m_ctx = SSL_CTX_new(TLSv1_2_method());
      |                                        ^
In file included from /home/ubuntu/NetCHASM/include/NetCHASM/HMControlTLSSocketClient.h:11,
                 from /home/ubuntu/NetCHASM/src/api/HMControlTLSSocketClient.cpp:12:
/usr/include/openssl/ssl.h:2020:50: note: declared here
 2020 | OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_2_method(void); /* TLSv1.2 */
      |                                                  ^~~~~~~~~~~~~~
/home/ubuntu/NetCHASM/src/api/HMControlTLSSocketClient.cpp:100:40: warning: ‘const SSL_METHOD* TLSv1_2_method()’ is deprecated: Since OpenSSL 1.1.0 [-Wdeprecated-declarations]
  100 |     m_ctx = SSL_CTX_new(TLSv1_2_method());
      |                                        ^
In file included from /home/ubuntu/NetCHASM/include/NetCHASM/HMControlTLSSocketClient.h:11,
                 from /home/ubuntu/NetCHASM/src/api/HMControlTLSSocketClient.cpp:12:
/usr/include/openssl/ssl.h:2020:50: note: declared here
 2020 | OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_2_method(void); /* TLSv1.2 */
      |                                                  ^~~~~~~~~~~~~~
/home/ubuntu/NetCHASM/src/internal/HMWorkHealthCheckCurl.cpp:86:21: warning: ‘void RSA_free(RSA*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   86 |         RSA_free(rsa);
      |                     ^
In file included from /usr/include/openssl/x509.h:36,
                 from /usr/include/openssl/ssl.h:31,
                 from /home/ubuntu/NetCHASM/include/internal/HMEventLoopLibEvent.h:15,
                 from /home/ubuntu/NetCHASM/include/internal/HMStateManager.h:9,
                 from /home/ubuntu/NetCHASM/src/internal/HMWorkHealthCheckCurl.cpp:10:
/usr/include/openssl/rsa.h:293:28: note: declared here
  293 | OSSL_DEPRECATEDIN_3_0 void RSA_free(RSA *r);
      |                            ^~~~~~~~

Full Log: make.log

Possible Solution

I'm not really sure why FIPS_mode_set(0) (which would attempt to turn FIPS Mode off) is called as I can't find an instance in the NetCHASM code where FIPS mode is turned on. The OpenSSL page on migrating to OpenSSL3 is here: https://www.openssl.org/docs/man3.0/man7/migration_guide.html#Deprecated-low-level-encryption-functions and it says this:

Removed FIPS_mode() and FIPS_mode_set()
These functions are legacy APIs that are not applicable to the new provider model. Applications should instead use [EVP_default_properties_is_fips_enabled(3)](https://www.openssl.org/docs/man3.0/man3/EVP_default_properties_is_fips_enabled.html) and [EVP_default_properties_enable_fips(3)](https://www.openssl.org/docs/man3.0/man3/EVP_default_properties_enable_fips.html).

So I can't fully suggest what to change here to fix this issue.

Steps to Reproduce (for bugs)

Clone the repository on Ubuntu 22.04 LTS and follow the normal steps for building. Install the pre-reqs, run the cmake command then make. Note that I also had to install and use g++-9 because NetCHASM won't build with g++-11 due to compiler changes.

Context

OpenSSL3 is the current version of the OpenSSL project and has been adopted by Ubuntu 22.04, CentOS 9, and presumably will be the default for most distros going forward. The older OpenSSL versions will go EOL eventually thus meaning that all systems that want to use OpenSSL must upgrade. Unfortunately, OpenSSL has deprecated or removed some of their API in this major version update. If people want to use NetCHASM on these newer distros then it will have to be updated to support the OpenSSL 3.0 APIs. Here is the migration guide which helps explain this.

Your Environment

  • Version used: git master, as of this writing that is commit 3071241ce0d
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Ubuntu 22.04, g++-9, OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
  • Operating System and version (desktop or mobile): Ubuntu 22.04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the build on Ubuntu 22.04 with OpenSSL 3 and inspect src/internal/HMStateManager.cpp, especially the FIPS_mode_set() call. Then review the deprecated API warnings in src/api/HMControlTLSSocketClient.cpp and src/internal/HMWorkHealthCheckCurl.cpp, using the linked OpenSSL migration guide. Done means NetCHASM builds successfully against OpenSSL 3 without the reported removed API failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.