summaryrefslogtreecommitdiff
path: root/cmd/strsclnt
Commit message (Collapse)AuthorAgeFilesLines
* Bug 1819958. Removed deprecated sprintf function and replaced with snprintf. ↵Noah Lokocz2023-03-161-4/+0
| | | | | | r=djackson Differential Revision: https://phabricator.services.mozilla.com/D171859
* Bug 1792821 - Updating the clang-format version to 10. r=jschanckAnna Weine2022-10-071-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D158323
* Bug 1710773 NSS needs FIPS 180-3 FIPS indicators. r=mtRobert Relyea2021-05-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes from the review: The while loop was taken out of it's subshell pipe, which prevented the selfserv PID from being passed on to the final selfserv-kill. This eventally lead to a freeze on windows. The last paragraph of ISO 19790:2012 section 7.2.4.2 states: All services shall [02.24] provide an indicator when the service utilises an approved cryptographic algorithm, security function or process in an approved manner and those services or processes specified in 7.4.3 This means our libraries need to grow an API or provide some additional information via contexts or similar in order for an application to be able to query this indicator. This can't be just a Security Policy description because ISO 24759:2017 section 6.2.4.2 states: TE02.24.02: The tester shall execute all services and verify that the indicator provides an unambiguous indication of whether the service utilizes an approved cryptographic algorithm, security function or process in an approved manner or not. The indicator can't be just a marker over an algorithm either, because it needs to show different values based on whether the algorithm parameters causes the algorithm to run in approved or non-approved mode (ie keys outside of valid range for RSA means RSA is being used in non-approved mode ...) For NSS, there is a PKCS #11 design: https://docs.google.com/document/d/1Me9YksPE7K1Suvk9Ls5PqJXPpDmpAboLsrq0z54m_tA/edit?usp=sharing This patch implments the above design as well as: 1) NSS proper functions to access these indicators from either the pk11wrap layer or the ssl layer. 2) Updates to the ssl tests which will output the value of the Changes decription by file: cmd/selfserv/selfserv.c Add a FIPS indicator if the connection was excuted in FIPS mode on a FIPS token. cmd/strsclnt/strsclnt.c Add a FIPS indicator if the connection was excuted in FIPS mode on a FIPS token. cmd/tstclnt/tstclnt.c Add a FIPS indicator if the connection was excuted in FIPS mode on a FIPS token. lib/nss/nss.def Add the new pk11 functions to access the fips indicator. lib/pk11wrap/pk11cxt.c Implement a function to get the FIPS indicator for the current PK11Context. lib/pk11wrap/pk11load.c Get the fips indicator function from the PKCS #11 module using the vendor function interface from PKCS #11 v3.0 lib/pk11wrap/pk11obj.c Implement a function to get the FIPS indicator for a specific PKCS #11 object. lib/pk11wrap/pk11priv.h Add a generalized helper function to get the FIPS indicator used by all the other exported functions to get FIPS indicator. lib/pk11wrap/pk11pub.h Add function to get the FIPS indicator for the current PK11Context. lib/pk11wrap/pk11slot.c Implement a generalized helper function to get the FIPS indicator. Implement a function to get the FIPS indicator for the latest single shot operation on the slot. lib/pk11wrap/secmodt.h Add a new field to hold the fipsIndicator function. lib/softoken/fips_algorithms.h New sample header which vendors can replace with their own table. In the default NSS case, the table in this header will be empty. lib/softoken/fipstokn.c Add Vendor specific interface for the FIPS indicator to the FIPS token. lib/softoken/pkcs11.c Add Vendor specific interface for the FIPS indicator to the non-FIPS token. Factor out the code tha maps an attribute value to a mechanism flag to it's own file so it can be used by other parts of softoken. (new function is in pkcs11u.c Implement the function that returns the FIPS indicator. This function fetches the indicator from either the session or the object or both. The session indicator is in the crypto context (except the last operation indicator, which is in the session itself. The object indicator is in the base object. lib/softoken/pkcs11c.c Record the FIPS indicator in the various helper function. - sftk_TerminateOp is called when a crypto operation had been finalized, so we can store that fips indicator in the lastOpWasFIPS field. - sftk_InitGeneric is called when a crypto operation has been initialized, so we can make a preliminary determination if the operation is within the FIPS policy (could later change bases on other operations. For this to work, we need the actual mechanism, so pMechanism is now a parameter to sftk_InitGeneric. - sftk_HKDF - HKDF when used in TLS has the unusual characteristic that the salt could actually be a key. In this case, usually the base key is some known public value which would not be FIPS generated, but the security is based on whether the salt is really a FIPS generated key. In this case we redo the calculation based on the salt key. lib/softoken/pkcs11i.h - add the FIPS indicators to the various structures (crypto contexts, sessions, objects). - add the FIPS indicators function list - add pMechanism the the sftkInitGeneric function. - add the helper function to map Attribute Types to Mechanism Flags. - add the function that will look up the current operation in the FIPS table to determine that it is allowed by policy. lib/softoken/pkcs11u.c - include the new fips_algorithms.h (if NSS_FIPS_DISABLED is not on) - handle the FIPS status for objects and session on creation an copy. - implement the helper function to map Attribute Types to Mechanism Flags. - get the key length of a key. This involves getting the key type and then using the key type to determin the appropriate attribute to fetch. Most keys it's simply the CKA_VALUE. ECC is special, we get the key length from the curve. Since only a subset of curves can be FIPS Curves, we use key length to return false for other curves. - the handle special function handles any unusal semantics for various mechanism types. This function precodes possible mechanism semantics we may need to check. The special handling can be selected by the mechanism table in fips_algorithms.h - sftk_operationIsFIPS - the actual function to determine if the givelib/n operation is in the FIPS table. lib/softoken/sftkmessage.c - just need to update the sftk_InitGeneric function to pass the mechanism. lib/ssl/ssl3con.c - and functions to query the underlying crypto contexts to see if the current ssl session is running in FIPS approved mode based on the security policy. It does so by checking the CipherSpecIsFIPS function to verify that both the mac and the encryption algorithm FIPS conforms to the ciphers in the security profile (using PK11_GetFIPSStatus). We check both the cipher specs for read and write. These underlying specs depends on the keys used in these specs being generated with FIPS approved algorithms as well, so this verifies the kea and kdf functions as well. lib/ssl/sslimpl.h - ass ssl_isFIPS() so it can be used by other files here in the ssl directory. lib/ssl/sslinfo.c - set the new isFIPS field in the existing sslinfo structure. SSL_GetChannelInfo knows how to handle sslinfo structures that are smaller then expected and larger than expected. unknown fields will be set to '0' (so new applications running against old versions will always get zero for new fields). sslinfo that are smaller will only return a the subset the calling application expects (so old applications will not get the new fields). lib/ssl/sslt.h - Add the new isFIPS field (must be at the end of the ChannelInfo structure). lib/util/pkcs11n.h - add the new FIPS indicator defines. tests/ssl/ssl.h - The main changes was to turn on verbose for the coverage tests so we can test the FIPS indicators on various cipher suites. NOTE: this only works with either NSS_TEST_FIPS_ALGORIHTMS set, or a vendor fips_algorthims.h, so vendors will need to do their own test interpretation. While working in ssl.sh I fixed an number of other issues: - many tests that were skipped in FIPS mode were skipped not because they didn't work in FIPS mode, but because tstclnt requires a password when running in FIPS mode. I've now added the password if the function is running in fips mode and removed the fips restrictions. - dtls had a race condition. the server side needed to come up before the client, but couldn't end before the client ran. We already had a sleep to guarrentee the former, I added a sleep before sending the server it's data to handle the latter. - CURVE25519 is the default ECC curve, but it's not a fiPS curve, so I disable it in FIPS mode so we will actually get FIPS indicators when using ECDHE. - I added TLS 1.3 to the coverage tests. Differential Revision: https://phabricator.services.mozilla.com/D115034
* Bug 1575968 - Add strsclnt option to enforce the use of either IPv4 or IPv6 ↵Kevin Jacobs2019-08-231-7/+34
| | | | | | r=jcj Differential Revision: https://phabricator.services.mozilla.com/D43134
* Bug 1528262, add -J option to strsclnt to specify sigschemes, r=mtDaiki Ueno2019-03-041-3/+36
| | | | | | | | | | Reviewers: mt Reviewed By: mt Bug #: 1528262 Differential Revision: https://phabricator.services.mozilla.com/D21516
* Bug 1309068 - Enable -Wshadow, r=franziskusMartin Thomson2018-02-141-9/+7
|
* Bug 1320708, strsclnt: Avoid infloop if DB is created without password, r=kaieDaiki Ueno2017-08-231-2/+4
|
* Bug 1321806, Error out if version range cannot be parsed, r=kaieDaiki Ueno2016-12-081-0/+1
|
* bug 1237872 - Add gyp build system for NSS. r=fkieferTed Mielczarek2016-09-231-0/+30
|
* Bug 1303224 - Remove the PKCS#11 bypass r=franziskus,mtTim Taubert2016-09-161-14/+3
|
* Bug 1252849 - Remove export-grade cipher suites r=mtTim Taubert2016-09-161-26/+26
|
* Bug 1254918 - clang-format NSS: cmd, r=kaieFranziskus Kiefer2016-04-211-637/+678
|
* Bug 1256630 - Fix scan-build errors. r=mtEKR2016-03-131-8/+7
|
* Bug 1228555 - Remove support for SSLv2 r=mt,wtc,ekrTim Taubert2016-03-111-58/+18
|
* Bug 1194680, Use PR_GetEnvSecure, r=jldNSS_3_23_BETA1Kai Engert2016-01-291-1/+1
|
* Bug 1182667 - Enable warnings as errors, r=rrelyeaMartin Thomson2015-08-171-8/+7
|
* Backed out changeset 4355f55afeb2 (Bug 1158489)Martin Thomson2015-08-121-7/+8
|
* Bug 1182667 - Removing warnings, enabling -Werror, r=rrelyeaMartin Thomson2015-08-071-8/+7
|
* Bug 334961, Backout nonworking revision 014577d91a1aKai Engert2014-04-151-5/+1
|
* Bug 334961, strsclnt: PR_Connect: Local Network address is in use, merged by ↵Wan-Teh Chang2014-04-091-1/+5
| | | | and r=kaie
* Bug 938369: Use official IANA cipher suite names, r=emaldonaNSS_3_16_BETA5Brian Smith2014-03-091-12/+12
|
* Bug 951816: Improve error reporting of PR_Connect failure. r=brian.Wan-Teh Chang2013-12-181-2/+5
|
* Bug 480514: Implement TLS 1.2 (RFC 5246). A very small part of theAdam Langley2013-05-291-1/+1
| | | | patch was written by wtc. r=wtc.
* Bug 845556, adjust Makefiles and tests to new NSS directory layout, r=wtcKai Engert2013-02-281-1/+1
| | | | (Previous changeset with identical description was accidentally empty.)
* Bug 845556, reorganize NSS directory layout, moving files, very large ↵Kai Engert2013-02-283-0/+1628
changeset! r=wtc