Fix test case with newer openssl.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2025-11-09 21:38:52 +01:00
parent ae61150f5c
commit de33124d6b
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -7,9 +7,9 @@ test $? -eq 0 || exit $?
rsa_encrypt_decrypt() { rsa_encrypt_decrypt() {
openssl pkeyutl -encrypt -pubin -inkey 1.pub $2 -in $1 -out data.crypt openssl pkeyutl -encrypt -pubin -inkey 1.pub $2 -in $1 -out data.crypt
test $? -eq 0 && echo -n "." || exit $? test $? -eq 0 && echo -n "." || exit $?
TDATA=$(tr -d '\0' < <(pkcs11-tool --id 1 --pin 648219 --decrypt $3 -i data.crypt 2>/dev/null)) TDATA=$(pkcs11-tool --id 1 --pin 648219 --decrypt $3 -i data.crypt 2>/dev/null | sed '/^OAEP parameters:/d' | tr -d '\0')
test $? -eq 0 && echo -n "." || exit $? test $? -eq 0 && echo -n "." || exit $?
if [[ ${TEST_STRING} != "$TDATA" ]]; then if [[ "$TEST_STRING" != "$TDATA" ]]; then
exit 1 exit 1
fi fi
test $? -eq 0 && echo -n "." || exit $? test $? -eq 0 && echo -n "." || exit $?
@ -36,7 +36,7 @@ rsa_encrypt_decrypt data_pad "-pkeyopt rsa_padding_mode:none" "--mechanism RSA-X
test $? -eq 0 && echo -e ".\t${OK}" || exit $? test $? -eq 0 && echo -e ".\t${OK}" || exit $?
echo -n " Test RSA-PKCS-OAEP ciphering..." echo -n " Test RSA-PKCS-OAEP ciphering..."
rsa_encrypt_decrypt data "-pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -pkeyopt rsa_mgf1_md:sha256" "--mechanism RSA-PKCS-OAEP" rsa_encrypt_decrypt data "-pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -pkeyopt rsa_mgf1_md:sha256" "--mechanism RSA-PKCS-OAEP --hash-algorithm SHA256 --mgf MGF1-SHA256"
test $? -eq 0 && echo -e ".\t${OK}" || exit $? test $? -eq 0 && echo -e ".\t${OK}" || exit $?
rm -rf data* 1.* rm -rf data* 1.*