Bugfixes:

opencryptoki-2.3.3_slotid.patch

* lcv is uninitialized, replaced by slot_id
* Signed-off-by: Andreas Piesk <[email protected]>

opencryptoki-2.3.3_catcheof.patch

* check if a really empty pin was entered (^D) to prevent a segfault
* Signed-off-by: Andreas Piesk <[email protected]>

opencryptoki-2.3.3_msgid.patch

* replace VERSION by VVERSION, VERSION is the software version not the cat msg 
id
* Signed-off-by: Andreas Piesk <[email protected]>

opencryptoki-2.3.3_mechlist.patch

* option -m needs a slot id to list the mechs
* Signed-off-by: Andreas Piesk <[email protected]>

opencryptoki-2.3.3_warnings.patch

* missing includes added
* depreceted includes tss/tcpa_* removed
* some casts to silence the compiler
* Signed-off-by: Andreas Piesk <[email protected]>



currently i'm adding cmdline parsing to pkcsslotd but the '#ifdef DEV' stuff 
makes it a little bit
difficult.

regards,
-ap
diff -Purp opencryptoki-2.3.3.org/usr/sbin/pkcsconf/pkcsconf.c 
opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c
--- opencryptoki-2.3.3.org/usr/sbin/pkcsconf/pkcsconf.c 2011-01-22 
14:54:10.492552855 +0100
+++ opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c     2011-01-22 
15:23:31.922294591 +0100
@@ -989,7 +989,7 @@ list_slot(int slot_id){
         }

         /* Display the slot description */
-        printf("%ld:", SlotList[lcv]);
+        printf("%ld:", SlotList[slot_id]);
         printf(PKCSINIT_MSG(SLOTDESC, "\tDescription: %.64s\n"), 
SlotInfo.slotDescription);

         return CKR_OK;
@@ -1127,8 +1127,6 @@ init_token(int slot_id, CK_CHAR_PTR pin)
     CK_CHAR     label[32],        // What we want to set the Label of the card 
to
                 enteredlabel[33]; // Max size of 32 + carriage return;

-    unsigned int lcv;             // Loop Control Varable
-
     /* Find out the size of the entered PIN */
     pinlen = strlen((char *)pin);


diff -Purp opencryptoki-2.3.3.org/usr/sbin/pkcsconf/pkcsconf.c 
opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c
--- opencryptoki-2.3.3.org/usr/sbin/pkcsconf/pkcsconf.c 2011-01-22 
14:54:10.492552855 +0100
+++ opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c     2011-01-22 
15:23:31.922294591 +0100
@@ -1137,7 +1135,11 @@ init_token(int slot_id, CK_CHAR_PTR pin)
      * unique token label; however the PKCS11 spec does not.  */
     printf(PKCSINIT_MSG(GETLABEL, "Enter a unique token label: "));
     fflush(stdout);
-    fgets((char *)enteredlabel, sizeof(enteredlabel), stdin);
+
+    /* catch no pin entered (^D) to prevent segfault */
+    if(fgets((char *)enteredlabel, sizeof(enteredlabel), stdin) != NULL) {
+      return CKR_PIN_INCORRECT;
+    }

     /* First clear the label array. Per PKCS#11 spec, We must PAD this field to
      * 32 bytes, and it should NOT be null-terminated */

diff -Pur opencryptoki-2.3.3.org/usr/sbin/pkcsconf/pkcsconf.c 
opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c
--- opencryptoki-2.3.3.org/usr/sbin/pkcsconf/pkcsconf.c 2011-01-22 
15:55:03.482292758 +0100
+++ opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c     2011-01-22 
17:01:54.754543979 +0100
@@ -783,7 +783,7 @@

    /* display the header and information */
    printf(PKCSINIT_MSG(PKCSINFO, "PKCS#11 Info\n"));
