Skip to content

SIV properly handle zero AD components - #777

Open
karel-m wants to merge 2 commits into
developfrom
pr/siv-zero-ad
Open

SIV properly handle zero AD components#777
karel-m wants to merge 2 commits into
developfrom
pr/siv-zero-ad

Conversation

@karel-m

@karel-m karel-m commented Jul 18, 2026

Copy link
Copy Markdown
Member

This PR fixes an SIV corner case that occurs when zero AD components are used.

Checklist

  • tests are added or updated

@karel-m
karel-m requested a review from sjaeckel July 18, 2026 21:18

@sjaeckel sjaeckel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This has been discussed on the IETF ML [0] and FMU it was unconclusive.

Now I'm not sure if merging this would make our implementation worse, since we already allow a zero-length nonce...

[0] https://mailarchive.ietf.org/arch/msg/cfrg/Gu5cyorHPLrQ_CGYe775Xc6SV1c/

@karel-m

karel-m commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

I did not look into it that deeply. I mainly wanted to be compatible with OpenSSL SIV implementation.

You are right, it may need more investigation.

@karel-m

karel-m commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

I investigated this further and the main problem seems to be that with SIV there are two kinds of "empty associated data":

  • zero AD components (no AD at all)
  • one empty AD component

I found that empty AD was also an issue in OpenSSL before versions 3.0.9/3.1.1 - see: https://openssl-library.org/news/secadv/20230714.txt

I updated siv_test() so that it now checks both scenarios "zero AD components" + "one empty AD component" and verifies that libtomcrypt behaves in the same way as OpenSSL 3.5.6.

So the main idea of this PR is: let us stick with what the "big boys" in the OpenSSL project are doing.

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.

2 participants