Series applied to branch 'opencryptoki-next'

 -Klaus



On Thu, 15 Jul 2010 11:20:03 -0300
Klaus Heinrich Kiwi <[email protected]> wrote:

> The CCA token broke after the recent session/object handlers patches.
> This patch replicates some of the changes introduced in the common
> code, thus fixing the issue.
> 
> The symptom:
> libpkcs11_cca.so: undefined symbol: session_mgr_readonly_exists
> 
> Signed-off-by: Klaus Heinrich Kiwi <[email protected]>
> ---
>  usr/lib/pkcs11/cca_stdll/globals.c   |    8 ++++----
>  usr/lib/pkcs11/cca_stdll/h_extern.h  |   11 +++++------
>  usr/lib/pkcs11/cca_stdll/host_defs.h |    6 ++++++
>  usr/lib/pkcs11/cca_stdll/new_host.c  |    8 ++++----
>  4 files changed, 19 insertions(+), 14 deletions(-)
> 
> diff --git a/usr/lib/pkcs11/cca_stdll/globals.c
> b/usr/lib/pkcs11/cca_stdll/globals.c index ee8080b..74b58d5 100644
> --- a/usr/lib/pkcs11/cca_stdll/globals.c
> +++ b/usr/lib/pkcs11/cca_stdll/globals.c
> @@ -53,14 +53,14 @@ 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/cca_stdll/h_extern.h
> b/usr/lib/pkcs11/cca_stdll/h_extern.h index 25aa048..ed1a909 100644
> --- a/usr/lib/pkcs11/cca_stdll/h_extern.h
> +++ b/usr/lib/pkcs11/cca_stdll/h_extern.h
> @@ -73,10 +73,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;
> 
> 
> @@ -1559,7 +1560,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 );
> @@ -1659,8 +1660,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/cca_stdll/host_defs.h
> b/usr/lib/pkcs11/cca_stdll/host_defs.h index ee6209c..20dffb6 100644
> --- a/usr/lib/pkcs11/cca_stdll/host_defs.h
> +++ b/usr/lib/pkcs11/cca_stdll/host_defs.h
> @@ -178,6 +178,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
>  {
> @@ -261,6 +265,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/cca_stdll/new_host.c
> b/usr/lib/pkcs11/cca_stdll/new_host.c index bc03b63..93ee886 100644
> --- a/usr/lib/pkcs11/cca_stdll/new_host.c
> +++ b/usr/lib/pkcs11/cca_stdll/new_host.c
> @@ -139,8 +139,8 @@ Fork_Initializer(void)
>       // This should clear the entire session list out
>       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. @@ -1104,7 +1104,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;
>   done:
> @@ -1378,7 +1378,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;
>               }



-- 
Klaus Heinrich Kiwi | [email protected] | http://blog.klauskiwi.com
Open Source Security blog :     http://www.ratliff.net/blog
IBM Linux Technology Center :   http://www.ibm.com/linux/ltc

------------------------------------------------------------------------------
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

Reply via email to