-   printf(PKCSINIT_MSG(VERSION, "\tVersion %d.%d \n"), 
CryptokiInfo.cryptokiVersion.major,
+   printf(PKCSINIT_MSG(VVERSION, "\tVersion %d.%d \n"), 
CryptokiInfo.cryptokiVersion.major,
          CryptokiInfo.cryptokiVersion.minor);
    printf(PKCSINIT_MSG(MANUFACT, "\tManufacturer: %.32s \n"), 
CryptokiInfo.manufacturerID);
    printf(PKCSINIT_MSG(FLAGS, "\tFlags: 0x%X  \n"), CryptokiInfo.flags);

diff -Purp opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c 
opencryptoki-2.3.3.mod/usr/sbin/pkcsconf/pkcsconf.c
--- opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c     2011-01-22 
19:49:23.236543054 +0100
+++ opencryptoki-2.3.3.mod/usr/sbin/pkcsconf/pkcsconf.c 2011-01-22 
19:51:46.865543946 +0100
@@ -467,8 +467,8 @@ main(int argc, char *argv[]){
    if (!flags)  /* If there was no options print the usage statement */
        usage(argv[0]);
 
-   /* Eliminate the ability to specify -I -p -u -P without a slot number */
-   if ( (flags & (CFG_INITIALIZE | CFG_INIT_USER | CFG_SET_USER | CFG_SET_SO))
+   /* Eliminate the ability to specify -I -p -u -P -m without a slot number */
+   if ( (flags & (CFG_INITIALIZE | CFG_INIT_USER | CFG_SET_USER | CFG_SET_SO | 
CFG_MECHANISM_INFO))
             && !(flags & CFG_SLOT)){
       usage(argv[0]);
    }
@@ -515,7 +515,7 @@ main(int argc, char *argv[]){
 
    /* If the user wants to display mechanism info call the function to do so */
    if (flags & CFG_MECHANISM_INFO)
-      if ((rc = display_mechanism_info((flags & CFG_SLOT) ? in_slot : -1)))
+      if ((rc = display_mechanism_info(in_slot)))
         goto done;
 
     /* If the user wants to initialize the card check to see if they passed in
diff -Pur opencryptoki-2.3.3.org/usr/sbin/pkcsconf/pkcsconf.c 
opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c
--- opencryptoki-2.3.3.org/usr/sbin/pkcsconf/pkcsconf.c 2011-01-22 
15:55:03.482292758 +0100
+++ opencryptoki-2.3.3/usr/sbin/pkcsconf/pkcsconf.c     2011-01-22 
17:01:54.754543979 +0100
@@ -559,14 +559,14 @@
                     fflush(stdout);
                     rc = get_pin(&newpin);
                 } while (rc == -EINVAL);
-                newpinlen = strlen(newpin);
+                newpinlen = strlen((char *)newpin);
                 do {
                     printf(PKCSINIT_MSG(VNEWUSER,
                                 "Re-enter the new user PIN: "));
                     fflush(stdout);
                     rc = get_pin(&newpin2);
                 } while (rc == -EINVAL);
-                newpin2len = strlen(newpin2);
+                newpin2len = strlen((char *)newpin2);
                 if (newpinlen != newpin2len || memcmp(newpin, newpin2, 
strlen((char *)newpin)) != 0) {
                     printf(PKCSINIT_MSG(PINMISMATCH, "New PINs do not 
match.\n"));
                     fflush(stdout);
@@ -603,13 +603,13 @@
                     fflush(stdout);
                     rc = get_pin(&newpin);
                 } while (rc == -EINVAL);
-                newpinlen = strlen(newpin);
+                newpinlen = strlen((char *)newpin);
                 do {
                     printf(PKCSINIT_MSG(VNEWSO, "Re-enter the new SO PIN: "));
                     fflush(stdout);
                     rc = get_pin(&newpin2);
                 } while (rc == -EINVAL);
-                newpin2len = strlen(newpin2);
+                newpin2len = strlen((char *)newpin2);
                 if (newpinlen != newpin2len || memcmp(newpin, newpin2, 
strlen((char *)newpin)) != 0) {
                     printf(PKCSINIT_MSG(PINMISMATCH, "New PINs do not 
match.\n"));
                     fflush(stdout);
@@ -644,13 +644,13 @@
                     fflush(stdout);
                     rc = get_pin(&newpin);
                 } while (rc == -EINVAL);
-                newpinlen = strlen(newpin);
+                newpinlen = strlen((char *)newpin);
                 do {
                     printf(PKCSINIT_MSG(VNEWUSER, "Re-enter the new user PIN: 
"));
                     fflush(stdout);
                     rc = get_pin(&newpin2);
                 } while (rc == -EINVAL);
-                newpin2len = strlen(newpin2);
+                newpin2len = strlen((char *)newpin2);
                 if (newpinlen != newpin2len || memcmp(newpin, newpin2, 
strlen((char *)newpin)) != 0) {
                     printf(PKCSINIT_MSG(PINMISMATCH, "New PINs do not 
match.\n"));
                     fflush(stdout);
diff -Purp opencryptoki-2.3.3.org/usr/lib/pkcs11/common/p11util.c 
opencryptoki-2.3.3/usr/lib/pkcs11/common/p11util.c
--- opencryptoki-2.3.3.org/usr/lib/pkcs11/common/p11util.c      2011-01-13 
18:26:36.000000000 +0100
+++ opencryptoki-2.3.3/usr/lib/pkcs11/common/p11util.c  2011-01-22 
15:37:23.754293916 +0100
@@ -290,6 +290,8 @@
 
 
 #include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include "pkcs11types.h"
 
 #define _sym2str(X)     case X: return #X
diff -Purp opencryptoki-2.3.3.org/usr/lib/pkcs11/common/utility.c 
opencryptoki-2.3.3/usr/lib/pkcs11/common/utility.c
--- opencryptoki-2.3.3.org/usr/lib/pkcs11/common/utility.c      2011-01-13 
18:26:36.000000000 +0100
+++ opencryptoki-2.3.3/usr/lib/pkcs11/common/utility.c  2011-01-22 
15:40:28.200294202 +0100
@@ -971,8 +971,10 @@ init_token_data( void )
       return CKR_FUNCTION_FAILED;
    }
    rc = save_token_data();
-   if (rc != CKR_OK)
+   if (rc != CKR_OK) {
       // st_err_log(4, __FILE__, __LINE__, __FUNCTION__);
+   }
+
    return rc;
 }
 
diff -Purp opencryptoki-2.3.3.org/usr/lib/pkcs11/tpm_stdll/tpm_openssl.c 
opencryptoki-2.3.3/usr/lib/pkcs11/tpm_stdll/tpm_openssl.c
--- opencryptoki-2.3.3.org/usr/lib/pkcs11/tpm_stdll/tpm_openssl.c       
2011-01-13 18:26:36.000000000 +0100
+++ opencryptoki-2.3.3/usr/lib/pkcs11/tpm_stdll/tpm_openssl.c   2011-01-22 
16:00:13.536314199 +0100
@@ -33,10 +33,6 @@
 #include <openssl/rand.h>
 
 #include <tss/platform.h>
-#include <tss/tcpa_defines.h>
-#include <tss/tcpa_typedef.h>
-#include <tss/tcpa_struct.h>
-#include <tss/tcpa_error.h>
 #include <tss/tss_defines.h>
 #include <tss/tss_typedef.h>
 #include <tss/tss_structs.h>
diff -Purp opencryptoki-2.3.3.org/usr/lib/pkcs11/tpm_stdll/tpm_specific.c 
opencryptoki-2.3.3/usr/lib/pkcs11/tpm_stdll/tpm_specific.c
--- opencryptoki-2.3.3.org/usr/lib/pkcs11/tpm_stdll/tpm_specific.c      
2011-01-13 18:26:36.000000000 +0100
+++ opencryptoki-2.3.3/usr/lib/pkcs11/tpm_stdll/tpm_specific.c  2011-01-22 
15:59:58.241294026 +0100
@@ -53,10 +53,6 @@
 #include <openssl/evp.h>
 
 #include <tss/platform.h>
-#include <tss/tcpa_defines.h>
-#include <tss/tcpa_typedef.h>
-#include <tss/tcpa_struct.h>
-#include <tss/tcpa_error.h>
 #include <tss/tss_defines.h>
 #include <tss/tss_typedef.h>
 #include <tss/tss_structs.h>
diff -Purp opencryptoki-2.3.3.org/usr/lib/pkcs11/tpm_stdll/tpm_util.c 
opencryptoki-2.3.3/usr/lib/pkcs11/tpm_stdll/tpm_util.c
--- opencryptoki-2.3.3.org/usr/lib/pkcs11/tpm_stdll/tpm_util.c  2011-01-13 
18:26:36.000000000 +0100
+++ opencryptoki-2.3.3/usr/lib/pkcs11/tpm_stdll/tpm_util.c      2011-01-22 
16:00:31.247359501 +0100
@@ -30,10 +30,6 @@
 #include <openssl/rsa.h>
 
 #include <tss/platform.h>
-#include <tss/tcpa_defines.h>
-#include <tss/tcpa_typedef.h>
-#include <tss/tcpa_struct.h>
-#include <tss/tcpa_error.h>
 #include <tss/tss_defines.h>
 #include <tss/tss_typedef.h>
 #include <tss/tss_structs.h>
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to