Skip to content

Commit

Permalink
Move the ability to load the dasync engine into ssltestlib.c
Browse files Browse the repository at this point in the history
The sslapitest has a helper function to load the dasync engine which is
useful for testing pipelining. We would like to have the same facility
from sslbuffertest, so we move the function to the common location
ssltestlib.c

Follow on from CVE-2024-4741
  • Loading branch information
dongbeiouba committed Jun 26, 2024
1 parent d77c2e1 commit 5619493
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
26 changes: 25 additions & 1 deletion test/ssltestlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <string.h>

#include <openssl/engine.h>
#include "internal/nelem.h"
#include "ssltestlib.h"
#include "testutil.h"
Expand Down Expand Up @@ -947,3 +947,27 @@ void shutdown_ssl_connection(SSL *serverssl, SSL *clientssl)
SSL_free(serverssl);
SSL_free(clientssl);
}

ENGINE *load_dasync(void)
{
#if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_DYNAMIC_ENGINE)
ENGINE *e;

if (!TEST_ptr(e = ENGINE_by_id("dasync")))
return NULL;

if (!TEST_true(ENGINE_init(e))) {
ENGINE_free(e);
return NULL;
}

if (!TEST_true(ENGINE_register_ciphers(e))) {
ENGINE_free(e);
return NULL;
}

return e;
#else
return NULL;
#endif
}
2 changes: 1 addition & 1 deletion test/ssltestlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ int mempacket_test_inject(BIO *bio, const char *in, int inl, int pktnum,
typedef struct mempacket_st MEMPACKET;

DEFINE_STACK_OF(MEMPACKET)

ENGINE *load_dasync(void);
#endif /* OSSL_TEST_SSLTESTLIB_H */

0 comments on commit 5619493

Please sign in to comment.