DNIe: card also supports 1920 bits (#1247)

fixes https://github.com/OpenSC/OpenSC/issues/1246
This commit is contained in:
Frank Morgner 2018-01-28 21:25:42 +01:00 committed by GitHub
parent a0b562a7c8
commit e5699ef04b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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)outlen<result_resplen)
LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS);
memcpy(out, apdu.resp, result_resplen);
/* and return response length */
LOG_FUNC_RETURN(card->ctx, result_resplen);