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

Endian or alignment bugs in poly1305 code? #2

Open
richfelker opened this issue May 13, 2021 · 2 comments
Open

Endian or alignment bugs in poly1305 code? #2

richfelker opened this issue May 13, 2021 · 2 comments

Comments

@richfelker
Copy link

I'm getting correct encryption but wrong tag output on a big endian system without support for misaligned loads or stores. Haven't tracked down the cause yet. I'm not building with USE_UNALIGNED and the code looks correct in that case, but apparently it's not. I can provide the output with test vectors if needed.

@richfelker
Copy link
Author

Found the bug: the poly1305_get_tag function in chachapoly.c wrongly uses (unsigned char *)&len in an attempt to access the little endian encoding of length. It needs to use a proper U32TO8 construct like everywhere else.

@doggodanubus
Copy link

@richfelker Could provide a fixed snippet or diff? Thanks.

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

No branches or pull requests

2 participants