From: "Cristian Rodríguez" <cristian@rodriguez.im>
Cc: "Cristian Rodríguez" <cristian@rodriguez.im>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org (open list:All patches CC here)
Subject: [PATCH] crypto/gcrypt: prefer kernel as direct source of entropy
Date: Fri, 19 Jan 2024 17:39:40 -0300 [thread overview]
Message-ID: <20240119203950.6434-1-cristian@rodriguez.im> (raw)
gcrypt by default uses an userspace RNG, which cannot know
when it is time to discard/invalidate its buffer
(suspend, resume, vm forks, other corner cases)
as a "when to discard" event is unavailable to userspace.
Set GCRYCTL_SET_PREFERRED_RNG_TYPE to GCRY_RNG_TYPE_SYSTEM
which must be done before the first call to gcry_check_version()
Signed-off-by: Cristian Rodríguez <cristian@rodriguez.im>
---
crypto/init.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/crypto/init.c b/crypto/init.c
index fb7f1bff10..0c3fe6a841 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -60,6 +60,7 @@ int qcrypto_init(Error **errp)
#endif
#ifdef CONFIG_GCRYPT
+ gcry_control(GCRYCTL_SET_PREFERRED_RNG_TYPE, GCRY_RNG_TYPE_SYSTEM);
if (!gcry_check_version(NULL)) {
error_setg(errp, "Unable to initialize gcrypt");
return -1;
--
2.43.0
next reply other threads:[~2024-01-19 22:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 20:39 Cristian Rodríguez [this message]
2024-01-22 14:48 ` [PATCH] crypto/gcrypt: prefer kernel as direct source of entropy Daniel P. Berrangé
2024-01-22 20:08 ` Cristian Rodríguez
2024-01-22 20:19 ` Daniel P. Berrangé
2024-01-22 20:21 ` Cristian Rodríguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240119203950.6434-1-cristian@rodriguez.im \
--to=cristian@rodriguez.im \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).