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

Consider changing PoseidonPermutation::set_from_slice #824

Open
sdwoodbury opened this issue Jan 28, 2025 · 2 comments
Open

Consider changing PoseidonPermutation::set_from_slice #824

sdwoodbury opened this issue Jan 28, 2025 · 2 comments
Labels
maybe_bug Something to verify or to make more robust

Comments

@sdwoodbury
Copy link

potential security issue

relevant code
Duplex Sponge Paper

It appears that this function will

  • overwrite the capacity portion of the state if the slice is large enough
  • not pad the rate portion of the state when the slice is less than rate field elements.

If the sponge ingested elements by adding them into the state, and the padding scheme is to pad with zeros, then ignoring the unset portion of the rate is ok (adding zero-padding is a no-op). But here, overwrite mode is being used. I think that this would require the unset portion of the rate to be overwritten with padding.

@sdwoodbury
Copy link
Author

for reference, this is what plonky2 does:

related PRs

@naure naure added the maybe_bug Something to verify or to make more robust label Jan 29, 2025
@sdwoodbury
Copy link
Author

based on this it looks like Plonky2 waits until the rate portion is full before permuting. This eliminates the need for padding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maybe_bug Something to verify or to make more robust
Projects
None yet
Development

No branches or pull requests

2 participants