diff options
author | Alon Levy <alevy@redhat.com> | 2011-02-23 16:50:44 +0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-02-23 16:50:44 +0200 |
commit | 27728857b41643bd1f3003db2827126a3e9234f3 (patch) | |
tree | f76d3a670354ec0351df6d7d3875207f2ed3c808 /card_7816.c | |
parent | c0aa647f37f029f52a15f81587701eab44e7c438 (diff) |
Diffstat (limited to 'card_7816.c')
-rw-r--r-- | card_7816.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/card_7816.c b/card_7816.c index e2d8466..6b84645 100644 --- a/card_7816.c +++ b/card_7816.c @@ -71,7 +71,7 @@ vcard_init_buffer_response(VCard *card, unsigned char *buf, int len) VCardResponse *response; VCardBufferResponse *buffer_response; - buffer_response =vcard_get_buffer_response(card); + buffer_response = vcard_get_buffer_response(card); if (buffer_response) { vcard_set_buffer_response(card, NULL); vcard_buffer_response_delete(buffer_response); @@ -85,7 +85,7 @@ vcard_init_buffer_response(VCard *card, unsigned char *buf, int len) if (response == NULL) { return NULL; } - vcard_set_buffer_response(card,buffer_response); + vcard_set_buffer_response(card, buffer_response); return response; } @@ -99,13 +99,13 @@ vcard_response_new(VCard *card, unsigned char *buf, VCardResponse *new_response; if (len > Le) { - return vcard_init_buffer_response(card, buf, len); + return vcard_init_buffer_response(card, buf, len); } - new_response = vcard_response_new_data(buf,len); + new_response = vcard_response_new_data(buf, len); if (new_response == NULL) { return NULL; } - vcard_response_set_status(new_response,status); + vcard_response_set_status(new_response, status); return new_response; } @@ -119,13 +119,13 @@ vcard_response_new_bytes(VCard *card, unsigned char *buf, int len, int Le, VCardResponse *new_response; if (len > Le) { - return vcard_init_buffer_response(card, buf, len); + return vcard_init_buffer_response(card, buf, len); } - new_response = vcard_response_new_data(buf,len); + new_response = vcard_response_new_data(buf, len); if (new_response == NULL) { return NULL; } - vcard_response_set_status_bytes(new_response,sw1,sw2); + vcard_response_set_status_bytes(new_response, sw1, sw2); return new_response; } @@ -145,7 +145,7 @@ vcard_response_new_status(vcard_7816_status_t status) new_response->b_len = 0; new_response->b_total_len = 2; new_response->b_type = VCARD_MALLOC_STRUCT; - vcard_response_set_status(new_response,status); + vcard_response_set_status(new_response, status); return new_response; } @@ -194,13 +194,13 @@ vcard_response_delete(VCardResponse *response) free(response->b_data); } break; - case VCARD_MALLOC_STRUCT: + case VCARD_MALLOC_STRUCT: /* only the structure was malloc'ed */ free(response); break; - case VCARD_STATIC: + case VCARD_STATIC: break; - } + } } /* @@ -243,7 +243,7 @@ vcard_apdu_set_class(VCardAPDU *apdu) { case 0xf0: default: apdu->a_gen_type = - (apdu->a_cla == 0xff)? VCARD_7816_PTS : VCARD_7816_PROPIETARY; + (apdu->a_cla == 0xff) ? VCARD_7816_PTS : VCARD_7816_PROPIETARY; break; } return VCARD7816_STATUS_SUCCESS; @@ -314,7 +314,7 @@ vcard_apdu_set_length(VCardAPDU *apdu) return VCARD7816_STATUS_ERROR_WRONG_LENGTH; } /* not extended */ - apdu->a_Lc= apdu->a_header->ah_Le; + apdu->a_Lc = apdu->a_header->ah_Le; apdu->a_body = &apdu->a_header->ah_body[0]; if (L == apdu->a_Lc + 1) { /* 3S only body parameters */ @@ -651,10 +651,10 @@ vcard7816_vm_process_apdu(VCard *card, VCardAPDU *apdu, unsigned char *aid; int aid_len; aid = vcard_applet_get_aid(current_applet, &aid_len); - *response = vcard_response_new(card, aid, aid_len, apdu->a_Le, + *response = vcard_response_new(card, aid, aid_len, apdu->a_Le, VCARD7816_STATUS_SUCCESS); } else { - *response = vcard_make_response( + *response = vcard_make_response( VCARD7816_STATUS_ERROR_FILE_NOT_FOUND); } break; @@ -702,12 +702,12 @@ vcard7816_vm_process_apdu(VCard *card, VCardAPDU *apdu, card, buffer_response->current, bytes_to_copy, apdu->a_Le, next_byte_count ? - VCARD7816_SW1_RESPONSE_BYTES: VCARD7816_SW1_SUCCESS, + VCARD7816_SW1_RESPONSE_BYTES : VCARD7816_SW1_SUCCESS, next_byte_count); buffer_response->current += bytes_to_copy; buffer_response->len -= bytes_to_copy; if (*response == NULL || (next_byte_count == 0)) { - vcard_set_buffer_response(card,NULL); + vcard_set_buffer_response(card, NULL); vcard_buffer_response_delete(buffer_response); } if (*response == NULL) { @@ -753,11 +753,11 @@ vcard_process_apdu(VCard *card, VCardAPDU *apdu, VCardResponse **response) } buffer_response = vcard_get_buffer_response(card); if (buffer_response && apdu->a_ins != VCARD7816_INS_GET_RESPONSE) { - /* clear out buffer_response, return an error */ - vcard_set_buffer_response(card,NULL); + /* clear out buffer_response, return an error */ + vcard_set_buffer_response(card, NULL); vcard_buffer_response_delete(buffer_response); - *response = vcard_make_response(VCARD7816_STATUS_EXC_ERROR); - return VCARD_DONE; + *response = vcard_make_response(VCARD7816_STATUS_EXC_ERROR); + return VCARD_DONE; } status = vcard_process_applet_apdu(card, apdu, response); @@ -766,13 +766,13 @@ vcard_process_apdu(VCard *card, VCardAPDU *apdu, VCardResponse **response) } switch (vcard_get_type(card)) { case VCARD_FILE_SYSTEM: - return vcard7816_file_system_process_apdu(card,apdu,response); + return vcard7816_file_system_process_apdu(card, apdu, response); case VCARD_VM: - return vcard7816_vm_process_apdu(card,apdu,response); + return vcard7816_vm_process_apdu(card, apdu, response); case VCARD_DIRECT: /* if we are type direct, then the applet should handle everything */ assert("VCARD_DIRECT: applet failure"); - break; + break; } *response = vcard_make_response(VCARD7816_STATUS_ERROR_COMMAND_NOT_SUPPORTED); |