RustCrypto / RustCrypto/traits

cipher: Block alignment

Open
#159 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cipher
Dominant language
Rust
Stars
755
Forks
256
Avg merge
1h 27m
Merged PRs (30d)
2

Description

Some hardware implementations (e.g. of AES) need particular alignment of blocks to operate directly over AHB (e.g. NXP LPC55's HASHCRYPT wants 32-bit alignment, I can imagine this is a typical case for ARM microcontrollers). If a large chunk of data needs to be en/de-crypted that's aligned, it would be neat to pass this information through on the type level to avoid stack copies for each block.

The aligned crate (which is sadly missing an A1 type) would be one approach to do it, set

pub type Block<B> = aligned::Aligned<
    <B as BlockCipher>::BlockAlignment, 
    GenericArray<u8, <B as BlockCipher>::BlockSize>
>;

Splitting this out from https://github.com/RustCrypto/traits/issues/43 for possible discussion.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the related discussion in RustCrypto/traits issue #43 and this issue's proposal involving Block, BlockCipher, GenericArray, and the aligned crate. Determine whether block alignment belongs in the trait API and what compatibility constraints apply. Done means a decided design and agreed scope for exposing alignment without per-block stack copies.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.