OpenPGP: re-factor pgp_list_files()
Use ushort2bebytes instead of calculating the mapping to IDs ourselves. Signed-off-by: Peter Marschall <peter@adpm.de> git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5497 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
e422a57449
commit
fa259c63d5
|
@ -709,11 +709,8 @@ pgp_list_files(sc_card_t *card, u8 *buf, size_t buflen)
|
|||
if ((r = pgp_enumerate_blob(card, blob)) < 0)
|
||||
LOG_FUNC_RETURN(card->ctx, r);
|
||||
|
||||
for (k = 0, blob = blob->files; blob; blob = blob->next) {
|
||||
if (k + 2 > buflen)
|
||||
break;
|
||||
buf[k++] = blob->id >> 8;
|
||||
buf[k++] = blob->id;
|
||||
for (k = 0, blob = blob->files; (blob != NULL) && (k + 2 <= buflen); blob = blob->next, k += 2) {
|
||||
ushort2bebytes(buf + k, blob->id);
|
||||
}
|
||||
|
||||
LOG_FUNC_RETURN(card->ctx, k);
|
||||
|
|
Loading…
Reference in New Issue