]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix requests for "plain" SHA digests of an empty buffer.
authorJohn Baldwin <jhb@FreeBSD.org>
Wed, 24 Apr 2019 23:18:10 +0000 (23:18 +0000)
committerJohn Baldwin <jhb@FreeBSD.org>
Wed, 24 Apr 2019 23:18:10 +0000 (23:18 +0000)
commita2ad169e613a23b239f47c7b2769a4315f2694cf
treea54c8ae4343be06bcc452d3c16ef0f42b4353a53
parentcc1ac7fcda4e00c48c6e4042e5f39de9d7db16b3
Fix requests for "plain" SHA digests of an empty buffer.

To workaround limitations in the crypto engine, empty buffers are
handled by manually constructing the final length block as the payload
passed to the crypto engine and disabling the normal "final" handling.
For HMAC this length block should hold the length of a single block
since the hash is actually the hash of the IPAD digest, but for
"plain" SHA the length should be zero instead.

Reported by: NIST SHA1 test failure
MFC after: 2 weeks
Sponsored by: Chelsio Communications
sys/dev/cxgbe/crypto/t4_crypto.c