microsoft / Azure-DCAP-Client

Interfaces between SGX SDKs and the Azure Attestation SGX Certification Cache.
MIT License
60 stars 45 forks source link

Fails to build on Ubuntu 22.04 LTS (-Werror) #173

Open TimotheeIsnard opened 1 year ago

TimotheeIsnard commented 1 year ago

Hello, on the current Ubuntu LTS (22.04), libssl-dev installs OpenSSL 3.0, which deprecates a few functions. Unfortunately, this causes Azure-DCAP-Client to fail to build from source because of usage of some functions that have been deprecated in 3.0:

local_cache.cpp: In function 'std::string sha256(size_t, const void*)':
local_cache.cpp:244:16: error: 'int SHA256_Init(SHA256_CTX*)' is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  244 |     SHA256_Init(&sha256);
      |     ~~~~~~~~~~~^~~~~~~~~
In file included from local_cache.cpp:13:
/usr/include/openssl/sha.h:73:27: note: declared here
   73 | OSSL_DEPRECATEDIN_3_0 int SHA256_Init(SHA256_CTX *c);
      |                           ^~~~~~~~~~~
local_cache.cpp:245:18: error: 'int SHA256_Update(SHA256_CTX*, const void*, size_t)' is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  245 |     SHA256_Update(&sha256, data, data_size);
      |     ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from local_cache.cpp:13:
/usr/include/openssl/sha.h:74:27: note: declared here
   74 | OSSL_DEPRECATEDIN_3_0 int SHA256_Update(SHA256_CTX *c,
      |                           ^~~~~~~~~~~~~
local_cache.cpp:246:17: error: 'int SHA256_Final(unsigned char*, SHA256_CTX*)' is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
  246 |     SHA256_Final(hash, &sha256);
      |     ~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from local_cache.cpp:13:
/usr/include/openssl/sha.h:76:27: note: declared here
   76 | OSSL_DEPRECATEDIN_3_0 int SHA256_Final(unsigned char *md, SHA256_CTX *c);
      |                           ^~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [Makefile:28: local_cache.o] Error 1
dimakuv commented 1 year ago

@TimotheeIsnard I'm not from Microsoft Azure, but I just stumbled upon your issue. We had the same problem, and resolved like this:

echo "deb http://security.ubuntu.com/ubuntu focal-security main" | tee /etc/apt/sources.list.d/focal-security.list
apt-get update && apt-get install libssl1.1

So basically there is a libssl1.1 package that you can install, but for this you need the focal-security Ubuntu repo. With this, it worked.

blinton-sc commented 1 year ago

Any update on this? We are looking into implementing this and running into issues