[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
Thu Jul 21 12:57:48 CEST 2022




Alexander Sosedkin started a new discussion on lib/crypto-api.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1611#note_1033798875

> +	} else {
> +		ret = _gnutls_cipher_decrypt2(&h->ctx_dec,
> +					      ctext, ctext_len,
> +					      ptext, *ptext_len);
> +	}
> +
> +	if (ret < 0) {
> +		_gnutls_switch_fips_state(GNUTLS_FIPS140_OP_ERROR);
> +	} else {
> +		_gnutls_switch_fips_state(GNUTLS_FIPS140_OP_APPROVED);
> +	}
> +
> +	if (_gnutls_cipher_type(h->ctx_enc.e) == CIPHER_BLOCK &&
> +	    (flags & GNUTLS_CIPHER_PADDING_PKCS7)) {
> +		uint8_t *p = ptext;
> +		uint8_t padding = p[*ptext_len - 1];

Checking just the last value is more lax than my reading of https://datatracker.ietf.org/doc/html/rfc2315#section-10.3. Is it intended or should the prior values be checked as well?

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1611#note_1033798875
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/20220721/6a76fe73/attachment-0001.html>


More information about the Gnutls-devel mailing list