---
usr/lib/pkcs11/tpm_stdll/globals.c | 66 ++++++++++++++--------------
usr/lib/pkcs11/tpm_stdll/h_extern.h | 72 +++++++++++++++---------------
usr/lib/pkcs11/tpm_stdll/key_mgr.c | 2 +-
usr/lib/pkcs11/tpm_stdll/tpm_specific.c | 8 ++--
4 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/usr/lib/pkcs11/tpm_stdll/globals.c
b/usr/lib/pkcs11/tpm_stdll/globals.c
index 2012d86..1c1adb0 100644
--- a/usr/lib/pkcs11/tpm_stdll/globals.c
+++ b/usr/lib/pkcs11/tpm_stdll/globals.c
@@ -121,49 +121,49 @@ struct ST_FCN_LIST function_list ;
// OBJECT IDENTIFIERs
//
-CK_BYTE ber_idDSA[] = { 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x38,
0x04, 0x01 };
-CK_BYTE ber_rsaEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
0x0d, 0x01, 0x01, 0x01 };
-CK_BYTE ber_md2WithRSAEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
0xf7, 0x0d, 0x01, 0x01, 0x02 };
-CK_BYTE ber_md4WithRSAEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
0xf7, 0x0d, 0x01, 0x01, 0x03 };
-CK_BYTE ber_md5WithRSAEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
0xf7, 0x0d, 0x01, 0x01, 0x04 };
-CK_BYTE ber_sha1WithRSAEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
0xf7, 0x0d, 0x01, 0x01, 0x05 };
+const CK_BYTE ber_idDSA[] = { 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce,
0x38, 0x04, 0x01 };
+const CK_BYTE ber_rsaEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
0xf7, 0x0d, 0x01, 0x01, 0x01 };
+const CK_BYTE ber_md2WithRSAEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48,
0x86, 0xf7, 0x0d, 0x01, 0x01, 0x02 };
+const CK_BYTE ber_md4WithRSAEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48,
0x86, 0xf7, 0x0d, 0x01, 0x01, 0x03 };
+const CK_BYTE ber_md5WithRSAEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48,
0x86, 0xf7, 0x0d, 0x01, 0x01, 0x04 };
+const CK_BYTE ber_sha1WithRSAEncryption[] = { 0x06, 0x09, 0x2a, 0x86, 0x48,
0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05 };
// Algorithm IDs. (Sequence of OID plus parms, usually NULL)
//
-CK_BYTE ber_AlgMd2[] = { 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x02, 0x02, 0x05, 0x00 };
-CK_BYTE ber_AlgMd5[] = { 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86,
0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00 };
-CK_BYTE ber_AlgSha1[] = { 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02,
0x1A, 0x05, 0x00 };
-CK_BYTE ber_AlgSha256[] = { 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00 };
-CK_BYTE ber_AlgIdRSAEncryption[] = { 0x30, 0x0D, 0x06, 0x09, 0x2a, 0x86,
0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00 };
+const CK_BYTE ber_AlgMd2[] = { 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48,
0x86, 0xF7, 0x0D, 0x02, 0x02, 0x05, 0x00 };
+const CK_BYTE ber_AlgMd5[] = { 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48,
0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00 };
+const CK_BYTE ber_AlgSha1[] = { 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, 0x03,
0x02, 0x1A, 0x05, 0x00 };
+const CK_BYTE ber_AlgSha256[] = { 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48,
0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00 };
+const CK_BYTE ber_AlgIdRSAEncryption[] = { 0x30, 0x0D, 0x06, 0x09, 0x2a,
0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00 };
// ID Lengths
//
-CK_ULONG ber_idDSALen = sizeof(ber_idDSA);
-CK_ULONG ber_rsaEncryptionLen = sizeof(ber_rsaEncryption);
-CK_ULONG ber_md2WithRSAEncryptionLen = sizeof(ber_md2WithRSAEncryption);
-CK_ULONG ber_md4WithRSAEncryptionLen = sizeof(ber_md4WithRSAEncryption);
-CK_ULONG ber_md5WithRSAEncryptionLen = sizeof(ber_md5WithRSAEncryption);
-CK_ULONG ber_sha1WithRSAEncryptionLen= sizeof(ber_sha1WithRSAEncryption);
+const CK_ULONG ber_idDSALen = sizeof(ber_idDSA);
+const CK_ULONG ber_rsaEncryptionLen = sizeof(ber_rsaEncryption);
+const CK_ULONG ber_md2WithRSAEncryptionLen = sizeof(ber_md2WithRSAEncryption);
+const CK_ULONG ber_md4WithRSAEncryptionLen = sizeof(ber_md4WithRSAEncryption);
+const CK_ULONG ber_md5WithRSAEncryptionLen = sizeof(ber_md5WithRSAEncryption);
+const CK_ULONG ber_sha1WithRSAEncryptionLen= sizeof(ber_sha1WithRSAEncryption);
-CK_ULONG ber_AlgMd2Len= sizeof(ber_AlgMd2);
-CK_ULONG ber_AlgMd5Len= sizeof(ber_AlgMd5);
-CK_ULONG ber_AlgSha1Len= sizeof(ber_AlgSha1);
-CK_ULONG ber_AlgSha256Len= sizeof(ber_AlgSha256);
-CK_ULONG ber_AlgIdRSAEncryptionLen = sizeof(ber_AlgIdRSAEncryption);
+const CK_ULONG ber_AlgMd2Len= sizeof(ber_AlgMd2);
+const CK_ULONG ber_AlgMd5Len= sizeof(ber_AlgMd5);
+const CK_ULONG ber_AlgSha1Len= sizeof(ber_AlgSha1);
+const CK_ULONG ber_AlgSha256Len= sizeof(ber_AlgSha256);
+const CK_ULONG ber_AlgIdRSAEncryptionLen = sizeof(ber_AlgIdRSAEncryption);
-CK_ULONG des_weak_count = 4;
-CK_ULONG des_semi_weak_count = 12;
-CK_ULONG des_possibly_weak_count = 48;
+const CK_ULONG des_weak_count = 4;
+const CK_ULONG des_semi_weak_count = 12;
+const CK_ULONG des_possibly_weak_count = 48;
-CK_BYTE des_weak_keys[4][8] = {
+const CK_BYTE des_weak_keys[4][8] = {
{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
{0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E},
{0xE0, 0xE0, 0xE0, 0xE0, 0xF1, 0xF1, 0xF1, 0xF1},
{0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE}
};
-CK_BYTE des_semi_weak_keys[12][8] = {
+const CK_BYTE des_semi_weak_keys[12][8] = {
{0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE},
{0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01},
{0x1F, 0xE0, 0x1F, 0xE0, 0x0E, 0xF1, 0x0E, 0xF1},
@@ -178,7 +178,7 @@ CK_BYTE des_semi_weak_keys[12][8] = {
{0xFE, 0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1}
};
-CK_BYTE des_possibly_weak_keys[48][8] = {
+const CK_BYTE des_possibly_weak_keys[48][8] = {
{0x1F, 0x1F, 0x01, 0x01, 0x0E, 0x0E, 0x01, 0x01},
{0x01, 0x1F, 0x1F, 0x01, 0x01, 0x0E, 0x0E, 0x01},
{0x1F, 0x01, 0x01, 0x1F, 0x0E, 0x01, 0x01, 0x0E},
@@ -237,7 +237,7 @@ CK_BYTE des_possibly_weak_keys[48][8] = {
};
-MECH_LIST_ELEMENT mech_list[] = {
+const MECH_LIST_ELEMENT mech_list[] = {
{ CKM_RSA_PKCS_KEY_PAIR_GEN, {512, 2048, CKF_GENERATE_KEY_PAIR} },
{ CKM_DES_KEY_GEN, {0, 0, CKF_GENERATE} },
{ CKM_DES3_KEY_GEN, {0, 0, CKF_GENERATE} },
@@ -305,25 +305,25 @@ MECH_LIST_ELEMENT mech_list[] = {
CKF_WRAP | CKF_UNWRAP} },
};
-CK_ULONG mech_list_len = (sizeof(mech_list) / sizeof(MECH_LIST_ELEMENT));
+const CK_ULONG mech_list_len = (sizeof(mech_list) /
sizeof(MECH_LIST_ELEMENT));
// default SO pin hash values
//
// default SO pin = "87654321"
//
-CK_BYTE default_so_pin_md5[MD5_HASH_SIZE] = {
+const CK_BYTE default_so_pin_md5[MD5_HASH_SIZE] = {
0x5E, 0x86, 0x67, 0xA4, 0x39, 0xC6, 0x8F, 0x51,
0x45, 0xDD, 0x2F, 0xCB, 0xEC, 0xF0, 0x22, 0x09
};
-CK_BYTE default_so_pin_sha[SHA1_HASH_SIZE] = {
+const CK_BYTE default_so_pin_sha[SHA1_HASH_SIZE] = {
0xA7, 0xD5, 0x79, 0xBA, 0x76, 0x39, 0x80, 0x70,
0xEA, 0xE6, 0x54, 0xC3, 0x0F, 0xF1, 0x53, 0xA4,
0xC2, 0x73, 0x27, 0x2A
};
/* SHA-1 of "12345678" */
-CK_BYTE default_user_pin_sha[SHA1_HASH_SIZE] = {
+const CK_BYTE default_user_pin_sha[SHA1_HASH_SIZE] = {
0x7c, 0x22, 0x2f, 0xb2, 0x92, 0x7d, 0x82, 0x8a,
0xf2, 0x2f, 0x59, 0x21, 0x34, 0xe8, 0x93, 0x24,
0x80, 0x63, 0x7c, 0x0d
diff --git a/usr/lib/pkcs11/tpm_stdll/h_extern.h
b/usr/lib/pkcs11/tpm_stdll/h_extern.h
index e28d1de..ef86d3f 100644
--- a/usr/lib/pkcs11/tpm_stdll/h_extern.h
+++ b/usr/lib/pkcs11/tpm_stdll/h_extern.h
@@ -51,8 +51,8 @@ extern CK_BBOOL initialized;
extern char *card_function_names[];
extern char *total_function_names[];
-extern MECH_LIST_ELEMENT mech_list[];
-extern CK_ULONG mech_list_len;
+extern const MECH_LIST_ELEMENT mech_list[];
+extern const CK_ULONG mech_list_len;
extern pthread_mutex_t native_mutex;
#if SYSVSEM
@@ -76,9 +76,9 @@ extern CK_BYTE master_key_private[MK_SIZE];
extern CK_BYTE so_pin_md5[MD5_HASH_SIZE];
extern CK_BYTE user_pin_md5[MD5_HASH_SIZE];
-extern CK_BYTE default_user_pin_sha[SHA1_HASH_SIZE];
-extern CK_BYTE default_so_pin_sha[SHA1_HASH_SIZE];
-extern CK_BYTE default_so_pin_md5[MD5_HASH_SIZE];
+extern const CK_BYTE default_user_pin_sha[SHA1_HASH_SIZE];
+extern const CK_BYTE default_so_pin_sha[SHA1_HASH_SIZE];
+extern const CK_BYTE default_so_pin_md5[MD5_HASH_SIZE];
extern LW_SHM_TYPE *global_shm;
@@ -93,37 +93,37 @@ extern CK_ULONG ro_session_count;
extern CK_STATE global_login_state;
-extern CK_BYTE ber_AlgIdRSAEncryption[];
-extern CK_ULONG ber_AlgIdRSAEncryptionLen;
-extern CK_BYTE ber_rsaEncryption[];
-extern CK_ULONG ber_rsaEncryptionLen;
-extern CK_BYTE ber_idDSA[];
-extern CK_ULONG ber_idDSALen;
-
-extern CK_BYTE ber_md2WithRSAEncryption[];
-extern CK_ULONG ber_md2WithRSAEncryptionLen;
-extern CK_BYTE ber_md4WithRSAEncryption[];
-extern CK_ULONG ber_md4WithRSAEncryptionLen;
-extern CK_BYTE ber_md5WithRSAEncryption[];
-extern CK_ULONG ber_md5WithRSAEncryptionLen;
-extern CK_BYTE ber_sha1WithRSAEncryption[];
-extern CK_ULONG ber_sha1WithRSAEncryptionLen;
-extern CK_BYTE ber_AlgMd2[];
-extern CK_ULONG ber_AlgMd2Len;
-extern CK_BYTE ber_AlgMd5[];
-extern CK_ULONG ber_AlgMd5Len;
-extern CK_BYTE ber_AlgSha1[];
-extern CK_ULONG ber_AlgSha1Len;
-extern CK_BYTE ber_AlgSha256[];
-extern CK_ULONG ber_AlgSha256Len;
-
-
-extern CK_ULONG des_weak_count;
-extern CK_ULONG des_semi_weak_count;
-extern CK_ULONG des_possibly_weak_count;
-extern CK_BYTE des_weak_keys[4][8];
-extern CK_BYTE des_semi_weak_keys[12][8];
-extern CK_BYTE des_possibly_weak_keys[48][8];
+extern const CK_BYTE ber_AlgIdRSAEncryption[];
+extern const CK_ULONG ber_AlgIdRSAEncryptionLen;
+extern const CK_BYTE ber_rsaEncryption[];
+extern const CK_ULONG ber_rsaEncryptionLen;
+extern const CK_BYTE ber_idDSA[];
+extern const CK_ULONG ber_idDSALen;
+
+extern const CK_BYTE ber_md2WithRSAEncryption[];
+extern const CK_ULONG ber_md2WithRSAEncryptionLen;
+extern const CK_BYTE ber_md4WithRSAEncryption[];
+extern const CK_ULONG ber_md4WithRSAEncryptionLen;
+extern const CK_BYTE ber_md5WithRSAEncryption[];
+extern const CK_ULONG ber_md5WithRSAEncryptionLen;
+extern const CK_BYTE ber_sha1WithRSAEncryption[];
+extern const CK_ULONG ber_sha1WithRSAEncryptionLen;
+extern const CK_BYTE ber_AlgMd2[];
+extern const CK_ULONG ber_AlgMd2Len;
+extern const CK_BYTE ber_AlgMd5[];
+extern const CK_ULONG ber_AlgMd5Len;
+extern const CK_BYTE ber_AlgSha1[];
+extern const CK_ULONG ber_AlgSha1Len;
+extern const CK_BYTE ber_AlgSha256[];
+extern const CK_ULONG ber_AlgSha256Len;
+
+
+extern const CK_ULONG des_weak_count;
+extern const CK_ULONG des_semi_weak_count;
+extern const CK_ULONG des_possibly_weak_count;
+extern const CK_BYTE des_weak_keys[4][8];
+extern const CK_BYTE des_semi_weak_keys[12][8];
+extern const CK_BYTE des_possibly_weak_keys[48][8];
extern struct ST_FCN_LIST function_list;
diff --git a/usr/lib/pkcs11/tpm_stdll/key_mgr.c
b/usr/lib/pkcs11/tpm_stdll/key_mgr.c
index 8b853b6..5abbb64 100644
--- a/usr/lib/pkcs11/tpm_stdll/key_mgr.c
+++ b/usr/lib/pkcs11/tpm_stdll/key_mgr.c
@@ -50,7 +50,7 @@
//#include "args.h"
-static CK_BBOOL true = TRUE, false = FALSE;
+static const CK_BBOOL true = TRUE, false = FALSE;
//
//
diff --git a/usr/lib/pkcs11/tpm_stdll/tpm_specific.c
b/usr/lib/pkcs11/tpm_stdll/tpm_specific.c
index a1c39e8..a0835f4 100644
--- a/usr/lib/pkcs11/tpm_stdll/tpm_specific.c
+++ b/usr/lib/pkcs11/tpm_stdll/tpm_specific.c
@@ -79,10 +79,10 @@
TSS_RESULT util_set_public_modulus(TSS_HKEY, unsigned long, unsigned char *);
-CK_CHAR manuf[] = "IBM Corp.";
-CK_CHAR model[] = "TPM v1.1 Token";
-CK_CHAR descr[] = "Token for the Trusted Platform Module";
-CK_CHAR label[] = "IBM PKCS#11 TPM Token";
+static const CK_CHAR manuf[] = "IBM Corp.";
+static const CK_CHAR model[] = "TPM v1.1 Token";
+static const CK_CHAR descr[] = "Token for the Trusted Platform Module";
+static const CK_CHAR label[] = "IBM PKCS#11 TPM Token";
CK_BYTE master_key_private[MK_SIZE];
--
1.7.5.rc1
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech