Skip to content
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

cipher: rename BlockCipher*/BlockMode* #1482

Merged
merged 2 commits into from
Jan 21, 2024

Conversation

tarcieri
Copy link
Member

Renames the following traits:

  • BlockEncrypt => BlockCipherEncrypt
  • BlockDecrypt => BlockCipherDecrypt
  • BlockEncryptMut => BlockModeEncrypt
  • BlockDecryptMut => BlockModeDecrypt

As originally suggested in this comment:

RustCrypto/block-modes#14 (comment)

This better reflects how these traits are actually used, i.e. BlockCipher* is used by ciphers, and BlockMode* is used by their modes of operation.

Renames the following traits:

- `BlockEncrypt` => `BlockCipherEncrypt`
- `BlockDecrypt` => `BlockCipherDecrypt`
- `BlockEncryptMut` => `BlockModeEncrypt`
- `BlockDecryptMut` => `BlockModeDecrypt`

As originally suggested in this comment:

RustCrypto/block-modes#14 (comment)

This better reflects how these traits are actually used, i.e.
`BlockCipher*` is used by ciphers, and `BlockMode*` is used by their
modes of operation.
@tarcieri tarcieri changed the title [WIP] cipher: rename BlockCipher*/BlockMode* cipher: rename BlockCipher*/BlockMode* Jan 21, 2024
Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's worth to remove the _mut suffixes from BlockMode* method names? It may cause issues when both BlockMode* and BlockCipher* imported simultaneously, but I think it's a relatively rare situation in user code.

@tarcieri tarcieri merged commit 7ae1519 into master Jan 21, 2024
9 checks passed
@tarcieri tarcieri deleted the cipher/rename-block-cipher-traits branch January 21, 2024 23:30
@tarcieri
Copy link
Member Author

Hmm, guess I should've prepared a branch of https://github.com/rustcrypto/block-ciphers first because this is causing all sorts of wacky breakages including macro invocation failures like:

error: expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `:`
   --> sm4/src/lib.rs:127:1
    |
127 | / cipher::impl_simple_block_encdec!(
128 | |     Sm4, U16, cipher, block,
129 | |     encrypt: {
130 | |         let b = block.get_in();
...   |
174 | |     }
175 | | );
    | | ^
    | | |
    | |_expected one of 8 possible tokens
    |   in this macro invocation

tarcieri added a commit that referenced this pull request Jan 22, 2024
The branch was never tested against the block ciphers repo located at
https://github.com/rustcrypto/block-ciphers

There were various errors and missed changes in macros which were
required to get everything to compile.

This includes fixes and has been tested against the downstream repo.
@tarcieri
Copy link
Member Author

#1483 contains fixes to errors/omissions in this PR

tarcieri added a commit that referenced this pull request Jan 22, 2024
The branch was never tested against the block ciphers repo located at
https://github.com/rustcrypto/block-ciphers

There were various errors and missed changes in macros which were
required to get everything to compile.

This includes fixes and has been tested against the downstream repo.
tarcieri added a commit to RustCrypto/block-ciphers that referenced this pull request Jan 22, 2024
Updates the previous `BlockEncrypt`/`BlockEncrypt` trait names to use
the new ones introduced in RustCrypto/traits#1482
tarcieri added a commit to RustCrypto/block-ciphers that referenced this pull request Jan 22, 2024
Updates the previous `BlockEncrypt`/`BlockEncrypt` trait names to use
the new ones introduced in RustCrypto/traits#1482
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.

None yet

2 participants