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

Add in the ability to dynamically adjust module path at run-time via system environmental exports #103

Closed
wants to merge 1 commit into from

Conversation

timesys-nathan
Copy link
Contributor

Add in the ability to dynamically adjust module path at run-time via system environmental exports

Background: While trying to integrate PKCS11+HSM into a build system (Yocto Project), we wanted the build system to be able to use the HSM directly. However, The Yocto Project creates a sandboxed environment for each package which uses CCID during compilation. This means that the CCID modules cannot be found from within these sandboxed directories, as their paths are non-determinable at compile time. OpenSSL appears to use OPENSSL_CONF for this sort of dynamic configuration, so I've followed their lead and incorporated a similar ccid_getenv() method.

…system environmental exports

Background: While trying to integrate PKCS11+HSM into a build system (Yocto Project), we wanted the build system to be able to use the HSM directly. However, The Yocto Project creates a sandboxed environment for each package which uses CCID during compilation. This means that the CCID modules cannot be found from within these sandboxed directories, as their paths are non-determinable at compile time. OpenSSL appears to use OPENSSL_CONF for this sort of dynamic configuration, so I've followed their lead and incorporated a similar ccid_getenv() method.
Copy link
Owner

@LudovicRousseau LudovicRousseau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CCID could also call the HPGetenv() function directly from the pcscd binary.
So no need to define a similar function for the CCID driver.
And the ./configure argument --enable-usbdropdir= could be removed.

macOS is a special case that can be handled easily.

@@ -0,0 +1,59 @@
/*
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CCID driver already include code from PCSC (in PCSC/ subdiretory).

I propose to have the ccid_getenv() function only in PCSC source code and reuse it for CCID.
The name ccid_getenv() could be changed to something more generic.

LudovicRousseau pushed a commit to LudovicRousseau/CCID-debug that referenced this pull request Nov 8, 2022
Add in the ability to dynamically adjust module path at run-time via
system environmental exports

Background: While trying to integrate PKCS11+HSM into a build system
(Yocto Project), we wanted the build system to be able to use the HSM
directly. However, The Yocto Project creates a sandboxed environment for
each package which uses CCID during compilation. This means that the
CCID modules cannot be found from within these sandboxed directories, as
their paths are non-determinable at compile time. OpenSSL appears to use
OPENSSL_CONF for this sort of dynamic configuration, so I've followed
their lead and incorporated a similar SYS_GetEnv() method.

LudovicRousseau/CCID#103
LudovicRousseau pushed a commit to LudovicRousseau/CCID-debug that referenced this pull request Nov 8, 2022
Add in the ability to dynamically adjust module path at run-time via
system environmental exports

Background: While trying to integrate PKCS11+HSM into a build system
(Yocto Project), we wanted the build system to be able to use the HSM
directly. However, The Yocto Project creates a sandboxed environment for
each package which uses CCID during compilation. This means that the
CCID modules cannot be found from within these sandboxed directories, as
their paths are non-determinable at compile time. OpenSSL appears to use
OPENSSL_CONF for this sort of dynamic configuration, so I've followed
their lead and incorporated a similar SYS_GetEnv() method.

LudovicRousseau/CCID#103
LudovicRousseau pushed a commit to LudovicRousseau/CCID-debug that referenced this pull request Nov 8, 2022
Add in the ability to dynamically adjust module path at run-time via
system environmental exports

Background: While trying to integrate PKCS11+HSM into a build system
(Yocto Project), we wanted the build system to be able to use the HSM
directly. However, The Yocto Project creates a sandboxed environment for
each package which uses CCID during compilation. This means that the
CCID modules cannot be found from within these sandboxed directories, as
their paths are non-determinable at compile time. OpenSSL appears to use
OPENSSL_CONF for this sort of dynamic configuration, so I've followed
their lead and incorporated a similar SYS_GetEnv() method.

LudovicRousseau/CCID#103
@LudovicRousseau
Copy link
Owner

Fixed in 209f459

Thanks

@timesys-nathan
Copy link
Contributor Author

Fixed in 209f459

Thanks

I was just making your suggested changes and you beat me to it. Looks good! Thanks

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

Successfully merging this pull request may close these issues.

None yet

2 participants