From cb3f7acb505e06cebaac59b31f03b3a2970dcebd Mon Sep 17 00:00:00 2001 From: toidiu Date: Tue, 12 Nov 2024 13:22:41 -0800 Subject: [PATCH] Revert "test check: do we test OPENSSL_NO_ENGINE" This reverts commit f051bbff5f5997d1de5b24875e136613490fb3af. --- .../features/S2N_LIBCRYPTO_SUPPORTS_ENGINE.c | 64 +++++++++---------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/tests/features/S2N_LIBCRYPTO_SUPPORTS_ENGINE.c b/tests/features/S2N_LIBCRYPTO_SUPPORTS_ENGINE.c index 5b0b07ca1a5..68676ad5315 100644 --- a/tests/features/S2N_LIBCRYPTO_SUPPORTS_ENGINE.c +++ b/tests/features/S2N_LIBCRYPTO_SUPPORTS_ENGINE.c @@ -26,47 +26,43 @@ * [3] https://github.com/aws/s2n-tls/pull/4873 */ -/* #include */ +#include int main() { - /* /1* S2N_LIBCRYPTO_SUPPORTS_ENGINE is disabled when compiling with AWS-LC. */ - /* * */ - /* * Custom random is only used when linked with OpenSSL. However, it should be */ - /* * possible to compile the ENGINE related code with other libcrypto (eg. */ - /* * BoringSSL, LibreSSL). This is not the case with AWS-LC which has a different */ - /* * `RAND_METHOD` signature and results in a compilation error. */ - /* * */ - /* * [1] AWS-LC: https://github.com/aws/aws-lc/blob/main/include/openssl/rand.h#L124 */ - /* * [2] OpenSSL: https://github.com/openssl/openssl/blob/master/include/openssl/rand.h#L42 */ - /* *1/ */ -#if defined(OPENSSL_IS_AWSLC) + /* S2N_LIBCRYPTO_SUPPORTS_ENGINE is disabled when compiling with AWS-LC. + * + * Custom random is only used when linked with OpenSSL. However, it should be + * possible to compile the ENGINE related code with other libcrypto (eg. + * BoringSSL, LibreSSL). This is not the case with AWS-LC which has a different + * `RAND_METHOD` signature and results in a compilation error. + * + * [1] AWS-LC: https://github.com/aws/aws-lc/blob/main/include/openssl/rand.h#L124 + * [2] OpenSSL: https://github.com/openssl/openssl/blob/master/include/openssl/rand.h#L42 + */ +#if defined(OPENSSL_NO_ENGINE) || defined(OPENSSL_IS_AWSLC) #error "engine is not supported" #endif -/* #if defined(OPENSSL_NO_ENGINE) || defined(OPENSSL_IS_AWSLC) */ - /* #error "engine is not supported" */ -/* #endif */ + /* Init usage in utils/s2n_random.c */ + ENGINE *e = ENGINE_new(); + ENGINE_set_id(e, "id"); + ENGINE_set_name(e, "name"); + ENGINE_set_flags(e, ENGINE_FLAGS_NO_REGISTER_ALL); + ENGINE_set_init_function(e, NULL); + ENGINE_set_RAND(e, NULL); + ENGINE_add(e); + ENGINE_init(e); + ENGINE_set_default(e, ENGINE_METHOD_RAND); - /* /1* Init usage in utils/s2n_random.c *1/ */ - /* ENGINE *e = ENGINE_new(); */ - /* ENGINE_set_id(e, "id"); */ - /* ENGINE_set_name(e, "name"); */ - /* ENGINE_set_flags(e, ENGINE_FLAGS_NO_REGISTER_ALL); */ - /* ENGINE_set_init_function(e, NULL); */ - /* ENGINE_set_RAND(e, NULL); */ - /* ENGINE_add(e); */ - /* ENGINE_init(e); */ - /* ENGINE_set_default(e, ENGINE_METHOD_RAND); */ - - /* /1* Cleanup usage in utils/s2n_random.c *1/ */ - /* ENGINE_remove(e); */ - /* ENGINE_finish(e); */ - /* ENGINE_unregister_RAND(e); */ - /* ENGINE_free(e); */ - /* ENGINE_cleanup(); */ - /* RAND_set_rand_engine(NULL); */ - /* RAND_set_rand_method(NULL); */ + /* Cleanup usage in utils/s2n_random.c */ + ENGINE_remove(e); + ENGINE_finish(e); + ENGINE_unregister_RAND(e); + ENGINE_free(e); + ENGINE_cleanup(); + RAND_set_rand_engine(NULL); + RAND_set_rand_method(NULL); return 0; }