LCOV - code coverage report
Current view: top level - waltz/openssl - fd_openssl.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 6 0.0 %
Date: 2026-03-19 18:19:27 Functions: 0 5 0.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_waltz_openssl_fd_openssl_h
       2             : #define HEADER_fd_src_waltz_openssl_fd_openssl_h
       3             : 
       4             : #include "../../util/fd_util_base.h"
       5             : 
       6             : #if FD_HAS_OPENSSL
       7             : 
       8             : #include <openssl/bio.h>
       9             : #include <openssl/ssl.h>
      10             : 
      11             : FD_PROTOTYPES_BEGIN
      12             : 
      13             : /* fd_openssl_ssl_strerror returns a human-readable string for SSL error
      14             :    codes like SSL_ERROR_ZERO_RETURN.  Unfortunately, no such strerror
      15             :    API exists in OpenSSL itself, for APIs that don't append to the error
      16             :    queue. */
      17             : 
      18             : FD_FN_CONST char const *
      19             : fd_openssl_ssl_strerror( int ssl_err );
      20             : 
      21             : /* fd_openssl_bio_new_socket creates a socket BIO that uses send() with
      22             :    MSG_NOSIGNAL to prevent SIGPIPE.  Drop-in replacement for
      23             :    BIO_new_socket(). */
      24             : 
      25             : BIO *
      26             : fd_openssl_bio_new_socket( int fd,
      27             :                            int close_flag );
      28             : 
      29             : /* fd_openssl_ssl_set_fd attaches a NOSIGPIPE socket BIO to the SSL
      30             :    object.  Drop-in replacement for SSL_set_fd(). */
      31             : 
      32             : static inline int
      33             : fd_openssl_ssl_set_fd( SSL * ssl,
      34           0 :                        int   fd ) {
      35           0 :   BIO * bio = fd_openssl_bio_new_socket( fd, BIO_NOCLOSE );
      36           0 :   if( FD_UNLIKELY( !bio ) ) return 0;
      37           0 :   SSL_set_bio( ssl, bio, bio );
      38           0 :   return 1;
      39           0 : }
      40             : 
      41             : FD_PROTOTYPES_END
      42             : 
      43             : #endif /* FD_HAS_OPENSSL */
      44             : 
      45             : #endif /* HEADER_fd_src_waltz_openssl_fd_openssl_h */

Generated by: LCOV version 1.14