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 682A746E4D for ; Fri, 14 Jul 2023 19:42:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D9FF068C63B; Fri, 14 Jul 2023 22:42:30 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AF36668C4E5 for ; Fri, 14 Jul 2023 22:42:24 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 249CEE8C53 for ; Fri, 14 Jul 2023 21:39:20 +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 TxhRq7vWiauv for ; Fri, 14 Jul 2023 21:39:18 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 2484EE8C4E for ; Fri, 14 Jul 2023 21:39:18 +0200 (CEST) Date: Fri, 14 Jul 2023 21:39:18 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20230706170105.4804-1-cus@passwd.hu> Message-ID: <7cf2bae9-f1ea-3834-278-fad408d3f33@passwd.hu> References: <10991752-b1e9-41c0-623f-69ac11d994c9@passwd.hu> <20230706170105.4804-1-cus@passwd.hu> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: use av_random_bytes() for generating AES128 key 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 Thu, 6 Jul 2023, Marton Balint wrote: > av_random_bytes() can use OS provided strong random functions and does not > depend soley on openssl/gcrypt external libraries. > > Fixes ticket #10441. Will apply. Regards, Marton > > Signed-off-by: Marton Balint > --- > configure | 1 - > libavformat/hlsenc.c | 23 ++--------------------- > 2 files changed, 2 insertions(+), 22 deletions(-) > > diff --git a/configure b/configure > index 107d533b3e..b331b2e9db 100755 > --- a/configure > +++ b/configure > @@ -3507,7 +3507,6 @@ gxf_muxer_select="pcm_rechunk_bsf" > hds_muxer_select="flv_muxer" > hls_demuxer_select="adts_header ac3_parser mov_demuxer mpegts_demuxer" > hls_muxer_select="mov_muxer mpegts_muxer" > -hls_muxer_suggest="gcrypt openssl" > image2_alias_pix_demuxer_select="image2_demuxer" > image2_brender_pix_demuxer_select="image2_demuxer" > imf_demuxer_deps="libxml2" > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index 1e0848ce3d..27d97f5f72 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -27,12 +27,6 @@ > #include > #endif > > -#if CONFIG_GCRYPT > -#include > -#elif CONFIG_OPENSSL > -#include > -#endif > - > #include "libavutil/avassert.h" > #include "libavutil/mathematics.h" > #include "libavutil/avstring.h" > @@ -40,6 +34,7 @@ > #include "libavutil/intreadwrite.h" > #include "libavutil/opt.h" > #include "libavutil/log.h" > +#include "libavutil/random_seed.h" > #include "libavutil/time.h" > #include "libavutil/time_internal.h" > > @@ -710,20 +705,6 @@ fail: > return ret; > } > > -static int randomize(uint8_t *buf, int len) > -{ > -#if CONFIG_GCRYPT > - gcry_randomize(buf, len, GCRY_VERY_STRONG_RANDOM); > - return 0; > -#elif CONFIG_OPENSSL > - if (RAND_bytes(buf, len)) > - return 0; > -#else > - return AVERROR(ENOSYS); > -#endif > - return AVERROR(EINVAL); > -} > - > static int do_encrypt(AVFormatContext *s, VariantStream *vs) > { > HLSContext *hls = s->priv_data; > @@ -775,7 +756,7 @@ static int do_encrypt(AVFormatContext *s, VariantStream *vs) > if (!*hls->key_string) { > AVDictionary *options = NULL; > if (!hls->key) { > - if ((ret = randomize(key, sizeof(key))) < 0) { > + if ((ret = av_random_bytes(key, sizeof(key))) < 0) { > av_log(s, AV_LOG_ERROR, "Cannot generate a strong random key\n"); > return ret; > } > -- > 2.35.3 > > _______________________________________________ > 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". > _______________________________________________ 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".