OLD | NEW |
---|---|
(Empty) | |
1 diff -ru clean/opencryptoki-2.3.2/usr/lib/pkcs11/tpm_stdll/new_host.c opencrypto ki-2.3.2/usr/lib/pkcs11/tpm_stdll/new_host.c | |
2 --- clean/opencryptoki-2.3.2/usr/lib/pkcs11/tpm_stdll/new_host.c 2010-07- 29 05:28:41.000000000 -0700 | |
3 +++ opencryptoki-2.3.2/usr/lib/pkcs11/tpm_stdll/new_host.c 2010-11-16 09:30 :53.075739829 -0800 | |
4 @@ -28,6 +28,9 @@ | |
5 4/25/03 Kapil Sood (kapil@corrent.com) | |
6 Added DH key pair generation and DH shared key derivation | |
7 functions. | |
8 + 11/16/10 Nelson Araujo (nelsona@chromium.org) | |
9 + Return default public exponent if not stored and/or returned | |
James Simonsen
2010/12/07 22:32:21
This doesn't feel like the right place to put in t
Nelson Araujo
2010/12/07 23:20:33
Without this code *all* operations with a openCryp
| |
10 + by the TPM token device | |
11 ****************************************************************************/ | |
12 | |
13 | |
14 @@ -120,6 +124,7 @@ | |
15 | |
16 CK_C_INITIALIZE_ARGS cinit_args = { NULL, NULL, NULL, NULL, 0, NULL }; | |
17 | |
18 +CK_BYTE pub_exp[] = { 0x1, 0x0, 0x1 }; // 65537 | |
19 | |
20 extern void stlogterm(); | |
21 extern void stloginit(); | |
22 @@ -1926,11 +1931,30 @@ | |
23 goto done; | |
24 } | |
25 | |
26 + for (i=0; i<ulCount; i++) { | |
27 + if (pTemplate[i].type == CKA_PUBLIC_EXPONENT) { | |
28 + if (pTemplate[i].ulValueLen < sizeof(pub_exp)) { | |
James Simonsen
2010/12/07 22:32:21
It seems like this should only be checked if we're
Nelson Araujo
2010/12/07 23:20:33
correct. that's what the if() in the line immediat
| |
29 + rc = CKR_BUFFER_TOO_SMALL; | |
30 + goto done; | |
31 + } | |
32 + } | |
33 + } | |
34 + | |
35 rc = object_mgr_get_attribute_values( sess, hObject, pTemplate, ulCount ); | |
36 if (rc != CKR_OK){ | |
37 st_err_log(159, __FILE__, __LINE__); | |
38 } | |
39 | |
40 + for (i=0; i<ulCount; i++) { | |
41 + if (pTemplate[i].type == CKA_PUBLIC_EXPONENT) { | |
42 + if (rc || pTemplate[i].ulValueLen == 0) { | |
43 + // Use well-known exponent if value not stored by the device | |
44 + memcpy( pTemplate[i].pValue, pub_exp, sizeof(pub_exp) ); | |
45 + pTemplate[i].ulValueLen = sizeof(pub_exp); | |
46 + rc = 0; | |
47 + } | |
48 + } | |
49 + } | |
50 | |
51 done: | |
52 LLOCK; | |
53 | |
OLD | NEW |