From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C0CB7460D6 for ; Tue, 4 Jul 2023 20:05:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E82D068C621; Tue, 4 Jul 2023 23:05:20 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1C67E68C5A6 for ; Tue, 4 Jul 2023 23:05:14 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id C1B1EE8C12 for ; Tue, 4 Jul 2023 22:02:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eU_5I9OcMrwj for ; Tue, 4 Jul 2023 22:02:30 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id D70B4E8C11 for ; Tue, 4 Jul 2023 22:02:29 +0200 (CEST) Date: Tue, 4 Jul 2023 22:02:29 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20230704185044.2154-2-jamrial@gmail.com> Message-ID: <4bcbaa7e-2623-88be-cf41-218b939a9996@passwd.hu> References: <20230704185044.2154-1-jamrial@gmail.com> <20230704185044.2154-2-jamrial@gmail.com> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 2/2] avutil/random_seed: ass support for gcrypt and OpenSSL as source of randomness X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Tue, 4 Jul 2023, James Almer wrote: > Signed-off-by: James Almer > --- In the commit message s/ass/add/ > I put these after /dev/random/ to not change the current behavior of > av_get_random_seed(), but if either of these are prefered i can move them up. > > configure | 2 +- > libavutil/random_seed.c | 13 +++++++++++++ > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 107d533b3e..d6e78297fe 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 libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt stdatomic" > +avutil_suggest="clock_gettime ffnvcodec gcrypt 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 39fb27c5ad..e8967c0cfe 100644 > --- a/libavutil/random_seed.c > +++ b/libavutil/random_seed.c > @@ -30,6 +30,11 @@ > #include > #include > #endif > +#if CONFIG_GCRYPT > +#include > +#elif CONFIG_OPENSSL > +#include > +#endif > #include > #include > #include > @@ -144,6 +149,14 @@ int av_random(uint8_t* buf, size_t len) > return 0; > #endif > > +#if CONFIG_GCRYPT > + gcry_randomize(buf, len, GCRY_VERY_STRONG_RANDOM); > + return 0; > +#elif CONFIG_OPENSSL > + if (RAND_bytes(buf, len)) (RAND_bytes(buf, len) == 1) is more in line with openssl docs. Regards, Marton _______________________________________________ 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".