libopensc: search pkcs15 objects: accept NULL value for the output argument
So that, the dummy object for the 'search pkcs15 object' calls is not neccessary. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3942 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
2ec8932c93
commit
5cd5728c0e
|
@ -894,7 +894,7 @@ __sc_pkcs15_search_objects(sc_pkcs15_card_t *p15card,
|
||||||
continue;
|
continue;
|
||||||
/* Okay, we have a match. */
|
/* Okay, we have a match. */
|
||||||
match_count++;
|
match_count++;
|
||||||
if (ret_size <= 0)
|
if (!ret || ret_size <= 0)
|
||||||
continue;
|
continue;
|
||||||
ret[match_count-1] = obj;
|
ret[match_count-1] = obj;
|
||||||
if (ret_size <= match_count)
|
if (ret_size <= match_count)
|
||||||
|
|
|
@ -961,14 +961,12 @@ sc_pkcs15init_store_pin(struct sc_pkcs15_card *p15card,
|
||||||
|
|
||||||
/* No auth_id given: select one */
|
/* No auth_id given: select one */
|
||||||
if (args->auth_id.len == 0) {
|
if (args->auth_id.len == 0) {
|
||||||
struct sc_pkcs15_object *dummy;
|
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
|
|
||||||
args->auth_id.len = 1;
|
args->auth_id.len = 1;
|
||||||
for (n = 1, r = 0; n < 256; n++) {
|
for (n = 1, r = 0; n < 256; n++) {
|
||||||
args->auth_id.value[0] = n;
|
args->auth_id.value[0] = n;
|
||||||
r = sc_pkcs15_find_pin_by_auth_id(p15card,
|
r = sc_pkcs15_find_pin_by_auth_id(p15card, &args->auth_id, NULL);
|
||||||
&args->auth_id, &dummy);
|
|
||||||
if (r == SC_ERROR_OBJECT_NOT_FOUND)
|
if (r == SC_ERROR_OBJECT_NOT_FOUND)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -977,10 +975,8 @@ sc_pkcs15init_store_pin(struct sc_pkcs15_card *p15card,
|
||||||
return SC_ERROR_INVALID_ARGUMENTS;
|
return SC_ERROR_INVALID_ARGUMENTS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct sc_pkcs15_object *dummy;
|
|
||||||
|
|
||||||
/* Make sure we don't get duplicate PIN IDs */
|
/* Make sure we don't get duplicate PIN IDs */
|
||||||
r = sc_pkcs15_find_pin_by_auth_id(p15card, &args->auth_id, &dummy);
|
r = sc_pkcs15_find_pin_by_auth_id(p15card, &args->auth_id, NULL);
|
||||||
if (r != SC_ERROR_OBJECT_NOT_FOUND) {
|
if (r != SC_ERROR_OBJECT_NOT_FOUND) {
|
||||||
sc_debug(card->ctx, "There already is a PIN with this ID.");
|
sc_debug(card->ctx, "There already is a PIN with this ID.");
|
||||||
return SC_ERROR_INVALID_ARGUMENTS;
|
return SC_ERROR_INVALID_ARGUMENTS;
|
||||||
|
|
Loading…
Reference in New Issue