Please review the following patch which addresses the issue of the pre-registered security module for shared PKI instances:

The patch has been tested successfully on a machine using an nCipher HSM.