| 1 | --- ./engine_pkcs11.c 2008-09-09 16:44:15.000000000 -0400 |
|---|
| 2 | +++ engine_pkcs11.c.orig 2008-07-31 10:49:08.000000000 -0400 |
|---|
| 3 | @@ -391,7 +391,7 @@ |
|---|
| 4 | PKCS11_TOKEN *tok; |
|---|
| 5 | PKCS11_CERT *certs, *selected_cert = NULL; |
|---|
| 6 | X509 *x509; |
|---|
| 7 | - unsigned int slot_count, cert_count, n, m; |
|---|
| 8 | + unsigned int count, n, m; |
|---|
| 9 | unsigned char cert_id[MAX_VALUE_LEN / 2]; |
|---|
| 10 | size_t cert_id_len = sizeof(cert_id); |
|---|
| 11 | char *cert_label = NULL; |
|---|
| 12 | @@ -425,14 +425,14 @@ |
|---|
| 13 | } |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | - if (PKCS11_enumerate_slots(ctx, &slot_list, &slot_count) < 0) |
|---|
| 17 | + if (PKCS11_enumerate_slots(ctx, &slot_list, &count) < 0) |
|---|
| 18 | fail("failed to enumerate slots\n"); |
|---|
| 19 | |
|---|
| 20 | if (verbose) { |
|---|
| 21 | - fprintf(stderr, "Found %u slot%s\n", slot_count, |
|---|
| 22 | - (slot_count <= 1) ? "" : "s"); |
|---|
| 23 | + fprintf(stderr, "Found %u slot%s\n", count, |
|---|
| 24 | + (count <= 1) ? "" : "s"); |
|---|
| 25 | } |
|---|
| 26 | - for (n = 0; n < slot_count; n++) { |
|---|
| 27 | + for (n = 0; n < count; n++) { |
|---|
| 28 | slot = slot_list + n; |
|---|
| 29 | flags[0] = '\0'; |
|---|
| 30 | if (slot->token) { |
|---|
| 31 | @@ -464,20 +464,20 @@ |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | if (slot_nr == -1) { |
|---|
| 35 | - if (!(slot = PKCS11_find_token(ctx, slot_list, slot_count))) |
|---|
| 36 | + if (!(slot = PKCS11_find_token(ctx, slot_list, count))) |
|---|
| 37 | fail("didn't find any tokens\n"); |
|---|
| 38 | - } else if (slot_nr >= 0 && slot_nr < slot_count) |
|---|
| 39 | + } else if (slot_nr >= 0 && slot_nr < count) |
|---|
| 40 | slot = slot_list + slot_nr; |
|---|
| 41 | else { |
|---|
| 42 | fprintf(stderr, "Invalid slot number: %d\n", slot_nr); |
|---|
| 43 | - PKCS11_release_all_slots(ctx, slot_list, slot_count); |
|---|
| 44 | + PKCS11_release_all_slots(ctx, slot_list, count); |
|---|
| 45 | return NULL; |
|---|
| 46 | } |
|---|
| 47 | tok = slot->token; |
|---|
| 48 | |
|---|
| 49 | if (tok == NULL) { |
|---|
| 50 | fprintf(stderr, "Found empty token; \n"); |
|---|
| 51 | - PKCS11_release_all_slots(ctx, slot_list, slot_count); |
|---|
| 52 | + PKCS11_release_all_slots(ctx, slot_list, count); |
|---|
| 53 | return NULL; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | @@ -486,18 +486,18 @@ |
|---|
| 57 | fprintf(stderr, "Found token: %s\n", slot->token->label); |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | - if (PKCS11_enumerate_certs(tok, &certs, &cert_count)) { |
|---|
| 61 | + if (PKCS11_enumerate_certs(tok, &certs, &count)) { |
|---|
| 62 | fprintf(stderr, "unable to enumerate certificates\n"); |
|---|
| 63 | - PKCS11_release_all_slots(ctx, slot_list, slot_count); |
|---|
| 64 | + PKCS11_release_all_slots(ctx, slot_list, count); |
|---|
| 65 | return NULL; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | if (verbose) { |
|---|
| 69 | - fprintf(stderr, "Found %u cert%s:\n", cert_count, |
|---|
| 70 | - (cert_count <= 1) ? "" : "s"); |
|---|
| 71 | + fprintf(stderr, "Found %u cert%s:\n", count, |
|---|
| 72 | + (count <= 1) ? "" : "s"); |
|---|
| 73 | } |
|---|
| 74 | if ((s_slot_cert_id && *s_slot_cert_id) || (cert_id_len == 0)) { |
|---|
| 75 | - for (n = 0; n < cert_count; n++) { |
|---|
| 76 | + for (n = 0; n < count; n++) { |
|---|
| 77 | PKCS11_CERT *k = certs + n; |
|---|
| 78 | |
|---|
| 79 | if (cert_id_len != 0 && k->id_len == cert_id_len && |
|---|
| 80 | @@ -511,7 +511,7 @@ |
|---|
| 81 | |
|---|
| 82 | if (selected_cert == NULL) { |
|---|
| 83 | fprintf(stderr, "certificate not found.\n"); |
|---|
| 84 | - PKCS11_release_all_slots(ctx, slot_list, slot_count); |
|---|
| 85 | + PKCS11_release_all_slots(ctx, slot_list, count); |
|---|
| 86 | return NULL; |
|---|
| 87 | } |
|---|
| 88 | |
|---|