Hello,

attached are three patches against:

pkcs11-global.c
pkcs11-object.c
pkcs11-session.c

the function prototype is usually CK_RV func(..) but
the implementation uses an int.

Is it possible to apply these?

regards,

Martin
Index: pkcs11-global.c
===================================================================
--- pkcs11-global.c     (revision 4413)
+++ pkcs11-global.c     (working copy)
@@ -190,10 +190,11 @@
 
 CK_RV C_Initialize(CK_VOID_PTR pInitArgs)
 {
+       CK_RV rv;
 #if !defined(_WIN32)
        pid_t current_pid = getpid();
 #endif
-       int rc, rv;
+       int rc;
        unsigned int i;
        sc_context_param_t ctx_opts;
 
@@ -705,7 +706,7 @@
 CK_RV
 sc_pkcs11_init_lock(CK_C_INITIALIZE_ARGS_PTR args)
 {
-       int rv = CKR_OK;
+        CK_RV rv = CKR_OK;
 
        int applock = 0;
        int oslock = 0;
Index: pkcs11-object.c
===================================================================
--- pkcs11-object.c     (revision 4413)
+++ pkcs11-object.c     (working copy)
@@ -53,9 +53,9 @@
                     CK_ULONG ulCount,  /* attributes in template */
                     CK_OBJECT_HANDLE_PTR phObject)
 {                              /* receives new object's handle. */
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_card *card;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -102,9 +102,9 @@
 CK_RV C_DestroyObject(CK_SESSION_HANDLE hSession,      /* the session's handle 
*/
                      CK_OBJECT_HANDLE hObject)
 {                              /* the object's handle */
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -150,7 +150,8 @@
                -1
        };
        char object_name[64];
-       int j, rv;
+       int j;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object;
        int res, res_type;
@@ -210,7 +211,7 @@
                          CK_ATTRIBUTE_PTR pTemplate,   /* specifies attributes 
and values */
                          CK_ULONG ulCount)
 {                              /* attributes in template */
-       int rv;
+       CK_RV rv;
        unsigned int i;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object;
@@ -252,10 +253,10 @@
                        CK_ATTRIBUTE_PTR pTemplate,     /* attribute values to 
match */
                        CK_ULONG ulCount)
 {                              /* attributes in search template */
+       CK_RV rv;
        CK_BBOOL is_private = TRUE;
        CK_ATTRIBUTE private_attribute = { CKA_PRIVATE, &is_private, 
sizeof(is_private) };
-
-       int rv, match, hide_private;
+       int match, hide_private;
        unsigned int i, j;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object;
@@ -350,7 +351,7 @@
                    CK_ULONG ulMaxObjectCount,  /* max handles to be returned */
                    CK_ULONG_PTR pulObjectCount)
 {                              /* actual number returned */
-       int rv;
+       CK_RV rv;
        CK_ULONG to_return;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_find_operation *operation;
@@ -391,7 +392,7 @@
 
 CK_RV C_FindObjectsFinal(CK_SESSION_HANDLE hSession)
 {                              /* the session's handle */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
 
        rv = sc_pkcs11_lock();
@@ -418,7 +419,7 @@
 CK_RV C_DigestInit(CK_SESSION_HANDLE hSession, /* the session's handle */
                   CK_MECHANISM_PTR pMechanism)
 {                              /* the digesting mechanism */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
 
        rv = sc_pkcs11_lock();
@@ -446,7 +447,7 @@
               CK_BYTE_PTR pDigest,     /* receives the message digest */
               CK_ULONG_PTR pulDigestLen)
 {                              /* receives byte length of digest */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
 
        rv = sc_pkcs11_lock();
@@ -471,7 +472,7 @@
                     CK_BYTE_PTR pPart, /* data to be digested */
                     CK_ULONG ulPartLen)
 {                              /* bytes of data to be digested */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
 
        rv = sc_pkcs11_lock();
@@ -497,7 +498,7 @@
                    CK_BYTE_PTR pDigest,        /* receives the message digest 
*/
                    CK_ULONG_PTR pulDigestLen)
 {                              /* receives byte count of digest */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
 
        rv = sc_pkcs11_lock();
@@ -517,13 +518,13 @@
                 CK_MECHANISM_PTR pMechanism,   /* the signature mechanism */
                 CK_OBJECT_HANDLE hKey)
 {                              /* handle of the signature key */
+       CK_RV rv;
        CK_BBOOL can_sign;
        CK_KEY_TYPE key_type;
        CK_ATTRIBUTE sign_attribute = { CKA_SIGN, &can_sign, sizeof(can_sign) };
        CK_ATTRIBUTE key_type_attr = { CKA_KEY_TYPE, &key_type, 
sizeof(key_type) };
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -570,7 +571,7 @@
             CK_BYTE_PTR pSignature,    /* receives the signature */
             CK_ULONG_PTR pulSignatureLen)
 {                              /* receives byte count of signature */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        CK_ULONG length;
 
@@ -609,8 +610,8 @@
                   CK_BYTE_PTR pPart,   /* the data (digest) to be signed */
                   CK_ULONG ulPartLen)
 {                              /* count of bytes to be signed */
+       CK_RV rv;
        struct sc_pkcs11_session *session;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -631,7 +632,7 @@
 {                              /* receives byte count of signature */
        struct sc_pkcs11_session *session;
        CK_ULONG length;
-       int rv;
+       CK_RV rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -665,13 +666,13 @@
                        CK_MECHANISM_PTR pMechanism,    /* the signature 
mechanism */
                        CK_OBJECT_HANDLE hKey)
 {                              /* handle of the signature key */
+       CK_RV rv;
        CK_BBOOL can_sign;
        CK_KEY_TYPE key_type;
        CK_ATTRIBUTE sign_attribute = { CKA_SIGN, &can_sign, sizeof(can_sign) };
        CK_ATTRIBUTE key_type_attr = { CKA_KEY_TYPE, &key_type, 
sizeof(key_type) };
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object;
-       int rv;
 
        /* FIXME #47: C_SignRecover is not implemented */
        return CKR_FUNCTION_NOT_SUPPORTED;
@@ -764,13 +765,13 @@
                    CK_MECHANISM_PTR pMechanism,        /* the decryption 
mechanism */
                    CK_OBJECT_HANDLE hKey)
 {                              /* handle of the decryption key */
+       CK_RV rv;
        CK_BBOOL can_decrypt;
        CK_KEY_TYPE key_type;
        CK_ATTRIBUTE decrypt_attribute = { CKA_DECRYPT, &can_decrypt, 
sizeof(can_decrypt) };
        CK_ATTRIBUTE key_type_attr = { CKA_KEY_TYPE, &key_type, 
sizeof(key_type) };
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -817,7 +818,7 @@
                CK_BYTE_PTR pData,      /* receives decrypted output */
                CK_ULONG_PTR pulDataLen)
 {                              /* receives decrypted byte count */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
 
        rv = sc_pkcs11_lock();
@@ -904,9 +905,9 @@
                        CK_OBJECT_HANDLE_PTR phPublicKey,       /* gets pub. 
key handle */
                        CK_OBJECT_HANDLE_PTR phPrivateKey)
 {                              /* gets priv. key handle */
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_slot *slot;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -965,9 +966,9 @@
                  CK_ULONG ulAttributeCount,    /* # of attributes in template 
*/
                  CK_OBJECT_HANDLE_PTR phKey)
 {                              /* gets handle of recovered key */
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object, *result;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -1026,9 +1027,9 @@
                   CK_BYTE_PTR pSeed,   /* the seed material */
                   CK_ULONG ulSeedLen)
 {                              /* count of bytes of seed material */
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_slot *slot;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -1053,9 +1054,9 @@
                       CK_BYTE_PTR RandomData,  /* receives the random data */
                       CK_ULONG ulRandomLen)
 {                              /* number of bytes to be generated */
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_slot *slot;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -1097,9 +1098,9 @@
 #endif
        CK_KEY_TYPE key_type;
        CK_ATTRIBUTE key_type_attr = { CKA_KEY_TYPE, &key_type, 
sizeof(key_type) };
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_object *object;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -1146,7 +1147,7 @@
 #ifndef ENABLE_OPENSSL
        return CKR_FUNCTION_NOT_SUPPORTED;
 #else
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
 
        rv = sc_pkcs11_lock();
@@ -1174,8 +1175,8 @@
 #ifndef ENABLE_OPENSSL
        return CKR_FUNCTION_NOT_SUPPORTED;
 #else
+       CK_RV rv;
        struct sc_pkcs11_session *session;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -1198,8 +1199,8 @@
 #ifndef ENABLE_OPENSSL
        return CKR_FUNCTION_NOT_SUPPORTED;
 #else
+       CK_RV rv;
        struct sc_pkcs11_session *session;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -1236,11 +1237,12 @@
  */
 int sc_pkcs11_any_cmp_attribute(struct sc_pkcs11_session *session, void *ptr, 
CK_ATTRIBUTE_PTR attr)
 {
+       int rv;
        struct sc_pkcs11_object *object;
        u8 temp1[1024];
        u8 *temp2 = NULL;       /* dynamic allocation for large attributes */
        CK_ATTRIBUTE temp_attr;
-       int rv, res;
+       int res;
 
        object = (struct sc_pkcs11_object *)ptr;
        temp_attr.type = attr->type;
Index: pkcs11-session.c
===================================================================
--- pkcs11-session.c    (revision 4413)
+++ pkcs11-session.c    (working copy)
@@ -40,9 +40,9 @@
                    CK_NOTIFY Notify,   /* notification callback function */
                    CK_SESSION_HANDLE_PTR phSession)
 {                              /* receives new session handle */
+       CK_RV rv;
        struct sc_pkcs11_slot *slot;
        struct sc_pkcs11_session *session;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -124,8 +124,8 @@
  * the global lock held */
 CK_RV sc_pkcs11_close_all_sessions(CK_SLOT_ID slotID)
 {
+       CK_RV rv = CKR_OK;
        struct sc_pkcs11_session *session;
-       CK_RV rv = CKR_OK;
        unsigned int i;
        sc_debug(context, SC_LOG_DEBUG_NORMAL, "real C_CloseAllSessions(0x%lx) 
%d", slotID, list_size(&sessions));
        for (i = 0; i < list_size(&sessions); i++) {
@@ -139,7 +139,7 @@
 
 CK_RV C_CloseSession(CK_SESSION_HANDLE hSession)
 {                              /* the session's handle */
-       int rv;
+       CK_RV rv;
 
        sc_debug(context, SC_LOG_DEBUG_NORMAL, "C_CloseSession(0x%lx)\n", 
hSession);
 
@@ -152,8 +152,8 @@
 
 CK_RV C_CloseAllSessions(CK_SLOT_ID slotID)
 {                              /* the token's slot */
+       CK_RV rv;
        struct sc_pkcs11_slot *slot;
-       int rv;
 
        sc_debug(context, SC_LOG_DEBUG_NORMAL, "C_CloseAllSessions(0x%lx)\n", 
slotID);
        rv = sc_pkcs11_lock();
@@ -173,9 +173,9 @@
 CK_RV C_GetSessionInfo(CK_SESSION_HANDLE hSession,     /* the session's handle 
*/
                       CK_SESSION_INFO_PTR pInfo)
 {                              /* receives session information */
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_slot *slot;
-       int rv;
 
        sc_debug(context, SC_LOG_DEBUG_NORMAL, "C_GetSessionInfo(0x%lx)", 
hSession);
        rv = sc_pkcs11_lock();
@@ -236,7 +236,7 @@
              CK_CHAR_PTR pPin, /* the user's PIN */
              CK_ULONG ulPinLen)
 {                              /* the length of the PIN */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_slot *slot;
 
@@ -296,7 +296,7 @@
 
 CK_RV C_Logout(CK_SESSION_HANDLE hSession)
 {                              /* the session's handle */
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_slot *slot;
 
@@ -326,9 +326,9 @@
 
 CK_RV C_InitPIN(CK_SESSION_HANDLE hSession, CK_CHAR_PTR pPin, CK_ULONG 
ulPinLen)
 {
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_slot *slot;
-       int rv;
 
        rv = sc_pkcs11_lock();
        if (rv != CKR_OK)
@@ -366,7 +366,7 @@
 CK_RV C_SetPIN(CK_SESSION_HANDLE hSession,
               CK_CHAR_PTR pOldPin, CK_ULONG ulOldLen, CK_CHAR_PTR pNewPin, 
CK_ULONG ulNewLen)
 {
-       int rv;
+       CK_RV rv;
        struct sc_pkcs11_session *session;
        struct sc_pkcs11_slot *slot;
 
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to