Fix tests against OpenSSL 3.0: improve p11test

Resolves: rhbz#1964838

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Alexander Bokovoy 2021-06-02 16:30:21 +03:00
parent f72a8752b4
commit 1204294086
2 changed files with 19 additions and 14 deletions

View File

@ -687,7 +687,7 @@ index e583b8b..3b397d2 100644
2.31.1
From 496fe2c8f5d4e7bdb99bd7f61bbcae0cd1f4a93b Mon Sep 17 00:00:00 2001
From ca037b327fc77b8a7078c63118f507a157d3c913 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy@redhat.com>
Date: Thu, 27 May 2021 15:08:02 +0300
Subject: [PATCH 4/4] openssl3: skip DES* tests
@ -696,8 +696,8 @@ Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
---
src/lib/test/DeriveTests.cpp | 16 ++-
src/lib/test/ObjectTests.cpp | 21 ++--
src/lib/test/SymmetricAlgorithmTests.cpp | 128 +++++++++++++----------
3 files changed, 99 insertions(+), 66 deletions(-)
src/lib/test/SymmetricAlgorithmTests.cpp | 129 +++++++++++++----------
3 files changed, 100 insertions(+), 66 deletions(-)
diff --git a/src/lib/test/DeriveTests.cpp b/src/lib/test/DeriveTests.cpp
index 9438ac2..275c399 100644
@ -810,7 +810,7 @@ index 9491ce1..4ffc1c8 100644
CPPUNIT_ASSERT(rv == CKR_OK);
}
diff --git a/src/lib/test/SymmetricAlgorithmTests.cpp b/src/lib/test/SymmetricAlgorithmTests.cpp
index b24caaf..850b732 100644
index b24caaf..1994563 100644
--- a/src/lib/test/SymmetricAlgorithmTests.cpp
+++ b/src/lib/test/SymmetricAlgorithmTests.cpp
@@ -195,6 +195,8 @@ void SymmetricAlgorithmTests::encryptDecrypt(
@ -822,20 +822,21 @@ index b24caaf..850b732 100644
CPPUNIT_ASSERT_EQUAL( (CK_RV)CKR_OK, CRYPTOKI_F_PTR( C_GenerateRandom(hSession, (CK_BYTE_PTR)&vData.front(), messageSize) ) );
@@ -231,6 +233,8 @@ void SymmetricAlgorithmTests::encryptDecrypt(
{
case CKM_DES_CBC:
@@ -233,6 +235,8 @@ void SymmetricAlgorithmTests::encryptDecrypt(
case CKM_DES_CBC_PAD:
+ oldMechs = CK_TRUE;
+ /* fall-through */
case CKM_DES3_CBC:
case CKM_DES3_CBC_PAD:
+ oldMechs = CK_TRUE;
+ /* fall-through */
case CKM_AES_CBC:
@@ -246,12 +250,17 @@ void SymmetricAlgorithmTests::encryptDecrypt(
case CKM_AES_CBC_PAD:
pMechanism->pParameter = (CK_VOID_PTR)&vData.front();
@@ -246,12 +250,18 @@ void SymmetricAlgorithmTests::encryptDecrypt(
pMechanism->pParameter = &gcmParams;
pMechanism->ulParameterLen = sizeof(gcmParams);
break;
+ case CKM_DES_ECB:
+ case CKM_DES3_ECB:
+ oldMechs = CK_TRUE;
+ break;
default:
@ -850,7 +851,7 @@ index b24caaf..850b732 100644
{
CK_ULONG ulEncryptedDataLen;
const CK_RV rv( CRYPTOKI_F_PTR( C_Encrypt(hSession,(CK_BYTE_PTR)&vData.front(),messageSize,NULL_PTR,&ulEncryptedDataLen) ) );
@@ -267,40 +276,42 @@ void SymmetricAlgorithmTests::encryptDecrypt(
@@ -267,40 +277,42 @@ void SymmetricAlgorithmTests::encryptDecrypt(
}
// Multi-part encryption
@ -921,7 +922,7 @@ index b24caaf..850b732 100644
CK_ULONG ulDataLen;
const CK_RV rv( CRYPTOKI_F_PTR( C_Decrypt(hSession,&vEncryptedData.front(),vEncryptedData.size(),NULL_PTR,&ulDataLen) ) );
if ( isSizeOK ) {
@@ -315,8 +326,9 @@ void SymmetricAlgorithmTests::encryptDecrypt(
@@ -315,8 +327,9 @@ void SymmetricAlgorithmTests::encryptDecrypt(
}
// Multi-part decryption
@ -933,7 +934,7 @@ index b24caaf..850b732 100644
std::vector<CK_BYTE> vDecryptedData;
CK_BYTE dummy;
for ( std::vector<CK_BYTE>::iterator i(vEncryptedDataParted.begin()); i<vEncryptedDataParted.end(); i+=partSize.getCurrent()) {
@@ -977,44 +989,44 @@ void SymmetricAlgorithmTests::testDesEncryptDecrypt()
@@ -977,44 +990,44 @@ void SymmetricAlgorithmTests::testDesEncryptDecrypt()
// Generate all combinations of session/token keys.
rv = generateDesKey(hSessionRW,IN_SESSION,IS_PUBLIC,hKey);

View File

@ -4,7 +4,7 @@
Summary: Software version of a PKCS#11 Hardware Security Module
Name: softhsm
Version: 2.6.1
Release: %{?prever:0.}6%{?prever:.%{prever}}%{?dist}
Release: %{?prever:0.}7%{?prever:.%{prever}}%{?dist}
License: BSD
Url: http://www.opendnssec.org/
Source: http://dist.opendnssec.org/source/%{?prever:testing/}%{name}-%{version}.tar.gz
@ -118,6 +118,10 @@ if [ -f /var/softhsm/slot0.db ]; then
fi
%changelog
* Wed Jun 02 2021 Alexander Bokovoy <abokovoy@redhat.com> - 2.6.1-7
- Fix tests against OpenSSL 3.0: improve p11test
- Resolves: rhbz#1964838
* Thu May 27 2021 Alexander Bokovoy <abokovoy@redhat.com> - 2.6.1-6
- Fix tests against OpenSSL 3.0
- Resolves: rhbz#1964838