replace last deprecated bzero function by memset.

This commit is contained in:
Audrey Diacre 2010-12-24 13:33:02 +00:00
parent 417052fb2f
commit 29c8ef5c07
5 changed files with 11 additions and 11 deletions

View file

@ -109,10 +109,10 @@ cmac_generate_subkeys (MifareDESFireKey key)
uint8_t R = (kbs == 8) ? 0x1B : 0x87;
uint8_t l[kbs];
bzero (l, kbs);
memset (l, 0, kbs);
uint8_t ivect[kbs];
bzero (ivect, kbs);
memset (ivect, 0, kbs);
mifare_cbc_des (NULL, key, ivect, l, kbs, MCD_RECEIVE, MCO_ENCYPHER);
@ -438,10 +438,10 @@ mifare_cryto_preprocess_data (MifareTag tag, void *data, size_t *nbytes, off_t o
if (!(communication_settings & NO_CRC)) {
desfire_crc32_append (res, *nbytes);
pdl = padded_data_length (*nbytes - offset + 4, key_block_size (MIFARE_DESFIRE (tag)->session_key));
bzero ((uint8_t *)res + *nbytes + 4, (offset + pdl) - (*nbytes + 4));
memset ((uint8_t *)res + *nbytes + 4, 0, (offset + pdl) - (*nbytes + 4));
} else {
pdl = padded_data_length (*nbytes - offset, key_block_size (MIFARE_DESFIRE (tag)->session_key));
bzero ((uint8_t *)res + *nbytes, (offset + pdl) - (*nbytes));
memset ((uint8_t *)res + *nbytes, 0, (offset + pdl) - (*nbytes));
}
mifare_cbc_des (tag, NULL, NULL, (uint8_t *)res + offset, pdl, MCD_SEND, MCO_ENCYPHER);
*nbytes = offset + pdl;

View file

@ -72,7 +72,7 @@ test_mifare_desfire_aes_cmac_empty (void)
cmac_generate_subkeys (key);
uint8_t ivect[16];
bzero (ivect, sizeof (ivect));
memset (ivect, 0, sizeof (ivect));
uint8_t expected_cmac[] = {
0xbb, 0x1d, 0x69, 0x29,
@ -96,7 +96,7 @@ test_mifare_desfire_aes_cmac_128 (void)
cmac_generate_subkeys (key);
uint8_t ivect[16];
bzero (ivect, sizeof (ivect));
memset (ivect, 0, sizeof (ivect));
uint8_t message[] = {
0x6b, 0xc1, 0xbe, 0xe2,
@ -127,7 +127,7 @@ test_mifare_desfire_aes_cmac_320 (void)
cmac_generate_subkeys (key);
uint8_t ivect[16];
bzero (ivect, sizeof (ivect));
memset (ivect, 0, sizeof (ivect));
uint8_t message[] = {
0x6b, 0xc1, 0xbe, 0xe2,
@ -164,7 +164,7 @@ test_mifare_desfire_aes_cmac_512 (void)
cmac_generate_subkeys (key);
uint8_t ivect[16];
bzero (ivect, sizeof (ivect));
memset (ivect, 0, sizeof (ivect));
uint8_t message[] = {
0x6b, 0xc1, 0xbe, 0xe2,

View file

@ -195,7 +195,7 @@ test_mifare_desfire_ev1_3des (void)
// Ensure that no content was changed yet
char ref_buffer[64];
bzero (ref_buffer, sizeof (ref_buffer));
memset (ref_buffer, 0, sizeof (ref_buffer));
for (int n = 0; n < transaction; n++) {
sprintf (ref_buffer + 3 * n, "%02d", n);
}

View file

@ -195,7 +195,7 @@ test_mifare_desfire_ev1_3k3des (void)
// Ensure that no content was changed yet
char ref_buffer[64];
bzero (ref_buffer, sizeof (ref_buffer));
memset (ref_buffer, 0, sizeof (ref_buffer));
for (int n = 0; n < transaction; n++) {
sprintf (ref_buffer + 3 * n, "%02d", n);
}

View file

@ -195,7 +195,7 @@ test_mifare_desfire_ev1_aes (void)
// Ensure that no content was changed yet
char ref_buffer[64];
bzero (ref_buffer, sizeof (ref_buffer));
memset (ref_buffer, 0, sizeof (ref_buffer));
for (int n = 0; n < transaction; n++) {
sprintf (ref_buffer + 3 * n, "%02d", n);
}