Skip to content

Commit 2ad06ca

Browse files
committed
Fixes rsa_pss_saltlen parameter for openssl/libressl
Older versions of openssl used this switch as follows: For pss mode only this option specifies the salt length. Two special values are supported: -1 sets the salt length to the digest length. When signing -2 sets the salt length to the maximum permissible value. When verifying -2 causes the salt length to be automatically determined based on the PSS block structure. Newer versions of openssl used this switch as follows: For pss mode only this option specifies the salt length. Three special values are supported: digest sets the salt length to the digest length, max sets the salt length to the maximum permissible value. When verifying auto causes the salt length to be automatically determined based on the PSS block structure.
1 parent f3f28cf commit 2ad06ca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/OsEID-tool

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,12 @@ rm -f tmp/rsa_sign_testfile.txt.${file_hash}.sign
11991199
# -in tmp/rsa_sign_testfile.txt.sha1 \
12001200
# -inkey _private_key.pem_ -pkeyopt digest:sha1 -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:-1 \
12011201
# -out tmp/rsa_sign_testfile.txt.sha1.sign
1202+
# rsa_pss_saltlen setting:
1203+
# Old openssl New
1204+
# -1 sets the salt length to the digest length rsa_pss_saltlen:digest
1205+
# -2 sets the salt length to the maximum permissible value rsa_pss_saltlen:max
1206+
# -2 for verify mode rsa_pss_saltlen:auto
1207+
#
12021208
echo "using pkcs11 interface to sign message, mechanism ${MECHANISM}"
12031209
PKCS11-TOOL --sign -m "${MECHANISM}" \
12041210
--id $keyID \
@@ -1209,7 +1215,7 @@ if [ $? -eq 0 ]; then
12091215
openssl pkeyutl -pubin -verify -in tmp/rsa_sign_testfile.txt.${file_hash} \
12101216
-sigfile tmp/rsa_sign_testfile.txt.${file_hash}.sign \
12111217
-inkey tmp/exported_rsa_key.pub -pkeyopt rsa_padding_mode:pss \
1212-
-pkeyopt rsa_pss_saltlen:-1 \
1218+
-pkeyopt rsa_pss_saltlen:digest \
12131219
-pkeyopt digest:${file_hash}
12141220
if [ $? -ne 0 ]; then
12151221
failecho "openssl signature test fail"

0 commit comments

Comments
 (0)