svn commit: r361583 - head/sys/crypto/aesni

John Baldwin jhb at FreeBSD.org
Thu May 28 18:29:57 UTC 2020


On 5/28/20 2:13 AM, Marcin Wojtas wrote:
> Author: mw
> Date: Thu May 28 09:13:20 2020
> New Revision: 361583
> URL: https://svnweb.freebsd.org/changeset/base/361583
> 
> Log:
>   Change return types of hash update functions in SHA-NI
>   
>   r359374 introduced crypto_apply function which takes as argument a function pointer
>   that is expected to return an int, however aesni hash update functions
>   return void.
>   Because of that the function pointer passed was simply cast with
>   its return value changed.
>   This resulted in undefined behavior, in particular when mbuf is used, (ipsec)
>   m_apply checks return value of function pointer passed to it
>   and in our case bogusly fails after calculating hash of the first mbuf
>   in chain.
>   Fix it by changing signatures of sha update routines in aesni and
>   dropping the casts.

Hmm, I missed one nit in the review.  r359374 didn't introduce
crypto_apply, it just changed some of the arguments arguments (crp
instead of crp_buf and crp_flags).  This fix needs to be MFC'd to 12
as well since the issue with the return type is also present there.

-- 
John Baldwin


More information about the svn-src-all mailing list