Bug 247471 - Audit use of cryptographically random functions
Summary: Audit use of cryptographically random functions
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-03 18:19 PDT by Don Olmstead
Modified: 2022-11-10 17:19 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Don Olmstead 2022-11-03 18:19:02 PDT
Cryptographically random numbers are expensive to generate and can have a negative performance impact. Determine if code using them should actually be using them instead of a weak random number.
Comment 1 Darin Adler 2022-11-07 12:34:49 PST
I just noticed that we have two identical functions in two different headers:

cryptographicallyRandomNumber
cryptographicallyRandomUint32
Comment 2 Darin Adler 2022-11-07 12:47:42 PST
Not necessarily part of this bug, but I suggest we do these 9 things:

1) Change the 3 callers of cryptographicallyRandomUint32 to use cryptographicallyRandomNumber instead.
2) Remove cryptographicallyRandomUint32.
3) Move cryptographicallyRandomUint64 to CryptographicallyRandomNumber.h
4) Move cryptographicallyRandomUnitInterval to CryptographicallyRandomNumber.h.
5) Rename cryptographicallyRandomUint64 to cryptographicallyRandomUInt64 or cryptographicallyRandom<uint64_t>.
6) Consider renaming cryptographicallyRandomNumber to cryptographicallyRandomUInt32 or cryptographicallyRandom<uint32_t>.
7) Consider renaming weakRandom to weakRandomUInt32 or weakRandom<uint32_t>.
8) Consider renaming RandomNumber.h to WeakRandomNumber.h.
9) Document that cryptographicallyRandomUnitInterval has only 32 bits of randomness in it to further discourage uninformed use of it.
Comment 3 Radar WebKit Bug Importer 2022-11-10 17:19:17 PST
<rdar://problem/102219729>