[gnutls-devel] GnuTLS | Support RSA-OAEP (!1805)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sat Mar 2 09:47:24 CET 2024




Daiki Ueno commented on a discussion on lib/nettle/pk.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1805#note_1797972800

>  
> +/* This wraps nettle_rsa_encrypt so it returns ciphertext as a byte
> + * array instead of a mpz_t value.  Returns 1 on success; 0 otherwise.
> + */
> +static inline int _rsa_encrypt(const struct rsa_public_key *key, void *rnd_ctx,
> +			       nettle_random_func *rnd_func, size_t length,
> +			       const uint8_t *message, uint8_t *ciphertext)
> +{
> +	mpz_t p;
> +	int ret;
> +
> +	mpz_init(p);
> +
> +	ret = rsa_encrypt(key, rnd_ctx, rnd_func, length, message, p);
> +
> +	if (_gnutls_mpi_bprint_size(p, ciphertext, key->size) < 0) {

Another great point, I've added an early return there.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1805#note_1797972800
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/20240302/b887346e/attachment.html>


More information about the Gnutls-devel mailing list