[gnutls-devel] GnuTLS | crypto-api: add gnutls_aead_cipher_{en, de}crypt_vec (!1052)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Thu Aug 8 16:02:29 CEST 2019




Daiki Ueno commented on a discussion on lib/iov.h: https://gitlab.com/gnutls/gnutls/merge_requests/1052#note_201648809

> +	iter->iov_index = 0;
> +	iter->iov_offset = 0;
> +	iter->block_size = block_size;
> +	iter->block_offset = 0;
> +	return 0;
> +}
> +
> +/* Retrieve the current block(s) pointed by @iter and advance it to
> + * the next buffer. */
> +static inline int
> +iov_iter_next(struct iov_iter_st *iter, uint8_t **data, size_t *blocks)
> +{
> +	while (iter->iov_index < iter->iov_count) {
> +		const giovec_t *iov = &iter->iov[iter->iov_index];
> +		uint8_t *p = iov->iov_base;
> +		ssize_t len = iov->iov_len;

The `DECR_LEN` macro is defined as follows:
```c
#define DECR_LEN(len, x) do { len-=x; if (len<0) {gnutls_assert
(); return GNUTLS_E_UNEXPECTED_PACKET_LENGTH;} } while (0)
```
If `len` becomes negative, it will immediately return from the loop and the cast will not reach.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/1052#note_201648809
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/20190808/0abdc0ea/attachment-0001.html>


More information about the Gnutls-devel mailing list