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

fix: fix gcm tag length truncation #845

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DasDingGehtNicht
Copy link

the truncate method takes the count of the number of bytes to trim off as an argument.
the calculation to calculate this number should therefore be oldLengthInBytes - (wantedLengthInBits / 8)

e.g. the original tag is 16 bytes long, i specify a tagLength of 32 bits, so the tag should be 4 bytes.
old calculation: 16 % (32/8) = 0 => no truncation => 16 bytes tag length
new calculation: 16 - (32/8) = 12 => truncate 12 bytes from the 16 bytes => 4 bytes tag length

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

1 participant