- (tim) [ssh-pkcs11.c] Fix "non-constant initializer" errors in older

compilers. OK djm@
This commit is contained in:
Tim Rice 2010-03-04 12:48:05 -08:00
parent f2b70cad75
commit 179eee081a
2 changed files with 14 additions and 3 deletions

View File

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

View File

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