As happened with the CCA token, the TPM token broke due to the changes introduced with the handle performance patches. Fix by propagating the necessary changes to the TPM token
The symptom: libpkcs11_tpm.so: undefined symbol: session_mgr_readonly_exists Signed-off-by: Klaus Heinrich Kiwi <[email protected]> --- usr/lib/pkcs11/tpm_stdll/globals.c | 7 ++++--- usr/lib/pkcs11/tpm_stdll/h_extern.h | 11 +++++------ usr/lib/pkcs11/tpm_stdll/host_defs.h | 6 ++++++ usr/lib/pkcs11/tpm_stdll/new_host.c | 8 ++++---- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/usr/lib/pkcs11/tpm_stdll/globals.c b/usr/lib/pkcs11/tpm_stdll/globals.c index 51583fd..dacfbfe 100755 --- a/usr/lib/pkcs11/tpm_stdll/globals.c +++ b/usr/lib/pkcs11/tpm_stdll/globals.c @@ -40,14 +40,15 @@ DL_NODE *publ_token_obj_list = NULL; DL_NODE *priv_token_obj_list = NULL; DL_NODE *object_map = NULL; +CK_ULONG ro_session_count = 0; -CK_STATE global_login_state = 0; +CK_STATE global_login_state = CKS_RO_PUBLIC_SESSION; LW_SHM_TYPE *global_shm; -CK_ULONG next_session_handle = 1; -CK_ULONG next_object_handle = 1; +//CK_ULONG next_session_handle = 1; +//CK_ULONG next_object_handle = 1; TOKEN_DATA *nv_token_data = NULL; diff --git a/usr/lib/pkcs11/tpm_stdll/h_extern.h b/usr/lib/pkcs11/tpm_stdll/h_extern.h index 74ab197..95e6a69 100644 --- a/usr/lib/pkcs11/tpm_stdll/h_extern.h +++ b/usr/lib/pkcs11/tpm_stdll/h_extern.h @@ -83,10 +83,11 @@ extern LW_SHM_TYPE *global_shm; extern TOKEN_DATA *nv_token_data; extern CK_SLOT_INFO slot_info; -extern CK_ULONG next_object_handle; -extern CK_ULONG next_session_handle; +//extern CK_ULONG next_object_handle; +//extern CK_ULONG next_session_handle; + +extern CK_ULONG ro_session_count; -// SAB FIXME FIXME extern CK_STATE global_login_state; @@ -1451,7 +1452,7 @@ CK_RV session_mgr_login_all ( CK_USER_TYPE user_type ); CK_RV session_mgr_logout_all( void ); CK_RV session_mgr_new( CK_ULONG flags, SESSION **sess ); -CK_BBOOL session_mgr_readonly_exists( void ); +CK_BBOOL session_mgr_readonly_session_exists( void ); CK_BBOOL session_mgr_so_session_exists ( void ); CK_BBOOL session_mgr_user_session_exists ( void ); CK_BBOOL session_mgr_public_session_exists( void ); @@ -1548,8 +1549,6 @@ CK_BBOOL object_mgr_purge_token_objects( void ); CK_BBOOL object_mgr_purge_private_token_objects( void ); -CK_RV object_mgr_remove_from_map( CK_OBJECT_HANDLE handle ); - CK_RV object_mgr_restore_obj( CK_BYTE *data, OBJECT *oldObj ); CK_RV object_mgr_set_attribute_values( SESSION * sess, diff --git a/usr/lib/pkcs11/tpm_stdll/host_defs.h b/usr/lib/pkcs11/tpm_stdll/host_defs.h index c2c4931..e90ec79 100755 --- a/usr/lib/pkcs11/tpm_stdll/host_defs.h +++ b/usr/lib/pkcs11/tpm_stdll/host_defs.h @@ -170,6 +170,10 @@ typedef struct _SESSION SIGN_VERIFY_CONTEXT verify_ctx; } SESSION; +/* TODO: + * Add compile-time checking that sizeof(void *) == sizeof(CK_SESSION_HANDLE) + * */ + typedef struct _DES_CONTEXT { @@ -250,6 +254,8 @@ typedef struct _OBJECT_MAP OBJECT * ptr; } OBJECT_MAP; +/* FIXME: Compile-time check that sizeof(void *) == sizeof(CK_OBJECT_HANDLE) */ + typedef struct _ATTRIBUTE_PARSE_LIST { diff --git a/usr/lib/pkcs11/tpm_stdll/new_host.c b/usr/lib/pkcs11/tpm_stdll/new_host.c index d8f025f..0933b3c 100644 --- a/usr/lib/pkcs11/tpm_stdll/new_host.c +++ b/usr/lib/pkcs11/tpm_stdll/new_host.c @@ -170,8 +170,8 @@ Fork_Initializer(void) session_mgr_close_all_sessions(); - next_session_handle = 1; // Make is so sessions start with 1 - next_object_handle = 1; + //next_session_handle = 1; // Make is so sessions start with 1 + //next_object_handle = 1; // Clean out the global login state variable // When implemented... Although logout_all should clear this up. @@ -1291,7 +1291,7 @@ CK_RV SC_OpenSession( CK_SLOT_ID sid, st_err_log(152, __FILE__, __LINE__); goto done; } - *phSession = sess->handle; + *phSession = (CK_SESSION_HANDLE_PTR) sess; // Set the correct slot ID here. Was hard coded to 1. - KEY sess->session_info.slotID = sid; @@ -1587,7 +1587,7 @@ CK_RV SC_Login( ST_SESSION_HANDLE sSession, st_err_log(56, __FILE__, __LINE__); rc = CKR_USER_ALREADY_LOGGED_IN; } - if (session_mgr_readonly_exists()){ + if (session_mgr_readonly_session_exists()){ st_err_log(142, __FILE__, __LINE__); rc = CKR_SESSION_READ_ONLY_EXISTS; } -- 1.7.1.1 ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Opencryptoki-tech mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech
