Page MenuHomeFreeBSD

armv8crypto: Fix some edge cases in the AES-GCM implementation
ClosedPublic

Authored by markj on Feb 5 2021, 2:25 PM.
Tags
None
Referenced Files
F168720656: D28501.id83541.diff
Sat, Aug 29, 7:36 PM
F168633616: D28501.diff
Sat, Aug 29, 8:52 AM
Unknown Object (File)
Sat, Aug 22, 3:39 PM
Unknown Object (File)
Thu, Aug 20, 2:58 PM
Unknown Object (File)
Tue, Aug 18, 4:10 PM
Unknown Object (File)
Sun, Aug 16, 7:24 PM
Unknown Object (File)
Fri, Aug 14, 7:48 PM
Unknown Object (File)
Thu, Aug 13, 3:09 PM
Subscribers

Details

Summary
  • We only hash up to the first 16 bytes of the AAD.
  • When computing the digest during decryption, handle the case where len == trailer properly.

While here:

  • trailer is always smaller than AES_BLOCK_LEN, so remove a pair of unnecessary modulus operations.
  • Replace some byte-by-byte loops with memcpy() and memset() calls. In particular, zero the full block before copying a partial block into it since we do that elsewhere and it means that the memset() length is known at compile time.
Test Plan

Noticed when doing some refactoring, verified with cryptocheck.

Specifically, I used cryptocheck -d soft -a aes-gcm -z.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable