Prepare extension of communication settings.

This commit is contained in:
Romain Tartiere 2010-11-20 22:29:23 +00:00
parent 8975c60de7
commit 6988e3e219
2 changed files with 4 additions and 2 deletions

View file

@ -116,6 +116,8 @@ typedef enum {
MD_RECEIVE MD_RECEIVE
} MifareDirection; } MifareDirection;
#define MDCM_MASK 0x000F
void *mifare_cryto_preprocess_data (MifareTag tag, void *data, size_t *nbytes, off_t offset, int communication_settings); void *mifare_cryto_preprocess_data (MifareTag tag, void *data, size_t *nbytes, off_t offset, int communication_settings);
void *mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int communication_settings); void *mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int communication_settings);
void mifare_cbc_des (MifareDESFireKey key, uint8_t *ivect, uint8_t *data, size_t data_size, MifareDirection direction, int mac); void mifare_cbc_des (MifareDESFireKey key, uint8_t *ivect, uint8_t *data, size_t data_size, MifareDirection direction, int mac);

View file

@ -145,7 +145,7 @@ mifare_cryto_preprocess_data (MifareTag tag, void *data, size_t *nbytes, off_t o
if (1 == *nbytes) if (1 == *nbytes)
return data; return data;
switch (communication_settings) { switch (communication_settings & MDCM_MASK) {
case MDCM_PLAIN: case MDCM_PLAIN:
break; break;
case MDCM_MACED: case MDCM_MACED:
@ -208,7 +208,7 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c
if (1 == *nbytes) if (1 == *nbytes)
return res; return res;
switch (communication_settings) { switch (communication_settings & MDCM_MASK) {
case MDCM_PLAIN: case MDCM_PLAIN:
break; break;
case MDCM_MACED: case MDCM_MACED: