summaryrefslogtreecommitdiffstats
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
parentf2b70cad7585a67f7098119ccb6ae31573f2dc60 (diff)
- (tim) [ssh-pkcs11.c] Fix "non-constant initializer" errors in older
compilers. OK djm@
-rw-r--r--ChangeLog2
-rw-r--r--ssh-pkcs11.c15
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f0ba423..25457530 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
- djm@cvs.openbsd.org 2010/03/04 20:35:08
[ssh-keygen.1 ssh-keygen.c]
Add a -L flag to print the contents of a certificate; ok markus@
+ - (tim) [ssh-pkcs11.c] Fix "non-constant initializer" errors in older
+ compilers. OK djm@
20100304
- (djm) [ssh-keygen.c] Use correct local variable, instead of
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index 7536f92a..f0192dcf 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,
CKM_RSA_PKCS, NULL_PTR, 0
};
CK_ATTRIBUTE key_filter[] = {
- {CKA_CLASS, &private_key_class, sizeof(private_key_class) },
+ {CKA_CLASS, NULL, sizeof(private_key_class) },
{CKA_ID, NULL, 0},
- {CKA_SIGN, &true_val, sizeof(true_val) }
+ {CKA_SIGN, NULL, sizeof(true_val) }
};
char *pin, prompt[1024];
int rval = -1;
+ /* some compilers complain about non-constant initializer so we
+ use NULL in CK_ATTRIBUTE above and set the values here */
+ key_filter[0].pValue = &private_key_class;
+ key_filter[2].pValue = &true_val;
+
if ((k11 = RSA_get_app_data(rsa)) == NULL) {
error("RSA_get_app_data failed for rsa %p", rsa);
return (-1);
@@ -371,7 +376,7 @@ pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx, Key ***keysp,
CK_FUNCTION_LIST *f;
CK_OBJECT_CLASS pubkey_class = CKO_PUBLIC_KEY;
CK_ATTRIBUTE pubkey_filter[] = {
- { CKA_CLASS, &pubkey_class, sizeof(pubkey_class) }
+ { CKA_CLASS, NULL, sizeof(pubkey_class) }
};
CK_ATTRIBUTE attribs[] = {
{ CKA_ID, NULL, 0 },
@@ -379,6 +384,10 @@ pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx, Key ***keysp,
{ CKA_PUBLIC_EXPONENT, NULL, 0 }
};
+ /* some compilers complain about non-constant initializer so we
+ use NULL in CK_ATTRIBUTE above and set the value here */
+ pubkey_filter[0].pValue = &pubkey_class;
+
f = p->function_list;
session = p->slotinfo[slotidx].session;
/* setup a filter the looks for public keys */