* [FFmpeg-devel] [PATCH] avutil/random_seed: add support for GnuTLS as source of randomness
@ 2023-07-06 18:34 James Almer
0 siblings, 0 replies; only message in thread
From: James Almer @ 2023-07-06 18:34 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
configure | 2 +-
libavutil/random_seed.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index d6e78297fe..56e2b85f97 100755
--- a/configure
+++ b/configure
@@ -3892,7 +3892,7 @@ avfilter_deps="avutil"
avfilter_suggest="libm stdatomic"
avformat_deps="avcodec avutil"
avformat_suggest="libm network zlib stdatomic"
-avutil_suggest="clock_gettime ffnvcodec gcrypt libm libdrm libmfx opencl openssl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt stdatomic"
+avutil_suggest="clock_gettime ffnvcodec gcrypt gnutls libm libdrm libmfx opencl openssl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt stdatomic"
postproc_deps="avutil gpl"
postproc_suggest="libm stdatomic"
swresample_deps="avutil"
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 2980e565e0..e02431898e 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -34,6 +34,8 @@
#include <gcrypt.h>
#elif CONFIG_OPENSSL
#include <openssl/rand.h>
+#elif CONFIG_GNUTLS
+#include <gnutls/crypto.h>
#endif
#include <fcntl.h>
#include <math.h>
@@ -158,6 +160,10 @@ int av_random_bytes(uint8_t* buf, size_t len)
if (RAND_bytes(buf, len) == 1)
return 0;
err = AVERROR_EXTERNAL;
+#elif CONFIG_GNUTLS
+ err = gnutls_rnd(GNUTLS_RND_KEY, buf, len);
+ if (!err)
+ return 0;
#endif
return err;
--
2.41.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-06 18:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 18:34 [FFmpeg-devel] [PATCH] avutil/random_seed: add support for GnuTLS as source of randomness James Almer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git