Print this page
6717509 Need to use bswap/bswapq for byte swap of 64-bit integer on x32/x64 (fix lint)

*** 532,542 **** #endif /* _BIG_ENDIAN */ { uint64_t tmp; #ifdef UNALIGNED_POINTERS_PERMITTED ! tmp = htonll(*(uint64_t *)&block[0]); #else tmp = (((uint64_t)block[0] << 56) | ((uint64_t)block[1] << 48) | ((uint64_t)block[2] << 40) | ((uint64_t)block[3] << 32) | ((uint64_t)block[4] << 24) | ((uint64_t)block[5] << 16) | ((uint64_t)block[6] << 8) | (uint64_t)block[7]); --- 532,542 ---- #endif /* _BIG_ENDIAN */ { uint64_t tmp; #ifdef UNALIGNED_POINTERS_PERMITTED ! tmp = htonll(*(uint64_t *)(void *)&block[0]); #else tmp = (((uint64_t)block[0] << 56) | ((uint64_t)block[1] << 48) | ((uint64_t)block[2] << 40) | ((uint64_t)block[3] << 32) | ((uint64_t)block[4] << 24) | ((uint64_t)block[5] << 16) | ((uint64_t)block[6] << 8) | (uint64_t)block[7]);
*** 546,556 **** tmp = des_crypt_impl(ksch->ksch_decrypt, tmp, 3); else tmp = des_crypt_impl(ksch->ksch_encrypt, tmp, 3); #ifdef UNALIGNED_POINTERS_PERMITTED ! *(uint64_t *)&out_block[0] = htonll(tmp); #else out_block[0] = tmp >> 56; out_block[1] = tmp >> 48; out_block[2] = tmp >> 40; out_block[3] = tmp >> 32; --- 546,556 ---- tmp = des_crypt_impl(ksch->ksch_decrypt, tmp, 3); else tmp = des_crypt_impl(ksch->ksch_encrypt, tmp, 3); #ifdef UNALIGNED_POINTERS_PERMITTED ! *(uint64_t *)(void *)&out_block[0] = htonll(tmp); #else out_block[0] = tmp >> 56; out_block[1] = tmp >> 48; out_block[2] = tmp >> 40; out_block[3] = tmp >> 32;
*** 594,604 **** #endif /* _BIG_ENDIAN */ { uint64_t tmp; #ifdef UNALIGNED_POINTERS_PERMITTED ! tmp = htonll(*(uint64_t *)&block[0]); #else tmp = (((uint64_t)block[0] << 56) | ((uint64_t)block[1] << 48) | ((uint64_t)block[2] << 40) | ((uint64_t)block[3] << 32) | ((uint64_t)block[4] << 24) | ((uint64_t)block[5] << 16) | ((uint64_t)block[6] << 8) | (uint64_t)block[7]); --- 594,604 ---- #endif /* _BIG_ENDIAN */ { uint64_t tmp; #ifdef UNALIGNED_POINTERS_PERMITTED ! tmp = htonll(*(uint64_t *)(void *)&block[0]); #else tmp = (((uint64_t)block[0] << 56) | ((uint64_t)block[1] << 48) | ((uint64_t)block[2] << 40) | ((uint64_t)block[3] << 32) | ((uint64_t)block[4] << 24) | ((uint64_t)block[5] << 16) | ((uint64_t)block[6] << 8) | (uint64_t)block[7]);
*** 609,619 **** tmp = des_crypt_impl(ksch->ksch_decrypt, tmp, 1); else tmp = des_crypt_impl(ksch->ksch_encrypt, tmp, 1); #ifdef UNALIGNED_POINTERS_PERMITTED ! *(uint64_t *)&out_block[0] = htonll(tmp); #else out_block[0] = tmp >> 56; out_block[1] = tmp >> 48; out_block[2] = tmp >> 40; out_block[3] = tmp >> 32; --- 609,619 ---- tmp = des_crypt_impl(ksch->ksch_decrypt, tmp, 1); else tmp = des_crypt_impl(ksch->ksch_encrypt, tmp, 1); #ifdef UNALIGNED_POINTERS_PERMITTED ! *(uint64_t *)(void *)&out_block[0] = htonll(tmp); #else out_block[0] = tmp >> 56; out_block[1] = tmp >> 48; out_block[2] = tmp >> 40; out_block[3] = tmp >> 32;
*** 671,681 **** if (key == NULL) return (B_FALSE); #ifdef UNALIGNED_POINTERS_PERMITTED ! key_so_far = htonll(*(uint64_t *)&key[0]); #else /* * The code below reverses the bytes on LITTLE_ENDIAN machines. * On BIG_ENDIAN, the same code copies without reversing * the bytes. --- 671,681 ---- if (key == NULL) return (B_FALSE); #ifdef UNALIGNED_POINTERS_PERMITTED ! key_so_far = htonll(*(uint64_t *)(void *)&key[0]); #else /* * The code below reverses the bytes on LITTLE_ENDIAN machines. * On BIG_ENDIAN, the same code copies without reversing * the bytes.
*** 697,707 **** return (B_FALSE); } if (corrected_key != NULL) { #ifdef UNALIGNED_POINTERS_PERMITTED ! *(uint64_t *)&corrected_key[0] = htonll(key_so_far); #else /* * The code below reverses the bytes on LITTLE_ENDIAN machines. * On BIG_ENDIAN, the same code copies without reversing * the bytes. --- 697,707 ---- return (B_FALSE); } if (corrected_key != NULL) { #ifdef UNALIGNED_POINTERS_PERMITTED ! *(uint64_t *)(void *)&corrected_key[0] = htonll(key_so_far); #else /* * The code below reverses the bytes on LITTLE_ENDIAN machines. * On BIG_ENDIAN, the same code copies without reversing * the bytes.
*** 806,816 **** paritied_key = (uint8_t *)aligned_key; while (strength > i) { offset = 8 * i; #ifdef UNALIGNED_POINTERS_PERMITTED ! key_so_far = htonll(*(uint64_t *)&paritied_key[offset]); #else key_so_far = (((uint64_t)paritied_key[offset + 0] << 56) | ((uint64_t)paritied_key[offset + 1] << 48) | ((uint64_t)paritied_key[offset + 2] << 40) | ((uint64_t)paritied_key[offset + 3] << 32) | --- 806,816 ---- paritied_key = (uint8_t *)aligned_key; while (strength > i) { offset = 8 * i; #ifdef UNALIGNED_POINTERS_PERMITTED ! key_so_far = htonll(*(uint64_t *)(void *)&paritied_key[offset]); #else key_so_far = (((uint64_t)paritied_key[offset + 0] << 56) | ((uint64_t)paritied_key[offset + 1] << 48) | ((uint64_t)paritied_key[offset + 2] << 40) | ((uint64_t)paritied_key[offset + 3] << 32) |
*** 821,831 **** #endif /* UNALIGNED_POINTERS_PERMITTED */ fix_des_parity(&key_so_far); #ifdef UNALIGNED_POINTERS_PERMITTED ! *(uint64_t *)&paritied_key[offset] = htonll(key_so_far); #else paritied_key[offset + 0] = key_so_far >> 56; paritied_key[offset + 1] = key_so_far >> 48; paritied_key[offset + 2] = key_so_far >> 40; paritied_key[offset + 3] = key_so_far >> 32; --- 821,831 ---- #endif /* UNALIGNED_POINTERS_PERMITTED */ fix_des_parity(&key_so_far); #ifdef UNALIGNED_POINTERS_PERMITTED ! *(uint64_t *)(void *)&paritied_key[offset] = htonll(key_so_far); #else paritied_key[offset + 0] = key_so_far >> 56; paritied_key[offset + 1] = key_so_far >> 48; paritied_key[offset + 2] = key_so_far >> 40; paritied_key[offset + 3] = key_so_far >> 32;
*** 888,898 **** } else #endif /* _BIG_ENDIAN */ { for (i = 0, j = 0; j < keysize; i++, j += 8) { #ifdef UNALIGNED_POINTERS_PERMITTED ! key_uint64[i] = htonll(*(uint64_t *)&cipherKey[j]); #else key_uint64[i] = (((uint64_t)cipherKey[j] << 56) | ((uint64_t)cipherKey[j + 1] << 48) | ((uint64_t)cipherKey[j + 2] << 40) | ((uint64_t)cipherKey[j + 3] << 32) | --- 888,899 ---- } else #endif /* _BIG_ENDIAN */ { for (i = 0, j = 0; j < keysize; i++, j += 8) { #ifdef UNALIGNED_POINTERS_PERMITTED ! key_uint64[i] = ! htonll(*(uint64_t *)(void *)&cipherKey[j]); #else key_uint64[i] = (((uint64_t)cipherKey[j] << 56) | ((uint64_t)cipherKey[j + 1] << 48) | ((uint64_t)cipherKey[j + 2] << 40) | ((uint64_t)cipherKey[j + 3] << 32) |