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 @@ - 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 */ |