[FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: fall back to av_get_random_seed() when generating AES128 key
Marton Balint
cus at passwd.hu
Mon Jul 3 22:23:25 EEST 2023
On Mon, 3 Jul 2023, Steven Liu wrote:
> Marton Balint <cus at passwd.hu> 于2023年7月3日周一 03:30写道:
>>
>> It should be OK to use av_get_random_seed() to generate the key instead of
>> using openSSL/Gcrypt functions. This removes the hard dependancy of those libs
>> for key generation functionality.
>>
>> Fixes ticket #10441.
>>
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
[...]
>> static int do_encrypt(AVFormatContext *s, VariantStream *vs)
>> @@ -775,10 +776,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) {
>> - av_log(s, AV_LOG_ERROR, "Cannot generate a strong random key\n");
>> - return ret;
>> - }
>> + randomize(key, sizeof(key));
>> } else {
>> memcpy(key, hls->key, sizeof(key));
>> }
> Hi Marton,
>
> Should remove braces too. I cannot sure how to make it more simpler as
> !hls->key ? randomize(key, sizeof(key)) : memcpy(key, hls->key,
> sizeof(key)); ?
I will just remove the braces, looks more readable to me than using the
ternary operator.
Will apply the series, thanks.
Marton
More information about the ffmpeg-devel
mailing list