Skip to content

cipher: Block alignment #159

@nickray

Description

@nickray

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 #43 for possible discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cipherBlock and stream cipher crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions