Closed
Bug 318970
Opened 20 years ago
Closed 19 years ago
Implement RSA algorithm test for FIPS 140-2 validation
Categories
(NSS :: Test, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
3.11.1
People
(Reporter: glenbeasley, Assigned: glenbeasley)
Details
Attachments
(4 files, 2 obsolete files)
82.28 KB,
text/plain
|
Details | |
1.48 KB,
patch
|
Details | Diff | Splinter Review | |
2.19 KB,
patch
|
wtc
:
review-
|
Details | Diff | Splinter Review |
16.36 KB,
patch
|
neil.williams
:
review+
rrelyea
:
superreview+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #209650 -
Flags: review?(wtchang)
Comment 2•19 years ago
|
||
Comment on attachment 209650 [details] [diff] [review]
rsa test
r=wtc.
Bob, this patch requires the fipstest command
to include some softoken headers. Please approve
exporting these softoken headers as "private exports".
Glen, I suggest renaming DEFAULT_EXPONENT as
DEFAULT_PUBLIC_EXPONENT or even
DEFAULT_RSA_PUBLIC_EXPONENT.
>+ int publicExponent = DEFAULT_EXPONENT; /* default exponent */
The comment is not necessary (it repeats the code).
Attachment #209650 -
Flags: superreview?(rrelyea)
Attachment #209650 -
Flags: review?(wtchang)
Attachment #209650 -
Flags: review+
Comment 3•19 years ago
|
||
Comment on attachment 209650 [details] [diff] [review]
rsa test
r+ but I would like you to make the following changes:
1)Increase the suse of 'buf' by at leas 1 byte and include a comment that this is only good for up to 4 k modulus.
(currently a 4K modulus (512 bytes) will overflow the buffer with a trailing NULL).
2) optional: sanity check in reading the modulus to make sure it's not to big. (if you don't make the change above, you need to cap the modulus at 4095).
3) your for (j=0; isxdigit();) loop should
quit if j >= sizeof(msg).
4) You should rename rsaHighPrivKey and rsaHowPublicKey as neither key are 'high' keys. The are blapi keys and are lower than NSSLOWKEYPrivateKey (softoken keys). rsaPublicKey and rsaPrivateKey should be sufficient (or you can call them rsaBlapiPrivateKey, etc).
Attachment #209650 -
Flags: superreview?(rrelyea) → superreview+
Comment 4•19 years ago
|
||
One thing that might be better is to create a define "MAX_TEST_MODULUS_BITS"
new define MAX_TEST_MODULUS_BYTES would be (MAX_TEST_MODULUS_BITS/8)
buf would be size (2*MAX_TEST_MODULUS_BYTES+1)
Mod would test to be less than equal to MAX_TEST_MODULUS_BITS
rsa_computed_signature would be size(MAX_TEST_MODULUS_BYTES)
That way you can handle larger key sizes with changing a single define.
Assignee | ||
Comment 5•19 years ago
|
||
to run this test
fipstest rsa sigver SigVer_15.kat > SigVer_15.rsp
diff SigVer_15.kat SigVer_15.rsp (should be the same)
Assignee | ||
Comment 6•19 years ago
|
||
Attachment #209650 -
Attachment is obsolete: true
Attachment #211359 -
Flags: review?(wtchang)
Comment 7•19 years ago
|
||
Comment on attachment 211359 [details] [diff] [review]
update to rsa sigver and siggen tests
>+#define MAX_RSA_EXPONENT 8 /* rsa.c */
This macro should be renamed
RSA_MAX_TEST_EXPONENT_BYTES
to be consistent with the RSA_MAX_TEST_XXX macros
defined above it.
Attachment #211359 -
Flags: review?(wtchang) → review+
Assignee | ||
Comment 8•19 years ago
|
||
wan-teh sent this patch by email, I reviewed the patch,
ran the tests successfully, and am checking into nss
3.11.x and the tip.
cvs commit -m "fix by wan-teh for RSA siggen tests r=glen" fipstest.c
Enter passphrase for key '/home/gb134726/.ssh/id_dsa':
Checking in fipstest.c;
/cvsroot/mozilla/security/nss/cmd/fipstest/fipstest.c,v <-- fipstest.c
new revision: 1.26; previous revision: 1.25
done
/cvsroot/mozilla/security/nss/cmd/fipstest/fipstest.c,v <-- fipstest.c
new revision: 1.3.2.19; previous revision: 1.3.2.18
done
Attachment #211359 -
Attachment is obsolete: true
Assignee | ||
Comment 9•19 years ago
|
||
"gsigver" option will allow the generated RSA signature to produce formatted output that can be tested using for the RSA signature verification test.
Example:
fipstest rsa siggen SigGen15.req gsigver > sigver.req
fipstest rsa sigver sigver.req > sigver.rsp
grep -c "S = " sigver.rsp == 200
grep -c "Result = P" sigver.rsp == 200
Attachment #213057 -
Flags: review?(wtchang)
Comment 10•19 years ago
|
||
Comment on attachment 213057 [details] [diff] [review]
create sigver file
This patch is correct, but has some formatting problems.
In NSS code, please test a PRBool variable like this:
if (bGenVer)
or
if (!bGenVer)
>+ if (bGenVer == PR_FALSE) {
> to_hex_str(buf, rsaBlapiPrivKey->publicExponent.data,
> rsaBlapiPrivKey->publicExponent.len);
> fprintf(rsaresp, "e = %s\n", buf);
>+ }
You need to indent the code inside the if block.
Attachment #213057 -
Flags: review?(wtchang) → review-
Comment 11•19 years ago
|
||
The reason we failed the RSA SigGen test is that we
did not turn the hash into a DigestInfo before we
signed it. This patch fixes that. Unfortunately
I need to call two static functions in the softoken.
So I made them non-static NSS private functions.
Bob, you just need to review the softoken portion of
the patch. Let me know if you want me to move the
new RSA_HashSign and RSA_HashCheckSign functions to
lib/softoken/rsawrapr.c, and if you want these functions
to take SFTKHashSignInfo *info and SFTKHashVerifyInfo *info
instead of hashOid and key as arguments.
Attachment #214510 -
Flags: superreview?(rrelyea)
Attachment #214510 -
Flags: review?(neil.williams)
Comment 12•19 years ago
|
||
Comment on attachment 214510 [details] [diff] [review]
Need to create DigestInfo
Patch looks good. From an organization standpoint I'd expect the new RSA* functions to be in rsawrapr.c but I can see why you might want them where they are.
Attachment #214510 -
Flags: review?(neil.williams) → review+
Comment 13•19 years ago
|
||
Comment on attachment 214510 [details] [diff] [review]
Need to create DigestInfo
r+
Attachment #214510 -
Flags: superreview?(rrelyea) → superreview+
Assignee | ||
Comment 14•19 years ago
|
||
check in Wan-Teh fix to the tip and NSS_3_11_BRANCH
Checking in cmd/fipstest/fipstest.c;
/cvsroot/mozilla/security/nss/cmd/fipstest/fipstest.c,v <-- fipstest.c
new revision: 1.28; previous revision: 1.27
done
Checking in lib/softoken/pkcs11c.c;
/cvsroot/mozilla/security/nss/lib/softoken/pkcs11c.c,v <-- pkcs11c.c
new revision: 1.78; previous revision: 1.77
done
Checking in lib/softoken/softoken.h;
/cvsroot/mozilla/security/nss/lib/softoken/softoken.h,v <-- softoken.h
new revision: 1.11; previous revision: 1.10
done
nss_3_11_branch
Enter passphrase for key '/home/gb134726/.ssh/id_dsa':
Checking in cmd/fipstest/fipstest.c;
/cvsroot/mozilla/security/nss/cmd/fipstest/fipstest.c,v <-- fipstest.c
new revision: 1.3.2.21; previous revision: 1.3.2.20
done
Checking in lib/softoken/pkcs11c.c;
/cvsroot/mozilla/security/nss/lib/softoken/pkcs11c.c,v <-- pkcs11c.c
new revision: 1.68.2.7; previous revision: 1.68.2.6
done
Checking in lib/softoken/softoken.h;
/cvsroot/mozilla/security/nss/lib/softoken/softoken.h,v <-- softoken.h
new revision: 1.7.30.1; previous revision: 1.7
done
Updated•19 years ago
|
QA Contact: jason.m.reid → test
Assignee | ||
Updated•19 years ago
|
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•