You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.5 KiB

  1. From f4aec38233010953cea72c367bccc71c3687b2f1 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?=
  3. <ng.hong.quan@gmail.com>
  4. Date: Tue, 16 Apr 2013 16:02:17 +0700
  5. Subject: [PATCH 17/26] OpenPGP: Make code neater
  6. ---
  7. src/libopensc/card-openpgp.c | 8 ++------
  8. 1 file changed, 2 insertions(+), 6 deletions(-)
  9. diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c
  10. index beeee83..ca0d01b 100644
  11. --- a/src/libopensc/card-openpgp.c
  12. +++ b/src/libopensc/card-openpgp.c
  13. @@ -1222,10 +1222,7 @@ static int gnuk_write_certificate(sc_card_t *card, const u8 *buf, size_t length)
  14. r = sc_transmit_apdu(card, &apdu);
  15. LOG_TEST_RET(card->ctx, r, "APDU transmit failed");
  16. /* Check response */
  17. - r = sc_check_sw(card, apdu.sw1, apdu.sw2);
  18. - if (r < 0)
  19. - LOG_FUNC_RETURN(card->ctx, r);
  20. - LOG_FUNC_RETURN(card->ctx, length);
  21. + LOG_TEST_RET(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2), "Certificate writing failed");
  22. }
  23. /* Ref: gnuk_put_binary_libusb.py and gnuk_token.py in Gnuk source tree */
  24. @@ -1262,8 +1259,7 @@ static int gnuk_write_certificate(sc_card_t *card, const u8 *buf, size_t length)
  25. r = sc_transmit_apdu(card, &apdu);
  26. LOG_TEST_RET(card->ctx, r, "APDU transmit failed");
  27. /* Check response */
  28. - r = sc_check_sw(card, apdu.sw1, apdu.sw2);
  29. - LOG_TEST_RET(card->ctx, r, "UPDATE BINARY returned error");
  30. + LOG_TEST_RET(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2), "UPDATE BINARY returned error");
  31. /* To next part */
  32. i++;
  33. --
  34. 2.1.3