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
Unknown Object (File)
Sat, Apr 20, 12:26 AM
Unknown Object (File)
Mar 7 2024, 3:56 PM
Unknown Object (File)
Mar 2 2024, 4:39 PM
Unknown Object (File)
Feb 19 2024, 10:09 PM
Unknown Object (File)
Dec 14 2023, 8:17 PM
Unknown Object (File)
Dec 7 2023, 6:09 PM
Unknown Object (File)
Sep 11 2023, 7:01 AM
Unknown Object (File)
Sep 3 2023, 4:23 AM
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