Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: dev-libs/opencryptoki/files/opencryptoki-2.2.8-tpm_pubexp.patch

Issue 5179001: Fix to openCryptoki PKCS#11 TPM generated key handling (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/chromiumos-overlay.git@master
Patch Set: Addressing code review comments. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dev-libs/opencryptoki/opencryptoki-2.2.8.ebuild » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dev-libs/opencryptoki/files/opencryptoki-2.2.8-tpm_pubexp.patch
diff --git a/dev-libs/opencryptoki/files/opencryptoki-2.2.8-tpm_pubexp.patch b/dev-libs/opencryptoki/files/opencryptoki-2.2.8-tpm_pubexp.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6d39463b9fe4b04bc6d353238011abf014dacc8b
--- /dev/null
+++ b/dev-libs/opencryptoki/files/opencryptoki-2.2.8-tpm_pubexp.patch
@@ -0,0 +1,56 @@
+diff -ru opencryptoki-2.2.8.ORG/work/opencryptoki-2.2.8/usr/lib/pkcs11/tpm_stdll/new_host.c opencryptoki-2.2.8/work/opencryptoki-2.2.8/usr/lib/pkcs11/tpm_stdll/new_host.c
+--- opencryptoki-2.2.8.ORG/work/opencryptoki-2.2.8/usr/lib/pkcs11/tpm_stdll/new_host.c 2010-12-07 16:38:55.000000000 -0800
++++ opencryptoki-2.2.8/work/opencryptoki-2.2.8/usr/lib/pkcs11/tpm_stdll/new_host.c 2010-12-07 17:05:17.000000000 -0800
+@@ -28,6 +28,9 @@
+ 4/25/03 Kapil Sood (kapil@corrent.com)
+ Added DH key pair generation and DH shared key derivation
+ functions.
++ 11/16/10 Nelson Araujo (nelsona@chromium.org)
++ Return default public exponent if not stored and/or returned
++ by the TPM token device
+ ****************************************************************************/
+
+
+@@ -120,6 +123,7 @@
+
+ CK_C_INITIALIZE_ARGS cinit_args = { NULL, NULL, NULL, NULL, 0, NULL };
+
++CK_BYTE pub_exp[] = { 0x1, 0x0, 0x1 }; // 65537
+
+ extern void stlogterm();
+ extern void stloginit();
+@@ -1926,11 +1930,34 @@
+ goto done;
+ }
+
++ for (i=0; i<ulCount; i++) {
++ if (pTemplate[i].type == CKA_PUBLIC_EXPONENT) {
++ // 'object_mgr_get_attribute_values' requires the buffer to be
++ // of the right size, otherwise it will fail with a too generic
++ // error code. if buffer is too small, return to the caller
++ // failure with more appropriate (specific) error code.
++ if (pTemplate[i].ulValueLen < sizeof(pub_exp)) {
++ rc = CKR_BUFFER_TOO_SMALL;
++ goto done;
++ }
++ }
++ }
++
+ rc = object_mgr_get_attribute_values( sess, hObject, pTemplate, ulCount );
+ if (rc != CKR_OK){
+ st_err_log(159, __FILE__, __LINE__);
+ }
+
++ for (i=0; i<ulCount; i++) {
++ if (pTemplate[i].type == CKA_PUBLIC_EXPONENT) {
++ if (rc || pTemplate[i].ulValueLen == 0) {
++ // Use well-known exponent if value not stored by the device.
++ memcpy( pTemplate[i].pValue, pub_exp, sizeof(pub_exp) );
++ pTemplate[i].ulValueLen = sizeof(pub_exp);
++ rc = 0;
++ }
++ }
++ }
+
+ done:
+ LLOCK;
« no previous file with comments | « no previous file | dev-libs/opencryptoki/opencryptoki-2.2.8.ebuild » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698