opencryptoki: Fix to opencryptoki PKCS#11 TPM generated key handling

Original patch by Nelson Araujo <nelsona@chromium.org>.
http://codereview.chromium.org/5179001

BUG=chromium-os:14440
TEST=none

Change-Id: Icfec6716cb25268d9fbf008d7104017782f0945c
diff --git a/usr/lib/pkcs11/tpm_stdll/tpm_specific.c b/usr/lib/pkcs11/tpm_stdll/tpm_specific.c
index cc13299..eb539f2 100644
--- a/usr/lib/pkcs11/tpm_stdll/tpm_specific.c
+++ b/usr/lib/pkcs11/tpm_stdll/tpm_specific.c
@@ -2375,6 +2375,7 @@
 	CK_ULONG	mod_bits = 0;
 	CK_BBOOL	flag;
 	CK_RV		rc;
+	CK_BYTE		tpm_pubexp[] = { 0, 1, 0, 1 };
 
 	TSS_FLAG	initFlags = 0;
 	BYTE		authHash[SHA1_HASH_SIZE];
@@ -2491,6 +2492,14 @@
 	template_update_attribute( priv_tmpl, attr );
 	Tspi_Context_FreeMemory(tspContext, rgbBlob);
 
+	/* put the public exponent into the private key object */
+	if ((rc = build_attribute(CKA_PUBLIC_EXPONENT, tpm_pubexp,
+				  sizeof(tpm_pubexp), &attr))) {
+		st_err_log(84, __FILE__, __LINE__);
+		return rc;
+	}
+	template_update_attribute( priv_tmpl, attr );
+
 	/* wrap the authdata and put it into an object */
 	if (authData != NULL) {
 		if ((rc = token_wrap_auth_data(authData, publ_tmpl, priv_tmpl))) {