Skip to content

Commit c74ea5f

Browse files
authored
Merge pull request #5394 from vpodzime/master-valgrind_u22
Ubuntu 22.04 valgrind checks
2 parents e3f631a + 504c938 commit c74ea5f

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

libpromises/crypto.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ static void CleanupOpenSSLThreadLocks(void);
6262

6363
static bool crypto_initialized = false; /* GLOBAL_X */
6464

65+
#if OPENSSL_VERSION_NUMBER > 0x30000000
66+
static OSSL_PROVIDER *legacy_provider = NULL;
67+
static OSSL_PROVIDER *default_provider = NULL;
68+
#endif
69+
6570
const char *CryptoLastErrorString()
6671
{
6772
const char *errmsg = ERR_reason_error_string(ERR_get_error());
@@ -81,8 +86,8 @@ void CryptoInitialize()
8186
/* We need Blowfish for legacy encrypted network stuff and in OpenSSL
8287
* 3+, it's only available when the legacy provider is loaded. And we
8388
* also need the default provider. */
84-
OSSL_PROVIDER_load(NULL, "legacy");
85-
OSSL_PROVIDER_load(NULL, "default");
89+
legacy_provider = OSSL_PROVIDER_load(NULL, "legacy");
90+
default_provider = OSSL_PROVIDER_load(NULL, "default");
8691
#endif
8792
RandomSeed();
8893

@@ -113,6 +118,20 @@ void CryptoDeInitialize()
113118
EVP_cleanup();
114119
CleanupOpenSSLThreadLocks();
115120
ERR_free_strings();
121+
122+
#if OPENSSL_VERSION_NUMBER > 0x30000000
123+
if (legacy_provider != NULL)
124+
{
125+
OSSL_PROVIDER_unload(legacy_provider);
126+
legacy_provider = NULL;
127+
}
128+
if (default_provider != NULL)
129+
{
130+
OSSL_PROVIDER_unload(default_provider);
131+
default_provider = NULL;
132+
}
133+
#endif
134+
116135
crypto_initialized = false;
117136
}
118137
}

tests/valgrind-check/Containerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM ubuntu:20.04 AS build
1+
FROM ubuntu:22.04 AS build
22
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y
33
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libssl-dev libxml2-dev libpam0g-dev liblmdb-dev libacl1-dev libpcre3 libpcre3-dev
4-
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python git flex bison byacc automake make autoconf libtool valgrind
4+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3 git flex bison byacc automake make autoconf libtool valgrind
55
COPY masterfiles masterfiles
66
COPY core core
77
WORKDIR core

0 commit comments

Comments
 (0)