Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Tests fails #732

Open
sahrulijam opened this issue Dec 27, 2023 · 4 comments
Open

Unit Tests fails #732

sahrulijam opened this issue Dec 27, 2023 · 4 comments

Comments

@sahrulijam
Copy link

Hi there,

Not sure y but the Unit Test is failing

Below is the screenshot

image

@bjosv
Copy link
Contributor

bjosv commented Jan 17, 2024

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
Copy link

badfd commented Feb 29, 2024

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
Copy link

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
Copy link

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
  • Expression: des->encryptInit(&desKey56, SymMode::CBC, IV)
  1. test: DESTests::testECB (F) line: 537 DESTests.cpp
    assertion failed
  • Expression: des->encryptInit(&desKey56, SymMode::ECB, IV)
  1. test: DESTests::testOFB (F) line: 812 DESTests.cpp
    assertion failed
  • Expression: des->encryptInit(&desKey56, SymMode::OFB, IV)
  1. test: DESTests::testCFB (F) line: 1086 DESTests.cpp
    assertion failed
  • Expression: des->encryptInit(&desKey56, SymMode::CFB, IV)

FAIL cryptotest (exit status: 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants