diff options
| author | Kevin Redon <kevredon@mail.tsaitgaist.info> | 2012-09-11 11:44:18 +0200 | 
|---|---|---|
| committer | Harald Welte <laforge@gnumonks.org> | 2014-10-26 19:09:23 +0100 | 
| commit | e07967f689c56473a8492ec422ee38964d00c9c3 (patch) | |
| tree | 555121253597627d72b0cb7d4458c1c9bbd7b9dc | |
| parent | 6956ee1ba11aa2b7321e0d4fd41877184d9a3650 (diff) | |
sim: renamed case to the one defined in ISO7816-3
APDU_CASE_2 becomes APDU_CASE_2S
APDU_CASE_2_EXT becmoes APDU_CASE_2E
APDU_CASE_3 becomes APDU_CASE_3S
APDU_CASE_3_EXT becmoes APDU_CASE_3E
APDU_CASE_4 becomes APDU_CASE_4S
APDU_CASE_4_EXT becmoes APDU_CASE_4E
| -rw-r--r-- | include/osmocom/sim/sim.h | 12 | ||||
| -rw-r--r-- | src/sim/core.c | 12 | ||||
| -rw-r--r-- | src/sim/reader.c | 24 | 
3 files changed, 24 insertions, 24 deletions
diff --git a/include/osmocom/sim/sim.h b/include/osmocom/sim/sim.h index 35ff7b4c..32731939 100644 --- a/include/osmocom/sim/sim.h +++ b/include/osmocom/sim/sim.h @@ -9,12 +9,12 @@  /* command-response pairs cases, as specified in ISO/IEC 7816-3:2006(E) ยง12.1 */  enum osim_apdu_case {  	APDU_CASE_1, /* command header, no command data field, no response data field */ -	APDU_CASE_2, /* command header, no command data field, response data field (short) */ -	APDU_CASE_2_EXT, /* command header, no command data field, response data field (extended) */ -	APDU_CASE_3, /* command header, command data field (short), no response data field */ -	APDU_CASE_3_EXT, /* command header, command data field (extended), no response data field */ -	APDU_CASE_4, /* command header, command data field (short), response data field (short) */ -	APDU_CASE_4_EXT /* command header, command data field (extended), response data field (extended) */ +	APDU_CASE_2S, /* command header, no command data field, response data field (short) */ +	APDU_CASE_2E, /* command header, no command data field, response data field (extended) */ +	APDU_CASE_3S, /* command header, command data field (short), no response data field */ +	APDU_CASE_3E, /* command header, command data field (extended), no response data field */ +	APDU_CASE_4S, /* command header, command data field (short), response data field (short) */ +	APDU_CASE_4E /* command header, command data field (extended), response data field (extended) */  };  struct osim_apdu_cmd_hdr { diff --git a/src/sim/core.c b/src/sim/core.c index 86907521..9c1c9ae2 100644 --- a/src/sim/core.c +++ b/src/sim/core.c @@ -206,19 +206,19 @@ struct msgb *osim_new_apdumsg(uint8_t cla, uint8_t ins, uint8_t p1,  		msgb_apdu_case(msg) = APDU_CASE_1;  	else if (lc == 0 && le >= 1) {  		if (le <= 256) -			msgb_apdu_case(msg) = APDU_CASE_2; +			msgb_apdu_case(msg) = APDU_CASE_2S;  		else -			msgb_apdu_case(msg) = APDU_CASE_2_EXT; +			msgb_apdu_case(msg) = APDU_CASE_2E;  	} else if (le == 0 && lc >= 1) {  		if (lc <= 255) -			msgb_apdu_case(msg) = APDU_CASE_3; +			msgb_apdu_case(msg) = APDU_CASE_3S;  		else -			msgb_apdu_case(msg) = APDU_CASE_3_EXT; +			msgb_apdu_case(msg) = APDU_CASE_3E;  	} else if (lc >= 1 && le >= 1) {  		if (lc <= 255 & le <= 256) -			msgb_apdu_case(msg) = APDU_CASE_4; +			msgb_apdu_case(msg) = APDU_CASE_4S;  		else -			msgb_apdu_case(msg) = APDU_CASE_4_EXT; +			msgb_apdu_case(msg) = APDU_CASE_4E;  	}  	return msg; diff --git a/src/sim/reader.c b/src/sim/reader.c index 5d6033bf..71d10d14 100644 --- a/src/sim/reader.c +++ b/src/sim/reader.c @@ -66,10 +66,10 @@ static int transceive_apdu_t0(struct osim_card_hdl *st, struct msgb *amsg)  	case APDU_CASE_1:  		tpduh->p3 = 0x00;  		break; -	case APDU_CASE_2: +	case APDU_CASE_2S:  		tpduh->p3 = msgb_apdu_le(amsg);  		break; -	case APDU_CASE_2_EXT: +	case APDU_CASE_2E:  		if (msgb_apdu_le(amsg) <= 256) {  			/* case 2E.1 */  			tpduh->p3 = msgb_apdu_le(amsg) & 0xff; @@ -79,14 +79,14 @@ static int transceive_apdu_t0(struct osim_card_hdl *st, struct msgb *amsg)  			msgb_put_u16(tmsg, msgb_apdu_le(amsg));  		}  		break; -	case APDU_CASE_3: -	case APDU_CASE_4: +	case APDU_CASE_3S: +	case APDU_CASE_4S:  		tpduh->p3 = msgb_apdu_lc(amsg);  		cur = msgb_put(tmsg, tpduh->p3);  		memcpy(cur, msgb_apdu_dc(amsg), tpduh->p3);  		break; -	case APDU_CASE_3_EXT: -	case APDU_CASE_4_EXT: +	case APDU_CASE_3E: +	case APDU_CASE_4E:  		if (msgb_apdu_lc(amsg) < 256) {  			/* Case 3E.1 */  			tpduh->p3 = msgb_apdu_lc(amsg); @@ -121,10 +121,10 @@ transceive_again:  	switch (msgb_apdu_case(amsg)) {  	case APDU_CASE_1: -	case APDU_CASE_3: +	case APDU_CASE_3S:  		/* just copy SW */  		break; -	case APDU_CASE_2: +	case APDU_CASE_2S:  case_2s:  		switch (sw >> 8) {  		case 0x67: /* Case 2S.2: Le definitely not accepted */ @@ -145,7 +145,7 @@ case_2s:  			memcpy(cur, tmsg->l3h, msgb_l3len(tmsg));  		}  		break; -	case APDU_CASE_4: +	case APDU_CASE_4S:  		/* FIXME: this is 4S.2 only for 2nd... response: */  		if (num_resp >= 2)  			goto case_2s; @@ -177,7 +177,7 @@ case_2s:  		/* Case 4S.2: Command accepted: just copy SW */  		/* Case 4S.4: Just copy SW */  		break; -	case APDU_CASE_2_EXT: +	case APDU_CASE_2E:  		if (msgb_apdu_le(amsg) <= 256) {  			/* Case 2E.1: Le <= 256 */  			goto case_2s; @@ -201,10 +201,10 @@ case_2s:  			break;  		}  		break; -	case APDU_CASE_3_EXT: +	case APDU_CASE_3E:  		/* FIXME: handling for ENVELOPE splitting */  		break; -	case APDU_CASE_4_EXT: +	case APDU_CASE_4E:  		break;  	}  | 
