Changeset 113
- Timestamp:
- 12/06/08 19:43:46 (3 years ago)
- File:
-
- 1 edited
-
trunk/src/engine_pkcs11.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine_pkcs11.c
r112 r113 549 549 PKCS11_CERT *certs; 550 550 EVP_PKEY *pk; 551 unsigned int count, n, m;551 unsigned int slot_count, cert_count, key_count, n, m; 552 552 unsigned char key_id[MAX_VALUE_LEN / 2]; 553 553 size_t key_id_len = sizeof(key_id); … … 583 583 } 584 584 585 if (PKCS11_enumerate_slots(ctx, &slot_list, & count) < 0)585 if (PKCS11_enumerate_slots(ctx, &slot_list, &slot_count) < 0) 586 586 fail("failed to enumerate slots\n"); 587 587 588 588 if (verbose) { 589 fprintf(stderr, "Found %u slot%s\n", count,590 ( count <= 1) ? "" : "s");591 } 592 for (n = 0; n < count; n++) {589 fprintf(stderr, "Found %u slot%s\n", slot_count, 590 (slot_count <= 1) ? "" : "s"); 591 } 592 for (n = 0; n < slot_count; n++) { 593 593 slot = slot_list + n; 594 594 flags[0] = '\0'; … … 622 622 623 623 if (slot_nr == -1) { 624 if (!(slot = PKCS11_find_token(ctx, slot_list, count)))624 if (!(slot = PKCS11_find_token(ctx, slot_list, slot_count))) 625 625 fail("didn't find any tokens\n"); 626 } else if (slot_nr >= 0 && slot_nr < count)626 } else if (slot_nr >= 0 && slot_nr < slot_count) 627 627 slot = slot_list + slot_nr; 628 628 else { 629 629 fprintf(stderr, "Invalid slot number: %d\n", slot_nr); 630 PKCS11_release_all_slots(ctx, slot_list, count);630 PKCS11_release_all_slots(ctx, slot_list, slot_count); 631 631 return NULL; 632 632 } … … 635 635 if (tok == NULL) { 636 636 fprintf(stderr, "Found empty token; \n"); 637 PKCS11_release_all_slots(ctx, slot_list, count);637 PKCS11_release_all_slots(ctx, slot_list, slot_count); 638 638 return NULL; 639 639 } … … 647 647 if (isPrivate && !tok->userPinSet && !tok->readOnly) { 648 648 fprintf(stderr, "Found slot without user PIN\n"); 649 PKCS11_release_all_slots(ctx, slot_list, count);649 PKCS11_release_all_slots(ctx, slot_list, slot_count); 650 650 return NULL; 651 651 } … … 656 656 } 657 657 658 if (PKCS11_enumerate_certs(tok, &certs, &c ount))658 if (PKCS11_enumerate_certs(tok, &certs, &cert_count)) 659 659 fail("unable to enumerate certificates\n"); 660 660 661 661 if (verbose) { 662 fprintf(stderr, "Found %u certificate%s:\n", c ount,663 (c ount <= 1) ? "" : "s");664 for (n = 0; n < c ount; n++) {662 fprintf(stderr, "Found %u certificate%s:\n", cert_count, 663 (cert_count <= 1) ? "" : "s"); 664 for (n = 0; n < cert_count; n++) { 665 665 PKCS11_CERT *c = certs + n; 666 666 char *dn = NULL; … … 732 732 733 733 /* Make sure there is at least one private key on the token */ 734 if (PKCS11_enumerate_keys(tok, &keys, & count)) {734 if (PKCS11_enumerate_keys(tok, &keys, &key_count)) { 735 735 fail("unable to enumerate keys\n"); 736 736 } 737 if ( count == 0) {737 if (key_count == 0) { 738 738 fail("No keys found.\n"); 739 739 } 740 740 741 741 if (verbose) { 742 fprintf(stderr, "Found %u key%s:\n", count,743 ( count <= 1) ? "" : "s");742 fprintf(stderr, "Found %u key%s:\n", key_count, 743 (key_count <= 1) ? "" : "s"); 744 744 } 745 745 if (s_slot_key_id && *s_slot_key_id) { 746 for (n = 0; n < count; n++) {746 for (n = 0; n < key_count; n++) { 747 747 PKCS11_KEY *k = keys + n; 748 748
Note: See TracChangeset
for help on using the changeset viewer.
