Skip to content

Commit 41ec7af

Browse files
committed
Use TEST_PKCS11_MODULE environment variable to specify test token
Signed-off-by: Jakub Jelen <[email protected]>
1 parent d2c0cbe commit 41ec7af

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

.github/actions/ci_script/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ runs:
3030

3131
- name: Test script
3232
env:
33-
PKCS11_SOFTHSM2_MODULE: /usr/lib/softhsm/libsofthsm2.so
33+
TEST_PKCS11_MODULE: /usr/lib/softhsm/libsofthsm2.so
3434
SOFTHSM2_CONF: /tmp/softhsm2.conf
3535
run: ./ci.sh
3636
shell: bash

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
6363
- name: Test script
6464
env:
65-
PKCS11_SOFTHSM2_MODULE: /usr/lib/softhsm/libsofthsm2.so
65+
TEST_PKCS11_MODULE: /usr/lib/softhsm/libsofthsm2.so
6666
SOFTHSM2_CONF: /tmp/softhsm2.conf
6767
run: |
6868
rm Cargo.lock

cryptoki/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You can follow the installation steps directly in the repository's README but he
2222
sudo apt install libsofthsm2
2323
mkdir /tmp/tokens
2424
echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf
25-
export PKCS11_SOFTHSM2_MODULE="/usr/lib/softhsm/libsofthsm2.so"
25+
export TEST_PKCS11_MODULE="/usr/lib/softhsm/libsofthsm2.so"
2626
export SOFTHSM2_CONF="/tmp/softhsm2.conf"
2727
cargo run --example generate_key_pair
2828
```
@@ -43,7 +43,7 @@ use std::env;
4343

4444
// initialize a new Pkcs11 object using the module from the env variable
4545
let pkcs11 = Pkcs11::new(
46-
env::var("PKCS11_SOFTHSM2_MODULE")
46+
env::var("TEST_PKCS11_MODULE")
4747
.unwrap_or_else(|_| "/usr/local/lib/softhsm/libsofthsm2.so".to_string()),
4848
)?;
4949

cryptoki/examples/generate_key_pair.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub static SO_PIN: &str = "abcdef";
1515
fn main() -> testresult::TestResult {
1616
// initialize a new Pkcs11 object using the module from the env variable
1717
let pkcs11 = Pkcs11::new(
18-
env::var("PKCS11_SOFTHSM2_MODULE")
18+
env::var("TEST_PKCS11_MODULE")
1919
.unwrap_or_else(|_| "/usr/local/lib/softhsm/libsofthsm2.so".to_string()),
2020
)?;
2121

cryptoki/src/context/session_management.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl Pkcs11 {
5050
/// use cryptoki::context::Pkcs11;
5151
///
5252
/// let mut client = Pkcs11::new(
53-
/// std::env::var("PKCS11_SOFTHSM2_MODULE")
53+
/// std::env::var("TEST_PKCS11_MODULE")
5454
/// .unwrap_or_else(|_| "/usr/local/lib/softhsm/libsofthsm2.so".to_string()),
5555
/// )?;
5656
/// client.initialize(cryptoki::context::CInitializeArgs::OsThreads)?;

cryptoki/src/session/object_management.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const MAX_OBJECT_COUNT: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(10)
3939
///
4040
/// # fn main() -> testresult::TestResult {
4141
/// # let pkcs11 = Pkcs11::new(
42-
/// # env::var("PKCS11_SOFTHSM2_MODULE")
42+
/// # env::var("TEST_PKCS11_MODULE")
4343
/// # .unwrap_or_else(|_| "/usr/local/lib/libsofthsm2.so".to_string()),
4444
/// # )?;
4545
/// #
@@ -282,7 +282,7 @@ impl Session {
282282
/// # use cryptoki::object::{Attribute, AttributeType, CertificateType, ObjectClass, ObjectHandle};
283283
/// #
284284
/// # let mut client = Pkcs11::new(
285-
/// # std::env::var("PKCS11_SOFTHSM2_MODULE")
285+
/// # std::env::var("TEST_PKCS11_MODULE")
286286
/// # .unwrap_or_else(|_| "/usr/local/lib/softhsm/libsofthsm2.so".to_string()),
287287
/// # )?;
288288
/// # client.initialize(cryptoki::context::CInitializeArgs::OsThreads)?;
@@ -401,7 +401,7 @@ impl Session {
401401
/// use std::env;
402402
///
403403
/// let mut pkcs11 = Pkcs11::new(
404-
/// env::var("PKCS11_SOFTHSM2_MODULE")
404+
/// env::var("TEST_PKCS11_MODULE")
405405
/// .unwrap_or_else(|_| "/usr/local/lib/softhsm/libsofthsm2.so".to_string()),
406406
/// )
407407
/// .unwrap();

cryptoki/tests/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub static SO_PIN: &str = "abcdef";
1313

1414
pub fn get_pkcs11() -> Pkcs11 {
1515
Pkcs11::new(
16-
env::var("PKCS11_SOFTHSM2_MODULE")
16+
env::var("TEST_PKCS11_MODULE")
1717
.unwrap_or_else(|_| "/usr/local/lib/softhsm/libsofthsm2.so".to_string()),
1818
)
1919
.unwrap()

0 commit comments

Comments
 (0)