security: reimplement RSA and EC key generation for OpenSSL 3.0
Also suppress deprecation warnings related to the RAND_METHOD API.
Refs: #5154
Change-Id: I977b902465f4e4cae663c21fbeda5ab808a6e66c
diff --git a/tests/unit/util/random.t.cpp b/tests/unit/util/random.t.cpp
index 73c3825..8875cce 100644
--- a/tests/unit/util/random.t.cpp
+++ b/tests/unit/util/random.t.cpp
@@ -46,6 +46,13 @@
BOOST_CHECK_EQUAL(r1, r3);
}
+// RAND_get_rand_method() and RAND_set_rand_method() are deprecated in OpenSSL 3.0
+// and there is no straightforward replacement. Suppress the warnings for now, but
+// we may have to drop this test case when OpenSSL removes the RAND_METHOD API.
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
// This fixture uses OpenSSL routines to set a dummy random generator that always fails
class FailRandMethodFixture
{
@@ -110,7 +117,7 @@
BOOST_FIXTURE_TEST_CASE(Error, FailRandMethodFixture)
{
- std::array<uint8_t, 1024> buf;
+ std::array<uint8_t, 512> buf;
BOOST_CHECK_THROW(random::generateSecureBytes(buf), std::runtime_error);
}