Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: nss/lib/softoken/fipstest.c

Issue 195763027: Update NSS to NSS_3_16_RC0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Use the RTM tag Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « nss/lib/softoken/ecdecode.c ('k') | nss/lib/softoken/fipstokn.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * PKCS #11 FIPS Power-Up Self Test. 2 * PKCS #11 FIPS Power-Up Self Test.
3 * 3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public 4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 7
8 #include "softoken.h" /* Required for RC2-ECB, RC2-CBC, RC4, DES-ECB, */ 8 #include "softoken.h" /* Required for RC2-ECB, RC2-CBC, RC4, DES-ECB, */
9 /* DES-CBC, DES3-ECB, DES3-CBC, RSA */ 9 /* DES-CBC, DES3-ECB, DES3-CBC, RSA */
10 /* and DSA. */ 10 /* and DSA. */
11 #include "seccomon.h" /* Required for RSA and DSA. */ 11 #include "seccomon.h" /* Required for RSA and DSA. */
12 #include "lowkeyi.h" /* Required for RSA and DSA. */ 12 #include "lowkeyi.h" /* Required for RSA and DSA. */
13 #include "pkcs11.h" /* Required for PKCS #11. */ 13 #include "pkcs11.h" /* Required for PKCS #11. */
14 #include "secerr.h" 14 #include "secerr.h"
15 15
16 #ifdef NSS_ENABLE_ECC 16 #ifndef NSS_DISABLE_ECC
17 #include "ec.h" /* Required for ECDSA */ 17 #include "ec.h" /* Required for ECDSA */
18 #endif 18 #endif
19 19
20 20
21 /* FIPS preprocessor directives for RC2-ECB and RC2-CBC. */ 21 /* FIPS preprocessor directives for RC2-ECB and RC2-CBC. */
22 #define FIPS_RC2_KEY_LENGTH 5 /* 40-bits */ 22 #define FIPS_RC2_KEY_LENGTH 5 /* 40-bits */
23 #define FIPS_RC2_ENCRYPT_LENGTH 8 /* 64-bits */ 23 #define FIPS_RC2_ENCRYPT_LENGTH 8 /* 64-bits */
24 #define FIPS_RC2_DECRYPT_LENGTH 8 /* 64-bits */ 24 #define FIPS_RC2_DECRYPT_LENGTH 8 /* 64-bits */
25 25
26 26
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 return( CKR_OK ); 1605 return( CKR_OK );
1606 1606
1607 rsa_loser: 1607 rsa_loser:
1608 1608
1609 nsslowkey_DestroyPublicKey( rsa_public_key ); 1609 nsslowkey_DestroyPublicKey( rsa_public_key );
1610 nsslowkey_DestroyPrivateKey( rsa_private_key ); 1610 nsslowkey_DestroyPrivateKey( rsa_private_key );
1611 1611
1612 return( CKR_DEVICE_ERROR ); 1612 return( CKR_DEVICE_ERROR );
1613 } 1613 }
1614 1614
1615 #ifdef NSS_ENABLE_ECC 1615 #ifndef NSS_DISABLE_ECC
1616 1616
1617 static CK_RV 1617 static CK_RV
1618 sftk_fips_ECDSA_Test(const PRUint8 *encodedParams, 1618 sftk_fips_ECDSA_Test(const PRUint8 *encodedParams,
1619 unsigned int encodedParamsLen, 1619 unsigned int encodedParamsLen,
1620 const PRUint8 *knownSignature, 1620 const PRUint8 *knownSignature,
1621 unsigned int knownSignatureLen) { 1621 unsigned int knownSignatureLen) {
1622 1622
1623 /* ECDSA Known Seed info for curves nistp256 and nistk283 */ 1623 /* ECDSA Known Seed info for curves nistp256 and nistk283 */
1624 static const PRUint8 ecdsa_Known_Seed[] = { 1624 static const PRUint8 ecdsa_Known_Seed[] = {
1625 0x6a, 0x9b, 0xf6, 0xf7, 0xce, 0xed, 0x79, 0x11, 1625 0x6a, 0x9b, 0xf6, 0xf7, 0xce, 0xed, 0x79, 0x11,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 ecdsa_known_K283_signature, 1788 ecdsa_known_K283_signature,
1789 sizeof ecdsa_known_K283_signature ); 1789 sizeof ecdsa_known_K283_signature );
1790 if (crv != CKR_OK) { 1790 if (crv != CKR_OK) {
1791 return( CKR_DEVICE_ERROR ); 1791 return( CKR_DEVICE_ERROR );
1792 } 1792 }
1793 #endif 1793 #endif
1794 1794
1795 return( CKR_OK ); 1795 return( CKR_OK );
1796 } 1796 }
1797 1797
1798 #endif /* NSS_ENABLE_ECC */ 1798 #endif /* NSS_DISABLE_ECC */
1799 1799
1800 static CK_RV 1800 static CK_RV
1801 sftk_fips_DSA_PowerUpSelfTest( void ) 1801 sftk_fips_DSA_PowerUpSelfTest( void )
1802 { 1802 {
1803 /* DSA Known P (1024-bits), Q (160-bits), and G (1024-bits) Values. */ 1803 /* DSA Known P (1024-bits), Q (160-bits), and G (1024-bits) Values. */
1804 static const PRUint8 dsa_P[] = { 1804 static const PRUint8 dsa_P[] = {
1805 0x80,0xb0,0xd1,0x9d,0x6e,0xa4,0xf3,0x28, 1805 0x80,0xb0,0xd1,0x9d,0x6e,0xa4,0xf3,0x28,
1806 0x9f,0x24,0xa9,0x8a,0x49,0xd0,0x0c,0x63, 1806 0x9f,0x24,0xa9,0x8a,0x49,0xd0,0x0c,0x63,
1807 0xe8,0x59,0x04,0xf9,0x89,0x4a,0x5e,0xc0, 1807 0xe8,0x59,0x04,0xf9,0x89,0x4a,0x5e,0xc0,
1808 0x6d,0xd2,0x67,0x6b,0x37,0x81,0x83,0x0c, 1808 0x6d,0xd2,0x67,0x6b,0x37,0x81,0x83,0x0c,
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 2073
2074 if( rv != CKR_OK ) 2074 if( rv != CKR_OK )
2075 return rv; 2075 return rv;
2076 2076
2077 /* RNG Power-Up SelfTest(s). */ 2077 /* RNG Power-Up SelfTest(s). */
2078 rv = sftk_fips_RNG_PowerUpSelfTest(); 2078 rv = sftk_fips_RNG_PowerUpSelfTest();
2079 2079
2080 if( rv != CKR_OK ) 2080 if( rv != CKR_OK )
2081 return rv; 2081 return rv;
2082 2082
2083 #ifdef NSS_ENABLE_ECC 2083 #ifndef NSS_DISABLE_ECC
2084 /* ECDSA Power-Up SelfTest(s). */ 2084 /* ECDSA Power-Up SelfTest(s). */
2085 rv = sftk_fips_ECDSA_PowerUpSelfTest(); 2085 rv = sftk_fips_ECDSA_PowerUpSelfTest();
2086 2086
2087 if( rv != CKR_OK ) 2087 if( rv != CKR_OK )
2088 return rv; 2088 return rv;
2089 #endif 2089 #endif
2090 2090
2091 /* Software/Firmware Integrity Test. */ 2091 /* Software/Firmware Integrity Test. */
2092 rv = sftk_fipsSoftwareIntegrityTest(); 2092 rv = sftk_fipsSoftwareIntegrityTest();
2093 2093
2094 if( rv != CKR_OK ) 2094 if( rv != CKR_OK )
2095 return rv; 2095 return rv;
2096 2096
2097 /* Passed Power-Up SelfTest(s). */ 2097 /* Passed Power-Up SelfTest(s). */
2098 return( CKR_OK ); 2098 return( CKR_OK );
2099 } 2099 }
2100 2100
OLDNEW
« no previous file with comments | « nss/lib/softoken/ecdecode.c ('k') | nss/lib/softoken/fipstokn.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698