[gnutls-devel] GnuTLS | crypto-api: add block cipher API with automatic padding (!1611)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Fri Jul 22 08:29:47 CEST 2022




Andreas Schneider started a new discussion on tests/cipher-padding.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1611#note_1034918794

> +				     plaintext, SIZE_MAX,
> +				     NULL, &size,
> +				     GNUTLS_CIPHER_PADDING_PKCS7);
> +	if (ret != GNUTLS_E_INVALID_REQUEST) {
> +		fail("gnutls_cipher_encrypt3 succeeded\n");
> +	}
> +
> +	/* Get the ciphertext size */
> +	ret = gnutls_cipher_encrypt3(ch,
> +				     plaintext, plaintext_size,
> +				     NULL, &size,
> +				     GNUTLS_CIPHER_PADDING_PKCS7);
> +	if (ret < 0) {
> +		fail("gnutls_cipher_encrypt3 failed\n");
> +	}
> +

As there is *always* padding, I would suggest to add a check: `size > plaintext_size`

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1611#note_1034918794
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/20220722/4a7400bb/attachment.html>


More information about the Gnutls-devel mailing list