Bug 247581

Summary: Improve clarity of cryptographically random number functions
Product: WebKit Reporter: Darin Adler <darin>
Component: Web Template FrameworkAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, don.olmstead, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=247471
https://bugs.webkit.org/show_bug.cgi?id=247756
Bug Depends on: 247758    
Bug Blocks:    

Description Darin Adler 2022-11-07 13:03:57 PST
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 1 Radar WebKit Bug Importer 2022-11-07 13:39:08 PST
<rdar://problem/102057413>
Comment 2 Darin Adler 2022-11-07 15:50:17 PST
Pull request: https://github.com/WebKit/WebKit/pull/6227
Comment 3 EWS 2022-11-09 11:42:13 PST
Committed 256493@main (017574a4e19b): <https://commits.webkit.org/256493@main>

Reviewed commits have been landed. Closing PR #6227 and removing active labels.
Comment 4 WebKit Commit Bot 2022-11-10 13:33:16 PST
Re-opened since this is blocked by bug 247758
Comment 5 Ryan Haddad 2022-11-10 13:39:14 PST
Reverted because this caused API test crashes on iOS simulator. Details in https://bugs.webkit.org/show_bug.cgi?id=247756
Comment 6 Darin Adler 2022-11-10 14:32:17 PST
I’ll re-land this with a stub that keeps the iOS simulator working.
Comment 7 Darin Adler 2022-11-10 14:40:25 PST
Pull request: https://github.com/WebKit/WebKit/pull/6366
Comment 8 EWS 2022-11-10 16:32:06 PST
Committed 256555@main (08e4dc175b88): <https://commits.webkit.org/256555@main>

Reviewed commits have been landed. Closing PR #6366 and removing active labels.