]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-linux/engine-pkcs11.git/commitdiff
Fix issue: Engine_pkcs11 reports all object ID:s as zero master DEV.ENGINE_PKCS11-01.03.00.01
authorAntti Lyytinen <a-lyytinen@ti.com>
Tue, 24 Feb 2015 13:02:43 +0000 (15:02 +0200)
committerAntti Lyytinen <a-lyytinen@ti.com>
Tue, 24 Feb 2015 13:02:43 +0000 (15:02 +0200)
src/engine_pkcs11.c

index b79fb47ee45a5c67aeae567ae4c6da6bd037f7b0..d177e52741b07c8e63dac7abbb54e1d8e2a61930 100644 (file)
@@ -1161,7 +1161,7 @@ int list_token_objects
                Log(LOG_INFO,  "\ttype: X.509 cert");
                Log(LOG_INFO,  "\tlabel: %s", c->label);
                for (i = 0; i < c->id_len; i++) {
-                       snprintf(&tmp[i*2], 2, "%02x", c->id[i]);
+                       snprintf(&tmp[i*2], 3, "%02x", c->id[i]);
                }
                Log(LOG_INFO,  "\tID: %s", tmp);
 
@@ -1195,7 +1195,7 @@ int list_token_objects
                }
                Log(LOG_INFO,  "\tlabel: %s", k->label);
                for (i = 0; i < k->id_len; i++) {
-                       snprintf(&tmp[i*2], 2, "%02x", k->id[i]);
+                       snprintf(&tmp[i*2], 3, "%02x", k->id[i]);
                }
                Log(LOG_INFO,  "\tID: %s", tmp);
        }
@@ -1309,7 +1309,7 @@ int store_cert_cmd(ENGINE * e, const char *p)
        if (verbose) {
                char tmp[MAX_VALUE_LEN];
                for (n = 0; n < cert_id_len; n++) {
-                       snprintf(&tmp[n*2], 2, "%02x", cert_id[n]);
+                       snprintf(&tmp[n*2], 3, "%02x", cert_id[n]);
                }
                Log(LOG_INFO, "Storing cert(%s) in slot(%d) with label(%s) and id(%s)",
                        cert_file, slot_nr, cert_label, tmp);
@@ -1558,7 +1558,7 @@ int gen_key_cmd(ENGINE * e, const char *p)
        if (verbose) {
                char tmp[MAX_VALUE_LEN];
                for (n = 0; n < key_id_len; n++) {
-                       snprintf(&tmp[n*2], 2, "%02x", key_id[n]);
+                       snprintf(&tmp[n*2], 3, "%02x", key_id[n]);
                }
                Log(LOG_INFO, "Generating %dbits RSA key in slot(%d) with label(%s) and id(s)",
                        key_size, slot_nr, key_label, tmp);
@@ -1805,7 +1805,7 @@ int del_obj_cmd(ENGINE * e, const char *p)
        if (verbose) {
                char tmp[MAX_VALUE_LEN];
                for (n = 0; n < id_len; n++) {
-                       snprintf(&tmp[n*2], 2, "%02x", id[n]);
+                       snprintf(&tmp[n*2], 3, "%02x", id[n]);
                }
                Log(LOG_INFO, "Deleting object type(%s) from slot(%d) with label(%s) and id(%s)",
                        type, slot_nr, label, tmp);
@@ -2092,7 +2092,7 @@ int get_pubkey_cmd(ENGINE * e, const char *p)
        if (verbose) {
                char tmp[MAX_VALUE_LEN];
                for (n = 0; n < key_id_len; n++) {
-                       snprintf(&tmp[n*2], 2, "%02x", key_id[n]);
+                       snprintf(&tmp[n*2], 3, "%02x", key_id[n]);
                }
                Log(LOG_INFO, "Getting public key in slot(%d) with label(%s) and id(%s)",
                        slot_nr, key_label, tmp);