summaryrefslogtreecommitdiff
path: root/ssh-pkcs11.c
diff options
context:
space:
mode:
authorTim Rice <tim@multitalents.net>2010-03-04 12:48:05 -0800
committerTim Rice <tim@multitalents.net>2010-03-04 12:48:05 -0800
commit179eee081a560f3e10506ae3a2facdc1c766f0f6 (patch)
treeebc022eb7b5931738edcea62228533054b93249e /ssh-pkcs11.c
parentf2b70cad7585a67f7098119ccb6ae31573f2dc60 (diff)
- (tim) [ssh-pkcs11.c] Fix "non-constant initializer" errors in older
compilers. OK djm@
Diffstat (limited to 'ssh-pkcs11.c')
-rw-r--r--ssh-pkcs11.c15
1 files changed, 12 insertions, 3 deletions
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 */