mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 23:18:42 +01:00
add OpenSC package
OpenSC is a smart card middleware. Patches for support of the GnuK USB token have been added. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
From f96f7536a8c2efd0ba41fd94fe3334e5fa556854 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?=
|
||||
<ng.hong.quan@gmail.com>
|
||||
Date: Tue, 16 Apr 2013 10:19:34 +0700
|
||||
Subject: [PATCH 16/18] OpenPGP: Correct parameter checking.
|
||||
|
||||
---
|
||||
src/libopensc/card-openpgp.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/libopensc/card-openpgp.c b/src/libopensc/card-openpgp.c
|
||||
index 19d3b04..196c094 100644
|
||||
--- a/src/libopensc/card-openpgp.c
|
||||
+++ b/src/libopensc/card-openpgp.c
|
||||
@@ -1221,6 +1221,8 @@ static int gnuk_write_certificate(sc_card_t *card, const u8 *buf, size_t length)
|
||||
LOG_TEST_RET(card->ctx, r, "APDU transmit failed");
|
||||
/* Check response */
|
||||
r = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
||||
+ if (r < 0)
|
||||
+ LOG_FUNC_RETURN(card->ctx, r);
|
||||
LOG_FUNC_RETURN(card->ctx, length);
|
||||
}
|
||||
|
||||
@@ -2448,6 +2450,11 @@ gnuk_delete_key(sc_card_t *card, u8 key_id)
|
||||
|
||||
LOG_FUNC_CALLED(ctx);
|
||||
|
||||
+ if (key_id < 1 || key_id > 3) {
|
||||
+ sc_log(ctx, "Key ID %d is invalid. Should be 1, 2 or 3.", key_id);
|
||||
+ LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS);
|
||||
+ }
|
||||
+
|
||||
/* Delete fingerprint */
|
||||
sc_log(ctx, "Delete fingerprints");
|
||||
r = pgp_put_data(card, 0xC6 + key_id, NULL, 0);
|
||||
@@ -2466,8 +2473,6 @@ gnuk_delete_key(sc_card_t *card, u8 key_id)
|
||||
data = "\x4D\x02\xB8";
|
||||
else if (key_id == 3)
|
||||
data = "\x4D\x02\xA4";
|
||||
- else
|
||||
- LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS);
|
||||
|
||||
r = pgp_put_data(card, 0x4D, data, strlen(data) + 1);
|
||||
|
||||
--
|
||||
1.9.3
|
||||
|
||||
Reference in New Issue
Block a user