[gnutls-devel] GnuTLS | WIP: Add Linux kernel AF_ALG backend (!1404)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Wed Mar 17 15:20:41 CET 2021




Daiki Ueno commented on a discussion on lib/accelerated/afalg.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1404#note_531527217

> +	 * read-only
> +	 */
> +	iov[1].iov_base = (void *)encr;
> +	iov[1].iov_len = encr_size;
> +
> +	if (kcapi_aead_stream_update_last(ctx->handle, iov, 2) < 0) {
> +		gnutls_assert();
> +		return GNUTLS_E_ENCRYPTION_FAILED;
> +	}
> +
> +	/* The kernel may set the AAD, avoid modification of auth */
> +	iov[0].iov_base = authtmp;
> +
> +	/* Set PT buffer to be filled by kernel */
> +	iov[1].iov_base = plain;
> +	iov[1].iov_len = plain_size;

The initial motivation of this change is:
https://gitlab.com/gnutls/gnutls/-/issues/308#note_527421502
i.e., `kcapi_aead_stream_op` blocks if the requested output size didn't match.

According to the libkcapi documentation, it seems like a legitimate behavior. I agree that it could cause a buffer overflow; maybe we could tighten the length check, and also merge it with the next `if` block.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1404#note_531527217
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20210317/e51c98c1/attachment-0001.html>


More information about the Gnutls-devel mailing list