Skip to content

Redo the scheme's no-std interface #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nyonson
Copy link
Collaborator

@nyonson nyonson commented Jun 23, 2025

Major changes! But confined to the lower level no-std interface, the higher level Async I/O one remains unchanged.

There are two big changes which then trickle around the whole library.

  1. Cosmetic, but re-name the no-std interface to not include Reader and Writer suffixes for clarity. These structures are purposely not implementing the standard Read/Write IO traits, so shouldn't follow that naming convention. Those helper wrappers live over in the IO module.
Old Name New Name Notes
PacketHandler CipherSession Main type for handling encrypted communication
PacketReader InboundCipher Handles decryption of incoming packets
PacketWriter OutboundCipher Handles encryption of outgoing packets
  1. Dropped the middle-ground alloc feature flag. This change makes the core library just no-std and the I/O module full on std. The inbound and outbound ciphers drop their "alloc" wrapper methods and instead expose helper methods to calculate appropriate buffer lengths, OutboundCipher::encryption_buffer_len() and InboundCipher::decryption_buffer_len(). These are used by the higher level IO wrappers.

@nyonson nyonson changed the title Redo the cipher's interface Redo the scheme's no-std interface Jun 23, 2025
@rustaceanrob
Copy link
Collaborator

Name changes make sense. From the point of view of the caller it seems nice to not have to worry about the allocations if possible, but if these are going to be wrapped by Payload for the most part it doesn't matter. I don't have a strong opinion since this is mostly no_std

@nyonson nyonson force-pushed the break-packet-handler branch 2 times, most recently from dd3706c to 37150ed Compare June 24, 2025 16:00
@nyonson nyonson marked this pull request as ready for review June 24, 2025 16:22
Major changes! But confined to the lower level no-std interface, the
higher level Async I/O one remains unchanged.

There are two big changes which then trickle around the whole library.

1. Cosmetic, but re-name the no-std interface to not include `Reader`
and `Writer` suffixes for clarity. These structures are purposely not
implementing the standard Read/Write IO traits, so shouldn't follow that
naming convention. Those helper wrappers live over in the IO module.
2. Dropped the middle-ground `alloc` feature flag. This change makes the
core library just no-std and the I/O module full on std. The inbound and
outbound ciphers drop their "alloc" wrapper methods and instead expose
 helper methods to calculate appropriate buffer lengths,
`OutboundCipher::encryption_buffer_len()` and
`InboundCipher::decryption_buffer_len()`. These are used by the higher i
level IO wrappers.
@nyonson nyonson force-pushed the break-packet-handler branch from 37150ed to d1327fe Compare June 24, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants