aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-10-17 14:42:33 +0000
committerWerner Koch <[email protected]>2023-10-17 14:42:33 +0000
commitd528de9c6efbbc4ac901e0bc345ab13bab2536f9 (patch)
tree7a84040adc81abded2f2cd75b6107c1cf6f8ed72
parentsm: Support import of PKCS#12 encoded ECC private keys. (diff)
downloadgnupg-d528de9c6efbbc4ac901e0bc345ab13bab2536f9.tar.gz
gnupg-d528de9c6efbbc4ac901e0bc345ab13bab2536f9.zip
sm: Minor robustness fix for a regression test.
* sm/t-minip12.c (run_one_test): Don't hash if we have no parameters at all. -- This fix handles the case that an empty result array is returned by minip12.c
-rw-r--r--sm/t-minip12.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sm/t-minip12.c b/sm/t-minip12.c
index 97d58d530..c9adcede6 100644
--- a/sm/t-minip12.c
+++ b/sm/t-minip12.c
@@ -539,7 +539,10 @@ run_one_test (const char *name, const char *desc, const char *pass,
}
}
- resulthash = hash_buffer (tmpstring, strlen (tmpstring));
+ /* Hash only if we have at least one parameter; i.e. the curve
+ * alone is not sufficient. */
+ if (result[0])
+ resulthash = hash_buffer (tmpstring, strlen (tmpstring));
xfree (tmpstring);
}