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 27A1542E6C for ; Fri, 7 Jul 2023 00:55:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2693D68C776; Fri, 7 Jul 2023 03:55:55 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0202D68C772 for ; Fri, 7 Jul 2023 03:55:47 +0300 (EEST) X-GND-Sasl: michael@niedermayer.cc Received: by mail.gandi.net (Postfix) with ESMTPSA id 05025240004 for ; Fri, 7 Jul 2023 00:55:46 +0000 (UTC) Date: Fri, 7 Jul 2023 02:55:46 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230707005546.GV1093384@pb2> References: <54fe8899-d250-8d62-1157-621deb546040@gmail.com> <168841533190.542.8113031316523716543@lain.khirnov.net> <4b0740-7b32-415b-47af-3199463854b@passwd.hu> <168841859463.9711.12513000520212201640@lain.khirnov.net> <20230703235057.GQ1093384@pb2> <168845004614.542.18132678959456829324@lain.khirnov.net> <20230704235012.GS1093384@pb2> <168854896467.542.3745621457505615992@lain.khirnov.net> <20230705225447.GT1093384@pb2> <168862993295.542.15593141999950137681@lain.khirnov.net> MIME-Version: 1.0 In-Reply-To: <168862993295.542.15593141999950137681@lain.khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 1/2] avformat/hlsenc: fall back to av_get_random_seed() when 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-Type: multipart/mixed; boundary="===============5254431719860196378==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============5254431719860196378== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QILrdhYozogw5Vly" Content-Disposition: inline --QILrdhYozogw5Vly Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 06, 2023 at 09:52:12AM +0200, Anton Khirnov wrote: > Quoting Michael Niedermayer (2023-07-06 00:54:47) > > On Wed, Jul 05, 2023 at 11:22:44AM +0200, Anton Khirnov wrote: > > > Quoting Michael Niedermayer (2023-07-05 01:50:12) > > > > On Tue, Jul 04, 2023 at 07:54:06AM +0200, Anton Khirnov wrote: > > > > > Quoting Michael Niedermayer (2023-07-04 01:50:57) > > > > > > On Mon, Jul 03, 2023 at 11:09:54PM +0200, Anton Khirnov wrote: > > > > > > > Quoting Marton Balint (2023-07-03 22:54:41) > > > > > > > > On Mon, 3 Jul 2023, Anton Khirnov wrote: > > > > > > > > My patch use av_get_random_seed() which uses what the under= lying OS=20 > > > > > > > > provides, BCrypt for Windows, /dev/urandom for Linux, arc4r= andom() for=20 > > > > > > > > BSD/Mac. > > > > > > >=20 > > > > > > > IOW it's a jungle of various paths, some of which are not gua= ranteed to > > > > > > > be cryptographically secure. I see no such guarantees for arc= 4random() > > > > > > > from a brief web search, and the fallback get_generic_seed() = certainly > > > > > > > is not either. Granted it's only used on obscure architecture= s, but > > > > > > > still. > > > > > > >=20 > > > > > > > The doxy even says > > > > > > > > This function tries to provide a good seed at a best effort= bases. > > > > > > >=20 > > > > > > > > You really think that these are significantly worse than > > > > > > > > OpenSSL/GCrypt, so it should not be allowed to fallback to? > > > > > > >=20 > > > > > > > I think we should be using cryptographically secure PRNG for = generating > > > > > > > encryption keys, or fail when they are not available. If you = want to get > > > > > > > rid of the openssl dependency, IMO the best solution is a new > > > > > > > int av_random(uint8_t* buf, size_t len); > > > > > > > that guarantees either cryptographically secure randomness or= an error. > > > > > >=20 > > > > > > "guarantees cryptographically secure randomness" ? > > > > > > If one defined "cryptographically secure" as "not broken public= ally as of today" > > > > > >=20 > > > > > > Iam saying that as i think "guarantees" can be misleading in wh= at it means > > > > >=20 > > > > > I feel your snark is very much misplaced. > > > > >=20 > > > >=20 > > > > > I recall way more instances of broken crypto caused by overconfid= ent > > > > > non-experts with an attitude like yours ("those silly crypto libr= aries, > > > > > broken all the time, how hard can it be really") than by actual > > > > > vulnerabilities in actual crypto libraries. > > > > >=20 > > > > > In fact the highest-profile break I remember (Debian key entropy = bug) > > > > > was caused precisely by non-experts fiddling with code they did n= ot > > > > > understand. > > > >=20 > > > > There is no snark here, at least that was not the intend > > > > Also what you say in these 2 paragraphs is true but isnt really > > > > related to what i said or meant to say > > > >=20 > > > > these cryptographically secure PRNGS are secure as long as the > > > > currently used components and assumtations they are build on havnt > > > > been broken. > > > > Can i do better? no. but that doesnt mean that these > > > > are going to be unbroken in 30 years. > > > > just look 30 years in the past what percentage of what was believed= to > > > > be secure 30 years ago has been broken today. or 50 or 100years > > > > thats really what i meant > > >=20 > > > I still don't see what point are you trying to make here. > > > Yes, any practical cryptographic algorithm could potentially be broken > > > at some point. And everything in real life is imperfect, because we do > > > not live in the world of ideal forms. > >=20 > > > But I don't see what practical steps could or should be taken in > > > response to this. > >=20 > > for us i dont know but a user could > > instead of putting critical data in a system that might be broken in 30= years > > just write it down on paper and burn and grind the paper when its not n= eeded anymore > > (which may or may not be an option) > >=20 > > nothing is perfect but there are methods to transfer and destroy data w= hich have a > > long track record of being secure and are simple. > >=20 > > I think we should not make it sound like encrypting with these random n= umbers > > is as good as not storing/transmitting or using bits from fliping a rea= l fair coin >=20 > We are not claiming that. We are claiming that the random numbers > generated are (to the best of our ability, and that of the underlying > libraries we rely on) cryptographically secure. This means suitable for > use in state of the art cryptographic algorithms like AES. > I do not think it makes sense to mistrust CSPRNGs, yet still trust AES. The litteral wording was "that guarantees either cryptographically secure randomness or an error." that was what i refered to. the wording used now: "to the best of our ability, and that of the underlying libraries we rely o= n) cryptographically secure." is perfectly fine with me. I would have the same issue if someone said AES gurantees ... thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable --QILrdhYozogw5Vly Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZKdijQAKCRBhHseHBAsP q3gEAKCXJtz4gVDwQ6x6m/mLopSY9EzapACfW3s/22aEritEGSBbbDdICl0bQ4c= =6A+I -----END PGP SIGNATURE----- --QILrdhYozogw5Vly-- --===============5254431719860196378== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============5254431719860196378==--