Skip to content

fix(#2809): make Algorithm getters const#2817

Open
jalil-salame wants to merge 1 commit intobriansmith:mainfrom
jalil-salame:jalil/const-getters
Open

fix(#2809): make Algorithm getters const#2817
jalil-salame wants to merge 1 commit intobriansmith:mainfrom
jalil-salame:jalil/const-getters

Conversation

@jalil-salame
Copy link
Copy Markdown

This allows using the key_len in constants for type safety, e.g.

type CHACHA_KEY = [u8; ring::aead::CHACHA20_POLY1305.key_len()];

static DEFAULT_KEY: CHACHA_KEY = [0; ring::aead::CHACHA20_POLY1305.key_len()];

Closes #2809

Copy link
Copy Markdown
Owner

@briansmith briansmith left a comment

Choose a reason for hiding this comment

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

Thank you. Could you please update the commit message, e.g. "aead/quic: Make key/nonce/tag length accessors const."? We generally want the commit messages to be independent of any GitHub-isms.

This allows using the `key_len` in constants for type safety, e.g.

```rust
type CHACHA_KEY = [u8; ring::aead::CHACHA20_POLY1305.key_len()];

static DEFAULT_KEY: CHACHA_KEY = [0; ring::aead::CHACHA20_POLY1305.key_len()];
```

Signed-off-by: Jalil David Salamé Messina <jalil.salame@gmail.com>
@jalil-salame jalil-salame force-pushed the jalil/const-getters branch from 54eab20 to 87a34b8 Compare May 2, 2026 11:40
@jalil-salame jalil-salame requested a review from briansmith May 2, 2026 11:40
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.

Constify accessor methods to the Algorithm struct

2 participants