Skip to content

Commit af5e9f0

Browse files
Krishna Harsha Vooraale-linux
authored andcommitted
[FAB-12670] Fix pkcs11 UT Failures
This patch allows to initialize softhsm2 token as non-root user, by merely setting SOFTHSM2_CONF, CI Envrionment should be updated to leverage SOFTHSM2_CONF. Change-Id: I9fdc9c837859a78619d9edc9e2e3fbe8733f04af Signed-off-by: Krishna Harsha Voora <krishvoor@in.ibm.com>
1 parent f4b1a7e commit af5e9f0

File tree

5 files changed

+34
-2
lines changed

5 files changed

+34
-2
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# - orderer - builds a native fabric orderer binary
1818
# - release - builds release packages for the host platform
1919
# - release-all - builds release packages for all target platforms
20+
# - softhsm2_initialization - generates softhsm2 tokens used in pkcs11 test
2021
# - unit-test - runs the go-test based unit tests
2122
# - verify - runs unit tests for only the changed package tree
2223
# - profile - runs unit tests for all packages in coverprofile mode (slow)
@@ -183,7 +184,10 @@ ccenv: $(BUILD_DIR)/image/ccenv/$(DUMMY)
183184
integration-test: gotool.ginkgo ccenv docker-thirdparty
184185
./scripts/run-integration-tests.sh
185186

186-
unit-test: unit-test-clean peer-docker docker-thirdparty ccenv
187+
softhsm2_initialization:
188+
./scripts/config_softhsm2.sh
189+
190+
unit-test: unit-test-clean peer-docker softhsm2_initialization docker-thirdparty ccenv
187191
unit-test/run.sh
188192

189193
unit-tests: unit-test

devenv/setupRHELonZ.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ fi
3636
iptables -I INPUT 1 -j ACCEPT
3737
sysctl vm.overcommit_memory=1
3838

39+
##################
40+
# Install softhsm2
41+
yum install softhsm -y
42+
3943
##################
4044
# Install Docker
4145
cd /tmp

devenv/setupUbuntuOnPPC64le.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fi
3939
# Install pre-requisite OS packages #
4040
#####################################
4141
apt-get update
42-
apt-get -y install software-properties-common curl git sudo wget "build-essential" zlib1g-dev libbz2-dev
42+
apt-get -y install software-properties-common curl git sudo wget "build-essential" zlib1g-dev libbz2-dev softhsm2
4343

4444
#####################################
4545
# Install and setup Docker services #

docs/source/dev-setup/devenv.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ Prerequisites
5555
- Note: The BIOS Enabled Virtualization may be within the CPU or
5656
Security settings of the BIOS
5757

58+
- (macOS) `Install softhsm on Mac OSX <http://macappstore.org/softhsm/>`__.You can
59+
use Homebrew to install it as follows:
60+
61+
::
62+
63+
brew install softhsm
64+
65+
5866
``pip``
5967
~~~~~~
6068

scripts/config_softhsm2.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
#
3+
# Copyright IBM Corp. All Rights Reserved.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
cd $HOME
9+
mkdir -p $HOME/lib/softhsm/tokens
10+
cd $HOME/lib/softhsm/
11+
echo "directories.tokendir = $PWD/tokens" > softhsm2.conf
12+
echo "Update SOFTHSM2_CONF via export SOFTHSM2_CONF=$HOME/lib/softhsm/softhsm2.conf"
13+
14+
export SOFTHSM2_CONF=$HOME/lib/softhsm/softhsm2.conf
15+
16+
softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 98765432

0 commit comments

Comments
 (0)