diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | ssh-pkcs11.c | 15 |
2 files changed, 14 insertions, 3 deletions
@@ -6,6 +6,8 @@ | |||
6 | - djm@cvs.openbsd.org 2010/03/04 20:35:08 | 6 | - djm@cvs.openbsd.org 2010/03/04 20:35:08 |
7 | [ssh-keygen.1 ssh-keygen.c] | 7 | [ssh-keygen.1 ssh-keygen.c] |
8 | Add a -L flag to print the contents of a certificate; ok markus@ | 8 | Add a -L flag to print the contents of a certificate; ok markus@ |
9 | - (tim) [ssh-pkcs11.c] Fix "non-constant initializer" errors in older | ||
10 | compilers. OK djm@ | ||
9 | 11 | ||
10 | 20100304 | 12 | 20100304 |
11 | - (djm) [ssh-keygen.c] Use correct local variable, instead of | 13 | - (djm) [ssh-keygen.c] Use correct local variable, instead of |
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c index 7536f92a6..f0192dcf1 100644 --- a/ssh-pkcs11.c +++ b/ssh-pkcs11.c | |||
@@ -204,13 +204,18 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, | |||
204 | CKM_RSA_PKCS, NULL_PTR, 0 | 204 | CKM_RSA_PKCS, NULL_PTR, 0 |
205 | }; | 205 | }; |
206 | CK_ATTRIBUTE key_filter[] = { | 206 | CK_ATTRIBUTE key_filter[] = { |
207 | {CKA_CLASS, &private_key_class, sizeof(private_key_class) }, | 207 | {CKA_CLASS, NULL, sizeof(private_key_class) }, |
208 | {CKA_ID, NULL, 0}, | 208 | {CKA_ID, NULL, 0}, |
209 | {CKA_SIGN, &true_val, sizeof(true_val) } | 209 | {CKA_SIGN, NULL, sizeof(true_val) } |
210 | }; | 210 | }; |
211 | char *pin, prompt[1024]; | 211 | char *pin, prompt[1024]; |
212 | int rval = -1; | 212 | int rval = -1; |
213 | 213 | ||
214 | /* some compilers complain about non-constant initializer so we | ||
215 | use NULL in CK_ATTRIBUTE above and set the values here */ | ||
216 | key_filter[0].pValue = &private_key_class; | ||
217 | key_filter[2].pValue = &true_val; | ||
218 | |||
214 | if ((k11 = RSA_get_app_data(rsa)) == NULL) { | 219 | if ((k11 = RSA_get_app_data(rsa)) == NULL) { |
215 | error("RSA_get_app_data failed for rsa %p", rsa); | 220 | error("RSA_get_app_data failed for rsa %p", rsa); |
216 | return (-1); | 221 | return (-1); |
@@ -371,7 +376,7 @@ pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx, Key ***keysp, | |||
371 | CK_FUNCTION_LIST *f; | 376 | CK_FUNCTION_LIST *f; |
372 | CK_OBJECT_CLASS pubkey_class = CKO_PUBLIC_KEY; | 377 | CK_OBJECT_CLASS pubkey_class = CKO_PUBLIC_KEY; |
373 | CK_ATTRIBUTE pubkey_filter[] = { | 378 | CK_ATTRIBUTE pubkey_filter[] = { |
374 | { CKA_CLASS, &pubkey_class, sizeof(pubkey_class) } | 379 | { CKA_CLASS, NULL, sizeof(pubkey_class) } |
375 | }; | 380 | }; |
376 | CK_ATTRIBUTE attribs[] = { | 381 | CK_ATTRIBUTE attribs[] = { |
377 | { CKA_ID, NULL, 0 }, | 382 | { CKA_ID, NULL, 0 }, |
@@ -379,6 +384,10 @@ pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx, Key ***keysp, | |||
379 | { CKA_PUBLIC_EXPONENT, NULL, 0 } | 384 | { CKA_PUBLIC_EXPONENT, NULL, 0 } |
380 | }; | 385 | }; |
381 | 386 | ||
387 | /* some compilers complain about non-constant initializer so we | ||
388 | use NULL in CK_ATTRIBUTE above and set the value here */ | ||
389 | pubkey_filter[0].pValue = &pubkey_class; | ||
390 | |||
382 | f = p->function_list; | 391 | f = p->function_list; |
383 | session = p->slotinfo[slotidx].session; | 392 | session = p->slotinfo[slotidx].session; |
384 | /* setup a filter the looks for public keys */ | 393 | /* setup a filter the looks for public keys */ |