From e5699ef04b415dca63e76f13351b1782f643f4de Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Sun, 28 Jan 2018 21:25:42 +0100 Subject: [PATCH] DNIe: card also supports 1920 bits (#1247) fixes https://github.com/OpenSC/OpenSC/issues/1246 --- src/libopensc/card-dnie.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libopensc/card-dnie.c b/src/libopensc/card-dnie.c index 92edf596..076d4415 100644 --- a/src/libopensc/card-dnie.c +++ b/src/libopensc/card-dnie.c @@ -712,6 +712,7 @@ static void init_flags(struct sc_card *card) /* RSA Support with PKCS1.5 padding */ algoflags = SC_ALGORITHM_RSA_HASH_NONE | SC_ALGORITHM_RSA_PAD_PKCS1; _sc_card_add_rsa_alg(card, 1024, algoflags, 0); + _sc_card_add_rsa_alg(card, 1920, algoflags, 0); _sc_card_add_rsa_alg(card, 2048, algoflags, 0); } @@ -1664,8 +1665,6 @@ static int dnie_compute_signature(struct sc_card *card, LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS); if (datalen > SC_MAX_APDU_BUFFER_SIZE) /* should be 256 */ LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS); - if (outlen<256) /* enought space to store 2048 bit response */ - LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS); #ifdef ENABLE_DNIE_UI /* (Requested by DGP): on signature operation, ask user consent */ @@ -1704,6 +1703,8 @@ static int dnie_compute_signature(struct sc_card *card, /* ok: copy result from buffer */ result_resplen = apdu.resplen; + if ((int)outlenctx, SC_ERROR_INVALID_ARGUMENTS); memcpy(out, apdu.resp, result_resplen); /* and return response length */ LOG_FUNC_RETURN(card->ctx, result_resplen);