• Robert Relyea's avatar
    Bug 1702663 Need to support RSA PSS with Hashing PKCS #11 Mechanisms. · 5023aeed
    Robert Relyea authored
    FIPS requires that we supply a hash and sign interface for our supported
    signing algorithms to be validated. We already have those interfaces in
    softoken for RSA PKCS1, DSA, and ECDSA. However, we don't test those
    interfaces, now do we supply a way for an application to access those
    interfaces (usually applications use the VFY_ and SGN_ interfaces which
    handles the hashing an verify/sign operations).
    
    We also have a generic pk11_signature_tests class in pk11_gtest, but only ecdsa
    and some rsa pss tests uses it.
    
    This patch rectifies all of these deficiencies:
    
    lib/softokn
    1) Hash and sign/verify mechanisms have been added to softoken to support PSS
    hash and sign.
    2) The rsa, dsa, and ecdsa hash and sign algorithms were also cleaned up by
    creating a fake CKM_SHA1 which matches CKM_SHA_1 so that we can fully use the
    same macros for all the hash types.
    
    1&2 was sufficient to provide the goals of this task, however we wanted to be
    able to add tests for this functionality..
    
    lib/pk11wrap
    3) Two new functions were added: PK11_CreateContextByPubKey and
    PK11_CreateContextByPrivKey. These allow you to create multipart contexts with
    Public and Private keys. This is a requirement to support hash and sign, as
    they are multi-part operations (rather then just signing a hash, which is a
    single part operation). With these functions, you can now use the PK11_DigestOp
    and PK11_DigestFinal to complete a signature or verify optiation.
    
    gtests/pk11_gtest
    4) Add hash and sign/hash and verify support to the generic
    pk11_signature_tests.h.
    5) pk11_dsa_unittest.cc, pk11_rsa_unittest.cc, and the remainder of
    pk11_rsapss_unittest.cc (Wycheproof tests) were moved to use the
    pk11_signature_tests common implementation rather then their own.
    6) pk11_ecdsa_unittest.cc was updated to support the hash&sign/verify combo
    mechanism.
    7) With multiple functions using pk11_signature_tests.h, The large functions
    are moved to pk11_signature_tests.cpp.
    8) The test vectors themselves were not changes, now just test against the
    traditional hash first then verify interfaces and the hash and verify
    interfaces.
    
    Differential Revision: https://phabricator.services.mozilla.com/D110641
    
    --HG--
    extra : rebase_source : d2ec6b9589562cedd4aca45b79a649162eadc5ec
    5023aeed
Name
Last commit
Last update
automation Loading commit data...
cmd Loading commit data...
coreconf Loading commit data...
cpputil Loading commit data...
doc Loading commit data...
fuzz Loading commit data...
gtests Loading commit data...
lib Loading commit data...
nss/automation/abi-check Loading commit data...
nss-tool Loading commit data...
pkg Loading commit data...
tests Loading commit data...
.arcconfig Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
.sancov-blacklist Loading commit data...
.taskcluster.yml Loading commit data...
COPYING Loading commit data...
Makefile Loading commit data...
build.sh Loading commit data...
exports.gyp Loading commit data...
help.txt Loading commit data...
mach Loading commit data...
manifest.mn Loading commit data...
nss.gyp Loading commit data...
readme.md Loading commit data...
trademarks.txt Loading commit data...