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 CAA9046BCB for ; Tue, 4 Jul 2023 23:26:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BCFA968C654; Wed, 5 Jul 2023 02:26:36 +0300 (EEST) Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C2B5D68C641 for ; Wed, 5 Jul 2023 02:26:29 +0300 (EEST) Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-1b06777596cso5724581fac.2 for ; Tue, 04 Jul 2023 16:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688513188; x=1691105188; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=QRcAirQfx7iBK9Yk0LxQKH2up6oCRiVXd7qFFaPDC7s=; b=UijHW7nU18OKj5QK18EwAKcdyt/7oYskWzesYC45xHUOLVFYfmofQVjl+lylSG3eX0 5wmdU5tFUoA2EbV3TxOVg7ZZ0C9y2Hp01xVrcqXXr3HboTOScYn993EZjX0DXy9O2f1e 31wqx38ieaJbxQoUZdxRDNkOdJZYn2tPCdNPzFp6LKceICAFnV7ADJrErIzq/IoqsXUZ feH39HUFmwobKBdOXdZc1A8KJlFrpEAXp4tWWC+tXX13N4yFwLG/bmQB9svHpSOA9YgW KLmTbR46saeOfXEdxkUU2vlLLZW84pFKsLJaXYrEHSOx9WbrjbhHEEUkiP3F6yci8FXk KuGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688513188; x=1691105188; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QRcAirQfx7iBK9Yk0LxQKH2up6oCRiVXd7qFFaPDC7s=; b=XbExHszDwa/AxSIm8gqq55YyDqRD4UR1fdkPxJLMeTEp/4b5DgTtxbQHM8GpAtGuFR Fx5Wv3WQtnrVzYRqcPJoSUiQ1VRpO8F39bYau0IxCKWiTmEXju7nLXyRGnniggEJ64tw eOyvgtLkeeuMy7Bh6Ksb33JapJKkmqWI7LpRF8e9YfG8awfeYDxQVDSchAaMicDHE9dk PhOSmHEvRznVd2594nWQaUS1gC6fTzHgft3SKG7pFRVWmfM/JFeKMoR3HT6t2+TohqVx NMEs0UnoghZ9JPahV/BOZSZlxMxX2F17xlDiu4nOZTVOkpiLSp++YpiFXV/2l+OenJFR nBHQ== X-Gm-Message-State: ABy/qLZS5uyGokrgQ+/k+vWDJ6GUOo55TelaUrjLnHh3+bFshL6QK1fu hwSyYdpBYdFaykvBAiseeqqK+BQe1dM= X-Google-Smtp-Source: ACHHUZ7j4lnPE2cQGzPHDhZY18AEDeb0R+qWP0p8WVo4N0KAifBPZ3QiZo/wJntfsuuk69agJMDP0Q== X-Received: by 2002:a05:6870:6493:b0:1b0:73e0:97eb with SMTP id cz19-20020a056870649300b001b073e097ebmr16924566oab.30.1688513188028; Tue, 04 Jul 2023 16:26:28 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id er28-20020a056870c89c00b0019ed19a8659sm14507303oab.8.2023.07.04.16.26.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 16:26:27 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 Jul 2023 20:26:14 -0300 Message-ID: <20230704232614.2785-3-jamrial@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230704232614.2785-1-jamrial@gmail.com> References: <20230704232614.2785-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 3/3] avutil/random_seed: add 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: James Almer --- configure | 2 +- libavutil/random_seed.c | 16 ++++++++++++++++ 2 files changed, 17 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 f5c291263e..2980e565e0 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 @@ -143,6 +148,17 @@ int av_random_bytes(uint8_t* buf, size_t len) #endif err = read_random(buf, len, "/dev/urandom"); + if (!err) + return err; + +#if CONFIG_GCRYPT + gcry_randomize(buf, len, GCRY_VERY_STRONG_RANDOM); + return 0; +#elif CONFIG_OPENSSL + if (RAND_bytes(buf, len) == 1) + return 0; + err = AVERROR_EXTERNAL; +#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".