]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
armv8crypto: Fix some edge cases in the AES-GCM implementation
authorMark Johnston <markj@FreeBSD.org>
Mon, 8 Feb 2021 14:19:07 +0000 (09:19 -0500)
committerMark Johnston <markj@FreeBSD.org>
Thu, 11 Feb 2021 15:25:39 +0000 (10:25 -0500)
commit860e0c7fb84863580521142825330aa941dee313
tree0c20844af83331497e33778cdfa59cf16a10bd4c
parent6930f97474e409808ca5e220c2b3a86805f786b8
armv8crypto: Fix some edge cases in the AES-GCM implementation

- We were only hashing up to the first 16 bytes of the AAD.
- When computing the digest during decryption, handle the case where
  len == trailer, i.e., len < AES_BLOCK_LEN, 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.

Reviewed by: jhb
Sponsored by: Ampere Computing
Submitted by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D28501

(cherry picked from commit 0dc7076037a87100060309f7179ef6a01f32f99e)
sys/crypto/armv8/armv8_crypto_wrap.c