Keys are supposed to be const.

This commit is contained in:
Romain Tartière 2014-04-13 20:29:57 +02:00
parent 32c585db69
commit 8290d3d8cc
3 changed files with 18 additions and 18 deletions

View file

@ -389,14 +389,14 @@ int mifare_desfire_clear_record_file (MifareTag tag, uint8_t file_no);
int mifare_desfire_commit_transaction (MifareTag tag);
int mifare_desfire_abort_transaction (MifareTag tag);
MifareDESFireKey mifare_desfire_des_key_new (uint8_t value[8]);
MifareDESFireKey mifare_desfire_3des_key_new (uint8_t value[16]);
MifareDESFireKey mifare_desfire_des_key_new_with_version (uint8_t value[8]);
MifareDESFireKey mifare_desfire_3des_key_new_with_version (uint8_t value[16]);
MifareDESFireKey mifare_desfire_3k3des_key_new (uint8_t value[24]);
MifareDESFireKey mifare_desfire_3k3des_key_new_with_version (uint8_t value[24]);
MifareDESFireKey mifare_desfire_aes_key_new (uint8_t value[16]);
MifareDESFireKey mifare_desfire_aes_key_new_with_version (uint8_t value[16], uint8_t version);
MifareDESFireKey mifare_desfire_des_key_new (const uint8_t value[8]);
MifareDESFireKey mifare_desfire_3des_key_new (const uint8_t value[16]);
MifareDESFireKey mifare_desfire_des_key_new_with_version (const uint8_t value[8]);
MifareDESFireKey mifare_desfire_3des_key_new_with_version (const uint8_t value[16]);
MifareDESFireKey mifare_desfire_3k3des_key_new (const uint8_t value[24]);
MifareDESFireKey mifare_desfire_3k3des_key_new_with_version (const uint8_t value[24]);
MifareDESFireKey mifare_desfire_aes_key_new (const uint8_t value[16]);
MifareDESFireKey mifare_desfire_aes_key_new_with_version (const uint8_t value[16], uint8_t version);
uint8_t mifare_desfire_key_get_version (MifareDESFireKey key);
void mifare_desfire_key_set_version (MifareDESFireKey key, uint8_t version);
void mifare_desfire_key_free (MifareDESFireKey key);

View file

@ -243,7 +243,7 @@ struct mifare_desfire_tag {
uint32_t selected_application;
};
MifareDESFireKey mifare_desfire_session_key_new (uint8_t rnda[], uint8_t rndb[], MifareDESFireKey authentication_key);
MifareDESFireKey mifare_desfire_session_key_new (const uint8_t rnda[], const uint8_t rndb[], MifareDESFireKey authentication_key);
const char *mifare_desfire_error_lookup (uint8_t error);
struct mifare_ultralight_tag {

View file

@ -38,7 +38,7 @@ update_key_schedules (MifareDESFireKey key)
}
MifareDESFireKey
mifare_desfire_des_key_new (uint8_t value[8])
mifare_desfire_des_key_new (const uint8_t value[8])
{
uint8_t data[8];
memcpy (data, value, 8);
@ -48,7 +48,7 @@ mifare_desfire_des_key_new (uint8_t value[8])
}
MifareDESFireKey
mifare_desfire_des_key_new_with_version (uint8_t value[8])
mifare_desfire_des_key_new_with_version (const uint8_t value[8])
{
MifareDESFireKey key;
@ -62,7 +62,7 @@ mifare_desfire_des_key_new_with_version (uint8_t value[8])
}
MifareDESFireKey
mifare_desfire_3des_key_new (uint8_t value[16])
mifare_desfire_3des_key_new (const uint8_t value[16])
{
uint8_t data[16];
memcpy (data, value, 16);
@ -74,7 +74,7 @@ mifare_desfire_3des_key_new (uint8_t value[16])
}
MifareDESFireKey
mifare_desfire_3des_key_new_with_version (uint8_t value[16])
mifare_desfire_3des_key_new_with_version (const uint8_t value[16])
{
MifareDESFireKey key;
@ -87,7 +87,7 @@ mifare_desfire_3des_key_new_with_version (uint8_t value[16])
}
MifareDESFireKey
mifare_desfire_3k3des_key_new (uint8_t value[24])
mifare_desfire_3k3des_key_new (const uint8_t value[24])
{
uint8_t data[24];
memcpy (data, value, 24);
@ -97,7 +97,7 @@ mifare_desfire_3k3des_key_new (uint8_t value[24])
}
MifareDESFireKey
mifare_desfire_3k3des_key_new_with_version (uint8_t value[24])
mifare_desfire_3k3des_key_new_with_version (const uint8_t value[24])
{
MifareDESFireKey key;
@ -110,13 +110,13 @@ mifare_desfire_3k3des_key_new_with_version (uint8_t value[24])
}
MifareDESFireKey
mifare_desfire_aes_key_new (uint8_t value[16])
mifare_desfire_aes_key_new (const uint8_t value[16])
{
return mifare_desfire_aes_key_new_with_version (value, 0);
}
MifareDESFireKey
mifare_desfire_aes_key_new_with_version (uint8_t value[16], uint8_t version)
mifare_desfire_aes_key_new_with_version (const uint8_t value[16], uint8_t version)
{
MifareDESFireKey key;
@ -158,7 +158,7 @@ mifare_desfire_key_set_version (MifareDESFireKey key, uint8_t version)
}
MifareDESFireKey
mifare_desfire_session_key_new (uint8_t rnda[], uint8_t rndb[], MifareDESFireKey authentication_key)
mifare_desfire_session_key_new (const uint8_t rnda[], const uint8_t rndb[], MifareDESFireKey authentication_key)
{
MifareDESFireKey key = NULL;