[pkg-opensc-commit] [opensc] 136/295: dnie: lost change in the previous pull request ...

Eric Dorland eric at moszumanska.debian.org
Sat Jun 24 21:11:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository opensc.

commit e1b4bf4d2c2e7e1c4413207c1ce2db33126c5193
Author: ricky <rickyepoderi at yahoo.es>
Date:   Mon Nov 21 23:16:16 2016 +0100

    dnie: lost change in the previous pull request ...
    
    ... and disable SM mode too.
---
 src/libopensc/cwa-dnie.c | 6 +++---
 src/libopensc/cwa14890.c | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/libopensc/cwa-dnie.c b/src/libopensc/cwa-dnie.c
index 6cb78cd..02b0b7e 100644
--- a/src/libopensc/cwa-dnie.c
+++ b/src/libopensc/cwa-dnie.c
@@ -556,9 +556,9 @@ static int dnie_get_privkey(sc_card_t * card, EVP_PKEY ** ifd_privkey,
 		sc_log(card->ctx, "Cannot create data for IFD private key");
 		return SC_ERROR_OUT_OF_MEMORY;
 	}
-	ifd_rsa_n = BN_bin2bn(ifd_modulus, sizeof(ifd_modulus), NULL);
-	ifd_rsa_e = BN_bin2bn(ifd_public_exponent, sizeof(ifd_public_exponent), NULL);
-	ifd_rsa_d = BN_bin2bn(ifd_private_exponent, sizeof(ifd_private_exponent), NULL);
+	ifd_rsa_n = BN_bin2bn(modulus, modulus_len, NULL);
+	ifd_rsa_e = BN_bin2bn(public_exponent, public_exponent_len, NULL);
+	ifd_rsa_d = BN_bin2bn(private_exponent, private_exponent_len, NULL);
 	if (RSA_set0_key(ifd_rsa, ifd_rsa_n, ifd_rsa_e, ifd_rsa_d) != 1) {
 		BN_free(ifd_rsa_n);
 		BN_free(ifd_rsa_e);
diff --git a/src/libopensc/cwa14890.c b/src/libopensc/cwa14890.c
index 0238265..04450d8 100644
--- a/src/libopensc/cwa14890.c
+++ b/src/libopensc/cwa14890.c
@@ -1076,6 +1076,7 @@ int cwa_create_secure_channel(sc_card_t * card,
 	switch (flag) {
 	case CWA_SM_OFF:	/* disable SM */
 		provider->status.session.state = CWA_SM_NONE;	/* just mark channel inactive */
+		card->sm_ctx.sm_mode = SM_MODE_NONE;
 		sc_log(ctx, "Setting CWA SM status to none");
 		LOG_FUNC_RETURN(ctx, SC_SUCCESS);
 	case CWA_SM_WARM:	/* only initialize if not already done */
@@ -1088,6 +1089,7 @@ int cwa_create_secure_channel(sc_card_t * card,
 		sc_log(ctx, "CWA SM initialization requested => reset and re-initialize");
 		sc_reset(card, 0);
 		provider->status.session.state = CWA_SM_INPROGRESS;
+		card->sm_ctx.sm_mode = SM_MODE_NONE;
 		break;
 	case CWA_SM_OVER:	/* create another channel over an existing one */
 		if (provider->status.session.state != CWA_SM_ACTIVE) {
@@ -1667,8 +1669,7 @@ int cwa_decode_response(sc_card_t * card,
 		if ((apdu->sw2 == 0x88) || (apdu->sw2 == 0x87)) {
 			/* configure the driver to re-establish the SM */
 			msg = "SM related errors in APDU response";
-			sm_session->state = CWA_SM_NONE;
-			card->sm_ctx.sm_mode = SM_MODE_NONE;
+			cwa_create_secure_channel(card, provider, CWA_SM_OFF);
 			res = SC_ERROR_SECURITY_STATUS_NOT_SATISFIED;
 			goto response_decode_end;
 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git



More information about the pkg-opensc-commit mailing list