* test to verify everything is in order.
*/
-#define CT(x, n) { x, #x, n },
+#define CT(x, n) { x, #x, { n } },
+#define CT2(x, n, n2) { x, #x, { n, n2 } },
const p11_constant p11_constant_types[] = {
CT (CKA_CLASS, "class")
};
const p11_constant p11_constant_categories[] = {
- { 0, "unspecified", "unspecified" },
- { 1, "token-user", "token-user" },
- { 2, "authority", "authority" },
- { 3, "other-entry", "other-entry" },
+ { 0, "unspecified", { "unspecified" } },
+ { 1, "token-user", { "token-user" } },
+ { 2, "authority", { "authority" } },
+ { 3, "other-entry", { "other-entry" } },
{ CKA_INVALID },
};
lookup_info (const p11_constant *table,
CK_ATTRIBUTE_TYPE type)
{
- p11_constant match = { type, NULL, NULL };
+ p11_constant match = { type, NULL, { NULL } };
int length = -1;
int i;
CK_ULONG type)
{
const p11_constant *constant = lookup_info (constants, type);
- return constant ? constant->nick : NULL;
+ return constant ? constant->nicks[0] : NULL;
}
p11_dict *
{
const p11_constant *table;
p11_dict *lookups;
- void *string;
int length = -1;
- int i, j;
+ int i, j, k;
lookups = p11_dict_new (p11_dict_str_hash, p11_dict_str_equal, NULL, NULL);
return_val_if_fail (lookups != NULL, NULL);
for (j = 0; j < length; j++) {
if (nick) {
- if (!table[j].nick)
- continue;
- string = (void *)table[j].nick;
+ for (k = 0; table[j].nicks[k] != NULL; k++) {
+ if (!p11_dict_set (lookups, (void *)table[j].nicks[k],
+ (void *)&table[j].value))
+ return_val_if_reached (NULL);
+ }
} else {
- string = (void *)table[j].name;
+ if (!p11_dict_set (lookups, (void *)table[j].name, (void *)&table[j].value))
+ return_val_if_reached (NULL);
}
- if (!p11_dict_set (lookups, string, (void *)&table[j].value))
- return_val_if_reached (NULL);
}
}
const p11_constant *constant = arg;
p11_dict *nicks, *names;
CK_ULONG check;
- int i;
+ int i, j;
nicks = p11_constant_reverse (true);
names = p11_constant_reverse (false);
for (i = 0; constant[i].value != CKA_INVALID; i++) {
assert_ptr_not_null (constant[i].name);
- if (constant[i].nick) {
- assert_str_eq (constant[i].nick,
+ if (constant[i].nicks[0]) {
+ assert_str_eq (constant[i].nicks[0],
p11_constant_nick (constant, constant[i].value));
}
assert_str_eq (constant[i].name,
p11_constant_name (constant, constant[i].value));
- if (constant[i].nick) {
- check = p11_constant_resolve (nicks, constant[i].nick);
+ for (j = 0; constant[i].nicks[j] != NULL; j++) {
+ check = p11_constant_resolve (nicks, constant[i].nicks[j]);
assert_num_eq (constant[i].value, check);
}