Skip to content

Fix SKINNY-AEAD inverse tweakey LFSR rows#35

Merged
AeonDave merged 1 commit into
mainfrom
codex/fix-reverse-key-schedule-in-skinny-aead
Oct 24, 2025
Merged

Fix SKINNY-AEAD inverse tweakey LFSR rows#35
AeonDave merged 1 commit into
mainfrom
codex/fix-reverse-key-schedule-in-skinny-aead

Conversation

@AeonDave
Copy link
Copy Markdown
Owner

Summary

  • ensure the inverse tweakey schedule in skinnyAddKeyInv rewinds the same rows as the forward schedule

Testing

  • go test ./aead

https://chatgpt.com/codex/tasks/task_e_68fb74494d9083259fdb8084ed56fc50

@AeonDave AeonDave merged commit e49fa52 into main Oct 24, 2025
1 check passed
@AeonDave AeonDave deleted the codex/fix-reverse-key-schedule-in-skinny-aead branch October 24, 2025 12:45
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

for i := 0; i < 2; i++ {
for j := 0; j < 4; j++ {
tmp[1][i][j] = ((tmp[1][i][j] >> 1) & 0x7f) ^ ((tmp[1][i][j] << 7) & 0x80) ^ ((tmp[1][i][j] << 1) & 0x80)
tmp[2][i][j] = ((tmp[2][i][j] << 1) & 0xfe) ^ ((tmp[2][i][j] >> 7) & 0x01) ^ ((tmp[2][i][j] >> 5) & 0x01)
}

P0 Badge Rewind LFSR on wrong rows after inverse permutation

In skinnyAddKeyInv the tweakey state is first rearranged with skinnyTweakeyPermInv. After this permutation the bytes that were advanced by the forward LFSRs reside in rows 2–3, not 0–1. The new loop for i := 0; i < 2 therefore applies the inverse LFSRs to rows that were never shifted and leaves the shifted rows untouched, so the key schedule is not correctly rewound before XORing the state. This breaks SKINNY-AEAD decryption for all inputs. The inverse step should still target rows 2 and 3 (or apply the LFSR before undoing the permutation).

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant