summaryrefslogtreecommitdiff
path: root/cmd/shlibsign
Commit message (Collapse)AuthorAgeFilesLines
* WIP: Bug 1804091 NSS needs to move off of DSA for integrity checks. ↵Robert Relyea2023-01-051-287/+598
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r=nss-reviewers,jschanck When we first added integrity checks to NSS for FIPS compliance, the only signature method allowed was DSA. NIST will be sunsetting DSA in 2023, so we need to update our integrity checks again. Since the time we added these checks, NIST has started accepting HMAC as a valid signature algorithm for integrity checks. HMAC is easier, faster and requires smaller .chk files and openssl and gnutls has been using hmac now for years for this purpose. Since we need to move off of DSA anyway it's time to move to HMAC. This patch does this move. shlibsign now produces HMAC_256 by default. It moves the version number up because even though nss includes a type field, previous versions of NSS did not look at the type field when checking integrity. Bumping the version number will cause previous versions of NSS to fail early if presented with a newly generated integrity check file (even though it should fail later anyway). shlibsign now has the ability to generate 'legacy' check files so it can be used to generate check files for older versions of NSS. NSS can still accept older check files unless NSS_STRICT_INTEGRITY is set at compile time. This means tools which may be using old shlibsign to resign nss shared libraries will continue to work. At some point we can remove all DSA support (maybe after one enterprise release cycle). While completing this work, we also complete some integrity code cleanup. There are lots of magic numbers defining where things fall in the integrity check header. These are now moved to a structure and defined in the shsign.h header. Both shlibsign and shvfy have been updated to use this header. New test cases are not needed since fips.sh adequately tests our integrity code (both normal case and against mangled libraries which should fail). Though the lowhash test was updated to catch a particular issue we can run into when we use the LOWHASH code. On RHEL-7, we use the NSSLOWHASH_ interface in freebl in libc, which needs to run independently of nspr and nssutil. This requirement puts a pretty heavy burned on freebl to be self-contained when used for NSSLOWHASH_, including running integrity checks. The previous test program linked with nssutil and nspr (just like all of the rest of the nss tests) and weren't detecting issues when unimplemented stub functions where called. This patch includes fixing those lowhash tests and also implementing the stubs needed by the current integrity check code. cmd/lowhashtest/Makefile remove linking lowhashtest with all the libraries except freebl. cmd/lowhashtest/lowhashtest.c remove any dependency NSPR or NSSUTIL in the code. cmd/lowhashtest/manifest.mn remove spurious requires statements. cmd/shlibsign/shlibsign.c add hmac code. add ability to select the hash type from the command line. separate signature processing into their own functions for DSA and HMAC General cleanups. Use PR_ARRAY_SIZE rather then a custom define. move error printing outside utility functions (so we don't have to pass around filenames everywhere) Use NSSSignChkHeader instead of a Buf with magic offsets for the Check file Header. Add ability to make old style .chk files for old versions of NSS. Add option to revert to DSA Add option to use old version numbers: only valid if DSA is set. lib/freebl/Makefile All NSS_STRICT_INTEGRITY to be set at build time. Setting NSS_STRICT_INTEGRITY only accepts hmac256, hmac384, hmac512. If it's not set, NSS will accept older .chk file formats (like DSA-2). lib/freebl/nsslowhash.c lowhashtest files expect to set NSS_FIPS to force fips mode when testing the lowhash interface, but NSS_FIPS was not being looked at in the nsslow_GetFIPSEnabled. NOTE: setting NSS_FIPS to true will force FIPS mode if the system isn't already in FIPS mode. Setting it to FALSE will not turn it off if the system is already in FIPS mode. lib/freebl/shsign.h Update version. Add new defines for HMAC add new Header structure to remove magic offsets into a raw buffer in the code. lib/freebl/shvfy.c Add HMAC processing. Turn off DSA processing if NSS_STRICT_INTEGERITY is set. Refactor the signature processing. lib/freebl/stubs.c Add SECITEM_ItemsAreEqual for HMAC shvfy Add implementations for SECITEM_ItemsAreEqual, SECITEM_ZfreeItem, and PR_GetEnvSecure. The first is new. The second solves and existing bug which is only seen on RHEL7, and the last is needed for the fix to nsslowhash.c above. PR_GetEnvSecure() calls secure_getenv if _USE_GNU is set, otherwise it falls back to the normal getenv. This should be safe since it's only used in LOWHASH to get the NSS_FIPS environment variable, which only has the effect of making LOWHASH run in fips mode when it otherwise wouldn't. lib/freebl/stubs.c Add SECITEM_ItemsAreEqual for HMAC shvfy tests/lowhash/lowhash.sh Make the test executable so it can be run on it's own. Differential Revision: https://phabricator.services.mozilla.com/D164137
* Bug 1642153 - Avoid infinite recursion when CHECKLOC is not set. r=jcjMike Hommey2020-06-031-0/+2
| | | | Differential Revision: https://phabricator.services.mozilla.com/D77596
* Bug 290526 Drop double-colon usage and add directory depends r=rrelyeaJan-Marek Glogowski2020-05-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Double-colon rule behaviour isn't really compatible with parallel build. This gets rid of all of them, so we can codify the directory dependencies. This leaves just three problems, which aren't really fixable with the current build system without completely replacing it: * everything depends on nsinstall * everything depends on installed headers * ckfw child directories depend on the build parent libs This is handled by the prepare_build target. Overall this allows most if the build to run in parallel. P.S. the release_md:: has to stay :-( P.P.S. no clue, why freebl must use libs: instead of using the TARGETS and .PHONY variables Differential Revision: https://phabricator.services.mozilla.com/D69023
* Bug 290526 Parallelize part of the NSS build r=rrelyeaJan-Marek Glogowski2020-05-051-2/+3
| | | | | | | | | | | | | | | | | | | | This still serializes many targets, but at least these targets themself run their build in parallel. The main serialization happens in nss/Makefile and nss/coreconf/rules.mk's all target. We can't add these as real dependencies, as all Makefile snippets use the same variable names. I tried to always run sub-makes to hack in the depndencies, but these don't know of each other, so targets very often run twice, and this breaks the build. Having a tests:: target and a tests directory leads to misery (and doesn't work), so it's renamed to check. This just works with NSS_DISABLE_GTESTS=1 specified and is fixed by a follow up patch, which removes the double-colon usage and adds the directory dependencies! Differential Revision: https://phabricator.services.mozilla.com/D69019
* Bug 1603628 Update NSS to handle PKCS #11 v3.0 r=daiki r=mhoyeRobert Relyea2020-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://phabricator.services.mozilla.com/D63241 This patch implements the first phase: updating the headers. lib/util/pkcs11.h lib/util/pkcs11f.h lib/util/pkcs11t.h Were updated using the released OASIS PKCS #11 v3.0 header files. lib/util/pkcs11n.h was updated to finally deprecate all uses of CK?_NETSCAPE_?. A new define as added: NSS_PKCS11_2_0_COMPAT. If it's defined, the small semantic changes (including the removal of deprecated defines) between the NSS PKCS #11 v2 header file and the new PKCS #11 v3 are reverted in favor of the PKCS #11 v2 definitions. This include the removal of CK?_NETSCAPE_? in favor of CK?_NSS_?. One notable change was caused by an inconsistancy between the spec and the released headers in PKCS #11 v2.40. CK_GCM_PARAMS had an extra field in the header that was not in the spec. OASIS considers the header file to be normative, so PKCS #11 v3.0 resolved the issue in favor of the header file definition. NSS had the spec definition, so now there are 2 defines for this structure: CK_NSS_GCM_PARAMS - the old nss define. Still used internally in freebl. CK_GCM_PARAMS_V3 - the new define. CK_GCM_PARAMS - no longer referenced in NSS itself. It's defined as CK_GCM_PARAMS_V3 if NSS_PKCS11_2_0_COMPAT is *not* defined, and it's defined as CKM_NSS_GCM_PARAMS if NSS_PKCS11_2_0_COMPAT is defined. Softoken has been updated to accept either CK_NSS_GCM_PARAMS or CK_GCM_PARAMS_V3. In a future patch NSS will be updated to use CK_GCM_PARAMS_V3 and fall back to CK_NSS_GMC_PARAMS. One other semantic difference between the 3.0 version of pkcs11f.h and the version here: In the oasis version of the header, you must define CK_PKCS11_2_0_ONLY to get just the PKCS #11 v2 defines. In our version you must define CK_PKCS11_3 to get the PCKS #11 v3 defines. Most of this patch is to handle changing the deprecated defines that have been removed in PCKS #11 v3 from NSS. Differential Revision: https://phabricator.services.mozilla.com/D63241
* Bug 1560806 - Increased the max size supported for softoken passwords. r=jcjMarcus Burghardt2019-07-261-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D39444
* Bug 1446100: Add range-check & cast to PR_Write result, to address build ↵Daniel Holbert2018-03-151-1/+1
| | | | warning. r=kaie
* Bug 1309578 - follow up, r=bustageFranziskus Kiefer2016-11-221-2/+2
|
* Bug 1309578 - fix null pointer in shlibsign, r=ttaubertFranziskus Kiefer2016-11-181-0/+16
|
* bug 1237872 - Add gyp build system for NSS. r=fkieferTed Mielczarek2016-09-232-0/+61
|
* Bug 1254918 - clang-format NSS: cmd, r=kaieFranziskus Kiefer2016-04-212-484/+498
|
* Bug 1194680, Use PR_GetEnvSecure, r=jldNSS_3_23_BETA1Kai Engert2016-01-291-1/+1
|
* Bug 1061701 - Integer overflow in binary searches, r=kaieGeorg Fritzsche2014-09-021-1/+1
|
* Bug 1182667 - Enable warnings as errors, r=rrelyeaMartin Thomson2015-08-171-1/+1
|
* Backed out changeset 4355f55afeb2 (Bug 1158489)Martin Thomson2015-08-121-1/+1
|
* Bug 1182667 - Removing warnings, enabling -Werror, r=rrelyeaMartin Thomson2015-08-071-1/+1
|
* Bug 1154106: Comment out unused const variables (provided for human readers) ↵Daniel Holbert2015-08-041-0/+10
| | | | in shlibsign.c. r=rrelyea
* Bug 565296 - shlibsign returns 0 although it fails, r=rrelyeaKai Engert2013-06-111-1/+7
|
* Bug 835919: Remove an extraneous ')' after an ifeq directive. Add aWan-Teh Chang2013-05-011-3/+3
| | | | space between variables and '='. TBR=emaldona.
* Bug 835919 - Allow optionally building nss without softoken in the tree, ↵Elio Maldonado2013-04-291-2/+5
| | | | r=rrelyea
* Bug 863871: Remove CVS keywords from NSS source files, Part 1 (trivialBrian Smith2013-04-252-4/+0
| | | | cases). r=wtc.
* backout bug 835919, backout bug 850905Elio Maldonado2013-04-101-33/+12
|
* Bug 850905 - shlibsign fails digest/signature verification unless default ↵Elio Maldonado2013-04-091-12/+33
| | | | keysize is used, r=rrelyea
* Bug 845556, adjust Makefiles and tests to new NSS directory layout, r=wtcKai Engert2013-02-282-2/+2
| | | | (Previous changeset with identical description was accidentally empty.)
* Bug 845556, reorganize NSS directory layout, moving files, very large ↵Kai Engert2013-02-288-0/+1718
changeset! r=wtc