Closed Bug 143492 Opened 24 years ago Closed 13 years ago

Mozilla should use threadsafe random number generators

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: KaiE, Unassigned)

References

Details

Mozilla should use threadsafe random number generators Some people told me "hey, random numbers should be random anyway, so what problem is it if we use unsafe random number generators"? I think the problems start if the implementation of a random number generator uses a non-trivial data structure. The random number generator might rely on allowed states of its data structures, and using non-thread safe functions from multiple threads might corrupt the data structure. I think Mozilla should use the thread safe alternative number generators, like they are provided by rand_r on Linux.
I wonder whether we need individual bugs for each occurrence. However, here are a few files that call rand() or srand(): mozilla/netwerk/protocol/http/src/nsHttpDigestAuth.cpp mozilla/profile/src/nsProfile.cpp mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp mozilla/content/html/content/src/nsFormSubmission.cpp mozilla/mailnews/compose/src/nsMsgCompUtils.cpp mozilla/mailnews/extensions/smime/src/nsMsgComposeSecure.cpp mozilla/mailnews/mapi/old/mapi32/mapiutl.cpp
A fix should replace the function calls to use functions provided by NSPR. Currently, there are no such functions. The only thing we have are "true random numbers", but those functions are very slow, and should not be used. I have opened bug 143493, requesting to implement those functions in NSPR.
Depends on: 143493
I can't fix it...
Assignee: Matti → nobody
Product: Browser → Seamonkey
The bug report isn't very useful... kaie.bugs@gmail.com - could you please read the Bug Writing Guidelines at <http://www.mozilla.org/quality/bug-writing-guidelines.html> to see the kinds of information we need in a bug report. Please report back with more information (like BuildID and steps to reproduce) after reading those guidelines and consider using the guided form to report future bugs. The guided entry form can be found at <https://bugzilla.mozilla.org/enter_bug.cgi?format=guided> Thanks for your help in testing Mozilla. Julian
*** Bug 143493 has been marked as a duplicate of this bug. ***
No longer depends on: 143493
Depends on: 143493
Assignee: nobody → wtc
Severity: normal → enhancement
Component: General → NSPR
Product: SeaMonkey → NSPR
QA Contact: imajes-qa → nspr
Version: Trunk → other
No, this is not an NSPR bug. And no, this is not a duplicate of bug 143493. This bug asks SeaMonkey to change to use NSPR's API for non-cryptographic PRNG, when that API is created. THat is why this bug is blocked by bug 143493, which IS an NSPR bug.
Assignee: wtc → nobody
Component: NSPR → General
Product: NSPR → SeaMonkey
QA Contact: nspr → general
Version: other → Trunk
Component: General → XPCOM
Product: SeaMonkey → Core
QA Contact: general → xpcom
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.