[FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: remove openssl/gcrypt random key generation

Marton Balint cus at passwd.hu
Sun Jul 2 22:30:10 EEST 2023


av_get_random_seed() should be sufficent and that is used everywhere in the
codebase for similar cases.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 configure            |  1 -
 libavformat/hlsenc.c | 13 -------------
 2 files changed, 14 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 0b22c71186..f2284e8ea0 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -27,12 +27,6 @@
 #include <unistd.h>
 #endif
 
-#if CONFIG_GCRYPT
-#include <gcrypt.h>
-#elif CONFIG_OPENSSL
-#include <openssl/rand.h>
-#endif
-
 #include "libavutil/avassert.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/avstring.h"
@@ -713,13 +707,6 @@ fail:
 
 static void randomize(uint8_t *buf, int len)
 {
-#if CONFIG_GCRYPT
-    gcry_randomize(buf, len, GCRY_VERY_STRONG_RANDOM);
-    return;
-#elif CONFIG_OPENSSL
-    if (RAND_bytes(buf, len))
-        return;
-#endif
     av_assert0(len % 4 == 0);
     for (int i = 0; i < len; i += 4)
         AV_WB32(buf + i, av_get_random_seed());
-- 
2.35.3



More information about the ffmpeg-devel mailing list