Add a recursive mutex for the HSM key factory when generating keys.