opendnssec / SoftHSMv2

SoftHSM version 2
http://www.softhsm.org/
Other
740 stars 335 forks source link

Unit Tests fails #732

Open sahrulijam opened 6 months ago

sahrulijam commented 6 months ago

Hi there,

Not sure y but the Unit Test is failing

Below is the screenshot

image

bjosv commented 5 months ago

FYI: I see similar failures in p11test on current branch develop, for both openssl-1.1.1w and libbotan 2.19 (Ubuntu 22.04).

badfd commented 4 months ago

The make check command gives me 4 unit test errors [same failures w/botan as with OpenSSL]:

$ cat src/lib/crypto/test/test-suite.log
o o o
1) test: DESTests::testCBC (F) line: 262 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::CBC, IV) 

2) test: DESTests::testECB (F) line: 537 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::ECB, IV) 

3) test: DESTests::testOFB (F) line: 812 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::OFB, IV) 

4) test: DESTests::testCFB (F) line: 1086 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::CFB, IV) 

FAIL cryptotest (exit status: 1)

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:    22.04
Codename:   jammy

$ dpkg -l botan libcppunit-dev g++ openssl automake autoconf libtool pkg-config
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                 Version              Architecture Description
+++-====================-====================-============-=====================================================
ii  autoconf             2.71-2               all          automatic configure script builder
ii  automake             1:1.16.5-1.3         all          Tool for generating GNU Standards-compliant Makefiles
ii  botan                2.19.1+dfsg-2ubuntu1 amd64        multiplatform crypto library (2.x version)
ii  g++                  4:11.2.0-1ubuntu1    amd64        GNU C++ compiler
ii  libcppunit-dev:amd64 1.15.1-4             amd64        Unit Testing Library for C++ - development library
ii  libtool              2.4.6-15build2       all          Generic library support script
ii  openssl              3.0.2-0ubuntu1.15    amd64        Secure Sockets Layer toolkit - cryptographic utility
ii  pkg-config           0.29.2-1ubuntu3      amd64        manage compile and link flags for libraries
xavieryin commented 1 month ago

The make check command gives me 4 unit test errors [same failures w/botan as with OpenSSL]:

$ cat src/lib/crypto/test/test-suite.log
o o o
1) test: DESTests::testCBC (F) line: 262 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::CBC, IV) 

2) test: DESTests::testECB (F) line: 537 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::ECB, IV) 

3) test: DESTests::testOFB (F) line: 812 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::OFB, IV) 

4) test: DESTests::testCFB (F) line: 1086 DESTests.cpp
assertion failed
- Expression: des->encryptInit(&desKey56, SymMode::CFB, IV) 

FAIL cryptotest (exit status: 1)

$ lsb_release -a
No LSB modules are available.
Distributor ID:   Ubuntu
Description:  Ubuntu 22.04.4 LTS
Release:  22.04
Codename: jammy

$ dpkg -l botan libcppunit-dev g++ openssl automake autoconf libtool pkg-config
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                 Version              Architecture Description
+++-====================-====================-============-=====================================================
ii  autoconf             2.71-2               all          automatic configure script builder
ii  automake             1:1.16.5-1.3         all          Tool for generating GNU Standards-compliant Makefiles
ii  botan                2.19.1+dfsg-2ubuntu1 amd64        multiplatform crypto library (2.x version)
ii  g++                  4:11.2.0-1ubuntu1    amd64        GNU C++ compiler
ii  libcppunit-dev:amd64 1.15.1-4             amd64        Unit Testing Library for C++ - development library
ii  libtool              2.4.6-15build2       all          Generic library support script
ii  openssl              3.0.2-0ubuntu1.15    amd64        Secure Sockets Layer toolkit - cryptographic utility
ii  pkg-config           0.29.2-1ubuntu3      amd64        manage compile and link flags for libraries

DES is relatively out-dated and may not be provided (by default) in modern crypto libraries. And this causes related unitest failures. If you run SoftHSMv2 w/ OSSL backend, you can modify OSSL config file to make legacy algorithms available (to SoftHSMv2). Typical OSSL config file path: /etc/ssl/openssl.cnf

[provider_sect]
default = default_sect
legacy = legacy_sect

[default_sect]
activate = 1

[legacy_sect]
activate = 1

With the above change cryptotest DESTests should pass

root@70cfde9dd1aa:/work/SoftHSMv2/src/lib/crypto/test# ./cryptotest 
...
DESTests::testBlockSize : OK
DESTests::testCBC : OK
DESTests::testECB : OK
DESTests::testOFB : OK
DESTests::testCFB : OK
...
OK (66 tests)
MajdDiyar commented 1 month ago

I also have same issue !!!FAILURES!!! Test Results: Run: 66 Failures: 4 Errors: 0

1) test: DESTests::testCBC (F) line: 262 DESTests.cpp assertion failed

2) test: DESTests::testECB (F) line: 537 DESTests.cpp assertion failed

3) test: DESTests::testOFB (F) line: 812 DESTests.cpp assertion failed

4) test: DESTests::testCFB (F) line: 1086 DESTests.cpp assertion failed

FAIL cryptotest (exit status: 1)