Skip to content

Fix: Potential side-channel in Kyber's Ciphertext::compress functions#3874

Merged
FAlbertDev merged 1 commit intorandombit:masterfrom
Rohde-Schwarz:fix/kyber-sc-follow-up
Feb 16, 2024
Merged

Fix: Potential side-channel in Kyber's Ciphertext::compress functions#3874
FAlbertDev merged 1 commit intorandombit:masterfrom
Rohde-Schwarz:fix/kyber-sc-follow-up

Conversation

@FAlbertDev
Copy link
Copy Markdown
Collaborator

@FAlbertDev FAlbertDev commented Jan 4, 2024

This is a follow-up to #3846 and relates to the KyberSlash side channel. It also fixes the Ciphertext::compress method's potential division side channel.

To remove the critical division operation, we enforce the optimization most compilers perform to replace the division by multiplication and various shifts (see godbolt).

@FAlbertDev FAlbertDev force-pushed the fix/kyber-sc-follow-up branch from 763cef1 to 1335e3b Compare January 4, 2024 10:50
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 4, 2024

Coverage Status

coverage: 92.065% (+0.005%) from 92.06%
when pulling 0e8d329 on Rohde-Schwarz:fix/kyber-sc-follow-up
into 700202b on randombit:master.

Replace the divisions by KyberConstants::Q with a divisionless alternative.
@FAlbertDev FAlbertDev force-pushed the fix/kyber-sc-follow-up branch from 1335e3b to 0e8d329 Compare January 4, 2024 15:41
@reneme reneme requested a review from randombit January 4, 2024 15:57
@reneme reneme added this to the Botan 3.3.0 milestone Jan 4, 2024
@reneme reneme added the bug label Jan 4, 2024
@FAlbertDev
Copy link
Copy Markdown
Collaborator Author

With #3898, a better, less "magic number" approach is introduced; however, it depends on the open PR #3887, which we will probably not merge until the 3.3 release. I recommend merging this quick fix for the 3.3 release and then going for the improved approach afterward.

Copy link
Copy Markdown
Owner

@randombit randombit left a comment

Choose a reason for hiding this comment

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

👍

@FAlbertDev FAlbertDev merged commit cada0d7 into randombit:master Feb 16, 2024
@FAlbertDev FAlbertDev deleted the fix/kyber-sc-follow-up branch February 16, 2024 07:39
This was referenced Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants