1e0c4386eSCy Schubert /* 2*44096ebdSEnji Cooper * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. 3e0c4386eSCy Schubert * 4e0c4386eSCy Schubert * Licensed under the Apache License 2.0 (the "License"). You may not use 5e0c4386eSCy Schubert * this file except in compliance with the License. You can obtain a copy 6e0c4386eSCy Schubert * in the file LICENSE in the source distribution or at 7e0c4386eSCy Schubert * https://www.openssl.org/source/license.html 8e0c4386eSCy Schubert */ 9e0c4386eSCy Schubert 10e0c4386eSCy Schubert #ifndef OSSL_TEST_SSLTESTLIB_H 11e0c4386eSCy Schubert # define OSSL_TEST_SSLTESTLIB_H 12e0c4386eSCy Schubert 13e0c4386eSCy Schubert # include <openssl/ssl.h> 14e0c4386eSCy Schubert 15e0c4386eSCy Schubert int create_ssl_ctx_pair(OSSL_LIB_CTX *libctx, const SSL_METHOD *sm, 16e0c4386eSCy Schubert const SSL_METHOD *cm, int min_proto_version, 17e0c4386eSCy Schubert int max_proto_version, SSL_CTX **sctx, SSL_CTX **cctx, 18e0c4386eSCy Schubert char *certfile, char *privkeyfile); 19e0c4386eSCy Schubert int create_ssl_objects(SSL_CTX *serverctx, SSL_CTX *clientctx, SSL **sssl, 20e0c4386eSCy Schubert SSL **cssl, BIO *s_to_c_fbio, BIO *c_to_s_fbio); 21e0c4386eSCy Schubert int create_bare_ssl_connection(SSL *serverssl, SSL *clientssl, int want, 22e0c4386eSCy Schubert int read); 23e0c4386eSCy Schubert int create_ssl_objects2(SSL_CTX *serverctx, SSL_CTX *clientctx, SSL **sssl, 24e0c4386eSCy Schubert SSL **cssl, int sfd, int cfd); 25e0c4386eSCy Schubert int create_test_sockets(int *cfd, int *sfd); 26e0c4386eSCy Schubert int create_ssl_connection(SSL *serverssl, SSL *clientssl, int want); 27e0c4386eSCy Schubert void shutdown_ssl_connection(SSL *serverssl, SSL *clientssl); 28e0c4386eSCy Schubert 29e0c4386eSCy Schubert /* Note: Not thread safe! */ 30e0c4386eSCy Schubert const BIO_METHOD *bio_f_tls_dump_filter(void); 31e0c4386eSCy Schubert void bio_f_tls_dump_filter_free(void); 32e0c4386eSCy Schubert 33e0c4386eSCy Schubert const BIO_METHOD *bio_s_mempacket_test(void); 34e0c4386eSCy Schubert void bio_s_mempacket_test_free(void); 35e0c4386eSCy Schubert 36e0c4386eSCy Schubert const BIO_METHOD *bio_s_always_retry(void); 37e0c4386eSCy Schubert void bio_s_always_retry_free(void); 38e0c4386eSCy Schubert void set_always_retry_err_val(int err); 39e0c4386eSCy Schubert 40e0c4386eSCy Schubert /* Packet types - value 0 is reserved */ 41e0c4386eSCy Schubert #define INJECT_PACKET 1 42e0c4386eSCy Schubert #define INJECT_PACKET_IGNORE_REC_SEQ 2 43e0c4386eSCy Schubert 44e0c4386eSCy Schubert /* 45e0c4386eSCy Schubert * Mempacket BIO ctrls. We make them large enough to not clash with standard BIO 46e0c4386eSCy Schubert * ctrl codes. 47e0c4386eSCy Schubert */ 48e0c4386eSCy Schubert #define MEMPACKET_CTRL_SET_DROP_EPOCH (1 << 15) 49e0c4386eSCy Schubert #define MEMPACKET_CTRL_SET_DROP_REC (2 << 15) 50e0c4386eSCy Schubert #define MEMPACKET_CTRL_GET_DROP_REC (3 << 15) 51e0c4386eSCy Schubert #define MEMPACKET_CTRL_SET_DUPLICATE_REC (4 << 15) 52e0c4386eSCy Schubert 53e0c4386eSCy Schubert int mempacket_swap_epoch(BIO *bio); 54e0c4386eSCy Schubert int mempacket_move_packet(BIO *bio, int d, int s); 55e0c4386eSCy Schubert int mempacket_test_inject(BIO *bio, const char *in, int inl, int pktnum, 56e0c4386eSCy Schubert int type); 57e0c4386eSCy Schubert 58e0c4386eSCy Schubert typedef struct mempacket_st MEMPACKET; 59e0c4386eSCy Schubert 60e0c4386eSCy Schubert DEFINE_STACK_OF(MEMPACKET) 61e0c4386eSCy Schubert 62*44096ebdSEnji Cooper ENGINE *load_dasync(void); 63e0c4386eSCy Schubert #endif /* OSSL_TEST_SSLTESTLIB_H */ 64