Note: There are a few cases of duplicates in user autocompletion which are being worked on.

On Windows, RNG_SystemInfoForRNG calls GetCurrentProcess, which returns the constant (HANDLE)-1.

RESOLVED FIXED in 3.12

Status

NSS
Libraries
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: Wan-Teh Chang, Assigned: Wan-Teh Chang)

Tracking

3.11.3
3.12
x86
Windows XP

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

1020 bytes, patch
Details | Diff | Splinter Review
(Assignee)

Description

11 years ago
On Windows, RNG_SystemInfoForRNG calls GetCurrentProcess to
get the current process's handle.  But this handle is a
pseudo handle and is a special constant, currently 0xffffffff,
or (HANDLE)-1.  There is no time-varying or machine-varying
bit in that value.
(Assignee)

Comment 1

11 years ago
Created attachment 242213 [details] [diff] [review]
Proposed patch

It is possible to call DuplicateHandle on the pseudo process handle
to get the real process handle, but I am going to do a quick fix today.
I'm going to replace the GetCurrentProcess call with a GetCurrentThreadId
call.
Attachment #242213 - Flags: superreview?(neil.williams)
Attachment #242213 - Flags: review?(glen.beasley)

Updated

11 years ago
Attachment #242213 - Flags: review?(glen.beasley) → review+
What "fix"?
It never hurts to input constant data into a PRNG.  
It doesn't lessen the PRNG's entropy any.
This can't be high priority.
(Assignee)

Comment 3

11 years ago
The GetCurrentProcess call is useless and it's easy to
replace it with a GetCurrentThreadId call, which returns
a time-varying (system global) thread id.  I can keep the
GetCurrentProcess call with a comment noting that it returns
a constant.  If you don't want me to add the GetCurrentThreadId
call on the NSS_3_11_BRANCH, I'll only add it to the NSS trunk.

Updated

11 years ago
Attachment #242213 - Flags: superreview?(neil.williams) → superreview+
(Assignee)

Comment 4

11 years ago
Created attachment 242525 [details] [diff] [review]
Patch as checked in

I did not remove the GetCurrentProcess call.  I just
noted in the comment that it returns a constant pseudo
handle.

I only checked in the patch on the NSS trunk (NSS 3.12).

Checking in win_rand.c;
/cvsroot/mozilla/security/nss/lib/freebl/win_rand.c,v  <--  win_rand.c
new revision: 1.12; previous revision: 1.11
done
Attachment #242213 - Attachment is obsolete: true
(Assignee)

Updated

11 years ago
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
Target Milestone: 3.11.4 → 3.12
(Assignee)

Comment 5

11 years ago
GetCurrentProcess returns 0xffffffff, or (HANDLE) -1.
GetCurrentThread returns 0xfffffffe.  Both are pseudo
handles.
You need to log in before you can comment on or make changes to this bug.