Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable RSA-PSS signatures in pkcs11-tool #1146

Merged
merged 20 commits into from
Sep 21, 2017
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a7a4e6c
Add missing SHA224 RSA algorithms
Jakuje Sep 6, 2017
811a6b9
Fix wrong replacement in pkcs11-tool manual page
Jakuje Sep 6, 2017
6d37b6c
Add MGF and PSS_PARAMS definitions in PKCS#11 header file
Jakuje Sep 6, 2017
89309a5
Inspect PSS signature parameters in pkcs11-spy
Jakuje Sep 6, 2017
1efb774
Enable RSA-PSS signatures in pkcs11-tool
Jakuje Sep 6, 2017
c2d8ee5
Added short names to RSA-PSS methods
Sep 7, 2017
ec8dd42
Change RSA-PSS salt length default to OpenSSL-compatible, aka digest …
Sep 7, 2017
aaecfdb
Fixed hashAlg but in pkcs11-tool for RSA-PSS
Sep 7, 2017
da9bae0
CHanged opt_salt to salt_len
mouse07410 Sep 8, 2017
7513ec2
Fixed type of salt length from unsigned long to long
mouse07410 Sep 9, 2017
cedbd3e
RSA-PSS: made sure special values for salt length from OpenSSL ("-1" …
mouse07410 Sep 9, 2017
0b7e5f0
Refactored dealing with salt length, and added input check
mouse07410 Sep 10, 2017
f2f53c1
Fix introduced incompatibility with C90 standard (declaration of vari…
mouse07410 Sep 11, 2017
ebd3ca2
Whitespace cleanup of mouse07410 commits
Jakuje Sep 11, 2017
55f0616
Add SHA-224 hash algorithm for RSA-PSS
Jakuje Sep 11, 2017
15659fb
Do not fallback to zero-length salt on unknown hash algorithms
Jakuje Sep 11, 2017
375e1c2
Add SHA224 definitions in pkcs11.h (for completenes)
Jakuje Sep 11, 2017
4450c2c
Reintroduce portable NORETURN indication for functions and use it to …
Jakuje Sep 13, 2017
e870706
Use default SHA-1 mechanisms, use --salt-len, improve wording of docu…
Jakuje Sep 15, 2017
63ae2f9
Check the mechanism type before dereferencing generic parameter
Jakuje Sep 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix introduced incompatibility with C90 standard (declaration of vari…
…ables inside the code)
  • Loading branch information
mouse07410 authored and Jakuje committed Sep 13, 2017
commit f2f53c1fad2b8e4f8290a235877d863fd14d3281
6 changes: 4 additions & 2 deletions src/tools/pkcs11-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,8 @@ static void sign_data(CK_SLOT_ID slot, CK_SESSION_HANDLE session,
CK_ULONG sig_len;
int fd, r;

unsigned long hashlen = 0, modlen = 0;

if (!opt_mechanism_used)
if (!find_mechanism(slot, CKF_SIGN|CKF_HW, NULL, 0, &opt_mechanism))
util_fatal("Sign mechanism not supported");
Expand Down Expand Up @@ -1721,15 +1723,15 @@ static void sign_data(CK_SLOT_ID slot, CK_SESSION_HANDLE session,
if (opt_mgf != 0)
pss_params.mgf = opt_mgf;

hashlen = figure_pss_salt_length(pss_params.hashAlg);

unsigned long hashlen = figure_pss_salt_length(pss_params.hashAlg);
if (salt_len_given == 1) { /* salt size explicitly given */
if (salt_len < 0 && salt_len != -1 && salt_len != -2)
util_fatal("Salt length must be greater or equal \
to zero, or equal to -1 (meaning: use digest size) or to -2 \
(meaning: use maximum permissible size");

unsigned long modlen = (get_private_key_length(session, key) + 7) / 8;
modlen = (get_private_key_length(session, key) + 7) / 8;
switch(salt_len) {
case -1: /* salt size equals to digest size */
pss_params.sLen = hashlen;
Expand Down