Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 14 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rust-version.workspace = true
[dependencies]
bcder = "0.7.5"
clap = { workspace = true }
cryptoki = "^0.10.0"
cryptoki = "^0.12.0"
daemonbase = { workspace = true }
domain = { git = "https://github.com/NLnetLabs/domain.git", version = "0.11.1", branch = "main", features = [
"unstable-crypto-sign",
Expand Down
4 changes: 3 additions & 1 deletion src/client_request_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ fn process_request(
Operation::Query => query::op(&pool, config, batch_item),
_ => {
let pkcs11conn = pool.get().unwrap();
if let Err(err) = pkcs11conn.ensure_logged_in(AuthPin::new(pin.to_string())) {
if let Err(err) =
pkcs11conn.ensure_logged_in(AuthPin::new(pin.to_string().into_boxed_str()))
{
Err((ResultReason::AuthenticationNotSuccessful, err.to_string()))
} else {
match batch_item.operation() {
Expand Down
3 changes: 2 additions & 1 deletion src/pkcs11/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ impl Display for Error {
RvError::PinTooWeak => "PinTooWeak",
RvError::PublicKeyInvalid => "PublicKeyInvalid",
RvError::FunctionRejected => "FunctionRejected",
RvError::VendorDefined => "VendorDefined",
RvError::VendorDefined(_) => "VendorDefined",
RvError::UnknownErrorCode(_) => "UnknownErrorCode",
};
write!(
f,
Expand Down
4 changes: 2 additions & 2 deletions src/pkcs11/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::hash_map::Entry;
use std::result::Result;
use std::sync::{Arc, RwLock};

use cryptoki::context::{CInitializeArgs, Function, Pkcs11};
use cryptoki::context::{CInitializeArgs, CInitializeFlags, Function, Pkcs11};
use cryptoki::object::{Attribute, ObjectClass, ObjectHandle};
use cryptoki::slot::Slot;
use kmip::types::common::UniqueIdentifier;
Expand Down Expand Up @@ -49,7 +49,7 @@ impl Pkcs11Pools {

pub fn init_pkcs11(cfg: &mut Config) -> Result<Pkcs11, Error> {
let pkcs11 = Pkcs11::new(&cfg.pkcs11.lib_path)?;
pkcs11.initialize(CInitializeArgs::OsThreads)?;
pkcs11.initialize(CInitializeArgs::new(CInitializeFlags::OS_LOCKING_OK))?;
for f in [
Function::FindObjects,
Function::GenerateKeyPair,
Expand Down
1 change: 1 addition & 0 deletions tests/full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl Daemon {
.into_iter()
.chain(
[
"/usr/lib64/pkcs11/libsofthsm2.so", // Fedora 43
"/usr/lib64/softhsm/libsofthsm2.so",
"/usr/lib/softhsm/libsofthsm2.so",
]
Expand Down