Closed
Bug 326754
Opened 19 years ago
Closed 19 years ago
Two minor bugs with the 'h' parameter in PQG_ParamGenSeedLen
Categories
(NSS :: Libraries, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
3.11.1
People
(Reporter: wtc, Assigned: wtc)
Details
Attachments
(1 file, 1 obsolete file)
1.19 KB,
patch
|
glenbeasley
:
review+
nelson
:
superreview+
|
Details | Diff | Splinter Review |
While reviewing the code of lib/freebl/pqg.c, I
found two minor bugs related to the 'h' parameter
in PQG_ParamGenSeedLen.
Assignee | ||
Comment 1•19 years ago
|
||
Please refer to FIPS 186-2.
This patch fixes two bugs.
1. The constraint on h is 1 < h < p-1. See FIPS 186-2
Sec. 4, item 3 on page 8. So we should disallow
h >= p-1 rather than h > p-1.
(The seemingly misaligned comment is caused by the
tab character at the beginning of that line.)
2. The size of the auxiliary SECItem 'hit' is wrong:
/* Generate h. */
SECITEM_AllocItem(NULL, &hit, seedBytes); /* h is no longer than p */
I got suspicious when the comment doesn't seem to
match the code. Recall that SEED only needs to be
at least 160 bits, and has no relation to the length
of p. See FIPS 186-2, Appendix 2.2, Step 1 on page
14.
So I think 'seedBytes' should be changed to 'L/8',
where 'L' is the length of p in bits. See FIPS 186-2
Sec. 4, item 1 on page 8.
Attachment #211448 -
Flags: superreview?(nelson)
Attachment #211448 -
Flags: review?(glen.beasley)
Comment 2•19 years ago
|
||
Good catch. How many FIPS reviews have missed these two bugs? :-)
Priority: -- → P2
Target Milestone: --- → 3.11.1
Comment 3•19 years ago
|
||
Comment on attachment 211448 [details] [diff] [review]
Proposed patch
SR=Nelson. This patch appears correct, but
I wonder if this patch will slow down PQG param generation.
Attachment #211448 -
Flags: superreview?(nelson) → superreview+
Assignee | ||
Comment 4•19 years ago
|
||
If we are worried about performance, we have two options.
1. Use fixed h=2. (h doesn't need to be random.)
2. I can also do:
/* Generate h. */
- SECITEM_AllocItem(NULL, &hit, seedBytes); /* h is no longer than p */
+ SECITEM_AllocItem(NULL, &hit, PR_MIN(seedBytes, L/8)); /* h is no longer than p */
Since seedBytes can be arbitrarily long, we must make
sure H is no longer than p, otherwise the H mod (p-1)
operation can't be implemented as a subtraction.
Would you like me to do #2?
Comment 5•19 years ago
|
||
I think that PQG generation is done infrequently.
So, assuming that this patch doesn't severly hurt performance,
I think it's fine as is.
Updated•19 years ago
|
Attachment #211448 -
Flags: review?(glen.beasley) → review+
Assignee | ||
Comment 6•19 years ago
|
||
I checked in the patch on the NSS trunk (3.12) and
NSS_3_11_BRANCH (3.11.1).
Checking in pqg.c;
/cvsroot/mozilla/security/nss/lib/freebl/pqg.c,v <-- pqg.c
new revision: 1.10; previous revision: 1.9
done
Checking in pqg.c;
/cvsroot/mozilla/security/nss/lib/freebl/pqg.c,v <-- pqg.c
new revision: 1.9.2.1; previous revision: 1.9
done
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 7•19 years ago
|
||
This previous patch made us fail the FIPS DSA PQGGen
test for [mod = 768] only. I don't know why. Among
the two changes, this change is more likely to be the
culprit. So I have backed it out from the NSS trunk
and the NSS_3_11_BRANCH.
Checking in pqg.c;
/cvsroot/mozilla/security/nss/lib/freebl/pqg.c,v <-- pqg.c
new revision: 1.11; previous revision: 1.10
done
Checking in pqg.c;
/cvsroot/mozilla/security/nss/lib/freebl/pqg.c,v <-- pqg.c
new revision: 1.9.2.2; previous revision: 1.9.2.1
done
Assignee | ||
Comment 8•19 years ago
|
||
Comment on attachment 212677 [details] [diff] [review]
Back out one of the changes
We now know we failed the FIPS DSA PQGGen test for
another reason (bug 334533). So I checked the
reverted change back in on the NSS trunk (3.12)
and the NSS_3_11_BRANCH (3.11.1).
Checking in pqg.c;
/cvsroot/mozilla/security/nss/lib/freebl/pqg.c,v <-- pqg.c
new revision: 1.12; previous revision: 1.11
done
Checking in pqg.c;
/cvsroot/mozilla/security/nss/lib/freebl/pqg.c,v <-- pqg.c
new revision: 1.9.2.3; previous revision: 1.9.2.2
done
Attachment #212677 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•