aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2019-02-18 12:37:03 -0800
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2019-02-18 12:59:42 -0800
commitd88fa76b2229b16babf5cc9a5a99066c8d905de9 (patch)
treef24503eab5a6d59531c2b36a623d92b166fc52ac
parent3c02b1244f55cc26537858cd176bdb6eca678055 (diff)
downloadopenssl-pkcs11-export-d88fa76b2229b16babf5cc9a5a99066c8d905de9.tar.gz
Fix check tests
The value of len must be set before being passed in to the signature routine because certain versions of openssl won't just blindly set the length. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--crypto.c6
-rwxr-xr-xtests/signature.sh1
2 files changed, 6 insertions, 1 deletions
diff --git a/crypto.c b/crypto.c
index 6ea738f..8ef2615 100644
--- a/crypto.c
+++ b/crypto.c
@@ -342,6 +342,9 @@ int crypto_sign(void *opdata, void *data, unsigned long data_len,
EVP_PKEY_CTX *ctx = opdata;
size_t len;
+ if (sig_len)
+ len = *sig_len;
+
if (!sig) {
*sig_len = EVP_PKEY_size(EVP_PKEY_CTX_get0_pkey(ctx));
return 0;
@@ -374,6 +377,9 @@ int crypto_decrypt(void *opdata, void *enc_data, unsigned long enc_len,
int ret = 0;
size_t len;
+ if (data_len)
+ len = *data_len;
+
if (!data) {
*data_len = EVP_PKEY_size(EVP_PKEY_CTX_get0_pkey(ctx));
return 0;
diff --git a/tests/signature.sh b/tests/signature.sh
index 5bf20ae..82505dd 100755
--- a/tests/signature.sh
+++ b/tests/signature.sh
@@ -17,7 +17,6 @@ check_signature
##
# PSS
##
-set -x
for hash in sha1 sha224 sha256 sha384 sha512; do
echo "PSS hash ${hash}"
openssl ${hash} -out tmp.md -binary tmp.txt || exit 1