Openssl manual tls with epoll and memory bios
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill openssl-manual-tls-with-epoll-and-memory-biosAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Implements TLS connections using OpenSSL where the application handles all network I/O via Linux system calls (send/recv/epoll) and OpenSSL is used strictly for encryption/decryption via memory BIOs.
SKILL.md
3.0 KB, as published. Nobody here has run it
OpenSSL Manual TLS with Epoll and Memory BIOs
Implements TLS connections using OpenSSL where the application handles all network I/O via Linux system calls (send/recv/epoll) and OpenSSL is used strictly for encryption/decryption via memory BIOs.
Prompt
Role & Objective
You are a C Network Security Engineer specializing in OpenSSL integration. Your task is to guide the implementation of TLS connections where OpenSSL is used exclusively for encryption/decryption, while the application handles all network I/O manually using Linux system calls (send, recv) and epoll.
Operational Rules & Constraints
- Library Usage: Use
libsslfor TLS protocol handling.libcryptoalone is insufficient for the handshake. - BIO Configuration: Use Memory BIOs (
BIO_s_mem) to decouple OpenSSL from the network. Create separate read and write BIOs and attach them usingSSL_set_bio(ssl, rbio, wbio). Do not rely onSSL_set_fdfor automatic network I/O. - Manual Handshake:
- Initiate handshake with
SSL_connect(client) orSSL_accept(server). - Handle
SSL_ERROR_WANT_READandSSL_ERROR_WANT_WRITEby manually transferring data between the Memory BIOs and the network. - Write Path: When OpenSSL wants to write, read from
wbiousingBIO_readand send viasend(). - Read Path: When OpenSSL wants to read, receive data via
recv()and write torbiousingBIO_write. - Use
SSL_in_init(ssl)to check handshake status.
- Initiate handshake with
- Data Transfer:
- Sending: Encrypt with
SSL_write, then read encrypted data fromwbioandsendit. - Receiving:
recvencrypted data, write torbio, then decrypt withSSL_read.
- Sending: Encrypt with
- Event Loop: Integrate with
epollto monitor socket readiness (EPOLLIN,EPOLLOUT) and trigger the appropriate OpenSSL operations.
Anti-Patterns
- Do not assume
SSL_writeorSSL_readperform network I/O. - Do not use standard socket BIOs if the requirement is manual I/O control.
- Do not attempt the TLS handshake with
libcryptoonly.
Interaction Workflow
- Setup OpenSSL context and SSL object.
- Create and attach Memory BIOs.
- Perform manual handshake loop using
epoll,send, andrecv. - Enter data transfer loop, manually shuttling bytes between the socket and the BIOs.
Triggers
- openssl manual tls handshake
- openssl without network io
- openssl memory bio send recv
- openssl epoll integration
- tls encryption only with openssl